LATTE: Main Page

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

LATTE Documentation

P04-06-05

Generated on Fri Jan 21 18:00:47 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: File Index

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

LATTE File List

Here is a list of all documented files with brief descriptions:
AcdHWMultiplexer.py [code]
AcdPanel.py [code]
ArgumentImpl.py [code]
BrowserImpl.py [code]
browserPreferencesImpl.py [code]
build/lib.win32-2.3/cfitsio/cfitsio.py [code]
src/cfitsio.py [code]
Collector.py [code]
colorScale.py [code]
consumer.py [code]
consumerPlotter.py [code]
copyright_SLAC.py [code]
createDigestData.py [code]
DataDistributor.py [code]
DataDistributorPoll.py [code]
DataExport.py [code]
dispatcher.py [code]
EnvMonImpl.py [code]
errors.py [code]
evtDataImpl.py [code]
excApp.py [code]
FEpowerUp.py [code]
fits2ldf.py [code]
FreeSpace.py [code]
FSM.py [code]
gAEM.py [code]
gAttr.py [code]
gBits.py [code]
gCmdCli.py [code]
gCommand.py [code]
gConstraint.py [code]
gCRU.py [code]
gDb.py [code]
gEBM.py [code]
gEGU.py [code]
gEvtCli.py [code]
gException.py [code]
gFswMessages.py [code]
gGEM.py [code]
gGLT.py [code]
gGroup.py [code]
gHdb.py [code]
gHSK.py [code]
gLAT.py [code]
gLCB.py [code]
GlobalPanelImpl.py [code]
gLog.py [code]
gLoopback.py [code]
gMem.py [code]
gNAT.py [code]
gNode.py [code]
gOCS.py [code]
gOcsMessages.py [code]
gOptions.py [code]
GOSED_LDF.py [code]
GOSEDACDImpl.py [code]
GOSEDCALImpl.py [code]
GOSEDCALTKRImpl.py [code]
GOSEDDataImpl.py [code]
gosedImpl.py [code]
GOSEDPainter.py [code]
GOSEDPreferencesImpl.py [code]
GOSEDTKRImpl.py [code]
GOSEDTWRImpl.py [code]
GOTEDImpl.py [code]
gPDU.py [code]
gRegister.py [code]
gResponse.py [code]
gRule.py [code]
gSchemaConfig.py [code]
gSocket.py [code]
gTEM.py [code]
gTPG.py [code]
guiBridges.py [code]
gVersions.py [code]
gXBR.py [code]
HskAlarms.py [code]
HskCli.py [code]
HskCollector.py [code]
HskGuiReceiver.py [code]
HskPacketDecoder.py [code]
HskPacketRetriever.py [code]
HskReceiver.py [code]
HskRecorder.py [code]
HskRegisters.py [code]
HskRetriever.py [code]
HskSqlGuiReceiver.py [code]
HskSqlInterface.py [code]
HskSqlSvr.py [code]
HskSvr.py [code]
HskTestSvr.py [code]
hTestAppEvt.py [code]
hTestAppTkr.py [code]
hTestEnv.py [code]
hTestStrip.py [code]
LATsweep.py [code]
ldf2fits.py [code]
MailAlert.py [code]
MiniGLTExample.py [code]
MSGLogGUIImpl.py [code]
nullApp.py [code]
NullObjects.py [code]
parseFswHsk.py [code]
PowerPanelImpl.py [code]
pythfilter.py [code]
rcArchiver.py [code]
rcCommentPanel.py [code]
rcComplStatus.py [code]
rcDefaultTrigger.py [code]
rcFitsWriter.py [code]
rcHouseKeeping.py [code]
rcLoginImpl.py [code]
rcParamVerifier.py [code]
rcParamVerifyGUIImpl.py [code]
rcPreferencesGUIImpl.py [code]
rcPreferencesManager.py [code]
rcPythonShell.py [code]
rcReportGen.py [code]
rcRunIdHelper.py [code]
rcScmCfgSelector.py [code]
rcSecurityMan.py [code]
rcStatusMonitor.py [code]
rcSuite.py [code]
rcTestReport.py [code]
rcTransitions.py [code]
rcTrgFunctions.py [code]
rcTrgGem.py [code]
rcTrgMiniGLT.py [code]
rcUsers.py [code]
rcUtil.py [code]
Receiver.py [code]
Recorder.py [code]
Retriever.py [code]
robustapply.py [code]
RunControl.py [code]
RunControlCommon.py [code]
RunControlFSM.py [code]
RunControlGUIImpl.py [code]
RunControlMain.py [code]
RunControlMainGUIImpl.py [code]
saferef.py [code]
searchTextBrowserImpl.py [code]
ServerPreferencesImpl.py [code]
setup.py [code]
SimpleGasuExample.py [code]
standardLDF.py [code]
standardPlotter.py [code]
standardPlotterGuiImpl.py [code]
startupGUI.py [code]
startupMainGUI.py [code]
taskEngine.py [code]
test_aem.py [code]
test_aeq.py [code]
test_cmd.py [code]
test_cmdrsp.py [code]
test_db.py [code]
test_evt_aem.py [code]
test_evt_cal.py [code]
test_evt_exttrg.py [code]
test_evt_filters.py [code]
test_evt_tkr.py [code]
test_gafe.py [code]
test_garc.py [code]
test_glt.py [code]
test_lat.py [code]
test_loopback.py [code]
test_mem.py [code]
test_options.py [code]
test_playback.py [code]
test_rate.py [code]
test_schema.py [code]
test_tem.py [code]
test_twoclients.py [code]
testAppAcd.py [code]
testAppAcdScalers.py [code]
testAppAlarm.py [code]
testAppArchiver.py [code]
testAppCal.py [code]
testAppCal_dg.py [code]
testAppEvt.py [code]
testAppEvtCli.py [code]
testAppEvtTO.py [code]
testAppLDFdump.py [code]
testAppTkr.py [code]
testArchiver.py [code]
testEvtCli.py [code]
testSAppCal.py [code]
testSAppEvt.py [code]
testSuite.py [code]
testSuite2.py [code]
testSuiteLong.py [code]
testTrending.py [code]
Trendable.py [code]
TrendMaps.py [code]
TrgAbstract.py [code]
TrgCmdCounters.py [code]
TrgCoincidences.py [code]
TrgConditions.py [code]
TrgConditionsValue.py [code]
TrgEngines.py [code]
TrgEventCounter.py [code]
TrgGem.py [code]
TrgGemAbstract.py [code]
TrgGemCounters.py [code]
TrgGemPeriodicCondition.py [code]
TrgGemRegisterGeometry.py [code]
TrgGemRegisters.py [code]
TrgGemSequence.py [code]
TrgInputEnables.py [code]
TrgMiniGLT.py [code]
TrgMiniGLTAbstract.py [code]
TrgMiniGLTRegisters.py [code]
TrgObject.py [code]
TrgPeriodic.py [code]
TrgRoiAsTiles.py [code]
TrgRoiAsVeto.py [code]
TrgSequence.py [code]
TrgTileCounters.py [code]
TrgTower.py [code]
TrgTriggerCounters.py [code]
TrgUsingTiles.py [code]
Generated on Fri Jan 21 18:00:47 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Class List

LATTE Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
_Anonymous |
_Any |
_Attr |
_Parameter |
AcdHWMultiplexer | AcdHWMultiplexer class
ACDmap |
AddableRoi |
AEM | AEM event object
BoundMethodWeakref |
CALcontributionIterator2 | CAL contribution Displayer
ccsdsHeader | CCSDS Header bitfield definition
ccsdsPacket | Interface to a generic CCSDS packet
Consumer | Consumer class to consume LDF data This class just handles file open/close or server open/close
consumerPlotter | Consumer class to consume LDF data This class just handles file open/close or server open/close
DataDistributorAddress | Data distributor address class containing static methods that govern the picking of multicast ports and addresses
DataDistributorClient | Data distributor client class
DataDistributorPoll | Data distributor client that polls for samples of data
DataDistributorServer | Data Distributor Server
DataExport |
DefaultPeriodicCondition | DefaultPeriodicCondition class
DispatcherError |
DispatcherKeyError |
DispatcherTypeError |
drawHatACD |
drawSide1ACD |
drawSide2ACD |
drawSide3ACD |
drawSide4ACD |
drawXZ_CAL |
drawXZ_TKR |
drawYZ_CAL |
drawYZ_TKR |
DummyRecorder | Example recorder that dumps the trendables to a logger
DummyRetriever |
evAEM_PHA | PHA object
evCAL_LayerLogData | Class that associates a layer with the log data
evCAL_LogAccepts | Log Accepts bitfields
evCAL_LogData | Log Data bitfields
evCellHeader | Cell Header bitfields
evContPacket | Contribution Packet bitfields
evDiag_CalLayer | Calorimeter Layer class
evDiag_CalLayerEnd | Calorimeter Layer End bitfields
evDiag_Data | Diagnostic Data class
evDiag_TkrTrgReq | TKR Trigger Request bitfields
evErr_CablePhase | Cable Controller Phasing Error bitfields
evErr_CableTimeOut | Cable Timeout Error bitfields
evErr_GCCC | GCCC Error bitfields
evErr_GCCC_Message | GCCC Error Message object
evErr_GTCC | GTCC Error bitfields
evErr_GTCC_Message | GTCC Error Message object
evErr_Summary | Error summary bitfields
evGEM_Veto_List | GEM Veto List object
evSummary | Event summary bitfields
Evt | Event object
EvtCli | Event handler client
EvtCliIO | Event client input/output class
evTKR_Strip | TKR strip bitfields
evTKR_StripData | TKR StripData class
evTKR_TOTdata | TKR TOT data class
ExceptionFSM |
FSM |
FullCondition |
GAEM | ACD Common Controller
GAEQ | ACD Environmental Monitors
GAFE | ACD Front-End Controller
GARC | ACD Readout Controller
Gattr | Base class which is instantiated once for each attribute kind
GattrBF | Bit field class which is instantiated for each bit field kind
GattrDlc |
GattrHsk | Class which is instantiated for each housekeeping quantity
GattrRaw | Class which is instantiated for each raw register kind
GattrReg | Class which is instantiated for each register
GCCC | Calorimeter Cable Controller node Record
GCFE | Calorimeter Front End node Record
Gconstraint | Base class for describing constraints
GconstraintBase | Base constraint class for use when no constraint is appropriate
GconstraintLimit | Limit Constraint
GconstraintLimitPegRE | Pegged Limit Constraint
GconstraintLimitRE | On Constraint Limit Raise Exception
gConstraintViolation | Constraint Violation Class
GCRC | Calorimeter Readout Controller node Record
GCRU | CRU node
Gdb | Base class for all GLAST LAT functional blocks
GDBN | Database node record
GEBM | GEBM node
GEBMC | EBM Controller node
GEBMST | EBM Event Statistics node
GEGU | Base class for raw/engineering unit conversions
GEGU_linear | EGU class for performing linear conversions
GEGU_poly3 | EGU class for performing 3rd degree polynominal conversions
GEM | GEM event object
GExportException |
GGEM | GGEM node
GGEMC | GEMC sub-node of GGEM (controller)
GGEMIE | GEMIE sub-node of GGEM (input enables)
GGEMMG | GEMMG sub-node of GGEM (TAM generator)
GGEMSC | GEMSC sub-node of GGEM (scheduler)
GGEMST | GEMST sub-node of GGEM (statistics)
GGEMVG | GEMVG sub-node of GGEM (ROI generator)
GGEMW | GEMW sub-node of GGEM
GGLT | Global Trigger
GHSK | GLAST HSK node Record
GLAT | GLAST LAT node Record
GLCB | LCB node
GMem | Memory node
GNAT | GNAT node Record
GOCS | OCS node
GPDU | PDU Controller
GPEQ | PDU Environmental Monitors
Grule | Base class for describing rules
GruleAlarms | Alarm rule
GruleBase | Base rule class for use when no rule is appropriate
GruleLimit | Rule class that limits a passed in value to given limits
GTCC | Tracker Cable Controller node record
GTEM | TEM node Record
GTFE | Tracker Front-End node Record
GTIC | Trigger Interface Controller
GTRC | Tracker Readout Controller node Record
GTWR | Tower node Record
GUIbridge | Class for providing a bridge between the GUI thread and other threads
GXBRD | Tower controller node Record
HAEM | GLAST AEM HSK node Record
HARC | GLAST ARC HSK node record
HCOM | GLAST Communications statistics HSK node record
HCPU | GLAST CPU metrics HSK node record
HEBM | GLAST EBM HSK node record
HGEM | GLAST GEM HSK node record
HNUL | GLAST HSK null record
HPDU | GLAST PDU HSK node record
HskAlarmRecorder |
HskCli | Housekeeping client input/output class
HskCollector | Configurable housekeeping collector
HskFileRecorder |
HskHandler | HskHandler class
HskLatRetriever |
HskPacketRetriever |
HskTestRetriever |
HTEM | GLAST TEM HSK node record
LATsweep |
LDBI_LATcontributionIterator | LDBI_LATcontributionIterator implementation
LogRecordStreamHandler |
MarkerTrgReadout | MarkerTrgReadout class definition
MiniGLTExample | MiniTower example interface to MiniGLT
MiniGLTExample | MiniTower example interface to MiniGLT
MiniGLTExample | MiniTower example interface to MiniGLT
MiniGLTSolicitedCondition |
MiniGLTSolicitedCondition |
MiniGLTSolicitedCondition |
MiniGLTSolicitedEngine |
MiniGLTSolicitedEngine |
MiniGLTSolicitedEngine |
MiniGLTTrgConditionsValue |
myLATcomponentIterator | LAT component Displayer
NoCnoEnabled |
NoInputsEnabled |
NoTilesEnabled |
NullCal |
NullCoincidence |
NullEngine |
NullRequest |
NullRoi |
NullStream |
NullTkr |
NullTower |
Preferences | Preferences dictionary Preferences needs a special dictionary class since the data it stores may have macros and environment variables in it
rcArchiver | Event Archiver
rcCompletionStatus |
rcGEMDefaultTrigger | RcGEMDefaultTrigger
rcGEMTrgEngines |
rcMiniGLTDefaultTrigger | RcMiniGLTDefaultTrigger
rcMiniGLTSolicitedCondition |
rcMiniGLTSolicitedEngine |
rcScmCfgSelector |
rcScmCfgSelText |
rcSecurityMan |
rcSolicitedCondition |
rcSolicitedEngine |
rcTestReport | Test Report class for RunControl
rcTransitions |
rcTrgCoincidence | RcTrgCoincidence class
rcTrgEngines | RcTrgEngines Class
rcTrgGem | RcTrgGem class definition This class implements a 'threaded' model for enabling/disabling the trigger
rcTrgMiniGLT | RcTrgMiniGLT class definition This class implements a 'threaded' model for enabling/disabling the trigger
rcTrgTileEnables | RcTrgTileEnables class
rcUser |
rcUsers |
Receiver | Abstract Receiver class
Recorder | Recorder class
RegisterInterface |
Reloader |
ReverseTrendMap |
RunControl |
RunControlCommon |
RunControlFileHandler | FileHandler class for handling multiple line log entries
RunControlMain |
SGETrgEngines |
SGETrgEngines |
SGETrgInputEnables |
SGETrgInputEnables |
SimpleGasuExample | SimpleGASU example interface to GEM
SimpleGasuExample | SimpleGASU example interface to GEM
singleEvtDisplayImpl | Glast Online Single Event Display (GOSED)
SolicitedCondition |
SolicitedCondition |
SolicitedEngine |
SolicitedEngine |
standardTestReport |
SweepMarkerEngine | SweepMarkerEngine class
TaskEngine |
TKRcontributionIterator | TKR contribution Displayer
TrgAbstract | Abstract trigger interface class definition
TrgCalorimeter | Trigger Calorimeter class definition
TrgCmdCounters | TrgCmdCounters class
TrgCmdStats | TrgCmdStats class
TrgCnoEnables | Trigger CNO Enables class definition
TrgCoincidence | Trigger Coincidence class definition This class defines the set of tiles which will constitute any one coincidence
TrgCoincidences | Trigger Coincidences class definition
TrgConditions | Trigger Conditions Value class definition This class is used to define one combinatoric of the 128 possible conditions
TrgConditionsValue | Trigger Conditions Value class definition
TrgDefaultPeriodicCondition | TrgDefaultPeriodicCondition class definition
TrgDefaultSequence |
TrgEngine | Trigger Engine class definition The user inherits from this class to customize their own Trigger Engines. The user must satisfy the member function 'request', which returns an object of type TrgEngineRequest. The user must satisfy the member function 'prescale', which returns an integer
TrgEngineRequest | Trigger Engine Request class definition The TrgEngineRequest class is used to specify the parameterization of the Trigger Message associated with a given engine
TrgEngines | Trigger Engines class definition A Trigger Engine defines what the Trigger System does when it detects a triggerable condition within the LAT
TrgEventCounter | TrgEventCounter class
TrgGem | Trigger Global Trigger Electronics Module Interface class definition This class implements the hardware register access to the GEM
TrgGemAbstract | Trigger Global trigger Electronics Module Interface class definition
TrgGemCmdCounters | TrgGemCmdCounters
TrgGemCmdStats | TrgGemCmdStats
TrgGemEventCounter | TrgGemEventCounter
TrgGemPeriodicCondition | Trigger Periodic Condition class definition
TrgGemRegisters | TrgGemRegisters class definition
TrgGemSequence | TrgGemSequence Hardware abstraction for TrgSequence
TrgGemTileCounters | TrgGemTileCounters
TrgGemTileStats | TrgGemTileStats
TrgGemTriggerCounters | TrgGemTriggerCounters class
TrgGemTriggerStats | TrgGemTriggerStats This class implements the HW abstraction corresponding to figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2
TrgInjectCharge | TrgInjectCharge class definition
TrgInjectChargeReadout | Trigger Inject Charge Readout class definition
TrgInjectMarker | Trigger Inject Marker class definition Directs a module to send to its Front-End Electronics a command sequence which is composed of only a TACK command. This sequence will trigger a readout of the module's Front-End Electronics
TrgInputEnables | Trigger Input Enables class definition
TrgMiniGLT | Mini GLT Hardware abstraction implementation
TrgMiniGLTAbstract | TrgMiniGLTAbstract Interface class definition This class inherits from TrgAbstract to define the structure of a MiniGLT trigger
TrgMiniGLTRegisters | Register shape definition class for the MiniGLT This class defines the shapes of the registers and bitfields used in the MiniGLT
TrgObject | Trigger Object class definition
TrgPeriodicCondition | Trigger Periodic Condition class definition
TrgPeriodicConditionAbstract | TrgPeriodicConditionAbstract class definition
TrgPeriodicConditionDefinition | TrgPeriodicConditionDefinition class definition
TrgReadout | TrgReadout class definition
TrgRoi | Trigger ROI (Region of Interest) class definition
TrgRoiAsTiles | Class TrgRoiAsTiles LATTE provided class to map coincidences to ROIs
TrgRois | Trigger ROI (Region of Interest) list class definition
TrgSequence | Trigger Sequence class definition
TrgSequenceAbstract | Abstract Trigger Sequence class definition
TrgSequenceDefinition | Trigger Sequence Definition class definition
TrgTileCounters | TrgTileCounters class definition This class controls the counters used to count ACD tile transitions
TrgTileEnables | Trigger Tile Enables class definition
TrgTileStats | TrgTileStats class definition This class specifies the statistics returned by the counters described by TrgTileCounters
TrgTower | Trigger Tower class definition
TrgTowerEnables | Trigger Tower Enables class definition
TrgTowers | Trigger Towers class definition
TrgTracker | Trigger Tracker class definition
TrgTriggerCounters | TrgTriggerCounters class definition This class controls the counters associated with the performance of the LAT with respect to the Trigger System
TrgTriggerStats | TrgTriggerStats This class specifies the statistics returned by the counters defined in TrgTriggerCounters
TrgUsingTiles | Trigger Using Tiles class definition
UDPReceiver | UDPReceiver class
UDPRecorder | Example recorder that UDP broadcasts trendables
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userApplication |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgText |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userArgument |
userSuite |
userSuite |
userSuite |
ZsupSolicitedEngine |
ZsupSolicitedEngine |
ZsupTrgInjectChargeReadout | ZsupTrgReadout class definition
ZsupTrgReadout | ZsupTrgReadout class definition
ZsupTrgReadout | ZsupTrgReadout class definition
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: _Anonymous Class Reference

dispatcher::_Anonymous

_Anonymous Class Reference

Inheritance diagram for _Anonymous:

[legend]
Collaboration diagram for _Anonymous:

[legend]
List of all members.

Detailed Description

Singleton used to signal "Anonymous Sender"

The Anonymous object is used to signal that the sender of a message is not specified (as distinct from being "any sender"). Registering callbacks for Anonymous will only receive messages sent without senders. Sending with anonymous will only send messages to those receivers registered for Any or Anonymous.

Note: The default sender for connect is Any, while the default sender for send is Anonymous. This has the effect that if you do not specify any senders in either function then all messages are routed as though there was a single sender (Anonymous) being used everywhere.

Definition at line 75 of file dispatcher.py.

The documentation for this class was generated from the following file:
  • dispatcher.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: _Any Class Reference

dispatcher::_Any

_Any Class Reference

Inheritance diagram for _Any:

[legend]
Collaboration diagram for _Any:

[legend]
List of all members.

Detailed Description

Singleton used to signal either "Any Sender" or "Any Signal"

The Any object can be used with connect, disconnect, send, or sendExact to signal that the parameter given Any should react to all senders/signals, not just a particular sender/signal.

Definition at line 53 of file dispatcher.py.

The documentation for this class was generated from the following file:
  • dispatcher.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: _Attr Class Reference

gAttr::_Attr

_Attr Class Reference

List of all members.

Public Member Functions

__init__ (node, attr)
getName ()
size ()
id ()
setRule (rule)
getRule ()
setConstraint (constraint)
setEGU (egu)
getEGU ()
getConstraint ()
flags ()
isReadOnly ()
isWriteOnly ()
isReadWrite ()
isNoDirectAccess ()
isCommand ()
getNode ()
setTimeStamp (value)
getTimeStamp ()

Detailed Description

Helper class for private use in this file only.

Definition at line 249 of file gAttr.py.

Member Function Documentation

getConstraint ( )

Method that returns the gConstraint.Gconstraint class for this gAttr

Returns:
A Gconstraint object instance

getEGU ( )

Method that returns the gEGU.GEGU class for this gAttr

Returns:
A Gegu object instance

getRule ( )

Retrieve the rule associated with the gAttr.

getTimeStamp ( )

Method that returns the timestamp at the moment when the register was accessed.

Returns:
Timestamp in seconds as a floating point value

isNoDirectAccess ( )

Returns a boolean value indicating if the attribute is no direct access or not

Returns:
1=No Direct Access, 0=Not No Direct Access.

isReadOnly ( )

Returns a boolean value indicating if the attribute is read only or not

Returns:
1=Read Only, 0=Not Read Only.

isReadWrite ( )

Returns a boolean value indicating if the attribute is read write or not

Returns:
1=Read Write, 0=Not Read Write.

isWriteOnly ( )

Returns a boolean value indicating if the attribute is write only or not

Returns:
1=Write Only, 0=Not Write Only.

setConstraint ( constraint )

Method to attach a constraint to a gAttr after the gAttr has been constructed. This method will go away once constraints are loaded from a configuration file.

Parameters:
constraint A Gconstraint object instance

setEGU ( egu )

Method to attach a EGU to a gAttr after the gAttr has been constructed.

Parameters:
egu A Gegu object instance

setRule ( rule )

Method to attach a rule to a gAttr after the gAttr has been constructed.

Parameters:
rule A Grule object instance

size ( )

Method for returning the size of the attribute

Returns:
Attribute size in bytes

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: _Parameter Class Reference

dispatcher::_Parameter

_Parameter Class Reference

Inheritance diagram for _Parameter:

[legend]
List of all members.

Public Member Functions

__repr__ ()

Detailed Description

Used to represent default parameter values.

Definition at line 40 of file dispatcher.py.

The documentation for this class was generated from the following file:
  • dispatcher.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AcdHWMultiplexer Class Reference

AcdHWMultiplexer::AcdHWMultiplexer

AcdHWMultiplexer Class Reference

AcdHWMultiplexer class. More...

List of all members.

Public Member Functions

__init__ (GEM)
AcdHWMultiplexer constructor.
start ()
Method for starting the accumulation of ACD hardware scalers.
stop ()
Method for stopping the accumulation of ACD hardware scalers.
resume ()
Method for resuming the accumulation of ACD hardware scalers after a stop.
abort ()
Method for aborting the accumulation of ACD hardware scalers.
shutdown ()
Method for shutting down the Multiplexer.
dwell (d=None)
Method to set the dwell time for scaler integration.
tileList (tList=None)
Method to set which tiles are integrated.
stats ()
Method to access the counter statistics.

Detailed Description

AcdHWMultiplexer class.

A class to multiplex the two ACD hardware scalers defined in section 2.6.2 of the GEM document, LAT-TD-01545 into up to 108 separate counters.

Definition at line 22 of file AcdHWMultiplexer.py.

Member Function Documentation

__init__ ( GEM )

AcdHWMultiplexer constructor.

Parameters:
GEM a GEM object

abort ( )

Method for aborting the accumulation of ACD hardware scalers.

Abort the integration of the hardware counters. The cycle stops immediately, and the set of counts from the current cycle is discarded.

dwell ( d = None )

Method to set the dwell time for scaler integration.

Set the dwell time (in seconds) for integration. Total time in a cycle through the scalers will be dwell * nTiles. Minimum dwell time is 0.1 seconds. Default is 1 second.

Parameters:
dwell Dwell time in seconds, default = 1 second

resume ( )

Method for resuming the accumulation of ACD hardware scalers after a stop.

Resume the integration of the hardware counters after a stop() call. At resume of integration, the internal counters are not reset, but continue from their previous values.

shutdown ( )

Method for shutting down the Multiplexer.

Shut down the thread the multiplexer is running in. Should be called during endRun.

start ( )

Method for starting the accumulation of ACD hardware scalers.

Start the integration of the hardware counters. At the start of integration, the counters are all reset to zero (0).

stats ( )

Method to access the counter statistics.

Provides the user with the a list containing the counter statistics. This list corresponds to the tiles in tileList.

Returns:
The list of the tile statistics.

stop ( )

Method for stopping the accumulation of ACD hardware scalers.

Stop the integration of the hardware counters. The stop occurs at the end of the current cycle, and the counts from the current cycle are integrated into the count statistics

tileList ( tList = None )

Method to set which tiles are integrated.

Defines the list of tiles which are being integrated. Ex: range(108); [0,2,4,6]

Parameters:
tList The list of tiles to be integrated.
Returns:
The list of tiles that are being integrated

The documentation for this class was generated from the following file:
  • AcdHWMultiplexer.py
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ACDmap Class Reference

TrgGemRegisterGeometry::ACDmap

ACDmap Class Reference

List of all members.

Public Member Functions

__init__ (gemVersion=None)
lookup (cable, channel)
freeName (cable)

Detailed Description

An implementation of LDF.ACDmap that forces a particular LATtypeId()

Definition at line 10 of file TrgGemRegisterGeometry.py.

The documentation for this class was generated from the following file:
  • TrgGemRegisterGeometry.py
Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AddableRoi Class Reference

TrgRoiAsTiles::AddableRoi

AddableRoi Class Reference

Inheritance diagram for AddableRoi:

[legend]
Collaboration diagram for AddableRoi:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgRoi constructor.
addTile (tile)
tile (tileNumber)
tile 'pure virtual' method

Detailed Description

The main purpose of this class is to add the member function addTile(tile). This function appends a tile to the list of tiles in the ROI

Definition at line 37 of file TrgRoiAsTiles.py.

Member Function Documentation

tile ( tileNumber )

tile 'pure virtual' method

Parameters:
tileNumber A tile number
Returns:
A boolean

Reimplemented from TrgRoi.

The documentation for this class was generated from the following file:
  • TrgRoiAsTiles.py
Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AEM Class Reference

gEvtCli::AEM

AEM Class Reference

AEM event object. More...

List of all members.

Public Member Functions

__init__ ()
clearEvent ()
Initialize accept and veto hit vectors.
addPHA (cbl, pha)
Adds a PHA value.

Detailed Description

AEM event object.

Members:

  • vetoHitVectors
  • acceptHitVectors
  • PHA

Definition at line 76 of file gEvtCli.py.

Member Function Documentation

addPHA | ( | cbl | ,
 |  | pha |
 | ) |

Adds a PHA value.

Called from evDumpAEM_PHA

Parameters:
cbl | Cable number
pha | 16 bit PHA value

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: BoundMethodWeakref Class Reference

saferef::BoundMethodWeakref

BoundMethodWeakref Class Reference

List of all members.

Public Member Functions

__init__ (target, onDelete=None)
__str__ ()
__nonzero__ ()
__cmp__ (other)
__call__ ()

Static Public Member Functions

static | __new__ (target, onDelete=None, arguments, named)
static | calculateKey (target)

Detailed Description

Safe' and reusable weak references to instance methods

BoundMethodWeakref objects provide a mechanism for referencing a bound method without requiring that the method object itself (which is normally a transient object) is kept alive. Instead, the BoundMethodWeakref object keeps weak references to both the object and the function which together define the instance method.

Attributes: key -- the identity key for the reference, calculated by the class's calculateKey method applied to the target instance method deletionMethods -- sequence of callable objects taking single argument, a reference to this object which will be called when *either* the target object or target function is garbage collected (i.e. when this object becomes invalid). These are specified as the onDelete parameters of safeRef calls. weakSelf -- weak reference to the target object weakFunc -- weak reference to the target function

Class Attributes: _allInstances -- class attribute pointing to all live BoundMethodWeakref objects indexed by the class's calculateKey(target) method applied to the target objects. This weak value dictionary is used to short-circuit creation so that multiple references to the same (object, function) pair produce the same BoundMethodWeakref instance.

Definition at line 52 of file saferef.py.

Member Function Documentation

__call__ ( )

Return a strong reference to the bound method

If the target cannot be retrieved, then will return None, otherwise returns a bound instance method for our object and function.

Note: You may call this method any number of times, as it does not invalidate the reference.

__cmp__ ( other )

Compare with another reference

__init__ | ( | target | ,
 |  | onDelete | = None
 | ) |

Return a weak-reference-like instance for a bound method

target -- the instance-method target for the weak reference, must have im_self and im_func attributes and be reconstructable via: target.im_func.__get__( target.im_self ) which is true of built-in instance methods. onDelete -- optional callback which will be called when this weak reference ceases to be valid (i.e. either the object or the function is garbage collected). Should take a single argument, which will be passed a pointer to this object.

static __new__ | ( | target | ,
 |  | onDelete | = None,
 |  | arguments | ,
 |  | named |
 | ) | [static]

Create new instance or return current instance

Basically this method of construction allows us to short-circuit creation of references to already- referenced instance methods. The key corresponding to the target is calculated, and if there is already an existing reference, that is returned, with its deletionMethods attribute updated. Otherwise the new instance is created and registered in the table of already-referenced methods.

__nonzero__ ( )

Whether we are still a valid reference

__str__ ( )

Give a friendly representation of the object

static calculateKey ( target ) [static]

Calculate the reference key for this reference

Currently this is a two-tuple of the id()'s of the target object and the target function respectively.

The documentation for this class was generated from the following file:
  • saferef.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: CALcontributionIterator2 Class Reference

GOSED_LDF::CALcontributionIterator2

CALcontributionIterator2 Class Reference

CAL contribution Displayer. More...

List of all members.

Public Member Functions

__init__ (event, contribution, gui, limits, lci)
plot ()
log (tower, layer, theLog)

Detailed Description

CAL contribution Displayer.

This class obtains the filtered entries from CALcontributorIterator1 and converts them to the appropriate format to display them

Definition at line 66 of file GOSED_LDF.py.

Member Function Documentation

__init__ | ( | event | ,
 |  | contribution | ,
 |  | gui | ,
 |  | limits | ,
 |  | lci |
 | ) |

CALcontributionIterator2 contructor

Parameters:
event | Event
contribution | Contribution
gui | GOSED
limits | Tuple with filtered values (min value, max value, log count and energy count) obtained from CALcontributionIterator1

log | ( | tower | ,
 |  | layer | ,
 |  | theLog |
 | ) |

This function iterates over all current event entries and displays all those entries that passed the filter of for CAL in CALContributorIterator1.

Returns:
tower, layer, theLog

plot ( )

Plot here will call the iterate() function to display the filtered event within the scale format selected by the user (Event, Custom or Default)

There are three sorts of pixmaps (and the 3 equivalent for the YZ projection): background = Background Pixmap with the skeleton of the CAL final = Final pixmap that is going to be loaded to the display. If no data passed the filter, the custom widget drawXZ_CAL will automatically load background to final for display ebfXZ_CAL = Temporary Pixmap that, if there is data that passed the filter for the current event, it gets painted with it over background. If so it is then passed to final (once the iteration is over).

The documentation for this class was generated from the following file:
  • GOSED_LDF.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ccsdsHeader Class Reference

HskPacketDecoder::ccsdsHeader

ccsdsHeader Class Reference

CCSDS Header bitfield definition. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

CCSDS Header bitfield definition.

Definition at line 41 of file HskPacketDecoder.py.

The documentation for this class was generated from the following file:
  • HskPacketDecoder.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ccsdsPacket Class Reference

HskPacketDecoder::ccsdsPacket

ccsdsPacket Class Reference

Interface to a generic CCSDS packet. More...

Inheritance diagram for ccsdsPacket:

[legend]
List of all members.

Public Member Functions

__init__ (ui)
apid ()
type ()
seqCnt ()
length ()
subSeconds ()

Detailed Description

Interface to a generic CCSDS packet.

Parameters:
ui The raw binary representation of the packet in big-endian byte order
Methods: apid() return packet APID secHead() return packet secondary header bit type() return packet type bit version() return packet version seqCnt() return sequence count seqFlg() return sequence flag length() return packet length in bytes seconds() return timestamp seconds subSeconds() return timestamp sub seconds payload() return packet payload (opaque)

Definition at line 25 of file HskPacketDecoder.py.

The documentation for this class was generated from the following file:
  • HskPacketDecoder.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Consumer Class Reference

consumer::Consumer

Consumer Class Reference

Consumer class to consume LDF data This class just handles file open/close or server open/close. More...

Inheritance diagram for Consumer:

[legend]
List of all members.

Public Member Functions

__init__ (argv)
parseEvent ()
checkUDF ()
getRunId ()
setRunId (runId)
getNextEvent ()
serverOpen (server="1")
serverClose ()
fileOpen (fn)
fileClose ()
archiveOpen (fn)
archiveClose (fn)
dataSize ()
usage ()
parseArgs (argv)
loop ()

Detailed Description

Consumer class to consume LDF data This class just handles file open/close or server open/close.

Definition at line 18 of file consumer.py.

Member Function Documentation

__init__ ( argv )

consumer constructor

Reimplemented in consumerPlotter.

archiveClose ( fn )

Close data archive

archiveOpen ( fn )

Open data archive

dataSize ( )

Return current event data size

fileClose ( )

Close input data file

fileOpen ( fn )

Load input data from a file

getNextEvent ( )

get Next Event into data buffer

parseEvent ( )

Analyse an event

Reimplemented in consumerPlotter.

serverClose ( )

Close network server

serverOpen ( server = "1" )

Connect to network server

The documentation for this class was generated from the following file:
  • consumer.py
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: consumerPlotter Class Reference

consumerPlotter::consumerPlotter

consumerPlotter Class Reference

Consumer class to consume LDF data This class just handles file open/close or server open/close. More...

Inheritance diagram for consumerPlotter:

[legend]
Collaboration diagram for consumerPlotter:

[legend]
List of all members.

Public Member Functions

__init__ (argv)
getName ()
parseEvent ()
checkUDF ()
checkLimits ()
setCompletionStatus (status)
getCompletionStatusStr ()
getCompletionStatus ()
addExportedFile (file, delete=False)
exportFiles ()

Detailed Description

Consumer class to consume LDF data This class just handles file open/close or server open/close.

Definition at line 17 of file consumerPlotter.py.

Member Function Documentation

__init__ ( argv )

consumer constructor

Reimplemented from Consumer.

parseEvent ( )

Analyse an event

Reimplemented from Consumer.

The documentation for this class was generated from the following file:
  • consumerPlotter.py
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorAddress Class Reference

DataDistributor::DataDistributorAddress

DataDistributorAddress Class Reference

Data distributor address class containing static methods that govern the picking of multicast ports and addresses. More...

List of all members.

Static Public Member Functions

static | port (name)
static | lookup (port, server)

Detailed Description

Data distributor address class containing static methods that govern the picking of multicast ports and addresses.

Definition at line 104 of file DataDistributor.py.

Member Function Documentation

static lookup | ( | port | ,
 |  | server |
 | ) | [static]

Static method for resolving the multicast port and group values.

Parameters:
port | An integer containing the multicast port to use, e.g. from the port() method above, or None to indicate that the value will come from the supplied server string.
server | A string that contains either the machine ID (test stand instance number), or <port><group IP or name>, or <group ip ="" or="" name=""> when a port number is also supplied. These last two can be used to override the values chosen by this class. The machine ID is a number from 0 - 999, where the hundreds digit represents the site ID and remainder (0-99) is the machine ID at the site. This latter portion is what's used.
Returns:
A list made up of the resolved port and group values.

static port ( name ) [static]

Static method to select a physical multicast port to use based on the type of data that is desired.

Parameters:
name The name of the type of data that is desired. Choose from 'LAT_EBFdata', 'LAT_CMDdata', 'LAT_HSKdata' and 'LAT_MsgLog'.

The documentation for this class was generated from the following file:
  • DataDistributor.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorClient Class Reference

DataDistributor::DataDistributorClient

DataDistributorClient Class Reference

Data distributor client class. More...

List of all members.

Public Member Functions

__init__ (name=None, length=4096)
connect (server)
disconnect ()
returnNone ()
receive ()

Detailed Description

Data distributor client class.

Definition at line 54 of file DataDistributor.py.

Member Function Documentation

__init__ | ( | name | = None,
 |  | length | = 4096
 | ) |

Data Distributor client constructor.

Parameters:
name | The name of the type of data that the client wants to receive. See the DataDistributorAddress class.
length | The size in bytes of the buffer to allocate for receiving the data

connect ( server )

Open a UDP socket, bind it to a port and select a multicast group.

Parameters:
server The address the server is multicasting on. This address must be the same for both server and client. The value can be in one of the following forms:
  • A number of which only the two lower decimal digits are used, i.e., in the range 0-99
  • <port><multicast address>, where <port> is a value that will override what is found from the data type name translation, and <multicast address=""> is some valid multicast IP address starting with the value 239. A name may be used for the <multicast address=""> value as well, as long as it can be found in the name server and translates to a valid multicast IP address.
  • <multicast address="">, as discussed in the previous bullet. The port value is taken to be the one found from looking up the data type name in the port table.

disconnect ( )

Gracefully shut down the socket.

receive ( )

Receive multicast data and the sender's identification.

Returns:
A list of the data and the sender's identification string.

returnNone ( )

Method to signal the receive loop to exit.

The documentation for this class was generated from the following file:
  • DataDistributor.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorPoll Class Reference

DataDistributorPoll::DataDistributorPoll

DataDistributorPoll Class Reference

Data distributor client that polls for samples of data. More...

List of all members.

Public Member Functions

__init__ (name)
start ()
stop ()
receive ()

Detailed Description

Data distributor client that polls for samples of data.

Use of this class involves the starting of a thread that constantly receives the data arriving in the base class's socket. Keeping the socket drained of data allows the user of this class to get the most recent data received, thus avoiding getting data with a bursty time structure. Whenever the application calls the receive() method, it gets the most recent data sample. Because of the reference counting method used by Python objects, no copy of the data needs to be made to avoid the data changing from underneath the application. The application can hold onto the data reference as long as it likes. Whenever new data appears a new reference is created, and is possibly deleted before the application gets access to it, leaving any existing reference alone. When the application tries to get access to the latest data, it gets a copy of the most recent reference, and the previous reference is deleted, if it has gone out of scope.

Definition at line 24 of file DataDistributorPoll.py.

Member Function Documentation

__init__ ( name )

DataDistributorPoll constructor.

Parameters:
name The name of the type of data that the client wants to receive. See the DataDistributorAddress class.

receive ( )

Receive a sampled value of the data and sender information.

Returns:
A list of the sampled data and sender's identification string.

start ( )

Start the polling thread.

stop ( )

Stop the polling thread.

The documentation for this class was generated from the following file:
  • DataDistributorPoll.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorServer Class Reference

DataDistributor::DataDistributorServer

DataDistributorServer Class Reference

Data Distributor Server. More...

List of all members.

Public Member Functions

__init__ (name=None)
connect (server)
disconnect ()
publish (data)

Detailed Description

Data Distributor Server.

Definition at line 10 of file DataDistributor.py.

Member Function Documentation

__init__ ( name = None )

Data Distributor server constructor.

Parameters:
name The name of the type of data to be served. See the DataDistributorAddress class.

connect ( server )

Method to set up a socket and connect to it.

Parameters:
server The address of a socket on which to serve the data. This address must be the same for both server and client. The value can be in one of the following forms:
  • A number of which only the two lower decimal digits are used, i.e., in the range 0-99
  • <port><multicast address>, where <port> is a value that will override what is found from the data type name translation, and <multicast address=""> is some valid multicast IP address starting with the value 239. A name may be used for the <multicast address=""> value as well, as long as it can be found in the name server and translates to a valid multicast IP address.
  • <multicast address="">, as discussed in the previous bullet. The port value is taken to be the one found from looking up the data type name in the port table.

disconnect ( )

Gracefully shut down the socket.

publish ( data )

Publish the data on the multicast socket.

Parameters:
data The data to be sent out on the multicast socket.

The documentation for this class was generated from the following file:
  • DataDistributor.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataExport Class Reference

DataExport::DataExport

DataExport Class Reference

List of all members.

Public Member Functions

__init__ ()
setPurge (purge)
synch (source, dest)
export (source, dest)
exportDir (sourceDir, destDir)
exportFile (sourceFile, destFile)
md5sum (fname)

Detailed Description

Class to synch a file or set of files between one location and another

Definition at line 26 of file DataExport.py.

Member Function Documentation

export | ( | source | ,
 |  | dest |
 | ) |

Copy from source to dest. This routine will determine whether source is a file or a directory

exportDir | ( | sourceDir | ,
 |  | destDir |
 | ) |

Copy a source directory to a destination. Destination must not be extant.

exportFile | ( | sourceFile | ,
 |  | destFile |
 | ) |

Copy a source file to a destination file. Destination must not be extant.

md5sum ( fname )

Returns an md5 hash for file fname.

synch | ( | source | ,
 |  | dest |
 | ) |

Synch up two directory structures. Synch only goes in one direction: source --> destination.

The documentation for this class was generated from the following file:
  • DataExport.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DefaultPeriodicCondition Class Reference

TrgUsingTiles::DefaultPeriodicCondition

DefaultPeriodicCondition Class Reference

DefaultPeriodicCondition class. More...

Inheritance diagram for DefaultPeriodicCondition:

[legend]
Collaboration diagram for DefaultPeriodicCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
DefaultPeriodicCondition constructor.
definition ()
definition() method See TrgPeriodicCondition base class

Detailed Description

DefaultPeriodicCondition class.

Definition at line 42 of file TrgUsingTiles.py.

The documentation for this class was generated from the following file:
  • TrgUsingTiles.py
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DispatcherError Class Reference

errors::DispatcherError

DispatcherError Class Reference

Inheritance diagram for DispatcherError:

[legend]

Detailed Description

Base class for all Dispatcher errors

Definition at line 8 of file errors.py.

The documentation for this class was generated from the following file:
  • errors.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DispatcherKeyError Class Reference

errors::DispatcherKeyError

DispatcherKeyError Class Reference

Inheritance diagram for DispatcherKeyError:

[legend]
Collaboration diagram for DispatcherKeyError:

[legend]

Detailed Description

Error raised when unknown (sender,signal) set specified

Definition at line 14 of file errors.py.

The documentation for this class was generated from the following file:
  • errors.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DispatcherTypeError Class Reference

errors::DispatcherTypeError

DispatcherTypeError Class Reference

Inheritance diagram for DispatcherTypeError:

[legend]
Collaboration diagram for DispatcherTypeError:

[legend]

Detailed Description

Error raised when inappropriate signal-type specified (None)

Definition at line 20 of file errors.py.

The documentation for this class was generated from the following file:
  • errors.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawHatACD Class Reference

GOSEDPainter::drawHatACD

drawHatACD Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
drawNames (pixmap)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the ACD Hat projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 145 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawHatACD contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the Hat projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for ACD, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawSide1ACD Class Reference

GOSEDPainter::drawSide1ACD

drawSide1ACD Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
drawNames (pixmap)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the ACD Side 1 projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 29 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawSide1ACD contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the Side 1 projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for ACD, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawSide2ACD Class Reference

GOSEDPainter::drawSide2ACD

drawSide2ACD Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
drawNames (pixmap)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the ACD Side 2 projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 58 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawSide2ACD contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the Side 2 projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for ACD, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawSide3ACD Class Reference

GOSEDPainter::drawSide3ACD

drawSide3ACD Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
drawNames (pixmap)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the ACD Side 3 projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 87 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawSide3ACD contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the Side 3 projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for ACD, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawSide4ACD Class Reference

GOSEDPainter::drawSide4ACD

drawSide4ACD Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
drawNames (pixmap)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the ACD Side 4 projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 116 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawSide4ACD contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the Side 4 projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for ACD, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawXZ_CAL Class Reference

GOSEDPainter::drawXZ_CAL

drawXZ_CAL Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the XZ CAL projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 230 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawXZ_CAL constructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the XZ CAL projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for TKR, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawXZ_TKR Class Reference

GOSEDPainter::drawXZ_TKR

drawXZ_TKR Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the XZ TKR projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 174 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawXZ_TKR contructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the XZ TKR projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for TKR, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawYZ_CAL Class Reference

GOSEDPainter::drawYZ_CAL

drawYZ_CAL Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the YZ TKR projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 258 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawYZ_CAL constructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the YZ CAL projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for TKR, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: drawYZ_TKR Class Reference

GOSEDPainter::drawYZ_TKR

drawYZ_TKR Class Reference

List of all members.

Public Member Functions

__init__ (gui, parent=None, name=None, fl=0)
clear ()
showEvent (se)
paintEvent (pe)
paintFace ()

Detailed Description

Draws background Pixmap for the YZ TKR projection and updates the custom widget with the final pixmap processed by GOSED_LDF.

Definition at line 202 of file GOSEDPainter.py.

Member Function Documentation

__init__ | ( | gui | ,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

drawYZ_TKR constructor

Parameters:
parent | None
name | None
fl | 0

paintEvent ( pe )

Paint Event function for the YZ TKR projection, paints its background and updates it with the current event pixmap (final) created in GOSED_LDF. If no data passed the filter for TKR, final will be updated as the background.

Parameters:
pe paint event

The documentation for this class was generated from the following file:
  • GOSEDPainter.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DummyRecorder Class Reference

Recorder::DummyRecorder

DummyRecorder Class Reference

Example recorder that dumps the trendables to a logger. More...

Inheritance diagram for DummyRecorder:

[legend]
Collaboration diagram for DummyRecorder:

[legend]
List of all members.

Public Member Functions

__init__ ()
processTrends (trendables)

Detailed Description

Example recorder that dumps the trendables to a logger.

Definition at line 22 of file Recorder.py.

The documentation for this class was generated from the following file:
  • Recorder.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DummyRetriever Class Reference

Retriever::DummyRetriever

DummyRetriever Class Reference

List of all members.

Public Member Functions

__init__ ()
retrievePacket ()

Detailed Description

Dummy retriever used for testing.

Creates 24 trendable objects which are simply sin/cos functions.

Definition at line 17 of file Retriever.py.

The documentation for this class was generated from the following file:
  • Retriever.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evAEM_PHA Class Reference

gEvtCli::evAEM_PHA

evAEM_PHA Class Reference

PHA object. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

PHA object.

Bit Fields:

  • more
  • range
  • ADC
  • parityErr

Definition at line 105 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evCAL_LayerLogData Class Reference

gEvtCli::evCAL_LayerLogData

evCAL_LayerLogData Class Reference

Class that associates a layer with the log data. More...

List of all members.

Public Member Functions

__init__ (twr, layer, data)
evCAL_LayerLogData constructor

Detailed Description

Class that associates a layer with the log data.

Definition at line 382 of file gEvtCli.py.

Member Function Documentation

__init__ | ( | twr | ,
 |  | layer | ,
 |  | data |
 | ) |

evCAL_LayerLogData constructor

Parameters:
layer | CAL layer (such as 'x1', 'y1', etc)
data | evCAL_LogData bitfield

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evCAL_LogAccepts Class Reference

gEvtCli::evCAL_LogAccepts

evCAL_LogAccepts Class Reference

Log Accepts bitfields. More...

List of all members.

Public Member Functions

__init__ (twr, ui)

Detailed Description

Log Accepts bitfields.

Bit Fields:

  • y3
  • y2
  • y1
  • y0
  • x3
  • x2
  • x1
  • x0

Definition at line 373 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evCAL_LogData Class Reference

gEvtCli::evCAL_LogData

evCAL_LogData Class Reference

Log Data bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Log Data bitfields.

Bit Fields:

  • column
  • rangeADC_neg
  • valADC_neg
  • rangeADC_pos
  • valADC_pos

Definition at line 404 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evCellHeader Class Reference

gEvtCli::evCellHeader

evCellHeader Class Reference

Cell Header bitfields. More...

Inheritance diagram for evCellHeader:

[legend]
List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Cell Header bitfields.

Bit Fields:

  • respond
  • destination
  • protocol
  • source
  • parity

Definition at line 577 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evContPacket Class Reference

gEvtCli::evContPacket

evContPacket Class Reference

Contribution Packet bitfields. More...

Inheritance diagram for evContPacket:

[legend]
List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Contribution Packet bitfields.

Bit Fields:

  • error
  • sequence
  • length

Definition at line 292 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evDiag_CalLayer Class Reference

gEvtCli::evDiag_CalLayer

evDiag_CalLayer Class Reference

Calorimeter Layer class. More...

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Calorimeter Layer class.

Members:

  • gccc
  • layer
  • negLayerEnd
  • posLayerEnd

Definition at line 433 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evDiag_CalLayerEnd Class Reference

gEvtCli::evDiag_CalLayerEnd

evDiag_CalLayerEnd Class Reference

Calorimeter Layer End bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Calorimeter Layer End bitfields.

Bit Fields:

  • trgRequestHigh
  • trgRequestLow
  • logAccepts

Definition at line 418 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evDiag_Data Class Reference

gEvtCli::evDiag_Data

evDiag_Data Class Reference

Diagnostic Data class. More...

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Diagnostic Data class.

Members:

  • cal
  • tkr

Definition at line 561 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evDiag_TkrTrgReq Class Reference

gEvtCli::evDiag_TkrTrgReq

evDiag_TkrTrgReq Class Reference

TKR Trigger Request bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

TKR Trigger Request bitfields.

Members:

  • gtcc

Bit Fields:

  • trgRequests

Definition at line 448 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_CablePhase Class Reference

gEvtCli::evErr_CablePhase

evErr_CablePhase Class Reference

Cable Controller Phasing Error bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Cable Controller Phasing Error bitfields.

Bit Fields:

  • tag7
  • tag6
  • tag5
  • tag4
  • tag3
  • tag2
  • tag1
  • tag0

Definition at line 501 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_CableTimeOut Class Reference

gEvtCli::evErr_CableTimeOut

evErr_CableTimeOut Class Reference

Cable Timeout Error bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Cable Timeout Error bitfields.

Bit Fields:

  • tkr
  • cal

Definition at line 548 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_GCCC Class Reference

gEvtCli::evErr_GCCC

evErr_GCCC Class Reference

GCCC Error bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

GCCC Error bitfields.

Bit Fields:

  • errParm
  • sweepNum
  • errType

Definition at line 463 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_GCCC_Message Class Reference

gEvtCli::evErr_GCCC_Message

evErr_GCCC_Message Class Reference

GCCC Error Message object. More...

List of all members.

Public Member Functions

__init__ (gccc, errGCCC)
evErr_GCCC_Message constructor

Detailed Description

GCCC Error Message object.

Members:

  • gccc
  • errGCCC

Definition at line 476 of file gEvtCli.py.

Member Function Documentation

__init__ | ( | gccc | ,
 |  | errGCCC |
 | ) |

evErr_GCCC_Message constructor

Parameters:
gccc | GCCC id
errGCCC | evErr_GCCC object instance

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_GTCC Class Reference

gEvtCli::evErr_GTCC

evErr_GTCC Class Reference

GTCC Error bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

GTCC Error bitfields.

Bit Fields:

  • dataParity
  • GTRCsum
  • wrdCntParity
  • hdrParity
  • cblTimeOut
  • fifoFull
  • phsGTFE
  • phsGTRC
  • nGTRC

Definition at line 521 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_GTCC_Message Class Reference

gEvtCli::evErr_GTCC_Message

evErr_GTCC_Message Class Reference

GTCC Error Message object. More...

List of all members.

Public Member Functions

__init__ ()

Detailed Description

GTCC Error Message object.

Members:

  • gtcc
  • errGTCC
  • parameters

Definition at line 535 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evErr_Summary Class Reference

gEvtCli::evErr_Summary

evErr_Summary Class Reference

Error summary bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Error summary bitfields.

Bit Fields:

  • cblTimeOut
  • cblPhsErr
  • gtccErr
  • gcccErr

Definition at line 251 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evGEM_Veto_List Class Reference

gEvtCli::evGEM_Veto_List

evGEM_Veto_List Class Reference

GEM Veto List object. More...

List of all members.

Public Member Functions

__init__ ()
clear ()

Detailed Description

GEM Veto List object.

Members:

  • XZP
  • XZM
  • YZP
  • YZM
  • XY
  • NA
  • RBN

Definition at line 148 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evSummary Class Reference

gEvtCli::evSummary

evSummary Class Reference

Event summary bitfields. More...

Inheritance diagram for evSummary:

[legend]
List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

Event summary bitfields.

Bit Fields:

  • startbit
  • calStrobe
  • tag
  • TACK
  • readout4
  • zeroSuppress
  • marker
  • error
  • diag
  • evNumber
  • trgParityErr

Definition at line 273 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Evt Class Reference

gEvtCli::Evt

Evt Class Reference

Event object. More...

List of all members.

Public Member Functions

__init__ ()
Event object constructor.
clearEvent ()
Clear the event data.
addTKRstrip (cc, rc, strip)
Add a stripData to the tracker strip hit list of evTKR_StripData objects.
addTKRaccept (accept)
Add a TKR accept to the list.
addTKRtot (cc, rc, tot)
Add a TKR tot to the list of evTKR_TOTdata objects.
addCAL_LogAccept (accept)
Add a log accept to the list.
addCAL_LogData (twr, layer, data)
Add a log data to the list.
addErrGCCCmsg (errGCCC)
Add a GCCC error contribution to the event object.
addErrGTCCmsg (errGTCCmsg)
Add a GTCC error message to the event object.

Detailed Description

Event object.

Members:

  • aem
  • gem
  • contributor
  • summary
  • TKRstrips
  • TKRaccepts
  • TKRtots
  • CAL_LogAccepts
  • CAL_LogData
  • diag
  • errSummary
  • errGCCCmsg
  • errGTCCmsg
  • errCablePhase
  • errCableTimeOut

Definition at line 175 of file gEvtCli.py.

Member Function Documentation

__init__ ( )

Event object constructor.

Instantiate the AEM object and clear the event.

addCAL_LogAccept ( accept )

Add a log accept to the list.

Parameters:
accept An evCAL_LogAccepts object instance

addCAL_LogData | ( | twr | ,
 |  | layer | ,
 |  | data |
 | ) |

Add a log data to the list.

Parameters:
layer | A layer id in the form of 'x1', 'y1', etc.
data | An evCAL_LogData object instance

addErrGCCCmsg ( errGCCC )

Add a GCCC error contribution to the event object.

Parameters:
errGCCC An evErr_GCCC object instance

addErrGTCCmsg ( errGTCCmsg )

Add a GTCC error message to the event object.

Parameters:
errGTCCmsg An evErr_GTCC_Message object instance

addTKRaccept ( accept )

Add a TKR accept to the list.

Parameters:
9-bit TKR accept value

addTKRstrip | ( | cc | ,
 |  | rc | ,
 |  | strip |
 | ) |

Add a stripData to the tracker strip hit list of evTKR_StripData objects.

Parameters:
cc | Cable controller id
rc | Readout controller id
strip | evTKR_Strip object instance

addTKRtot | ( | cc | ,
 |  | rc | ,
 |  | tot |
 | ) |

Add a TKR tot to the list of evTKR_TOTdata objects.

Parameters:
cc | Cable controller id
rc | Readout controller id
tot | 8-bit tot value

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: EvtCli Class Reference

gEvtCli::EvtCli

EvtCli Class Reference

Event handler client. More...

Inheritance diagram for EvtCli:

[legend]
Collaboration diagram for EvtCli:

[legend]
List of all members.

Public Member Functions

__init__ (debug=0)
Event client constructor.
setDebug (debug)
Set the debug mode.
readEvent (dat=None)
Read an event.
getGGLTStatus ()
Retrieve the GGLT status.
getGGLTStatusStr ()
Return the string equivalent of the GGLT status code.
getOnlineStatus ()
Retrieve the Online status code.
getEvtStatus ()
Return the event status from the event header.
getContributionStatus ()
Return the contribution status.
getContributionStatusStr ()
Return the contribution status string.
getOnlineStatusStr ()
Retrieve the string equivalent of the Online status code.
getEvtSize ()
Return the event size.
isErrorEvent ()
isSweepEvent ()
Determine if a sweep event is received.
isGGLTStatus (status=None)
Determine if the current event is bad.
checkOnlineStatus (status, mask)
Checks if the bit mask mask matches the status that is assumed as an Online status.
checkGGLTstatus (status, mask)
Checks if the bit mask mask matches the status that is assumed as a GGLT status.
readEventSocket ()
setCurrentContribution (contributionId)
Given a contribution id, set the current contribution data needed for the parsing routines.
getCurrentContribution ()
Return the integer id of the current contribution.
getContributionList ()
Walk through the whole event and construct a list of contribution id strings.
dumpContributionData ()
Prints out information pertaining to the current contribution.
evGetTimestamp ()
Return the timestamp of the event in seconds.
evGetTimebase ()
Return the timestamp of the event derived from the PPC timebase register.
getUserId ()
Return the user id passed to the event client.
evGetTKR_Accepts (pAccept)
Walks tower event contribution to the TKR accepts data.
evGetCAL_NumAccepts ()
Counts the number of hit calorimeter logs in the tower event contribution.
evDumpGEM ()
Parses the GEM contribution by populating the data in self.evt.gem.
evDumpGEM_Veto_List (offset)
Parses the Veto List block of the GEM contribution.
getWord (wordOffset)
Unpack and return a 16-bit word value located at wordOffset.
getDWord (dWordOffset)
Unpack and return a 32-bit word value located at dWordOffset.
getByte (byteOffset)
Unpack and return an 8-bit byte value located at byteOffset.
evGetCAL_Logs ()
Walks tower event contribution to the CAL log data.
evGetCAL_LogAccepts ()
Walks the tower event contribution to the calorimeter log accepts word.
evDumpCAL_LogAccepts ()
Decodes the log accepts word and stores it in evt.CAL_LogAccepts.
evDumpCAL_Logs ()
Decodes all the log data for the event and stores it in evt.CAL_LogData.
evGetSummary ()
Return the offset to the summary word of the current contribution.
evGetTKR_StripN (pAccepts, stripN, stripData=None)
Fetches a 12-bit strip word from pAccepts, indexed by stripN.
evDumpTKR ()
Decodes all the TKR event data and stores it in the event object.
evBitCount (x)
Count the number of set bits in x.
evGetTKR_NumStrips ()
evGetTKR_TOT ()
Returns pointer to start of tracker TOT list.
evGetTKR_NumAccepts ()
Counts the number of accepted TKR layer-ends.
evGetTEM_Diagnostic ()
Returns pointer to start of diagnostic event data.
evGetTEM_Error ()
Returns pointer to the error word contribution of event data.
evDumpTEM_Error (forcePrint=0)
Decodes the event error contribution.
evDumpDiagnostic ()
Decodes the event diagnostic contribution.
evDumpSummary (minEvSize=24)
Decodes the event summary word.
evDumpAEM_Vetos ()
Decodes the AEM veto hit list contribution.
evDumpAEM_Accepts ()
Decodes the AEM accept list contribution.
evGetAEM_PHA (cbl)
Returns pointer to start of AEM PHA values.
evGetAEM_Vec (cbl, type)
Returns the 18-bit vector for cable specified by cbl and type.
evDumpAEM_PHA ()
Decodes the AEM PHA contribution.
evDumpEventAEM_G2 ()
Given a pointer to AEM event contribution print its contents.
evDumpEventAEM ()
The new AEM event parsing routine.
print_EOE_Warning ()
Print warning if we have reached the end of the contribution prematurely.

Detailed Description

Event handler client.

Contents:

Receives an event from TCP socket or a file stream and parses it into the evt object.

Overview:

The event client is responsible for communicating with the event server and retrieve events triggered by a script or an external source. The source of the event can be either a TCP socket or an archive file.

The event client uses lazy parsing to parse the event. This means the user application needs to call the parsing routines that corresponds to the section of the event that the user is interested in. The parser methods populate event objects inside the Evt class in the event client, so after the parser method is called these objects can be accessed or iterated over. The parser methods only apply to the current contribution. By default after readEvent() the first contribution after the GEM contribution is the current contribution. Use the setCurrentContribution method to change the current contribution. Use the getContributionList method to find out which contributions exist in the event.

Available parser methods:

  • evDumpSummary()
  • evDumpCAL_LogAccepts()
  • evDumpCAL_Logs()
  • evDumpTKR()
  • evDumpDiagnostic()
  • evDumpTEM_Error()
  • evDumpEventAEM()

Contribution related methods:

  • getContributionList()
  • getCurrentContribution()
  • setCurrentContribution()
  • dumpContributionData()

Retrieving the timestamp and timebase:

  • evGetTimestamp()
  • evGetTimebase()

Usage:

For reading events from a socket:

    from gEvtCli import *
    ec = EvtCli(debug=0)
    ec.connect('gitot')
    while ec.readEvent() == 0:
      ec.setCurrentContribution(...)
      if ec.getContributionStatus() == 0:
        ec.evDumpXXX()
        :
      else:
        print "Error %s in contribution %s ",
          (ec.getContributionStatusStr(), cId)
    ec.disconnect()
For reading events from an archived event file:
    from gEvtCli import *
    ec = EvtCli(debug=0)
    ec.open('030305165528.ldf')
    while ec.readEvent() == 0:
      ec.setCurrentContribution(...)
      if ec.getContributionStatus() == 0:
        ec.evDumpXXX()
        :
      else:
        print "Error %s in contribution %s ",
          (ec.getContributionStatusStr(), cId)
    ec.close()
For looping over contributions:
    from gEvtCli import *
    ec = EvtCli(debug=0)
    ec.connect('gitot')
    status = ec.readEvent()
    contList = ec.getContributionList()
    for cId in contList:
      ec.setCurrentContribution(cId)
      if ec.getContributionStatus() == 0:
        ec.evDumpSummary()
        if cId.startswith('TEM'):
          ec.evDumpCAL_LogAccepts()
          ec.evDumpCAL_Logs()
          ec.evDumpTKR()
          ec.evDumpTEM_Error()
          ec.evDumpDiagnostic()
        elif cId == 'AEM':
          ec.evDumpEventAEM()
      else:
        print "Error %s in contribution %s ",
          (ec.getContributionStatusStr(), cId)

Definition at line 770 of file gEvtCli.py.

Member Function Documentation

__init__ ( debug = 0 )

Event client constructor.

Parameters:
debug Debug mode (0=Debug, 1=No debug)

Reimplemented from EvtCliIO.

checkGGLTstatus | ( | status | ,
 |  | mask |
 | ) |

Checks if the bit mask mask matches the status that is assumed as a GGLT status.

Parameters:
status | The status word to be checked against
mask | The mask bit(s) to be checked
Returns:
1 if there is a match 0 if there is no match

checkOnlineStatus | ( | status | ,
 |  | mask |
 | ) |

Checks if the bit mask mask matches the status that is assumed as an Online status.

Parameters:
status | The status word to be checked against
mask | The mask bit(s) to be checked
Returns:
1 if there is a match 0 if there is no match

evBitCount ( x )

Count the number of set bits in x.

Parameters:
x 32-bit word value
Returns:
Set bit count

evDumpAEM_Accepts ( )

Decodes the AEM accept list contribution.

This method is used by the old AEM event parser evDumpEventAEM_G2

evDumpAEM_PHA ( )

Decodes the AEM PHA contribution.

This method is used by the old AEM event parser evDumpEventAEM_G2

Given a pointer to AEM event contribution print the PHA values.

evDumpAEM_Vetos ( )

Decodes the AEM veto hit list contribution.

This method is used by the old AEM event parser evDumpEventAEM_G2

evDumpEventAEM ( )

The new AEM event parsing routine.

This parser works according to the latest specs where not all cable contributions are guaranteed to be provided.

evDumpEventAEM_G2 ( )

Given a pointer to AEM event contribution print its contents.

This method is the old G2 compatible AEM event parser, please use the new event parser evDumpEventAEM for G3 based AEM events.

evDumpGEM ( )

Parses the GEM contribution by populating the data in self.evt.gem.

Requires calling evtCli.setCurrentContribution(EvtCli.GEM) before usage.

evDumpGEM_Veto_List ( offset )

Parses the Veto List block of the GEM contribution.

Used by evDumpGEM

Parameters:
offset 32-bit word offset to the veto list block

evDumpSummary ( minEvSize = 24 )

Decodes the event summary word.

Given a pointer to tower event contribution print the event summary word.

Parameters:
minEvSize Minimum event size w/o error (default=24)

evDumpTEM_Error ( forcePrint = 0 )

Decodes the event error contribution.

If an error contribution is present this prints up to 20 16-bit words of the error contribution.

Parameters:
forcePrint If specified, dump the error even if in non-debug mode

evGetAEM_PHA ( cbl )

Returns pointer to start of AEM PHA values.

This method is used by the old AEM event parser evDumpEventAEM_G2

Parameters:
cbl Which cable is being decoded

evGetAEM_Vec | ( | cbl | ,
 |  | type |
 | ) |

Returns the 18-bit vector for cable specified by cbl and type.

This method is used by the old AEM event parser evDumpEventAEM_G2

Parameters:
cbl | Which cable is being decoded
type | ACD vector type
Returns:
18-bit vector

evGetCAL_LogAccepts ( )

Walks the tower event contribution to the calorimeter log accepts word.

Given a pointer to an entire TEM event contribution walk the data structure returning a pointer to the calorimeter log accepts word.

The 32-bit calorimeter log accepts word is immediately after the event summary word, i.e. the 2nd 32-bit word in the data.

Returns:
Offset to the calorimeter log accepts word.

evGetCAL_Logs ( )

Walks tower event contribution to the CAL log data.

Given a pointer to an entire TEM event contribution walk the data structure to the beginning of the calorimeter log data.

Returns:
Offset to the beginning of the calorimeter log data

evGetCAL_NumAccepts ( )

Counts the number of hit calorimeter logs in the tower event contribution.

Given a pointer to an entire TEM event contribution walk the data structure to the calorimeter log accepts word and return the sum of the number of hit logs.

Returns:
Number of hit logs

evGetSummary ( )

Return the offset to the summary word of the current contribution.

In a contribution, first word after the header is the summary word

Returns:
Offset to the summary word of the current contribution

evGetTEM_Diagnostic ( )

Returns pointer to start of diagnostic event data.

Caller should check the event summary word if a diagnostic contribution is present before calling this function.

Returns:
Offset to start of diagnostic event data

evGetTEM_Error ( )

Returns pointer to the error word contribution of event data.

Caller should check the event summary word if an error contribution is present before calling this function.

Returns:
Offset to the error word contribution

evGetTimebase ( )

Return the timestamp of the event derived from the PPC timebase register.

This is a 64 bit value that increments at an SBC implementation dependant rate (60 nS on MVME2306s). The value is reset at PPC reset time.

Returns:
Timestamp of the event in PPC timebase ticks.

evGetTimestamp ( )

Return the timestamp of the event in seconds.

The resolution of this timestamp is 1/60th of a second, by default. Consult VxWorks documentation for sysClkRateSet() and clock_setres() to see how to change this default. Beware that increasing the resolution from the default may cause adverse effects due to the increased interrupt rate generated.

Returns:
Timestamp of the event in seconds.

evGetTKR_Accepts ( pAccept )

Walks tower event contribution to the TKR accepts data.

Fills in the evGetTKR_Accepts structure pointed to by pAccept with the TKR accepts data. Also returns a pointer to the TKR accepts information.

Parameters:
pAccept Array to be filled with TKR accepts data
Returns:
Offset to the start of TKR accepts data

evGetTKR_NumAccepts ( )

Counts the number of accepted TKR layer-ends.

Returns:
Number of accepted TKR layer-ends.

evGetTKR_NumStrips ( )

Returns number of hit strips in the event

Returns:
Number of hit strips

evGetTKR_StripN | ( | pAccepts | ,
 |  | stripN | ,
 |  | stripData | = None
 | ) |

Fetches a 12-bit strip word from pAccepts, indexed by stripN.

pAccepts points to the top of the accepts data ... the strip data starts 72 bits ( 8 * 9 ) from the beginning of accepts. I.e. it starts 8 bits into the 3rd 32-bit word.

Parameters:
pAccepts | Pointer to 32-bit aligned tracker event data
stripN | The index of the 12-bit strip to fetch from pAccepts
stripData | Optional argument, if passed, avoid creating the object
Returns:
An evTKR_Strip object instance.

evGetTKR_TOT ( )

Returns pointer to start of tracker TOT list.

Returns:
Offset to the tracker TOT list

getByte ( byteOffset )

Unpack and return an 8-bit byte value located at byteOffset.

Parameters:
byteOffset Pointer to data
Returns:
8-bit byte value

getContributionList ( )

Walk through the whole event and construct a list of contribution id strings.

Returns:
A list of contributors that have contributed to the current event

getContributionStatus ( )

Return the contribution status.

Returns:
Contribution status

getContributionStatusStr ( )

Return the contribution status string.

Returns:
Contribution status string

getCurrentContribution ( )

Return the integer id of the current contribution.

Returns:
Current constribution id

getDWord ( dWordOffset )

Unpack and return a 32-bit word value located at dWordOffset.

Parameters:
dWordOffset Pointer to data
Returns:
32-bit word value

getEvtSize ( )

Return the event size.

Returns:
Event size

getGGLTStatus ( )

Retrieve the GGLT status.

If this status value is non zero then the event is considered "bad"

getOnlineStatus ( )

Retrieve the Online status code.

See getOnlineStatusStr method for a list of possible errors

getOnlineStatusStr ( )

Retrieve the string equivalent of the Online status code.

The error can be one of the following:

GGLT_STATUS_ERROR : A bad event was received. Call getGGLTStatusStr method for the description. MINIMAL_SIZE_ERROR : The event size was below the acceptable size. EOE_ERROR : End of event was reached before the parse completed. UNPACK_ERROR : There was an error while unpacking part of the event for parsing. IO_ERROR : An I/O error occurred while retrieving the event (socket or file). EVENT_VERSION_MISMATCH: An event with an old or unsupported format was received. PLAYBACK_ERROR : End of file was received while playing back an event archive file. READ_TIMEOUT_ERROR : A read timeout occurred while waiting for the event to be retrieved (Set by rcTransitions). EOF_ERROR : End of file is reached while reading the event file.

Returns:
Online status string

getUserId ( )

Return the user id passed to the event client.

Returns:
Current user id

getWord ( wordOffset )

Unpack and return a 16-bit word value located at wordOffset.

Parameters:
wordOffset Pointer to data
Returns:
16-bit word value

isErrorEvent ( )

Determines whether at least one contribution has the error bit set in its summary word.

Returns:
1: If at least one contribution has an error. 0: Otherwise

isGGLTStatus ( status = None )

Determine if the current event is bad.

User script can call this method in process() to determine if the current event is a bad event (gglt_status != 0).

Parameters:
Optional status value
Returns:
0: Not a bad event. 1: A bad event.

isSweepEvent ( )

Determine if a sweep event is received.

User script can call this method in process() to determine if the current event is a sweep event. A try block around the call should be used in case a bad event is received.

Returns:
0: Not a sweep event. 1: A sweep event.

readEvent ( dat = None )

Read an event.

Reads one event from an archive file or socket

Parameters:
dat If not None then interpret this data as event instead
Returns:
gglt_status

setCurrentContribution ( contributionId )

Given a contribution id, set the current contribution data needed for the parsing routines.

Parameters:
contributionId Integer contribution id
Returns:
The offset to the contribution requested. -1 If the contribution requested is not found or contribution offset was found to be larger than the event size Note: Use getContributionStatus() method after calling this routine to find out if the contribution has an error.

setDebug ( debug )

Set the debug mode.

Parameters:
debug Debug mode The following debug modes are available and can be added together for combinations: 0: No Debug 1: Debug All 2: Event Dump 4: Warnings 8: Parser Output 16: Error Output

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: EvtCliIO Class Reference

gEvtCli::EvtCliIO

EvtCliIO Class Reference

Event client input/output class. More...

Inheritance diagram for EvtCliIO:

[legend]
List of all members.

Public Member Functions

__init__ (debug)
connect (host)
setSocket (sock)
readSocket ()
The 'lightweight' event read routine.
setEventMode (mode)
setUserParm (parm)
readFile ()
Read the event from a file.
open (filename)
Open the event archive file for input.
close ()
Close the event source file.
abort ()
Abort out of a readEvent().
setTimeoutEnabled (flag)
Enable or disable event timeout.
isTimeoutEnabled ()
Checks the event timeout state.
setTimeout (timeout=1.0)
Set the timeout value.
getTimeout ()
Query the current timeout value.
unpack (fmt, str)
Wrapper method for unpack.

Detailed Description

Event client input/output class.

Contents:

This base class contains all the input/output handling routines for the event client (EvtCli) class.

Definition at line 595 of file gEvtCli.py.

Member Function Documentation

abort ( )

Abort out of a readEvent().

Can be used from another thread

getTimeout ( )

Query the current timeout value.

Returns:
Current event timeout value as a floating point number in seconds

isTimeoutEnabled ( )

Checks the event timeout state.

Returns:
1 = If event timeout is enabled 0 = If event timeout is disabled

open ( filename )

Open the event archive file for input.

Parameters:
filename Event archive file name

readSocket ( )

The 'lightweight' event read routine.

This routine does the minimal work of reading the raw event data from a file or a socket.

Returns:
Event buffer read

setTimeout ( timeout = 1.0 )

Set the timeout value.

Parameters:
timeout Event timeout value as a floating point number in seconds. Default is 1 second. Use 'None' to disable the timeout.

setTimeoutEnabled ( flag )

Enable or disable event timeout.

Parameters:
flag 1 = Enable event timeout 0 = Disable event timeout (default)

unpack | ( | fmt | ,
 |  | str |
 | ) |

Wrapper method for unpack.

Parameters:
fmt | Unpack format
str | String to be unpacked
Returns:
Unpacked data tuple

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evTKR_Strip Class Reference

gEvtCli::evTKR_Strip

evTKR_Strip Class Reference

TKR strip bitfields. More...

List of all members.

Public Member Functions

__init__ (ui)

Detailed Description

TKR strip bitfields.

Bit Fields:

  • done
  • gtfe
  • strip

Definition at line 333 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evTKR_StripData Class Reference

gEvtCli::evTKR_StripData

evTKR_StripData Class Reference

TKR StripData class. More...

List of all members.

Public Member Functions

__init__ (cc, rc, strip)
evTKR_StripData constructor

Detailed Description

TKR StripData class.

Members:

  • cc
  • rc
  • strip

Definition at line 347 of file gEvtCli.py.

Member Function Documentation

__init__ | ( | cc | ,
 |  | rc | ,
 |  | strip |
 | ) |

evTKR_StripData constructor

Parameters:
cc | Cable controller id
rc | Readout controller id
strip | An evTKR_Strip object instance

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evTKR_TOTdata Class Reference

gEvtCli::evTKR_TOTdata

evTKR_TOTdata Class Reference

TKR TOT data class. More...

List of all members.

Public Member Functions

__init__ (cc, rc, tot)
evTKR_TOTdata constructor

Detailed Description

TKR TOT data class.

Members:

  • tot
  • cc
  • rc

Definition at line 311 of file gEvtCli.py.

Member Function Documentation

__init__ | ( | cc | ,
 |  | rc | ,
 |  | tot |
 | ) |

evTKR_TOTdata constructor

Parameters:
cc | Cable controller id
rc | Readout controller id
tot | 8-bit TOT value

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ExceptionFSM Class Reference

FSM::ExceptionFSM

ExceptionFSM Class Reference

List of all members.

Public Member Functions

__init__ (value)
__str__ ()

Detailed Description

This is the FSM Exception class.

Definition at line 70 of file FSM.py.

The documentation for this class was generated from the following file:
  • FSM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FSM Class Reference

FSM::FSM

FSM Class Reference

Inheritance diagram for FSM:

[legend]
List of all members.

Public Member Functions

__init__ (initial_state, something)
reset ()
add_transition (input_symbol, state, action, next_state)
add_transition_list (list_input_symbols, state, action, next_state)
add_transition_any (state, action, next_state)
set_default_transition (action, next_state)
get_transition (input_symbol, state)
process (input_symbol)
process_list (s)

Detailed Description

This is a Finite State Machine (FSM).

Definition at line 79 of file FSM.py.

Member Function Documentation

__init__ | ( | initial_state | ,
 |  | something |
 | ) |

This creates the FSM. You set the initial state here. The "something" attribute is any object that you want to pass along to the action functions. It is not used by the FSM. For parsing you would typically pass a list to be used as a stack.

add_transition | ( | input_symbol | ,
 |  | state | ,
 |  | action | ,
 |  | next_state |
 | ) |

This adds a transition that associates (input_symbol, current_state) --> (action, next_state) The action may be set to None in which case the process() method will ignore the action and only set the next_state.

You can also set transitions for a list of symbols by using add_transition_list().

add_transition_any | ( | state | ,
 |  | action | ,
 |  | next_state |
 | ) |

This adds a transition that associates (current_state) --> (action, next_state) The process() method checks these associations if it cannot first find a match of an (input_symbol, current_state).

add_transition_list | ( | list_input_symbols | ,
 |  | state | ,
 |  | action | ,
 |  | next_state |
 | ) |

This adds the same transition for lots of different input symbols. You can pass a list or a string. Note that it is handy to use string.digits, string.whitespace, string.letters, etc. to add transitions that match character classes.

get_transition | ( | input_symbol | ,
 |  | state |
 | ) |

This returns (action, next state) given an input_symbol and state. This leaves the FSM unchanged. This does not update the current state nor does it trigger the output action. Normally you do not call this method. It is called by process().

The sequence of steps to check for a defined transition goes from the most specific to the least specific. 1. Check state_transitions[] that match (input_symbol, state) 2. Check state_transitions_any[] that match (state) In other words, match a specific state and ANY input_symbol. 3. Check if the default_transition is defined. This catches any input_symbol and any state. This is a handler for errors, undefined states, or defaults. 4. No transition was defined. If we get here then raise an exception.

process ( input_symbol )

This is the main method that you call to process input. This may cause the FSM to change state and call an action. This method calls get_transition() to find the action and next_state associated with the input_symbol and current_state. If the action is None then the action is not called and only the current state is changed. This method processes one input symbol. You can process a list of symbols (or a string) by calling process_list(). This method returns an uninterpreted status value used to indicate whether the state transition completed successfully.

process_list ( s )

This takes a list and sends each element to process(). The list may be a string.

reset ( )

This sets the current_state to the initial_state and sets input_symbol to None. The initial state was set by the constructor __init__().

set_default_transition | ( | action | ,
 |  | next_state |
 | ) |

This sets the default transition. This defines an action and next_state if the FSM cannot find the input symbol and the current state in the transition list and if the FSM cannot find the current_state in the transition_any list. This is useful for catching errors and undefined states.

The default transition can be removed by setting the attribute default_transition to None.

The documentation for this class was generated from the following file:
  • FSM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FullCondition Class Reference

testAppAcdScalers::FullCondition

FullCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()
calLow ()
tkr ()
cno ()

Detailed Description

Define a condition where only the solicited trigger is asserted

Definition at line 216 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GAEM Class Reference

gAEM::GAEM

GAEM Class Reference

ACD Common Controller. More...

Inheritance diagram for GAEM:

[legend]
Collaboration diagram for GAEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downARC (arcId)
Navigate to the GARC indicated by childId.
allARC ()
Navigate to the broadcast GARC.
existsARC (arcId)
Check if the GARC instance with the id arcId exists in the schema.
downAEQ ()
Navigate to the GAEQ.
existsAEQ ()
Check if the GAEQ instance exists in the schema.

Detailed Description

ACD Common Controller.

Has GAEM specific registers and dataless commands.

Valid Registers:

  • configuration
  • common_status
  • freeboard_status
  • command_response
  • trgseq
  • power_status
  • address
  • timeout
  • relocation
  • response_timeout
  • power_up
  • power_down

Dataless Commands:

  • cmd_reset

Definition at line 30 of file gAEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allARC ( )

Navigate to the broadcast GARC.

Returns:
The broadcast GARC object instance

downAEQ ( )

Navigate to the GAEQ.

Returns:
The GAEQ object instance

downARC ( arcId )

Navigate to the GARC indicated by childId.

Parameters:
childId The id of the child GARC
Returns:
A GARC object instance

existsAEQ ( )

Check if the GAEQ instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsARC ( arcId )

Check if the GARC instance with the id arcId exists in the schema.

Parameters:
arcId ACD readout controller id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gAEM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GAEQ Class Reference

gAEM::GAEQ

GAEQ Class Reference

ACD Environmental Monitors. More...

Inheritance diagram for GAEQ:

[legend]
Collaboration diagram for GAEQ:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

ACD Environmental Monitors.

Has GAEQ specific registers and dataless commands.

Valid Registers:

  • env_free_1la
  • env_free_1rb
  • env_free_2la
  • env_free_2lb
  • env_free_2ra
  • env_free_2rb
  • env_free_3la
  • env_free_3rb
  • env_free_4la
  • env_free_4lb
  • env_free_4ra
  • env_free_4rb
  • env_daq

Pseudo registers:

  • env_vdd_xxx
  • env_temp_xxx
  • env_hv1_xxx
  • env_hv2_xxx
  • env_dac_digital_3_3i
  • env_dac_temp
  • env_dac_hv_i
  • env_dac_v

Definition at line 114 of file gAEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

The documentation for this class was generated from the following file:
  • gAEM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GAFE Class Reference

gAEM::GAFE

GAFE Class Reference

ACD Front-End Controller. More...

Inheritance diagram for GAFE:

[legend]
Collaboration diagram for GAFE:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

ACD Front-End Controller.

Has GAFE specific registers and dataless commands.

Valid Registers:

  • configuration
  • veto_dac
  • hld_dac
  • veto_vernier
  • bias_dac
  • tci_dac
  • vers_addr
  • write_ctr
  • reject_ctr
  • loop_ctr
  • chip_addr

Deprecated:
  • lld_dac Use 'veto_vernier' instead

Definition at line 261 of file gAEM.py.

The documentation for this class was generated from the following file:
  • gAEM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GARC Class Reference

gAEM::GARC

GARC Class Reference

ACD Readout Controller. More...

Inheritance diagram for GARC:

[legend]
Collaboration diagram for GARC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downAFE (afeId)
Navigate to the GAFE indicated by childId.
allAFE ()
Navigate to the broadcast GAFE.
existsAFE (afeId)
Check if the GAFE instance with the id afeId exists in the schema.

Detailed Description

ACD Readout Controller.

Has GARC specific registers and dataless commands.

Valid Registers:

  • function block 0
    • veto_delay
    • hvbs
    • saa
    • use_hv_normal
    • use_hv_saa
    • hold_delay
    • veto_width
    • hitmap_width
    • hitmap_deadtime
  • function block 1
    • look_at_me
    • hitmap_delay
    • pha_en_0
    • veto_en_0
    • hld_en_0
    • pha_en_1
    • veto_en_1
    • hld_en_1
    • max_pha
  • function block 2
    • mode
    • status
    • last_cmd
    • diagnostic
    • cmd_reject
    • free_id
    • garc_version
  • function block 3
    • pha_threshold_0
    • pha_threshold_1
    • pha_threshold_2
    • pha_threshold_3
    • pha_threshold_4
    • pha_threshold_5
    • pha_threshold_6
  • function block 4
    • pha_threshold_7
    • pha_threshold_8
    • pha_threshold_9
    • pha_threshold_10
    • pha_threshold_11
    • pha_threshold_12
    • pha_threshold_13
  • function block 5
    • pha_threshold_14
    • pha_threshold_15
    • pha_threshold_16
    • pha_threshold_17
    • adc_tacq

Deprecated:
  • rqst_hvbs Use 'hvbs' instead
  • rqst_hvsaa Use 'saa' instead
  • hvbs Use 'use_hv_normal' instead
  • hvsaa Use 'use_hv_saa' instead
Dataless Commands
  • cmd_reset
  • cmd_calstrobe
  • cmd_set_hvbs
  • cmd_set_hvsaa

Definition at line 200 of file gAEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allAFE ( )

Navigate to the broadcast GAFE.

Returns:
The broadcast GAFE object instance

downAFE ( afeId )

Navigate to the GAFE indicated by childId.

Parameters:
childId The id of the child GAFE
Returns:
A GAFE object instance

existsAFE ( afeId )

Check if the GAFE instance with the id afeId exists in the schema.

Parameters:
afeId ACD readout controller id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gAEM.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Gattr Class Reference

gAttr::Gattr

Gattr Class Reference

Base class which is instantiated once for each attribute kind. More...

Inheritance diagram for Gattr:

[legend]
List of all members.

Public Member Functions

__init__ (name, id, size, flags, rule=None, constraint=None, egu=None)
create (node)
set (node, value, bypass=0)
get (node, bypass=0)
getName ()
size ()
id ()
setRule (rule)
getRule ()
setConstraint (constraint)
setEGU (egu)
getEGU ()
getConstraint ()
flags ()
isReadOnly ()
isWriteOnly ()
isReadWrite ()
isNoDirectAccess ()
isCommand ()

Detailed Description

Base class which is instantiated once for each attribute kind.

Definition at line 26 of file gAttr.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | id | ,
 |  | size | ,
 |  | flags | ,
 |  | rule | = None,
 |  | constraint | = None,
 |  | egu | = None
 | ) |

Gattr constructor.

Parameters:
name | The name of the attribute.
size | Attribute size in bytes.
rule | Optional. Attribute rule.
constraint | Optional. Attribute constraint.
egu | Optional. Attribute EGU

getConstraint ( )

Method that returns the gConstraint.Gconstraint class for this gAttr

Returns:
A Gconstraint object instance

getEGU ( )

Method that returns the gEGU.GEGU class for this gAttr

Returns:
A Gegu object instance

getRule ( )

Retrieve the rule associated with the gAttr.

isNoDirectAccess ( )

Returns a boolean value indicating if the attribute is no direct access or not

Returns:
1=No Direct Access, 0=Not No Direct Access.

isReadOnly ( )

Returns a boolean value indicating if the attribute is read only or not

Returns:
1=Read Only, 0=Not Read Only.

isReadWrite ( )

Returns a boolean value indicating if the attribute is read write or not

Returns:
1=Read Write, 0=Not Read Write.

isWriteOnly ( )

Returns a boolean value indicating if the attribute is write only or not

Returns:
1=Write Only, 0=Not Write Only.

setConstraint ( constraint )

Method to attach a constraint to a gAttr after the gAttr has been constructed. This method will go away once constraints are loaded from a configuration file.

Parameters:
constraint A Gconstraint object instance

setEGU ( egu )

Method to attach a EGU to a gAttr after the gAttr has been constructed.

Parameters:
egu A Gegu object instance

setRule ( rule )

Method to attach a rule to a gAttr after the gAttr has been constructed.

Parameters:
rule A Grule object instance

size ( )

Method for returning the size of the attribute

Returns:
Attribute size in bytes

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GattrBF Class Reference

gAttr::GattrBF

GattrBF Class Reference

Bit field class which is instantiated for each bit field kind. More...

Inheritance diagram for GattrBF:

[legend]
Collaboration diagram for GattrBF:

[legend]
List of all members.

Public Member Functions

__init__ (name, regno, start, end, flags=ATTR_READ_WRITE)
set (node, val, bypass=0)
get (node, bypass=0)

Detailed Description

Bit field class which is instantiated for each bit field kind.

This class allows operation on bit fields of the form (end, start] in a register specified by the register number (regno).

N.B. This attribute operates on the raw value of the associated register

Definition at line 213 of file gAttr.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | regno | ,
 |  | start | ,
 |  | end | ,
 |  | flags | = ATTR_READ_WRITE
 | ) |

GattrBF constructor

Parameters:
name | The name of the bit field
regno | Register no. containing the bit field
start | Bit offset to start (inclusive) of the bit field
end | Bit offset to the end (exclusive) of the bit field
flags | Optional flags to govern access to the bit field

get | ( | node | ,
 |  | bypass | = 0
 | ) |

Method for getting the value of a bit field.

Parameters:
val | bit field value to be set
bypass | ignored

Reimplemented from Gattr.

set | ( | node | ,
 |  | val | ,
 |  | bypass | = 0
 | ) |

Method for setting the value of a bit field. Calls the functions in the base class for setting values.

Parameters:
val | bit field value to be set
bypass | ignored

Reimplemented from Gattr.

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GattrDlc Class Reference

gAttr::GattrDlc

GattrDlc Class Reference

Inheritance diagram for GattrDlc:

[legend]
Collaboration diagram for GattrDlc:

[legend]
List of all members.

Public Member Functions

__init__ (name, cmdNo, size=0, flags=ATTR_COMMAND)
set (node, args)

Detailed Description

Attribute class for implementing dataless commands

Definition at line 193 of file gAttr.py.

Member Function Documentation

set | ( | node | ,
 |  | args |
 | ) |

Method for invoking a dataless command. The value parameter is meaningless for this method and is only supplied to satisfy the function signature.

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GattrHsk Class Reference

gHdb::GattrHsk

GattrHsk Class Reference

Class which is instantiated for each housekeeping quantity. More...

Inheritance diagram for GattrHsk:

[legend]
Collaboration diagram for GattrHsk:

[legend]
List of all members.

Public Member Functions

__init__ (node, attr)
getNode ()
__init__ (name, id, rule=gAttr.Gattr.defaultRule, constraint=gAttr.Gattr.defaultConstraint, egu=gAttr.Gattr.defaultEgu)
create (node)
set (node, val, bypass=True)
get (node, raw, bypass=False)

Detailed Description

Class which is instantiated for each housekeeping quantity.

Definition at line 11 of file gHdb.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | id | ,
 |  | rule | = gAttr.Gattr.defaultRule,
 |  | constraint | = gAttr.Gattr.defaultConstraint,
 |  | egu | = gAttr.Gattr.defaultEgu
 | ) |

GattrHsk constructor

Parameters:
name | The name of the attribute.
id | Positional identifier.
rule | Optional. Attribute rule.
constraint | Optional. Attribute constraint.
egu | Optional. Attribute EGU

get | ( | node | ,
 |  | raw | ,
 |  | bypass | = False
 | ) |

Method for getting the value of an attribute. If bypass=0 (the default), the value will be returned in EU. If bypass=1, the raw value will be returned.

set | ( | node | ,
 |  | val | ,
 |  | bypass | = True
 | ) |

Method for setting the value of an attribute. Calls the functions in the attribute's node for setting values.

Parameters:
val | Register value to be set
bypass | Optional. Flag for bypassing EGU conversion Default is to *not* convert to EGU.

Reimplemented from Gattr.

The documentation for this class was generated from the following file:
  • gHdb.py
Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GattrRaw Class Reference

gAttr::GattrRaw

GattrRaw Class Reference

Class which is instantiated for each raw register kind. More...

Inheritance diagram for GattrRaw:

[legend]
Collaboration diagram for GattrRaw:

[legend]
List of all members.

Public Member Functions

__init__ (name, regno, size, flags=ATTR_READ_WRITE)
set (node, val, bypass=0)
get (node, bypass=0)

Detailed Description

Class which is instantiated for each raw register kind.

Definition at line 122 of file gAttr.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | regno | ,
 |  | size | ,
 |  | flags | = ATTR_READ_WRITE
 | ) |

GattrRaw constructor

Parameters:
name | The name of the register
regno | Register no.
size | Register size in bytes.

get | ( | node | ,
 |  | bypass | = 0
 | ) |

Method for getting the value of a register attribute. Calls the functions in the node class for getting values. If bypass=0 (the default), the value will be returned in EU. If bypass=1, the raw value will be returned.

Reimplemented from Gattr.

set | ( | node | ,
 |  | val | ,
 |  | bypass | = 0
 | ) |

Method for setting the value of a register attribute. Calls the functions in the base class for setting values.

Parameters:
val | Register value to be set
bypass | Optional. Flag for bypassing EGU conversion

Reimplemented from Gattr.

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GattrReg Class Reference

gAttr::GattrReg

GattrReg Class Reference

Class which is instantiated for each register. More...

Inheritance diagram for GattrReg:

[legend]
Collaboration diagram for GattrReg:

[legend]
List of all members.

Public Member Functions

__init__ (name, regno, size, flags=ATTR_READ_WRITE, rule=Gattr.defaultRule, constraint=Gattr.defaultConstraint, egu=Gattr.defaultEgu)
set (node, val, bypass=0)
get (node, bypass=0)

Detailed Description

Class which is instantiated for each register.

Definition at line 156 of file gAttr.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | regno | ,
 |  | size | ,
 |  | flags | = ATTR_READ_WRITE,
 |  | rule | = Gattr.defaultRule,
 |  | constraint | = Gattr.defaultConstraint,
 |  | egu | = Gattr.defaultEgu
 | ) |

GattrReg constructor

Parameters:
name | The name of the register
regno | Register no.
size | Register size in bytes.
rule | Optional. Register rule.
constraint | Optional. Register constraint.
egu | Optional. Register EGU

get | ( | node | ,
 |  | bypass | = 0
 | ) |

Method for getting the value of a register attribute. Calls the functions in the node class for getting values. If bypass=0 (the default), the value will be returned in EU. If bypass=1, the raw value will be returned.

Reimplemented from Gattr.

set | ( | node | ,
 |  | val | ,
 |  | bypass | = 0
 | ) |

Method for setting the value of a register attribute. Calls the functions in the base class for setting values.

Parameters:
val | Register value to be set
bypass | Optional. Flag for bypassing EGU conversion

Reimplemented from Gattr.

The documentation for this class was generated from the following file:
  • gAttr.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GCCC Class Reference

gTEM::GCCC

GCCC Class Reference

Calorimeter Cable Controller node Record. More...

Inheritance diagram for GCCC:

[legend]
Collaboration diagram for GCCC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downCRC (childId)
Navigate to the GCRC indicated by childId.
allCRC ()
Navigate to the broadcast GCRC.
existsCRC (crcId)
Check if the GCRC instance with the id crcId exists in the schema.

Detailed Description

Calorimeter Cable Controller node Record.

Has GCCC specific registers and dataless commands.

Valid Registers:

  • configuration
  • layer_mask_0
  • layer_mask_1
  • fifo_status
  • latched_status
  • event_timeouts
  • trg_alignment

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 135 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allCRC ( )

Navigate to the broadcast GCRC.

Returns:
The broadcast GCRC object instance

downCRC ( childId )

Navigate to the GCRC indicated by childId.

Parameters:
childId The id of the child GCRC
Returns:
A GCRC object instance

existsCRC ( crcId )

Check if the GCRC instance with the id crcId exists in the schema.

Parameters:
crcId Calorimeter readout controller id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GCFE Class Reference

gTEM::GCFE

GCFE Class Reference

Calorimeter Front End node Record. More...

Inheritance diagram for GCFE:

[legend]
Collaboration diagram for GCFE:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

Calorimeter Front End node Record.

Has GCFE specific registers and dataless commands.

Valid Registers:

  • config_0
  • config_1
  • fle_dac
  • fhe_dac
  • log_acpt
  • rng_uld_dac
  • ref_dac

Dataless Commands:

  • cmd_nop

Definition at line 252 of file gTEM.py.

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Gconstraint Class Reference

gConstraint::Gconstraint

Gconstraint Class Reference

Base class for describing constraints. More...

Inheritance diagram for Gconstraint:

[legend]
Collaboration diagram for Gconstraint:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous=False)
_eval_ (value)
evaluate (value)
name ()
subsystem ()
category ()
enabled ()
enable ()
disable ()
reset ()
reject (message)

Detailed Description

Base class for describing constraints.

Definition at line 27 of file gConstraint.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | subsystem | ,
 |  | category | ,
 |  | enabled | ,
 |  | continuous | = False
 | ) |

Constructor.

Parameters:
name | Constraint name
subsystem | Subsystem gGroup to which the constraint belongs
category | Category gGroup to which the constraint belongs
enabled | Flag indicating whether constraint is enabled
continuous | Flag indicating whether constraint can fire repeatedly

_eval_ ( value )

Dummy evaluation method to be overridden through inheritance to implement the application specific constraint evaluation

Reimplemented in GconstraintLimitRE, GconstraintLimit, and GconstraintLimitPegRE.

category ( )

Method for discovering this constraint's category

disable ( )

Method used to disable evaluation of this constraint

enable ( )

Method used to enable evaluation of this constraint

enabled ( )

Method for discovering whether this constraint is enabled

evaluate ( value )

This method is called to evaluate the constraint on 'value

Reimplemented from GconstraintBase.

name ( )

Method to retrieve the constraint's name

reject ( message )

Method optionally used by the constraint evaluation implementation to signal a constraint violation

reset ( )

Method used to reenable evaluation of this constraint in the case of noncontinuous mode after it has been violated

subsystem ( )

Method for discovering this constraint's subsystem

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GconstraintBase Class Reference

gConstraint::GconstraintBase

GconstraintBase Class Reference

Base constraint class for use when no constraint is appropriate. More...

Inheritance diagram for GconstraintBase:

[legend]
List of all members.

Public Member Functions

__init__ ()
evaluate (value)

Detailed Description

Base constraint class for use when no constraint is appropriate.

Definition at line 18 of file gConstraint.py.

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GconstraintLimit Class Reference

gConstraint::GconstraintLimit

GconstraintLimit Class Reference

Limit Constraint. More...

Inheritance diagram for GconstraintLimit:

[legend]
Collaboration diagram for GconstraintLimit:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous, low, high)
_eval_ (value)

Detailed Description

Limit Constraint.

Constraint class that limits a passed in value to given limits. If the value is outside of the constraint limits, it is pegged to the nearest limit.

Definition at line 92 of file gConstraint.py.

Member Function Documentation

_eval_ ( value )

Dummy evaluation method to be overridden through inheritance to implement the application specific constraint evaluation

Reimplemented from Gconstraint.

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GconstraintLimitPegRE Class Reference

gConstraint::GconstraintLimitPegRE

GconstraintLimitPegRE Class Reference

Pegged Limit Constraint. More...

Inheritance diagram for GconstraintLimitPegRE:

[legend]
Collaboration diagram for GconstraintLimitPegRE:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous, low, high)
_eval_ (value)

Detailed Description

Pegged Limit Constraint.

Constraint class that limits a passed in value to given limits. If the value is outside of the constraint limits, it raises an exception AND the value is pegged to the nearest limit.

Definition at line 106 of file gConstraint.py.

Member Function Documentation

_eval_ ( value )

Dummy evaluation method to be overridden through inheritance to implement the application specific constraint evaluation

Reimplemented from Gconstraint.

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GconstraintLimitRE Class Reference

gConstraint::GconstraintLimitRE

GconstraintLimitRE Class Reference

On Constraint Limit Raise Exception. More...

Inheritance diagram for GconstraintLimitRE:

[legend]
Collaboration diagram for GconstraintLimitRE:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous, low, high)
_eval_ (value)

Detailed Description

On Constraint Limit Raise Exception.

Constraint class that determines whether to raise an exception based on the passed in value being within given limits.

Definition at line 79 of file gConstraint.py.

Member Function Documentation

_eval_ ( value )

Dummy evaluation method to be overridden through inheritance to implement the application specific constraint evaluation

Reimplemented from Gconstraint.

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gConstraintViolation Class Reference

gConstraint::gConstraintViolation

gConstraintViolation Class Reference

Constraint Violation Class. More...

List of all members.

Public Member Functions

__init__ (args=None)

Detailed Description

Constraint Violation Class.

Exception class used in constraint classes

Definition at line 10 of file gConstraint.py.

The documentation for this class was generated from the following file:
  • gConstraint.py
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GCRC Class Reference

gTEM::GCRC

GCRC Class Reference

Calorimeter Readout Controller node Record. More...

Inheritance diagram for GCRC:

[legend]
Collaboration diagram for GCRC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downCFE (childId)
Navigate to the GCFE indicated by childId.
allCFE ()
Navigate to the broadcast GCFE.
existsCFE (cfeId)
Check if the GCFE instance with the id cfeId exists in the schema.

Detailed Description

Calorimeter Readout Controller node Record.

Has GCRC specific registers and dataless commands.

Valid Registers:

  • csr
  • last_cmd
  • delay_1
  • delay_2
  • delay_3
  • dac
  • config

Dataless Commands:

  • cmd_nop
  • cmd_reset
  • cmd_calstrobe ]

Definition at line 195 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allCFE ( )

Navigate to the broadcast GCFE.

Returns:
The broadcast GCFE object instance

downCFE ( childId )

Navigate to the GCFE indicated by childId.

Parameters:
childId The id of the child GCFE
Returns:
A GCFE object instance

existsCFE ( cfeId )

Check if the GCFE instance with the id cfeId exists in the schema.

Parameters:
cfeId Calorimeter front-end id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GCRU Class Reference

gCRU::GCRU

GCRU Class Reference

CRU node. More...

Inheritance diagram for GCRU:

[legend]
Collaboration diagram for GCRU:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

CRU node.

Has GCRU specific registers and dataless commands.

Valid Registers:

  • configuration
  • command_enable
  • response_enable
  • cr_statistics
  • acd_startup_clock
  • test_io

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 23 of file gCRU.py.

The documentation for this class was generated from the following file:
  • gCRU.py
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Gdb Class Reference

gDb::Gdb

Gdb Class Reference

Base class for all GLAST LAT functional blocks. More...

Inheritance diagram for Gdb:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id, valid_attrs=[], addr=None)
up ()
id ()
addr ()
root ()
getIdTuple ()
getName ()
getOpaque (name=None)
Retrieves the named opaque data included in the schema The opaque data needs to be associated with a node therefore this method only returns the opaque data that is associated with that node.
getSerialNos (component=None)
Retrieves the serial numbers associated with the node.

Detailed Description

Base class for all GLAST LAT functional blocks.

Uses __getattr__ and __setattr__ methods to feature an SCL like syntax for referencing attributes

Definition at line 12 of file gDb.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id | ,
 |  | valid_attrs | = [],
 |  | addr | = None
 | ) |

gNode constructor.

Parameters:
valid_regs A list of valid attribute names.

addr ( )

Return the hardware address of this component

getIdTuple ( )

Return the node id(s) in this node's hierarchy

Returns:
The root node

getOpaque ( name = None )

Retrieves the named opaque data included in the schema The opaque data needs to be associated with a node therefore this method only returns the opaque data that is associated with that node.

Parameters:
name Name of the opaque XML data (optional)
Returns:
A list of XML DOM objects matching name or if name is None a dictionary of a list of XML DOM objects

Reimplemented in GHSK.

getSerialNos ( component = None )

Retrieves the serial numbers associated with the node.

Parameters:
component Hardware component identifier (optional)
Returns:
A dictionary matching component or if component is None a dictionary of all components and their serial numbers

id ( )

Return the hardware id of this component

root ( )

Return the root node in this node's hierarchy

Returns:
The root node

up ( )

Return the parent of this component

The documentation for this class was generated from the following file:
  • gDb.py
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GDBN Class Reference

RunControlCommon::GDBN

GDBN Class Reference

Database node record. More...

List of all members.

Public Member Functions

__init__ ()
Initialize the dictionary.

Detailed Description

Database node record.

The database node contains session level variables in addition to preferences and entries used for diagnostics purposes.

Definition at line 39 of file RunControlCommon.py.

The documentation for this class was generated from the following file:
  • RunControlCommon.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEBM Class Reference

gEBM::GEBM

GEBM Class Reference

GEBM node. More...

Inheritance diagram for GEBM:

[legend]
Collaboration diagram for GEBM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize child objects.
downEBMC ()
Navigate to the GEBMC node.
existsEBMC ()
Check if the GEBMC instance exists in the schema.
downEBMST ()
Navigate to the GEBMST node.
existsEBMST ()
Check if the GEBMS instance exists in the schema.

Detailed Description

GEBM node.

Definition at line 9 of file gEBM.py.

Member Function Documentation

downEBMC ( )

Navigate to the GEBMC node.

Returns:
The GEBMC object instance

downEBMST ( )

Navigate to the GEBMST node.

Returns:
The GEBMST object instance

existsEBMC ( )

Check if the GEBMC instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsEBMST ( )

Check if the GEBMS instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gEBM.py
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEBMC Class Reference

gEBM::GEBMC

GEBMC Class Reference

EBM Controller node. More...

Inheritance diagram for GEBMC:

[legend]
Collaboration diagram for GEBMC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

EBM Controller node.

Has GEBMC specific registers.

Valid Registers:

  • back_end_config
  • front_end_a_config
  • front_end_b_config
  • address
  • sources
  • input_enables
  • output_enables
  • timeout
  • tem_statistics
  • cr_statistics

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 69 of file gEBM.py.

The documentation for this class was generated from the following file:
  • gEBM.py
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEBMST Class Reference

gEBM::GEBMST

GEBMST Class Reference

EBM Event Statistics node. More...

Inheritance diagram for GEBMST:

[legend]
Collaboration diagram for GEBMST:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
send (cmd)

Detailed Description

EBM Event Statistics node.

Has GEBMST specific registers.

Valid Registers:

  • receive_gem
  • receive_aem
  • receive_siu0
  • receive_siu1
  • receive_epu0
  • receive_epu1
  • receive_epu2
  • receive_siu2
  • receive_tem_mux0
  • receive_tem_mux1
  • transmit_siu0
  • transmit_siu1
  • transmit_epu0
  • transmit_epu1
  • transmit_epu2
  • transmit_siu2
  • transmit_ssr

Dataless Commands:

  • cmd_reset

Definition at line 108 of file gEBM.py.

The documentation for this class was generated from the following file:
  • gEBM.py
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEGU Class Reference

gEGU::GEGU

GEGU Class Reference

Base class for raw/engineering unit conversions. More...

Inheritance diagram for GEGU:

[legend]
List of all members.

Public Member Functions

__init__ (units)
egu (value)
raw (value)
units ()

Detailed Description

Base class for raw/engineering unit conversions.

Definition at line 7 of file gEGU.py.

Member Function Documentation

egu ( value )

Overloadable method for converting raw units to engineering units

Parameters:
value Value in raw units.
Returns:
Engineering units value after the conversion.

raw ( value )

Overloadable method for converting engineering units to raw units

Parameters:
value Value in engineering units.
Returns:
Raw value after the conversion.

units ( )

Method for returning the units string

Returns:
Units string value.

The documentation for this class was generated from the following file:
  • gEGU.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEGU_linear Class Reference

gEGU::GEGU_linear

GEGU_linear Class Reference

EGU class for performing linear conversions. More...

Inheritance diagram for GEGU_linear:

[legend]
Collaboration diagram for GEGU_linear:

[legend]
List of all members.

Public Member Functions

__init__ (slope, intercept, units="")
egu (rawValue)
raw (eguValue)

Detailed Description

EGU class for performing linear conversions.

Definition at line 41 of file gEGU.py.

Member Function Documentation

__init__ | ( | slope | ,
 |  | intercept | ,
 |  | units | = ""
 | ) |

Initialize a raw/EGU linear conversion object.

Parameters:
slope | Number of engineering unit counts per raw value tick
intercept | Offset in units of the engineering unit
units | The engineering units name, e.g. 'cm'

egu ( rawValue )

Convert a value in raw units to engineering units

Parameters:
rawValue Value in raw units.
Returns:
Engineering units value after the conversion.

raw ( eguValue )

Convert a value in engineering units to raw units

Parameters:
eguValue Value in engineering units.
Returns:
Raw value after the conversion.

The documentation for this class was generated from the following file:
  • gEGU.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEGU_poly3 Class Reference

gEGU::GEGU_poly3

GEGU_poly3 Class Reference

EGU class for performing 3rd degree polynominal conversions. More...

Inheritance diagram for GEGU_poly3:

[legend]
Collaboration diagram for GEGU_poly3:

[legend]
List of all members.

Public Member Functions

__init__ (coeff0, coeff1, coeff2, coeff3, offset, units="")
egu (rawValue)
raw (eguValue)

Detailed Description

EGU class for performing 3rd degree polynominal conversions.

Definition at line 76 of file gEGU.py.

Member Function Documentation

__init__ | ( | coeff0 | ,
 |  | coeff1 | ,
 |  | coeff2 | ,
 |  | coeff3 | ,
 |  | offset | ,
 |  | units | = ""
 | ) |

Initialize a raw/EGU linear conversion object.

Parameters:
slope | Number of engineering unit counts per raw value tick
intercept | Offset in units of the engineering unit
units | The engineering units name, e.g. 'cm'

egu ( rawValue )

Convert a value in raw units to engineering units

Parameters:
rawValue Value in raw units
Returns:
Engineering units value after the conversion.

raw ( eguValue )

Convert a value in engineering units to raw units

Parameters:
eguValue Value in engineering units.
Returns:
Raw value after the conversion.

The documentation for this class was generated from the following file:
  • gEGU.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GEM Class Reference

gEvtCli::GEM

GEM Class Reference

GEM event object. More...

List of all members.

Public Member Functions

__init__ ()
clear ()

Detailed Description

GEM event object.

Members:

  • ROI_Vector
  • TKR_Vector
  • CAL_HE_Vector
  • CAL_LE_Vector
  • triggerSummary
  • CNO_Vector
  • vetoList
  • liveTime
  • busy
  • prescaled
  • sent
  • triggerTime
  • onePPSTime

Definition at line 129 of file gEvtCli.py.

The documentation for this class was generated from the following file:
  • gEvtCli.py
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GExportException Class Reference

DataExport::GExportException

GExportException Class Reference

List of all members.

Public Member Functions

__init__ (status)
__str__ ()

Detailed Description

Define an exception from the Export system

Definition at line 17 of file DataExport.py.

The documentation for this class was generated from the following file:
  • DataExport.py
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEM Class Reference

gGEM::GGEM

GGEM Class Reference

GGEM node. More...

Inheritance diagram for GGEM:

[legend]
Collaboration diagram for GGEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize child objects.
getEPUaddr ()
downGEMC ()
Navigate to the GGEMC node.
existsGEMC ()
Check if the GGEMC instance exists in the schema.
downGEMMG ()
Navigate to the GGEMMG node.
existsGEMMG ()
Check if the GGEMMG instance exists in the schema.
downGEMST ()
Navigate to the GGEMST node.
existsGEMST ()
Check if the GGEMST instance exists in the schema.
downGEMSC ()
Navigate to the GGEMSC node.
existsGEMSC ()
Check if the GGEMSC instance exists in the schema.
downGEMVG ()
Navigate to the GGEMVG node.
existsGEMVG ()
Check if the GGEMVG instance exists in the schema.
downGEMVG ()
Navigate to the GGEMVG node.
existsGEMVG ()
Check if the GGEMVG instance exists in the schema.
downGEMIE ()
Navigate to the GGEMIE node.
existsGEMIE ()
Check if the GGEMIE instance exists in the schema.
downGEMW ()
Navigate to the GGEMW node.
existsGEMW ()
Check if the GGEMW instance exists in the schema.

Detailed Description

GGEM node.

Definition at line 9 of file gGEM.py.

Member Function Documentation

downGEMC ( )

Navigate to the GGEMC node.

Returns:
The GGEMC object instance

downGEMIE ( )

Navigate to the GGEMIE node.

Returns:
The GGEMIE object instance

downGEMMG ( )

Navigate to the GGEMMG node.

Returns:
The GGEMMG object instance

downGEMSC ( )

Navigate to the GGEMSC node.

Returns:
The GGEMSC object instance

downGEMST ( )

Navigate to the GGEMST node.

Returns:
The GGEMST object instance

downGEMVG ( )

Navigate to the GGEMVG node.

Returns:
The GGEMVG object instance

downGEMVG ( )

Navigate to the GGEMVG node.

Returns:
The GGEMVG object instance

downGEMW ( )

Navigate to the GGEMW node.

Returns:
The GGEMW object instance

existsGEMC ( )

Check if the GGEMC instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMIE ( )

Check if the GGEMIE instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMMG ( )

Check if the GGEMMG instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMSC ( )

Check if the GGEMSC instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMST ( )

Check if the GGEMST instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMVG ( )

Check if the GGEMVG instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMVG ( )

Check if the GGEMVG instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEMW ( )

Check if the GGEMW instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMC Class Reference

gGEM::GGEMC

GGEMC Class Reference

GEMC sub-node of GGEM (controller). More...

Inheritance diagram for GGEMC:

[legend]
Collaboration diagram for GGEMC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

GEMC sub-node of GGEM (controller).

Has GGEMC specific registers and dataless commands.

Valid Registers:

  • configuration
  • address
  • periodic_mode
  • periodic_limits
  • periodic_rate
  • sequence
  • cr_statistics
  • event_statistics

Dataless Commands:

  • cmd_nop
  • cmd_reset
  • cmd_trigger

Definition at line 151 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMIE Class Reference

gGEM::GGEMIE

GGEMIE Class Reference

GEMIE sub-node of GGEM (input enables). More...

Inheritance diagram for GGEMIE:

[legend]
Collaboration diagram for GGEMIE:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

GEMIE sub-node of GGEM (input enables).

Has GGEMIE specific registers and dataless commands.

Valid Registers:

  • towers_0_3
  • towers_4_7
  • towers_8_11
  • towers_12_15
  • acd_cno
  • tiles_000_013
  • tiles_014_032
  • tiles_033_NA3
  • tiles_100_113
  • tiles_114_NA5
  • tiles_200_213
  • tiles_214_NA7
  • tiles_300_313
  • tiles_314_NA9
  • tiles_400_413
  • tiles_414_NA1
  • tiles_500_NA10
  • tower_busy

Definition at line 321 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMMG Class Reference

gGEM::GGEMMG

GGEMMG Class Reference

GEMMG sub-node of GGEM (TAM generator). More...

Inheritance diagram for GGEMMG:

[legend]
Collaboration diagram for GGEMMG:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

GEMMG sub-node of GGEM (TAM generator).

Has GGEMMG specific registers and dataless commands.

Valid Registers:

  • engine_0
  • engine_1
  • engine_2
  • engine_3
  • engine_4
  • engine_5
  • engine_6
  • engine_7
  • engine_8
  • engine_9
  • engine_a
  • engine_b
  • engine_c
  • engine_d
  • engine_e
  • engine_f

Definition at line 186 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMSC Class Reference

gGEM::GGEMSC

GGEMSC Class Reference

GEMSC sub-node of GGEM (scheduler). More...

Inheritance diagram for GGEMSC:

[legend]
Collaboration diagram for GGEMSC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

GEMSC sub-node of GGEM (scheduler).

Has GGEMSC specific registers and dataless commands.

Valid Registers:

  • conditions_00_07
  • conditions_08_0f
  • conditions_10_17
  • conditions_18_1f
  • conditions_20_27
  • conditions_28_2f
  • conditions_30_37
  • conditions_38_3f
  • conditions_40_47
  • conditions_48_4f
  • conditions_50_57
  • conditions_58_5f
  • conditions_60_67
  • conditions_68_6f
  • conditions_70_77
  • conditions_78_7f
  • conditions_80_87
  • conditions_88_8f
  • conditions_90_97
  • conditions_98_9f
  • conditions_a0_a7
  • conditions_a8_af
  • conditions_b0_b7
  • conditions_b8_bf
  • conditions_c0_c7
  • conditions_c8_cf
  • conditions_d0_d7
  • conditions_d8_df
  • conditions_e0_e7
  • conditions_e8_ef
  • conditions_f0_f7
  • conditions_f8_ff

Definition at line 265 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMST Class Reference

gGEM::GGEMST

GGEMST Class Reference

GEMST sub-node of GGEM (statistics). More...

Inheritance diagram for GGEMST:

[legend]
Collaboration diagram for GGEMST:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

GEMST sub-node of GGEM (statistics).

Has GGEMST specific registers and dataless commands.

Valid Registers:

  • livetime
  • prescaled
  • discarded
  • sent
  • tile_counters
  • tile_0
  • tile_1

Dataless Commands:

  • cmd_reset

Definition at line 214 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMVG Class Reference

gGEM::GGEMVG

GGEMVG Class Reference

GEMVG sub-node of GGEM (ROI generator). More...

Inheritance diagram for GGEMVG:

[legend]
Collaboration diagram for GGEMVG:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

GEMVG sub-node of GGEM (ROI generator).

Has GGEMVG specific registers and dataless commands.

Valid Registers:

  • ROI_00, ROI_01, ROI_02,...,ROI_53

Definition at line 285 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGEMW Class Reference

gGEM::GGEMW

GGEMW Class Reference

GEMW sub-node of GGEM. More...

Inheritance diagram for GGEMW:

[legend]
Collaboration diagram for GGEMW:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

GEMW sub-node of GGEM.

Has GGEMW specific registers.

Valid Registers:

  • window_width
  • window_open_mask

Definition at line 341 of file gGEM.py.

The documentation for this class was generated from the following file:
  • gGEM.py
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GGLT Class Reference

gGLT::GGLT

GGLT Class Reference

Global Trigger. More...

Inheritance diagram for GGLT:

[legend]
Collaboration diagram for GGLT:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent=None)
Initialize valid registers as Gattrs.
getEPUaddr ()
read (reg)
load (reg, value)
send (cmd)
initialize ()
waitForMaskEnable (tmo=None)
Waits until the enableMask() method is called.
enableMask ()
Commits the mask value to hardware.
disableMask ()
Disables all trigger masks but doesn't change the cached mask value.
triggersDisabled ()
Check if the triggers are disabled.
isMaskDirty ()
Return the mask dirty flag.
refreshMask ()
Refreshes the cached value of the mask from the hardware.
getEnableTime ()
Returns the VxWorks timestamp at the time the triggers are enabled.
getDisableTime ()
Returns the VxWorks timestamp at the time the triggers are disabled.
setDestinationOverride (override)
Sets the flag to determine whether the user should be able to override the destination value.

Detailed Description

Global Trigger.

Has GGLT specific registers and dataless commands.

Valid Registers:

  • mask
  • busy_disable
  • ext_cal_strobe
  • ext_tack
  • counter_mask
  • counter
  • ext_clk_out_enable

Deprecated:
  • configuration Use the bit fields instead
  • options Use the bit fields instead
  • aem_counter_mask Use 'counter_mask' instead
  • aem_counter Use 'counter' instead
Dataless Commands:
  • cmd_reset
  • cmd_self_trigger

Options Register Bit Fields:

  • parity
  • tag
  • event_number

Configuration Register Bit Fields:

  • destination
  • marker
  • tack
  • zero_suppress
  • four_range_readout
  • cal_strobe

Mask Register Bit Fields:

  • internal_trg
  • external_trg
  • cal_low
  • cal_high
  • three_in_a_row
  • acd_veto_00
  • acd_veto_01
  • acd_veto_02
  • acd_veto_03
  • acd_veto_04
  • acd_veto_05
  • acd_veto_06
  • acd_veto_07
  • acd_veto_08
  • acd_veto_09
  • acd_veto_10
  • acd_veto_11
  • acd_veto_12
  • acd_veto_13
  • acd_veto_14
  • acd_veto_15
  • acd_veto_16
  • acd_veto_17
  • acd_cno

Definition at line 75 of file gGLT.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | = None
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

disableMask ( )

Disables all trigger masks but doesn't change the cached mask value.

This way when the triggers are enabled again, the old setting can be applied.

enableMask ( )

Commits the mask value to hardware.

Returns:
The value of the dirty flag before the commit is made.

getDisableTime ( )

Returns the VxWorks timestamp at the time the triggers are disabled.

Returns:
Trigger disable time

getEnableTime ( )

Returns the VxWorks timestamp at the time the triggers are enabled.

Returns:
Trigger enable time

isMaskDirty ( )

Return the mask dirty flag.

Returns:
Mask dirty flag.

setDestinationOverride ( override )

Sets the flag to determine whether the user should be able to override the destination value.

Parameters:
override 0=Destination is supplied as the LCB address as returned by CmdCli.getLcbAddr() 1=The user supplied destination value takes effect

triggersDisabled ( )

Check if the triggers are disabled.

Returns:
True if triggers are disabled, False if triggers are disabled.

waitForMaskEnable ( tmo = None )

Waits until the enableMask() method is called.

This is usually needed by non-self-triggering scripts where the _commandSynch thread needs to wait until RunControl actually enables the mask before continuing.

Parameters:
tmo Optional parameter giving the wait timeout in seconds

The documentation for this class was generated from the following file:
  • gGLT.py
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GHSK Class Reference

gHSK::GHSK

GHSK Class Reference

GLAST HSK node Record. More...

Inheritance diagram for GHSK:

[legend]
Collaboration diagram for GHSK:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid attributes as Gattrs.
downHTEM (childId)
Navigate to the HTEM indicated by childId.
downHAEM ()
Navigate to the HAEM node.
downHGEM ()
Navigate to the HGEM node.
downHEBM ()
Navigate to the HEBM node.
downHPDU (childId)
Navigate to the HPDU node.
downHCOM ()
Navigate to the HCOM node.
downHCPU ()
Navigate to the HCPU node.
downHNUL ()
Navigate to the HNUL node.
existsHTEM (temID)
Check if the HTEM instance with the id temID exists in the schema.
existsHAEM ()
Check if the HAEM instance exists in the schema.
existsHGEM ()
Check if the HGEM instance exists in the schema.
existsHEBM ()
Check if the HEBM instance exists in the schema.
existsHPDU (hpduID)
Check if the HPDU instance exists in the schema.
existsHCOM ()
Check if the HCOM instance exists in the schema.
existsHCPU ()
Check if the HCPU instance exists in the schema.
readSchema (schema)
readConfig (cfgFileName)
applyConfig (seq)
getConfigurations ()
Get list of configurations.
getDeclarations ()
Get list of declarations.
getRules ()
Retrieves the rule dictionary as defined by the current schema/configuration.
getOpaque (name)
Retrieves the named opaque data included in the schema.

Detailed Description

GLAST HSK node Record.

Definition at line 33 of file gHSK.py.

Member Function Documentation

__init__ ( client )

Initialize valid attributes as Gattrs.

Assign default values to members

downHAEM ( )

Navigate to the HAEM node.

Returns:
The HAEM object instance

downHCOM ( )

Navigate to the HCOM node.

Returns:
The HCOM object instance

downHCPU ( )

Navigate to the HCPU node.

Returns:
The HCPU object instance

downHEBM ( )

Navigate to the HEBM node.

Returns:
The HEBM object instance

downHGEM ( )

Navigate to the HGEM node.

Returns:
The HGEM object instance

downHNUL ( )

Navigate to the HNUL node.

Returns:
The HNUL object instance

downHPDU ( childId )

Navigate to the HPDU node.

Returns:
The HPDU object instance

downHTEM ( childId )

Navigate to the HTEM indicated by childId.

Parameters:
childId The id of the child HTEM
Returns:
A HARC object instance

existsHAEM ( )

Check if the HAEM instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHCOM ( )

Check if the HCOM instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHCPU ( )

Check if the HCPU instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHEBM ( )

Check if the HEBM instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHGEM ( )

Check if the HGEM instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHPDU ( hpduID )

Check if the HPDU instance exists in the schema.

Returns:
True if it exists, False if it doesn't.

existsHTEM ( temID )

Check if the HTEM instance with the id temID exists in the schema.

Parameters:
temID ACD readout controller id
Returns:
1 if it exists, 0 if it doesn't.

getConfigurations ( )

Get list of configurations.

Return a list of configuration tuples where each tuple contains the configDOM, configName and configRelease.

Returns:
Configuration tuple list.

getDeclarations ( )

Get list of declarations.

Return a list of declarations

Returns:
Declarations.

getOpaque ( name )

Retrieves the named opaque data included in the schema.

Parameters:
name Name of the opaque XML data
Returns:
A list of XML DOM objects matching name

Reimplemented from Gdb.

getRules ( )

Retrieves the rule dictionary as defined by the current schema/configuration.

Returns:
Dictionary containing Grule objects (or its descendants).

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GLAT Class Reference

gLAT::GLAT

GLAT Class Reference

GLAST LAT node Record. More...

Inheritance diagram for GLAT:

[legend]
Collaboration diagram for GLAT:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
readSchema (name)
writeSchema (fileName)
writeConfig (fileName, seq=None)
takeSnapshot (stream, fileName, captureGTIC, captureGAEQ, trigger, configName, configVersion)
readConfig (cfgFileName)
applyConfig (seq=None, gxbrd=None)
downTEM (childId)
Navigate to the GTEM indicated by childId.
allTEM ()
downPDU (childId)
Navigate to the GPDU indicated by childId.
downAEM ()
Navigate to the GAEM.
downGEM ()
Navigate to the GGEM.
downEBM ()
Navigate to the GEBM.
downLCB ()
Navigate to the GLCB.
downCRU ()
Navigate to the GCRU.
TEMcnt ()
Return the TEM count.
existsTEM (temId)
Check if the GTEM instance with the id temId exists in the schema.
existsPDU (pduId)
Check if the GPDU instance with the id pduId exists in the schema.
existsAEM ()
Check if the GAEM instance exists in the schema.
existsGEM ()
Check if the GGEM instance exists in the schema.
existsEBM ()
Check if the GEBM instance exists in the schema.
existsCRU ()
Check if the GCRU instance exists in the schema.
existsLCB ()
Check if the GLCB instance exists in the schema.
getConfigurations ()
Get list of configurations.
getDeclarations ()
Get list of declarations.
getRules ()
Retrieves the rule dictionary as defined by the current schema/configuration.
getAllOpaque ()
Return all opaque data.
getAllSerialNos ()
Return all opaque data.

Detailed Description

GLAST LAT node Record.

The GLAT node provides access to parity registers and event statistics registers.

Valid Registers:

  • parity_latp_cell_header
  • parity_latp_cell_body
  • parity_tem_cmd_str
  • parity_tem_access_desc
  • parity_tem_cmd_payload
  • parity_aem_cmd_str
  • parity_aem_access_desc
  • parity_aem_cmd_payload
  • stats_failed_events
  • stats_failed_event_sends
  • stats_valid_events
  • stats_discarded_event_sends
  • stats_length_mismatch_count
  • stats_events_not_sent

Event statistics:

The following statistics registers are initialized at the start of each RunControl run:

  • stats_failed_events -- Counts events where the eventHandler receives a bad status for the event.

  • stats_failed_event_sends -- Counts events where the socket send failed with an error other than EWOULDBLOCK.

  • stats_valid_events -- Counts when a valid event has been successfully sent to the client.

  • stats_discarded_event_sends -- Counts cases when an event send failed due to the fact that the send returned an EWOULDBLOCK error.

  • stats_length_mismatch_count -- Counts cases when the length argument passed to the event handler did not match the length provided in the event header.

  • stats_events_not_sent -- Counts when the event mode is set to DONOT_SEND_EVENTS where the incoming events will not be forwarded to the client over the socket.

Definition at line 123 of file gLAT.py.

Member Function Documentation

__init__ ( client )

Initialize valid registers as Gattrs.

Assign default values to members

downAEM ( )

Navigate to the GAEM.

Returns:
the GAEM object instance

downCRU ( )

Navigate to the GCRU.

Returns:
the GCRU object instance

downEBM ( )

Navigate to the GEBM.

Returns:
the GEBM object instance

downGEM ( )

Navigate to the GGEM.

Returns:
the GGEM object instance

downLCB ( )

Navigate to the GLCB.

Returns:
the GLCB object instance

downPDU ( childId )

Navigate to the GPDU indicated by childId.

Parameters:
childId The id of the child PDU
Returns:
a GPDU object instance

downTEM ( childId )

Navigate to the GTEM indicated by childId.

Parameters:
childId The id of the child TEM
Returns:
a GTEM object instance

existsAEM ( )

Check if the GAEM instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsCRU ( )

Check if the GCRU instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsEBM ( )

Check if the GEBM instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsGEM ( )

Check if the GGEM instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsLCB ( )

Check if the GLCB instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsPDU ( pduId )

Check if the GPDU instance with the id pduId exists in the schema.

Parameters:
pduId PDU id
Returns:
1 if it exists, 0 if it doesn't.

existsTEM ( temId )

Check if the GTEM instance with the id temId exists in the schema.

Parameters:
temId TEM id
Returns:
1 if it exists, 0 if it doesn't.

getAllOpaque ( )

Return all opaque data.

Returns:
All opaque data regardless of the node they are associated with.

getAllSerialNos ( )

Return all opaque data.

Returns:
All serial number data regardless of the node they are associated with.

getConfigurations ( )

Get list of configurations.

Return a list of configuration tuples where each tuple contains the configDOM, configName and configRelease.

Returns:
Configuration tuple list.

getDeclarations ( )

Get list of declarations.

Return a list of declarations

Returns:
Declarations.

getRules ( )

Retrieves the rule dictionary as defined by the current schema/configuration.

Returns:
Dictionary containing Grule objects (or its descendants).

TEMcnt ( )

Return the TEM count.

Returns:
Current TEM count

The documentation for this class was generated from the following file:
  • gLAT.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GLCB Class Reference

gLCB::GLCB

GLCB Class Reference

LCB node. More...

Inheritance diagram for GLCB:

[legend]
Collaboration diagram for GLCB:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
getLCBCSR ()
setLCBCSR (value)
setEvtEnable (parm)
Sets the LCB event enable bit to true or false.

Detailed Description

LCB node.

Has GLCB specific registers and dataless commands.

Valid Registers:

  • csr
  • parity_latp_cell_header
  • parity_latp_cell_body

Definition at line 16 of file gLCB.py.

Member Function Documentation

setEvtEnable ( parm )

Sets the LCB event enable bit to true or false.

Parameters:
parm boolean.

The documentation for this class was generated from the following file:
  • gLCB.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GMem Class Reference

gMem::GMem

GMem Class Reference

Memory node. More...

Inheritance diagram for GMem:

[legend]
Collaboration diagram for GMem:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid registers as Gattrs.
gMEMread (addr, size=4)
gMEMload (addr, val, size=4)
gMEMbusToLocal (space, addr)
gMEMlocalToBus (space, addr)

Detailed Description

Memory node.

Has GMem specific registers

Dataless Commands: none

Definition at line 15 of file gMem.py.

Member Function Documentation

gMEMbusToLocal | ( | space | ,
 |  | addr |
 | ) |

Translate an address in some space to local (PPC) space

Parameters:
space | Bus address space in which addr resides
addr | Bus address to convert
Returns:
A tuple containing the user id, status, local address value and timestamp

gMEMload | ( | addr | ,
 |  | val | ,
 |  | size | = 4
 | ) |

SBC MEM load command

Parameters:
addr | SBC address
val | Value to be set at address addr
size | Addressing used (1=8bit, 2=16bit, 4=32bit, 8=64bit, default is 4)
Returns:
A tuple containing the user id, status and timestamp

gMEMlocalToBus | ( | space | ,
 |  | addr |
 | ) |

Translate an address in local (PPC) space to some space

Parameters:
space | Bus address space in which addr resides
addr | Local address to convert
Returns:
A tuple containing the user id, status, bus address value and timestamp

gMEMread | ( | addr | ,
 |  | size | = 4
 | ) |

SBC MEM read command

Parameters:
addr | SBC address
size | Addressing used (1=8bit, 2=16bit, 4=32bit, 8=64bit, default is 4)
Returns:
A tuple containing the user id, status and value

The documentation for this class was generated from the following file:
  • gMem.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GNAT Class Reference

gNAT::GNAT

GNAT Class Reference

GNAT node Record. More...

Inheritance diagram for GNAT:

[legend]
Collaboration diagram for GNAT:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid registers as Gattrs.
initHandle (slot, physAddr)
Initializes a new GNAT handle given a physical VME address.
clearBuffer ()
Zero out the contents of the bundle.
addChannel (channelNo, itemList)
loadFIFO ()
This is a combination of gBndlGetBndl() and gWritePF16v().
flushPlaybackFIFO ()
This is a combination of gFlushPF() and gEnablePF().
flushRecordFIFO ()
This is a combination of gFlushRF() and gEnableRF().
writeFIFO (data)
A wrapper around gWritePF().
writeFIFO32 (data)
A wrapper around gWritePF().
startPlayback ()
This is a wrapper around gStartPB().
setLATpMode (mode)
Sets the running mode of the COMM I/O board based on the boolean value of mode.

Detailed Description

GNAT node Record.

This node contains COMM card related functions. Each GNAT node is associated with one COMM card. A GNAT node can either be instantiated through the createGNATinstance method of GTEM, GAEM or GGLT nodes or it can be instantiated as a standalone node by creating an instance of it and calling its initHandle method with the pysical address of the COMM card. The other parameter that it needs is a slot. A slot is a placeholder for a GNAT handle. There are currently 16 slots available. When calling the createGNATinstance or initHandle methods the desired slot is passed and this is where the handle is stored for the duration of the session. Currently the GNAT node serves to major purposes:

(1) Statistics:

Contains registers for retrieving TX/RX ctrl and data cells as well as RX header parity and TX busy assert flags.

(2) Pattern generator functionality:

It is possible to use the exposed methods and registers to write bit streams to the COMM card. This functionality is available mostly for internal testing and should not be of and particular use to the subsystems.

Definition at line 34 of file gNAT.py.

Member Function Documentation

__init__ ( client )

Initialize valid registers as Gattrs.

Assign default values to members

Usage:

      gn = GNAT()

addChannel | ( | channelNo | ,
 |  | itemList |
 | ) |

Inserts data into a channel

Parameters:
channelNo | The channel number (0 - 15) to insert the chnlData into. The maximum channel number is defined in GNAT/gnat.h as MAX_CHANNEL.
itemList | A sequence of 32-bit words. The maximum number of words in the array is 5.
Returns:
Status
Usage:
      data = [0xdeadbeefL, 0xdeadbeefL, 0xdeadbeefL]
      gn.addChannel(channelNo=1, itemList=data)

clearBuffer ( )

Zero out the contents of the bundle.

Calls gBndlClear( gh);

Returns:
Status

flushPlaybackFIFO ( )

This is a combination of gFlushPF() and gEnablePF().

Flushes the playback FIFO.

Returns:
Status

flushRecordFIFO ( )

This is a combination of gFlushRF() and gEnableRF().

Flushes the record FIFO.

Returns:
Status

initHandle | ( | slot | ,
 |  | physAddr |
 | ) |

Initializes a new GNAT handle given a physical VME address.

Parameters:
slot | A number between 0 and 15 to hold the GNAT handle. Each GNAT handle should be assigned a unique slot number. The GNAT handle persists at that slot while the session is active.
physAddr | Physical VME address of the COMM card.
Returns:
Status
Usage:
      gn = GNAT()
      gn.setCmd(lat.getCmd())
      gn.initHandle(0, 0x08000000)

loadFIFO ( )

This is a combination of gBndlGetBndl() and gWritePF16v().

It transfers the data from the intermediate bundle buffer into the playback FIFO.

Returns:
Status

setLATpMode ( mode )

Sets the running mode of the COMM I/O board based on the boolean value of mode.

When mode is non-zero the mode bit of the COMM I/O control register is set to 1, which puts the board in "LATp mode". When mode is zero the mode bit is cleared, which puts the board in "dumb record FIFO mode".

Parameters:
mode The running mode of the COMM I/O board
Returns:
Status
Usage:
      gn.setLATpMode(0)

startPlayback ( )

This is a wrapper around gStartPB().

Starts the playback.

Returns:
Status
Usage:
      gn.startPlayback()

writeFIFO ( data )

A wrapper around gWritePF().

So user could write a single word to the FIFO or the user could prepare their own array of words, bypassing the bundle/channel interface.

Parameters:
data A single or a sequence of 16-bit words
Returns:
Status
Usage:
      data = [0xa0a0, 0xb0b0, 0xc0c0]
      gn.writeFIFO(data)
      data = 0x1234
      gn.writeFIFO(data)

writeFIFO32 ( data )

A wrapper around gWritePF().

So user could write a single word to the FIFO or the user could prepare their own array of words, bypassing the bundle/channel interface.

Parameters:
data A single or a sequence of 16-bit words
Returns:
Status
Usage:
      data = [0xa0a0a0a0L, 0xdeadbeefL, 0xc0c0c0c0L]
      gn.writeFIFO32(data)
      data = 0x12345678L
      gn.writeFIFO(data)

The documentation for this class was generated from the following file:
  • gNAT.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOCS Class Reference

gOCS::GOCS

GOCS Class Reference

OCS node. More...

Inheritance diagram for GOCS:

[legend]
Collaboration diagram for GOCS:

[legend]
List of all members.

Public Member Functions

__init__ (client)
read (reg)
load (reg, value)
evtHandlerSendAll ()
Sets the current event mode to send all events to the client.
evtHandlerSendNothing ()
Sets the current event mode to send no data events to the client.
evtHandlerSendErrorsOnly ()
Sets the current event mode to send only error events to the client.
evtHandlerSendAcdScalers (marker, prescale=0)
Sets the current event mode to send only events containing the ACD software scalers to the client upon recept of the given marker.
evtHandlerSendPrescaled (prescale)
Sets the current event mode to send prescaled events to the client.
evtHandlerPrescaleExternal (prescale)
Sets the current event mode to prescale externally triggered events. Only events with only the external trigger firing will be prescaled.
evtHandlerSetVerbosity (verbosity)
Sets the event server verbosity.
synchronize ()
Synchronize the SBC's clock with the host's clock.
getVersion ()
Get the protocol versions of code running on the SBC.
verifyVersion ()
Verify that the protocol version of the code running on the SBC is one the host code is expected to support.

Detailed Description

OCS node.

Has OCS specific registers and methods.

Definition at line 15 of file gOCS.py.

Member Function Documentation

evtHandlerPrescaleExternal ( prescale )

Sets the current event mode to prescale externally triggered events. Only events with only the external trigger firing will be prescaled.

Parameters:
prescale - Prescale value to use

evtHandlerSendAcdScalers | ( | marker | ,
 |  | prescale | = 0
 | ) |

Sets the current event mode to send only events containing the ACD software scalers to the client upon recept of the given marker.

Parameters:
marker | - Marker to value to use
prescale | - Prescale value to use

evtHandlerSendPrescaled ( prescale )

Sets the current event mode to send prescaled events to the client.

Parameters:
prescale - Prescale value to use

evtHandlerSetVerbosity ( verbosity )

Sets the event server verbosity.

Parameters:
verbosity - Verbosity value to use

The documentation for this class was generated from the following file:
  • gOCS.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GPDU Class Reference

gPDU::GPDU

GPDU Class Reference

PDU Controller. More...

Inheritance diagram for GPDU:

[legend]
Collaboration diagram for GPDU:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downPEQ ()
Navigate to the GPEQ (PDU environmental monitors).
existsPEQ ()
Check if the GPEQ instance exists in the schema.

Detailed Description

PDU Controller.

Valid Registers:

  • configuration
  • address
  • cr_statistics
  • crates
  • tems
  • acd
  • monitor

Dataless commands:

  • cmd_nop
  • cmd_reset

Definition at line 25 of file gPDU.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

downPEQ ( )

Navigate to the GPEQ (PDU environmental monitors).

Returns:
A GPEQ object instance

existsPEQ ( )

Check if the GPEQ instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gPDU.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GPEQ Class Reference

gPDU::GPEQ

GPEQ Class Reference

PDU Environmental Monitors. More...

Inheritance diagram for GPEQ:

[legend]
Collaboration diagram for GPEQ:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

PDU Environmental Monitors.

Has GPEQ specific registers and dataless commands.

Valid Registers:

  • adcs_00_07
  • adcs_08_15
  • adcs_16_19

Definition at line 63 of file gPDU.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

The documentation for this class was generated from the following file:
  • gPDU.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Grule Class Reference

gRule::Grule

Grule Class Reference

Base class for describing rules. More...

Inheritance diagram for Grule:

[legend]
Collaboration diagram for Grule:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous=False)
_eval_ (value, attr, node)
evaluate (value, attr, node=None)
name ()
subsystem ()
category ()
enabled ()
enable ()
disable ()
reset ()
registerAction (action, method, sender=dispatcher.Any)
setActions (actions)
sendAction (action, sender, arguments, named)
clearAllActions ()
unregisterAction (action, method, sender=dispatcher.Any)

Detailed Description

Base class for describing rules.

Definition at line 20 of file gRule.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | subsystem | ,
 |  | category | ,
 |  | enabled | ,
 |  | continuous | = False
 | ) |

Constructor.

Parameters:
name | Rule name
subsystem | Subsystem gGroup to which the rule belongs
category | Category gGroup to which the rule belongs
enabled | Flag indicating whether rule is enabled
continuous | Flag indicating whether rule can fire repeatedly

_eval_ | ( | value | ,
 |  | attr | ,
 |  | node |
 | ) |

Dummy evaluation method to be overridden through inheritance to implement the application specific rule evaluation

Reimplemented in GruleLimit, and GruleAlarms.

category ( )

Method for discovering this rule's category

Returns:
Rule's category.

clearAllActions ( )

Forces all registered actions to be cleared. If this is not done and the scripts re-register their actions there may be extraneous rule action firings.

disable ( )

Method used to disable evaluation of this rule

enable ( )

Method used to enable evaluation of this rule

enabled ( )

Method for discovering whether this rule is enabled

Returns:
Whether this rule is enabled or not.

evaluate | ( | value | ,
 |  | attr | ,
 |  | node | = None
 | ) |

This method is called to evaluate the rule on 'value'

Parameters:
value | Value to be evaluated.
attr | Attribute object whose value is being evaluated.
Returns:
Result of the evaluation, if any.

Reimplemented from GruleBase.

name ( )

Method to retrieve the rule's name

Returns:
Rule's name.

registerAction | ( | action | ,
 |  | method | ,
 |  | sender | = dispatcher.Any
 | ) |

Associate and action with a user method, optionally specifying a sender. If a sender is not specified, the rule action may be fired for all registers which declare its rule to be the rule of this action. If an attribute is specified as the sender then only if the evaluation of that specific attribute causes the action to be fired the method will be called.

Parameters:
action | A string that represents the action to be taken. This is specified under the <actions> tag in the schema/configuration.
method | A user method visible to the current context.
sender | Optional parameter that specifies the sender of the action registration. If specifed, only the sendAction requests which specify the same sender will be honored. Defaults to dispatcher.Any.

reset ( )

Method used to reenable evaluation of this rule in the case of noncontinuous mode after it has been violated

sendAction | ( | action | ,
 |  | sender | ,
 |  | arguments | ,
 |  | named |
 | ) |

Called from the rule evaluation method to fire the appropriate alarm action.

Parameters:
action | A string that represents the action to be taken. This is specified under the <actions> tag in the schema/configuration.
sender | The sender that made the rule firing request. This is usually the attribute which is being evaluated.
*arguments | An optional list of arguments which gets passed to the action method.
Returns:
A list of tuple pairs [(receiver, response), ... ]

setActions ( actions )

Convenience method that gets called from the rule constructor that defines the action names (which is read from the schema/configuration).

Parameters:
actions A list containing the action names.

subsystem ( )

Method for discovering this rule's subsystem

Returns:
Rule's subsystem.

unregisterAction | ( | action | ,
 |  | method | ,
 |  | sender | = dispatcher.Any
 | ) |

Reverse of registerAction, disassociates the action from the method.

Parameters:
action | A string that represents the action to be taken. This is specified under the <actions> tag in the schema/configuration.
method | A user method visible to the current context.
sender | Optional parameter that specifies the sender of the action registration. If specifed, only the sendAction requests which specify the same sender will be honored. Defaults to dispatcher.Any.

The documentation for this class was generated from the following file:
  • gRule.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GruleAlarms Class Reference

gRule::GruleAlarms

GruleAlarms Class Reference

Alarm rule. More...

Inheritance diagram for GruleAlarms:

[legend]
Collaboration diagram for GruleAlarms:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous, yellowUpperLimit, yellowLowerLimit, redUpperLimit, redLowerLimit, actions=[])
_eval_ (value, attr, node)

Detailed Description

Alarm rule.

If the value falls below the yellow or red lower limit or it exceeds the yellow or red upped limit the appropriate registered action is fired.

Definition at line 181 of file gRule.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | subsystem | ,
 |  | category | ,
 |  | enabled | ,
 |  | continuous | ,
 |  | yellowUpperLimit | ,
 |  | yellowLowerLimit | ,
 |  | redUpperLimit | ,
 |  | redLowerLimit | ,
 |  | actions | = []
 | ) |

Alarm rule constructor.

Parameters:
name | Rule name
subsystem | Subsystem gGroup to which the rule belongs
category | Category gGroup to which the rule belongs
enabled | Flag indicating whether rule is enabled
continuous | Flag indicating whether rule can fire repeatedly
yellowUpperLimit | Yellow alarm upper limit
yellowLowerLimit | Yellow alarm lower limit
redUpperLimit | Red alarm upper limit
redLowerLimit | Red alarm lower limit

_eval_ | ( | value | ,
 |  | attr | ,
 |  | node |
 | ) |

Alarm rule evaluation method.

If the red alarm is fired then the yellow alarm does not get fired.

Reimplemented from Grule.

The documentation for this class was generated from the following file:
  • gRule.py
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GruleBase Class Reference

gRule::GruleBase

GruleBase Class Reference

Base rule class for use when no rule is appropriate. More...

Inheritance diagram for GruleBase:

[legend]
List of all members.

Public Member Functions

__init__ ()
evaluate (value, attr, node=None)

Detailed Description

Base rule class for use when no rule is appropriate.

Definition at line 10 of file gRule.py.

The documentation for this class was generated from the following file:
  • gRule.py
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GruleLimit Class Reference

gRule::GruleLimit

GruleLimit Class Reference

Rule class that limits a passed in value to given limits. More...

Inheritance diagram for GruleLimit:

[legend]
Collaboration diagram for GruleLimit:

[legend]
List of all members.

Public Member Functions

__init__ (name, subsystem, category, enabled, continuous, low, high)
_eval_ (value, attr, node)

Detailed Description

Rule class that limits a passed in value to given limits.

Definition at line 152 of file gRule.py.

Member Function Documentation

__init__ | ( | name | ,
 |  | subsystem | ,
 |  | category | ,
 |  | enabled | ,
 |  | continuous | ,
 |  | low | ,
 |  | high |
 | ) |

Limit rule constructor.

Parameters:
name | Rule name
subsystem | Subsystem gGroup to which the rule belongs
category | Category gGroup to which the rule belongs
enabled | Flag indicating whether rule is enabled
continuous | Flag indicating whether rule can fire repeatedly
low | Low limit
high | High limit

_eval_ | ( | value | ,
 |  | attr | ,
 |  | node |
 | ) |

Evaluate the rule.

Reimplemented from Grule.

The documentation for this class was generated from the following file:
  • gRule.py
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTCC Class Reference

gTEM::GTCC

GTCC Class Reference

Tracker Cable Controller node record. More...

Inheritance diagram for GTCC:

[legend]
Collaboration diagram for GTCC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downTRC (childId)
Navigate to the GTRC indicated by childId.
allTRC ()
Navigate to the broadcast GTRC.
existsTRC (trcId)
Check if the GTRC instance with the id trcId exists in the schema.

Detailed Description

Tracker Cable Controller node record.

Has GTCC specific registers and dataless commands.

Valid Registers:

  • configuration
  • input_mask
  • fifo_status
  • latched_status
  • event_timeouts
  • trg_alignment

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 282 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allTRC ( )

Navigate to the broadcast GTRC.

Returns:
The broadcast GTRC object instance

downTRC ( childId )

Navigate to the GTRC indicated by childId.

Parameters:
childId The id of the child GTRC
Returns:
A GTRC object instance

existsTRC ( trcId )

Check if the GTRC instance with the id trcId exists in the schema.

Parameters:
trcId Tracker readout controller id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTEM Class Reference

gTEM::GTEM

GTEM Class Reference

TEM node Record. More...

Inheritance diagram for GTEM:

[legend]
Collaboration diagram for GTEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downCCC (childId)
Navigate to the GCCC indicated by childId.
downTCC (childId)
Navigate to the GTCC indicated by childId.
allCCC ()
Navigate to the broadcast GCCC.
allTCC ()
Navigate to the broadcast GTCC.
CCCcnt ()
Return the GCCC count.
TCCcnt ()
Return the GTCC count.
downTIC ()
Navigate to the GTIC node.
existsTIC ()
Check if the GTIC instance exists in the schema.
existsCCC (cccId)
Check if the GCCC instance with the id cccId exists in the schema.
existsTCC (tccId)
Check if the GTCC instance with the id tccId exists in the schema.

Detailed Description

TEM node Record.

Valid Registers:

  • configuration
  • data_masks
  • status
  • command_response
  • tkr_trgseq
  • cal_trgseq
  • address

Dataless Commands:

  • cmd_reset
  • cmd_look_at_me

Definition at line 26 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allCCC ( )

Navigate to the broadcast GCCC.

Returns:
The broadcast GCCC object instance

allTCC ( )

Navigate to the broadcast GTCC.

Returns:
The broadcast GTCC object instance

CCCcnt ( )

Return the GCCC count.

Returns:
Current GCCC count

downCCC ( childId )

Navigate to the GCCC indicated by childId.

Parameters:
childId The id of the child GCCC
Returns:
A GCCC object instance

downTCC ( childId )

Navigate to the GTCC indicated by childId.

Parameters:
childId The id of the child GTCC
Returns:
A GTCC object instance

downTIC ( )

Navigate to the GTIC node.

Returns:
The GTIC object instance

existsCCC ( cccId )

Check if the GCCC instance with the id cccId exists in the schema.

Parameters:
cccId Calorimeter cable controller id
Returns:
1 if it exists, 0 if it doesn't.

existsTCC ( tccId )

Check if the GTCC instance with the id tccId exists in the schema.

Parameters:
tccId Tracker cable controller id
Returns:
1 if it exists, 0 if it doesn't.

existsTIC ( )

Check if the GTIC instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

TCCcnt ( )

Return the GTCC count.

Returns:
Current GTCC count

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTFE Class Reference

gTEM::GTFE

GTFE Class Reference

Tracker Front-End node Record. More...

Inheritance diagram for GTFE:

[legend]
Collaboration diagram for GTFE:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

Tracker Front-End node Record.

Has GTFE specific registers and dataless commands.

Valid Registers:

  • data_mask
  • calib_mask
  • trig_mask
  • dac
  • mode

Dataless Commands:

  • cmd_nop
  • cmd_reset
  • cmd_calstrobe
  • cmd_readevent

Definition at line 412 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTIC Class Reference

gTEM::GTIC

GTIC Class Reference

Trigger Interface Controller. More...

Inheritance diagram for GTIC:

[legend]
Collaboration diagram for GTIC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid registers as Gattrs.
satCtrEnable (reg)
Enable the specified saturation counter. By default all saturation counters are disabled.
satCtrDisable (reg)
Disable the specified saturation counter. By default all saturation counters are disabled.
satCtrLoopEnable ()
Enable the update loop that updates all saturation counter pseudoregisters.
satCtrLoopDisable ()
Disable the update loop that updates all saturation counter pseudoregisters.
satCtrSetLoopDelay (delay)
Set the update loop interval for saturation counter pseudoregisters.
read (reg)
load (reg, value)
send (cmd)

Detailed Description

Trigger Interface Controller.

Has GTIC specific registers and dataless commands.

Valid Registers:

  • power_supply
  • status
  • cal_in_mask
  • cal_lrs_mask
  • cal_lrs_counters
  • tkr_layer_enable_0
  • tkr_layer_enable_1
  • tkr_out_mask
  • tkr_out_lrs_mask
  • tkr_lrs_counter_0
  • tkr_lrs_counter_1
  • busy_lrs_mask
  • busy_lrs_counter
  • adcs
  • mux_config
  • tkr_biasdac
  • cal_biasdac
  • adc_tkr_digital_2_5v
  • adc_tkr_digital_2_5i
  • adc_tkr_analog_a_1_5v
  • adc_tkr_analog_a_1_5i
  • adc_tkr_analog_b_2_5v
  • adc_tkr_analog_b_2_5i
  • adc_tkr_bias_v
  • adc_tkr_bias_v0
  • adc_tkr_bias_i
  • adc_cal_digital_3_3v
  • adc_cal_digital_3_3i
  • adc_tkr_bias_v1
  • adc_cal_analog_3_3v
  • adc_cal_analog_3_3i
  • adc_cal_bias_v1
  • adc_cal_bias_v
  • adc_cal_bias_v0
  • adc_cal_bias_i
  • adc_28_v0
  • adc_tem_digital_3_3v
  • adc_tem_digital_3_3i
  • adc_28_v1
  • adc_afee0_t0
  • adc_afee0_t1
  • adc_afee1_t0
  • adc_afee1_t1
  • adc_afee2_t0
  • adc_afee2_t1
  • adc_afee3_t0
  • adc_afee3_t1
  • adc_tkr_c0_t0
  • adc_tkr_c0_t1
  • adc_tkr_c1_t0
  • adc_tkr_c1_t1
  • adc_tkr_c2_t0
  • adc_tkr_c2_t1
  • adc_tkr_c3_t0
  • adc_tkr_c3_t1
  • adc_tkr_c4_t0
  • adc_tkr_c4_t1
  • adc_tkr_c5_t0
  • adc_tkr_c5_t1
  • adc_tkr_c6_t0
  • adc_tkr_c6_t1
  • adc_tkr_c7_t0
  • adc_tkr_c7_t1

Deadtime Counters:

  • sat_cal_lrs_ctr_0
  • sat_cal_lrs_ctr_1
  • sat_tkr_lrs_ctr_0
  • sat_tkr_lrs_ctr_1
  • sat_tkr_lrs_ctr_2
  • sat_tkr_lrs_ctr_3
  • sat_deadtime_lrs_ctr

Pseudo Registers:

  • psd_tkr_bias_i
  • psd_cal_bias_i
  • psd_tem_i

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 514 of file gTEM.py.

Member Function Documentation

satCtrDisable ( reg )

Disable the specified saturation counter. By default all saturation counters are disabled.

Parameters:
reg Register id of the saturation counter. Can be retrieved by calling tic.regs['regname'].id().
Returns:
A Response object

satCtrEnable ( reg )

Enable the specified saturation counter. By default all saturation counters are disabled.

Parameters:
reg Register id of the saturation counter. Can be retrieved by calling tic.regs['regname'].id().
Returns:
A Response object

satCtrLoopDisable ( )

Disable the update loop that updates all saturation counter pseudoregisters.

Returns:
A Response object

satCtrLoopEnable ( )

Enable the update loop that updates all saturation counter pseudoregisters.

Returns:
A Response object

satCtrSetLoopDelay ( delay )

Set the update loop interval for saturation counter pseudoregisters.

Parameters:
Set the saturation counter update loop delay in 1/60 second ticks. The default is 30 (2 Hz).
Returns:
A Response object

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTRC Class Reference

gTEM::GTRC

GTRC Class Reference

Tracker Readout Controller node Record. More...

Inheritance diagram for GTRC:

[legend]
Collaboration diagram for GTRC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
downTFE (childId)
Navigate to the GTFE indicated by childId.
allTFE ()
Navigate to the broadcast GTFE.
existsTFE (tfeId)
Check if the GTFE instance with the id tfeId exists in the schema.
getNoisyChannels (feId=None)
Get the noisy channels for this RC or for a specific FE belonging to this RC.
getDeadChannels (feId=None)
Get the dead channels for this RC or for a specific FE belonging to this RC.

Detailed Description

Tracker Readout Controller node Record.

Has GTRC specific registers and dataless commands.

Valid Registers:

  • csr
  • sync

Dataless Commands:

  • cmd_nop
  • cmd_reset

Definition at line 335 of file gTEM.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

allTFE ( )

Navigate to the broadcast GTFE.

Returns:
The broadcast GTFE object instance

downTFE ( childId )

Navigate to the GTFE indicated by childId.

Parameters:
childId The id of the child GTFE
Returns:
A GTFE object instance

existsTFE ( tfeId )

Check if the GTFE instance with the id tfeId exists in the schema.

Parameters:
tfeId Tracker front-end id
Returns:
1 if it exists, 0 if it doesn't.

getDeadChannels ( feId = None )

Get the dead channels for this RC or for a specific FE belonging to this RC.

Parameters:
feId Front-end id.
Returns:
If feId is None return a list of dead channels. If feId is not None return a bitmap of dead channels.

getNoisyChannels ( feId = None )

Get the noisy channels for this RC or for a specific FE belonging to this RC.

Parameters:
feId Front-end id.
Returns:
If feId is None return a list of noisy channels. If feId is not None return a bitmap of noisy channels.

The documentation for this class was generated from the following file:
  • gTEM.py
Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GTWR Class Reference

gXBR::GTWR

GTWR Class Reference

Tower node Record. More...

Inheritance diagram for GTWR:

[legend]
Collaboration diagram for GTWR:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, id)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)

Detailed Description

Tower node Record.

Valid Registers:

  • adc_ps_temp_0
  • adc_ps_temp_1
  • adc_tem_temp_0
  • adc_tem_temp_1
  • adc_tem_voltage_0
  • adc_tem_voltage_1

Definition at line 105 of file gXBR.py.

Member Function Documentation

__init__ | ( | client | ,
 |  | parent | ,
 |  | id |
 | ) |

Initialize valid registers as Gattrs.

Assign default values to members

The documentation for this class was generated from the following file:
  • gXBR.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GUIbridge Class Reference

guiBridges::GUIbridge

GUIbridge Class Reference

Class for providing a bridge between the GUI thread and other threads. More...

List of all members.

Public Member Functions

__init__ (guiThread)
This is the constructor of the GUIbridge class.
shutdown ()
This method is used to shut the GUI bridge down.
isGUIthread ()
Returns True if this method is being called from the GUI thread.
createGUI (qObject, obj, args, kwargs)
Method used for instantiating a GUI from a non-GUI thread.
execGUImethodNR (qObject, func, args, kwargs)
Method used for executing a GUI function from a non-GUI thread.
execGUImethod (qObject, func, args, kwargs)
Method used for executing a GUI function from a non-GUI thread.
execGUImethod2 (qObject, func, args, kwargs)
handleCustomEvent (e)

Detailed Description

Class for providing a bridge between the GUI thread and other threads.

This bridge is needed whenever a non-GUI thread needs to interact with the GUI. The GUI is handled by the 'GUI thread'. A 'GUI thread' is defined to be the one in which the Qt QApplication class's exec_loop() method is executed. There can be only one GUI thread in a program.

The solution to the problem is handled by sending a message (an 'event', in Qt terms) from the non-GUI thread to the GUI thread. The message contains information on how it is to be handled. In some cases, this handling produces a result that must be sent back to the initiating non-GUI thread. The requests and responses are passed around via queues. Separate queues are maintained for the different non-GUI threads so that responses don't end up handed off to the wrong thread.

Definition at line 28 of file guiBridges.py.

Member Function Documentation

__init__ ( guiThread )

This is the constructor of the GUIbridge class.

It must be called from the GUI thread.

createGUI | ( | qObject | ,
 |  | obj | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for instantiating a GUI from a non-GUI thread.

Parameters:
qObject | - The Qt object that will receive the customEvent callback
obj | - The GUI object class type to create
args | - Arguments for the object class constructor
kwargs | - Keyword arguments for the object class constructor
Returns:
An instance of the requested GUI object class

execGUImethod | ( | qObject | ,
 |  | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread.

Use this method when a response is expected from the function and when it is appropriate to wait for it (no deadlock arises)

Parameters:
qObject | - The Qt object that will receive the customEvent callback
func | - The GUI function or method to call
args | - Arguments for the function or method
kwargs | - Keyword arguments for the function or method
Returns:
The called GUI function's return value

execGUImethodNR | ( | qObject | ,
 |  | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread.

Use this method when no (useful) response is expected or when waiting for one could cause a deadlock. Any response from the function is lost.

Parameters:
qObject | - The Qt object that will receive the customEvent callback
func | - The GUI function or method to call
args | - Arguments for the function or method
kwargs | - Keyword arguments for the function or method

The documentation for this class was generated from the following file:
  • guiBridges.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GXBRD Class Reference

gXBR::GXBRD

GXBRD Class Reference

Tower controller node Record. More...

Inheritance diagram for GXBRD:

[legend]
Collaboration diagram for GXBRD:

[legend]
List of all members.

Public Member Functions

__init__ (client)
Initialize valid registers as Gattrs.
read (reg)
load (reg, value)
send (cmd)
readSchema (name)
readConfig (cfgFileName)
applyConfig (seq=None)
getConfigurations ()
Get list of configurations.
getDeclarations ()
Get list of declarations.
downGLT ()
Navigate to the GGLT.
existsGLT ()
Check if the GGLT instance exists in the schema.
downTWR (twrId)
Navigate to the GTWR indicated by childId.
existsTWR (twrId)
Check if the GTWR instance with the id twrId exists in the schema.

Detailed Description

Tower controller node Record.

Valid Registers:

  • dac_tem_voltage
  • dac_tkr_analog_2_5
  • dac_tkr_digital_2_5
  • dac_tkr_cal_analog
  • dac_cal_digital_3_3
  • path_cmd_resp_reset
  • path_trigger
  • path_event
  • evt_flow_ctrl

Dataless commands:

  • cmd_tem_hw_reset

Definition at line 29 of file gXBR.py.

Member Function Documentation

__init__ ( client )

Initialize valid registers as Gattrs.

Assign default values to members

downGLT ( )

Navigate to the GGLT.

Returns:
The GGLT object instance

downTWR ( twrId )

Navigate to the GTWR indicated by childId.

Parameters:
childId The id of the child tower
Returns:
A GTWR object instance

existsGLT ( )

Check if the GGLT instance exists in the schema.

Returns:
1 if it exists, 0 if it doesn't.

existsTWR ( twrId )

Check if the GTWR instance with the id twrId exists in the schema.

Parameters:
twrId Tower id
Returns:
1 if it exists, 0 if it doesn't.

getConfigurations ( )

Get list of configurations.

Return a list of configuration tuples where each tuple contains the configDOM, configName and configRelease.

Returns:
Configuration tuple list.

getDeclarations ( )

Get list of declarations.

Return a list of declarations

Returns:
Declarations.

The documentation for this class was generated from the following file:
  • gXBR.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HAEM Class Reference

gHSK::HAEM

HAEM Class Reference

GLAST AEM HSK node Record. More...

Inheritance diagram for HAEM:

[legend]
Collaboration diagram for HAEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid housekeeping quantities as Gattrs.
downHARC (arcID)
Navigate to the HARC indicated by arcID.
existsHARC (arcID)
Check if the HARC instance with the id arcID exists in the schema.

Detailed Description

GLAST AEM HSK node Record.

Valid Attributes:

  • FreeI
  • Temperature
  • HVI
  • DAQV
  • CommonStatus
  • CableStatus

Definition at line 268 of file gHSK.py.

Member Function Documentation

downHARC ( arcID )

Navigate to the HARC indicated by arcID.

Parameters:
arcID The id of the child HARC
Returns:
A HARC object instance

existsHARC ( arcID )

Check if the HARC instance with the id arcID exists in the schema.

Parameters:
arcId ACD readout controller id
Returns:
1 if it exists, 0 if it doesn't.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HARC Class Reference

gHSK::HARC

HARC Class Reference

GLAST ARC HSK node record. More...

Inheritance diagram for HARC:

[legend]
Collaboration diagram for HARC:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, arcID)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST ARC HSK node record.

Valid Attributes:

  • Vdd
  • Temperature
  • HV1
  • HV2

Definition at line 308 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HCOM Class Reference

gHSK::HCOM

HCOM Class Reference

GLAST Communications statistics HSK node record. More...

Inheritance diagram for HCOM:

[legend]
Collaboration diagram for HCOM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST Communications statistics HSK node record.

Valid Attributes:

  • Traffic_LCB0
  • Traffic_LCB0
  • Traffic_LCB0
  • Traffic_1553
  • Traffic_SSR

Definition at line 415 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HCPU Class Reference

gHSK::HCPU

HCPU Class Reference

GLAST CPU metrics HSK node record. More...

Inheritance diagram for HCPU:

[legend]
Collaboration diagram for HCPU:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST CPU metrics HSK node record.

Valid Attributes:

  • CPU_Idle_[0-3]
  • CPU_Temp_[0-3]
  • MemUsage_[0-3]
  • CacheMisses_[0-3]
  • TaskStats_[0-3]

Definition at line 433 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HEBM Class Reference

gHSK::HEBM

HEBM Class Reference

GLAST EBM HSK node record. More...

Inheritance diagram for HEBM:

[legend]
Collaboration diagram for HEBM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST EBM HSK node record.

Valid Attributes:

  • Events
  • GEMreceive
  • TEM[0-15]receive
  • AEMreceive
  • SIU0receive
  • SIU1receive
  • EPU0receive
  • EPU1receive
  • EPU2receive
  • SIU0transmit
  • SIU1transmit
  • EPU0transmit
  • EPU1transmit
  • EPU2transmit
  • SSRtransmit

Definition at line 357 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HGEM Class Reference

gHSK::HGEM

HGEM Class Reference

GLAST GEM HSK node record. More...

Inheritance diagram for HGEM:

[legend]
Collaboration diagram for HGEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST GEM HSK node record.

Valid Attributes:

  • Events
  • Livetime
  • Prescaled
  • Busy
  • Sent
  • PPS
  • LastPPS
  • TriggerTime

Definition at line 329 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HNUL Class Reference

gHSK::HNUL

HNUL Class Reference

GLAST HSK null record. More...

Inheritance diagram for HNUL:

[legend]
Collaboration diagram for HNUL:

[legend]
List of all members.

Public Member Functions

__init__ (parent)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST HSK null record.

Valid Attributes:

  • EMPTY

Definition at line 447 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HPDU Class Reference

gHSK::HPDU

HPDU Class Reference

GLAST PDU HSK node record. More...

Inheritance diagram for HPDU:

[legend]
Collaboration diagram for HPDU:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, pduID)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST PDU HSK node record.

Valid Attributes:

  • ACDShellTemp0
  • ACDShellTemp1
  • ACDconvTemp
  • ACDpowerState
  • ACDpowerSupply
  • GridTemp[0-12]
  • RadiatorTemp[0-12]
  • RadiatorAfrzTemp0
  • RadiatorAfrzTemp1
  • CalBaseplateTemp[0-16]
  • VHCP_DSHP_M_Temp[0-6]
  • VHCP_DSHP_P_Temp[0-6]
  • VHCP_XLHP_M_Temp[0-6]
  • VHCP_XLHP_P_Temp[0-6]
  • VHCPRes_M_Temp[0-6]
  • VHCPRes_P_Temp[0-6]
  • TEM[0-16]_PCBTemp
  • TEM[0-16]_digital33V
  • TEM[0-16]_PSTemp
  • TEM[0-16]_powerState
  • ACDpmtRailTemp[0-4]
  • ACDBEAgridTemp[0-1]
  • GridRadiatorTemp[0-4]
  • EPUdigitalVoltage[0-3]
  • EPUTemp[0-3]
  • EPUCratePowerStat[0-3]
  • EPUConverterStat[0-3]

Definition at line 397 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskAlarmRecorder Class Reference

HskRecorder::HskAlarmRecorder

HskAlarmRecorder Class Reference

List of all members.

Public Member Functions

__init__ (ghsk)
processTrends (trendables)

Detailed Description

Applys the trends to the housekeeping node structure. As alarms are part of the node structure, we get those for free.

Definition at line 14 of file HskRecorder.py.

The documentation for this class was generated from the following file:
  • HskRecorder.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCli Class Reference

HskCli::HskCli

HskCli Class Reference

Housekeeping client input/output class. More...

List of all members.

Public Member Functions

__init__ (handler=None)
connect (server)
connect method
disconnect ()
disconnect method
handler (newhandler)

Detailed Description

Housekeeping client input/output class.

This class instantiates and controls the sockets for the housekeeping process.

Definition at line 17 of file HskCli.py.

Member Function Documentation

connect ( server )

connect method

Parameters:
server the hostname where the housekeeping server process runs connect the housekeeping system to the housekeeping server

disconnect ( )

disconnect method

disconnect the housekeeping system from housekeeping server

The documentation for this class was generated from the following file:
  • HskCli.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCollector Class Reference

HskCollector::HskCollector

HskCollector Class Reference

Configurable housekeeping collector. More...

List of all members.

Public Member Functions

__init__ (config)
latDB ()

Detailed Description

Configurable housekeeping collector.

Takes a HskConfiguration object as input.

Definition at line 30 of file HskCollector.py.

The documentation for this class was generated from the following file:
  • HskCollector.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskFileRecorder Class Reference

HskRecorder::HskFileRecorder

HskFileRecorder Class Reference

List of all members.

Public Member Functions

__init__ (ghsk, flatFile)

Detailed Description

Writes the Hsk EGUs to a flat file for later retrieval.

Definition at line 23 of file HskRecorder.py.

The documentation for this class was generated from the following file:
  • HskRecorder.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskHandler Class Reference

HskCli::HskHandler

HskHandler Class Reference

HskHandler class. More...

List of all members.

Public Member Functions

__init__ (server, host)
connect ()
connect
disconnected ()
disconnected
timedout ()
timedout

Detailed Description

HskHandler class.

Defines connection protocol to hsk server. This class needs to define two calls: disconnected and timeout.

Inherit from this to create GUI versions of HskSvr

Definition at line 104 of file HskCli.py.

Member Function Documentation

connect ( )

connect

Connect to the command/hsk server

The documentation for this class was generated from the following file:
  • HskCli.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskLatRetriever Class Reference

HskRetriever::HskLatRetriever

HskLatRetriever Class Reference

List of all members.

Public Member Functions

__init__ (glat)
retrievePacket ()

Detailed Description

Fully populated LAT retriever. Should get all available LAT housekeeping quantities and trend them.

Definition at line 14 of file HskRetriever.py.

The documentation for this class was generated from the following file:
  • HskRetriever.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskPacketRetriever Class Reference

HskPacketRetriever::HskPacketRetriever

HskPacketRetriever Class Reference

List of all members.

Public Member Functions

__init__ (hskCli)
retrievePacket ()

Detailed Description

Retrieve HSK ccsds packets from ethernet connection

Definition at line 14 of file HskPacketRetriever.py.

The documentation for this class was generated from the following file:
  • HskPacketRetriever.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskTestRetriever Class Reference

HskRetriever::HskTestRetriever

HskTestRetriever Class Reference

List of all members.

Public Member Functions

__init__ (glat)
retrievePacket ()
aeqBuildDummy (timestamp)

Detailed Description

Test HskRetriever

Definition at line 23 of file HskRetriever.py.

The documentation for this class was generated from the following file:
  • HskRetriever.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HTEM Class Reference

gHSK::HTEM

HTEM Class Reference

GLAST TEM HSK node record. More...

Inheritance diagram for HTEM:

[legend]
Collaboration diagram for HTEM:

[legend]
List of all members.

Public Member Functions

__init__ (client, parent, temID)
Initialize valid housekeeping quantities as Gattrs.

Detailed Description

GLAST TEM HSK node record.

Valid Attributes:

  • tkr_digital_v
  • tkr_digital_i
  • tkr_analoga_v
  • tkr_analoga_i
  • tkr_analogb_v
  • tkr_analogb_i
  • tkr_bias_v
  • tkr_bias_i
  • cal_digital_v
  • cal_digital_i
  • cal_analog_v
  • cal_analog_i
  • cal_bias_v
  • cal_bias_i
  • tem_digital_v
  • tem_digital_i
  • afee_[0-3]_t[0-1]
  • tkr_c[0-7]_t[0-1]
  • tkr_lrs_0_low
  • tkr_lrs_0_high
  • tkr_lrs_1_low
  • tkr_lrs_1_high
  • tkr_lrs_mask
  • cal_lrs_0
  • cal_lrs_0_mask
  • cal_lrs_1
  • cal_lrs_1_mask
  • deadtime

Definition at line 248 of file gHSK.py.

The documentation for this class was generated from the following file:
  • gHSK.py
Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: LATsweep Class Reference

LATsweep::LATsweep

LATsweep Class Reference

List of all members.

Public Member Functions

__init__ (lat, trigger, shut)
shut (sweepEvent, progress=None)

Detailed Description

Saves the current values of the registers, sets the TEM to a valid and known state for reliable event data taking. Triggers the event and then restores the registers to their prior values. This is done to make sure the sweep events that are retrieved from the TEM are good events.

Parameters:
lat | The LAT object hierarchy
trigger | The trigger object
sweepEvent | Event() object passed to the trigger

Definition at line 19 of file LATsweep.py.

The documentation for this class was generated from the following file:
  • LATsweep.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: LDBI_LATcontributionIterator Class Reference

testAppAcdScalers::LDBI_LATcontributionIterator

LDBI_LATcontributionIterator Class Reference

LDBI_LATcontributionIterator implementation. More...

List of all members.

Public Member Functions

__init__ (lci)
UDF (contrib, nextContrib)

Detailed Description

LDBI_LATcontributionIterator implementation.

Reimplements virtual UDF contribution handler from LATcontributionIterator This implementation checks if the contribution ID corresponds to a ACD Software Counter contribution, and parses it out into summary, cno and tile pieces. If the contribution ID does not match the expected ID, an error message is given, and the parser returns -1, an error.

Definition at line 139 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: LogRecordStreamHandler Class Reference

MSGLogGUIImpl::LogRecordStreamHandler

LogRecordStreamHandler Class Reference

List of all members.

Public Member Functions

handle ()
unPickle (data)
handleLogRecord (record)

Detailed Description

Handler for a streaming logging request. It basically logs the record using whatever logging policy is configured locally.

Definition at line 29 of file MSGLogGUIImpl.py.

Member Function Documentation

handle ( )

Handle multiple requests - each expected to be a 4-byte length, followed by the LogRecord in pickle format. Logs the record according to whatever policy is configured locally.

The documentation for this class was generated from the following file:
  • MSGLogGUIImpl.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MarkerTrgReadout Class Reference

testAppAcdScalers::MarkerTrgReadout

MarkerTrgReadout Class Reference

MarkerTrgReadout class definition. More...

List of all members.

Public Member Functions

__init__ ()
TrgReadout constructor.
zeroSuppress ()

Detailed Description

MarkerTrgReadout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the TACK command. This command will trigger a readout of the module's Front-End Electronics. Zero suppression is turned on. Marker is set to 1

Definition at line 120 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTExample Class Reference

MiniGLTExample::MiniGLTExample

MiniGLTExample Class Reference

MiniTower example interface to MiniGLT. More...

List of all members.

Public Member Functions

__init__ ()
AcdTriggerExample constructor.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
conditions ()
Implementation of conditions 'pure virtual' method from TrgAbstract.

Detailed Description

MiniTower example interface to MiniGLT.

Definition at line 21 of file MiniGLTExample.py.

The documentation for this class was generated from the following file:
  • MiniGLTExample.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTExample Class Reference

testAppAcdScalers::MiniGLTExample

MiniGLTExample Class Reference

MiniTower example interface to MiniGLT. More...

List of all members.

Public Member Functions

__init__ ()
AcdTriggerExample constructor.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
conditions ()
Implementation of conditions 'pure virtual' method from TrgAbstract.

Detailed Description

MiniTower example interface to MiniGLT.

Definition at line 69 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTExample Class Reference

test_evt_cal::MiniGLTExample

MiniGLTExample Class Reference

MiniTower example interface to MiniGLT. More...

List of all members.

Public Member Functions

__init__ ()
AcdTriggerExample constructor.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
conditions ()
Implementation of conditions 'pure virtual' method from TrgAbstract.

Detailed Description

MiniTower example interface to MiniGLT.

Definition at line 40 of file test_evt_cal.py.

The documentation for this class was generated from the following file:
  • test_evt_cal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedCondition Class Reference

MiniGLTExample::MiniGLTSolicitedCondition

MiniGLTSolicitedCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()

Detailed Description

Define a condition where only the CNO trigger is asserted

Definition at line 57 of file MiniGLTExample.py.

The documentation for this class was generated from the following file:
  • MiniGLTExample.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedCondition Class Reference

testAppAcdScalers::MiniGLTSolicitedCondition

MiniGLTSolicitedCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()

Detailed Description

Define a condition where only the CNO trigger is asserted

Definition at line 105 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedCondition Class Reference

test_evt_cal::MiniGLTSolicitedCondition

MiniGLTSolicitedCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()

Detailed Description

Define a condition where only the CNO trigger is asserted

Definition at line 76 of file test_evt_cal.py.

The documentation for this class was generated from the following file:
  • test_evt_cal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedEngine Class Reference

MiniGLTExample::MiniGLTSolicitedEngine

MiniGLTSolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 46 of file MiniGLTExample.py.

The documentation for this class was generated from the following file:
  • MiniGLTExample.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedEngine Class Reference

testAppAcdScalers::MiniGLTSolicitedEngine

MiniGLTSolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 94 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTSolicitedEngine Class Reference

test_evt_cal::MiniGLTSolicitedEngine

MiniGLTSolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 65 of file test_evt_cal.py.

The documentation for this class was generated from the following file:
  • test_evt_cal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTTrgConditionsValue Class Reference

TrgMiniGLT::MiniGLTTrgConditionsValue

MiniGLTTrgConditionsValue Class Reference

Inheritance diagram for MiniGLTTrgConditionsValue:

[legend]
Collaboration diagram for MiniGLTTrgConditionsValue:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgConditionsValue constructor.
value ()
Value method.
external ()
external() 'pure virtual' method

Detailed Description

This class overrides the value() method of TrgConditionsValue as the MiniGLT has a different bitmap for the MASK register. It also provides the external() function.

Use this class instead of TrgConditionsValue for MiniGLT operations.

Definition at line 55 of file TrgMiniGLT.py.

Member Function Documentation

external ( )

external() 'pure virtual' method

Condition corresponding to an external trigger source

Returns:
A boolean

Reimplemented from TrgConditionsValue.

value ( )

Value method.

Returns:
integer
Returns an integer corresponding to the conditionValue integer corresponding to the WINDOW_OPEN mask register of the GEM Ref: LAT-TD-01545, S 2.9.2

Reimplemented from TrgConditionsValue.

The documentation for this class was generated from the following file:
  • TrgMiniGLT.py
Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: myLATcomponentIterator Class Reference

GOSED_LDF::myLATcomponentIterator

myLATcomponentIterator Class Reference

LAT component Displayer. More...

List of all members.

Public Member Functions

__init__ (gui)
UDFcomponent (event, ebfContribution)
GLTcomponent (event, contribution)
OSWcomponent (event, contribution)
GEMcomponent (event, gemContribution)
ACDcomponent (event, aemContribution)
TKRcomponent (event, tkrContribution)
CALcomponent (event, calContribution)
diagnostic (event, contribution)
error (event, contribution)
getAcdPeds ()
getCalPeds ()
readPedestals ()

Detailed Description

LAT component Displayer.

This class obtains the information of all the LAT components from EBF and passes it to the corresponding component iterators, to be displayed in GOSED.

Definition at line 184 of file GOSED_LDF.py.

Member Function Documentation

__init__ ( gui )

myLATcomponentIterator contructor

Parameters:
gui GOSED

ACDcomponent | ( | event | ,
 |  | aemContribution |
 | ) |

Obtain the ACD information of the event

CALcomponent | ( | event | ,
 |  | calContribution |
 | ) |

Obtain the CAL information of the event to be processed by CALcontributionIterator1 and CALcontributionIterator2.

diagnostic | ( | event | ,
 |  | contribution |
 | ) |

Obtain the diagnostic information of the event.

error | ( | event | ,
 |  | contribution |
 | ) |

Obtain the error information of the event.

GEMcomponent | ( | event | ,
 |  | gemContribution |
 | ) |

Obtain the ACD information of the event

getAcdPeds ( )

Returns the numarray of Acd pedestals Array shape is (12,18,2,2) (cable, channel, range, mean/rms)

getCalPeds ( )

Returns the numarray of Cal pedestals Array shape is (16,8,12,2,4,2) (tower, layer, column, end, range, mean/rms)

GLTcomponent | ( | event | ,
 |  | contribution |
 | ) |

Obtain the "fingerprints" of the event

OSWcomponent | ( | event | ,
 |  | contribution |
 | ) |

Obtain the 'fingerprints' of the event

readPedestals ( )

Retrieve pedestals from file. Needs ANCILLARY_ROOT in environment and assumes pedestal files are in ${ANCILLARY_ROOT}/Consumer/acdPeds.txt and calPeds.txt

TKRcomponent | ( | event | ,
 |  | tkrContribution |
 | ) |

Obtain the TKR information of the event to be processed by TKRcontributionIterator.

The documentation for this class was generated from the following file:
  • GOSED_LDF.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NoCnoEnabled Class Reference

NullObjects::NoCnoEnabled

NoCnoEnabled Class Reference

Inheritance diagram for NoCnoEnabled:

[legend]
Collaboration diagram for NoCnoEnabled:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCnoEnables constructor.

Detailed Description

NoCnoEnabled class: Class defining a system where all CNO inputs are disabled.

Definition at line 83 of file NullObjects.py.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NoInputsEnabled Class Reference

NullObjects::NoInputsEnabled

NoInputsEnabled Class Reference

Inheritance diagram for NoInputsEnabled:

[legend]
Collaboration diagram for NoInputsEnabled:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgInputEnables constructor.
towers ()
Towers 'pure virtual' method.
cno ()
Cno 'pure virtual' method.

Detailed Description

NoInputsEnabled class: Class defining a system where no inputs are enabled.

Definition at line 92 of file NullObjects.py.

Member Function Documentation

cno ( )

Cno 'pure virtual' method.

Returns:
A TrgCnoEnables object

Reimplemented from TrgInputEnables.

towers ( )

Towers 'pure virtual' method.

Returns:
A TrgTowerEnables object

Reimplemented from TrgInputEnables.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NoTilesEnabled Class Reference

NullObjects::NoTilesEnabled

NoTilesEnabled Class Reference

Inheritance diagram for NoTilesEnabled:

[legend]
Collaboration diagram for NoTilesEnabled:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTileEnables constructor.
tile (tileNumber)
Tile 'pure virtual' method.

Detailed Description

NoTilesEnabled class: Class defining a system where no tiles are enabled.

Definition at line 73 of file NullObjects.py.

Member Function Documentation

tile ( tileNumber )

Tile 'pure virtual' method.

Parameters:
tileNumber A tile number
Returns:
An integer

Reimplemented from TrgTileEnables.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:14 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullCal Class Reference

NullObjects::NullCal

NullCal Class Reference

Inheritance diagram for NullCal:

[legend]
Collaboration diagram for NullCal:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCalorimeter constructor.
useHighEnergy ()
UseHighEnergy 'virtual' method.
useLowEnergy ()
UseLowEnergy 'virtual' method.

Detailed Description

NullCal class: Class defines a calorimeter which is inactive. Used by NullTower

Definition at line 46 of file NullObjects.py.

Member Function Documentation

useHighEnergy ( )

UseHighEnergy 'virtual' method.

Returns:
A boolean

Reimplemented from TrgCalorimeter.

useLowEnergy ( )

UseLowEnergy 'virtual' method.

Returns:
A boolean

Reimplemented from TrgCalorimeter.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:13 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullCoincidence Class Reference

NullObjects::NullCoincidence

NullCoincidence Class Reference

Inheritance diagram for NullCoincidence:

[legend]
Collaboration diagram for NullCoincidence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCoincidence constructor.
inCoincidence (tileNumber)
InCoincidence 'pure virtual' method To be satisfied by the user.

Detailed Description

NullCoincidence class: Class defining a coincidence set that is all null.

Definition at line 113 of file NullObjects.py.

Member Function Documentation

inCoincidence ( tileNumber )

InCoincidence 'pure virtual' method To be satisfied by the user.

Parameters:
tileNumber A tile number [0..107]
Returns:
An integer

Reimplemented from TrgCoincidence.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullEngine Class Reference

NullObjects::NullEngine

NullEngine Class Reference

Inheritance diagram for NullEngine:

[legend]
Collaboration diagram for NullEngine:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngine constructor.
participate (conditionsValue)
participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.
prescale ()
prescale 'pure virtual' method
request ()
request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Detailed Description

NullEngine class: This class defines an engine doesn't do anything. Prescale is set to -1 to prevent engine from firing.

Definition at line 124 of file NullObjects.py.

Member Function Documentation

participate ( conditionsValue )

participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.

Parameters:
conditionsValue An integer
Returns:
A boolean

Reimplemented from TrgEngine.

prescale ( )

prescale 'pure virtual' method

Returns:
An integer

Reimplemented from TrgEngine.

request ( )

request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Returns:
A TrgEngineRequest object

Reimplemented from TrgEngine.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullRequest Class Reference

NullObjects::NullRequest

NullRequest Class Reference

Inheritance diagram for NullRequest:

[legend]
Collaboration diagram for NullRequest:

[legend]
List of all members.

Public Member Functions

__init__ ()
constructor
sequence ()
sequence 'pure virtual' method

Detailed Description

NullRequest class: This class defines an engineRequest that doesn't do anything However sequence must be set, so the detector will be read out.

Definition at line 137 of file NullObjects.py.

Member Function Documentation

sequence ( )

sequence 'pure virtual' method

Returns:
An integer

Reimplemented from TrgEngineRequest.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullRoi Class Reference

NullObjects::NullRoi

NullRoi Class Reference

Inheritance diagram for NullRoi:

[legend]
Collaboration diagram for NullRoi:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgRoi constructor.
tile (tileNumber)
tile 'pure virtual' method

Detailed Description

NullRoi class: Class defining a system where the ROI contains no tiles.

Definition at line 103 of file NullObjects.py.

Member Function Documentation

tile ( tileNumber )

tile 'pure virtual' method

Parameters:
tileNumber A tile number
Returns:
A boolean

Reimplemented from TrgRoi.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullStream Class Reference

GlobalPanelImpl::NullStream

NullStream Class Reference

List of all members.

Public Member Functions

close ()
write (str)

Detailed Description

A file like class that writes nothing

Definition at line 31 of file GlobalPanelImpl.py.

The documentation for this class was generated from the following file:
  • GlobalPanelImpl.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullTkr Class Reference

NullObjects::NullTkr

NullTkr Class Reference

Inheritance diagram for NullTkr:

[legend]
Collaboration diagram for NullTkr:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTracker constructor.
use ()
Use 'virtual' method.

Detailed Description

NullTkr class: Class defines a tracker which is inactive. Used by NullTower

Definition at line 58 of file NullObjects.py.

Member Function Documentation

use ( )

Use 'virtual' method.

Returns:
A boolean

Reimplemented from TrgTracker.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:14 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullTower Class Reference

NullObjects::NullTower

NullTower Class Reference

Inheritance diagram for NullTower:

[legend]
Collaboration diagram for NullTower:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTower constructor.
calorimeter ()
Calorimeter 'pure virtual' method.
tracker ()
Tracker 'pure virtual' method.

Detailed Description

NullTower class: Class defines a tower with no calorimeter active and no tracker active.

Definition at line 34 of file NullObjects.py.

Member Function Documentation

calorimeter ( )

Calorimeter 'pure virtual' method.

Returns:
A TrgCalorimeter object

Reimplemented from TrgTower.

tracker ( )

Tracker 'pure virtual' method.

Returns:
A TrgTracker object

Reimplemented from TrgTower.

The documentation for this class was generated from the following file:
  • NullObjects.py
Generated on Fri Jan 21 18:01:13 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Preferences Class Reference

rcPreferencesManager::Preferences

Preferences Class Reference

Preferences dictionary Preferences needs a special dictionary class since the data it stores may have macros and environment variables in it. More...

List of all members.

Public Member Functions

__init__ ()
__getitem__ (item)
isDir (item)
isNumber (item)
expandVars (path)
composePath (path)

Detailed Description

Preferences dictionary Preferences needs a special dictionary class since the data it stores may have macros and environment variables in it.

In order to read the values unprocessed use the self.__prefs.get(item) method. If you need to resolve all the macros and environment variables then access it like any other dictionary (self.__prefs[item])

Definition at line 41 of file rcPreferencesManager.py.

The documentation for this class was generated from the following file:
  • rcPreferencesManager.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcArchiver Class Reference

rcArchiver::rcArchiver

rcArchiver Class Reference

Event Archiver. More...

Inheritance diagram for rcArchiver:

[legend]
List of all members.

Public Member Functions

__init__ (filePath=None, fileName=None, mode=MODE_CREATE, userId=123)
write (rawEventData)
writeTuple (tuple)
read ()
close ()
isClosed ()
getFileName ()
getFilePath ()

Static Public Member Functions

static getFileNameFromTS (ts)

Detailed Description

Event Archiver.

Default event archiver class to store event data to a file. This class can be inherited to create a custom event class and using it from a RunControl class by calling the setArchiverClass method.

Definition at line 19 of file rcArchiver.py.

The documentation for this class was generated from the following file:
  • rcArchiver.py
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcCompletionStatus Class Reference

rcComplStatus::rcCompletionStatus

rcCompletionStatus Class Reference

List of all members.

Public Member Functions

getCompletionStatusStr (status)
isCompletionStatus (status)
addCompletionStatus (status, statusStr)

Static Public Member Functions

static getCompletionStatus (statStr)

Detailed Description

This helper class provides methods to facilitate the management of completion codes.

Definition at line 7 of file rcComplStatus.py.

Member Function Documentation

addCompletionStatus | ( | status | ,
 |  | statusStr |
 | ) |

Adds the new completion status code and its description to the dictionary.

Parameters:
status | Completion status code
statusStr | Completion status description
Returns:
0: If add is successful. -1: If status code already exists. -2: If a duplicate description was found.

static getCompletionStatus ( statStr ) [static]

Return the completion status code based on the description.

Parameters:
statStr Completion status description
Returns:
Completion status code or None if it doesn't exist.

getCompletionStatusStr ( status )

Return the completion status string based on the code.

Parameters:
status Completion status code
Returns:
Completion status description or None if it doesn't exist.

isCompletionStatus ( status )

Check if status is already in the dictionary.

Parameters:
status Completion status code
Returns:
True : If it is already defined. False: Otherwise

The documentation for this class was generated from the following file:
  • rcComplStatus.py
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcGEMDefaultTrigger Class Reference

rcDefaultTrigger::rcGEMDefaultTrigger

rcGEMDefaultTrigger Class Reference

rcGEMDefaultTrigger More...

Inheritance diagram for rcGEMDefaultTrigger:

[legend]
Collaboration diagram for rcGEMDefaultTrigger:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcGEMDefaultTrigger constructor
conditions ()
conditions 'pure virtual' method
coincidences ()
Implementation of coincdences 'pure virtual' method from TrgUsingTiles.
inputEnables ()
Implementation of inputEnables 'pure virtual' method from TrgAbstract.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
useAcdAsTrigger ()
sweepOnShut ()
shut (sweepEvent=None, progress=None)

Detailed Description

rcGEMDefaultTrigger

Definition at line 22 of file rcDefaultTrigger.py.

Member Function Documentation

conditions ( )

conditions 'pure virtual' method

Returns:
A TrgConditionsValue object This object specifies the set of conditions to be enabled when the enable() member function is called

Reimplemented from TrgAbstract.

shut | ( | sweepEvent | = None,
 |  | progress | = None
 | ) |

Re-implementation of the shut function to take advantage of the fact that in rcTrgGem, trigger engine 0 is reserved for the marker.

Parameters:
sweepEvent: A sweep Event() defined by runControl
progress: An optional function that returns a non-zero value when when events are passing through the system. If omitted a fixed timeout is used.

Reimplemented from rcTrgGem.

sweepOnShut ( )

Returns whether or not shut() does a sweep event. Default true.

Returns:
a boolean

Reimplemented from rcTrgGem.

useAcdAsTrigger ( )

Don't use ACD as a trigger source.

Reimplemented from TrgUsingTiles.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcGEMTrgEngines Class Reference

rcDefaultTrigger::rcGEMTrgEngines

rcGEMTrgEngines Class Reference

Inheritance diagram for rcGEMTrgEngines:

[legend]
Collaboration diagram for rcGEMTrgEngines:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcTrgEngines constructor

Detailed Description

Class rcGEMTrgEngines: Initialize the trigger engines list class.

Definition at line 71 of file rcDefaultTrigger.py.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcMiniGLTDefaultTrigger Class Reference

rcDefaultTrigger::rcMiniGLTDefaultTrigger

rcMiniGLTDefaultTrigger Class Reference

rcMiniGLTDefaultTrigger More...

Inheritance diagram for rcMiniGLTDefaultTrigger:

[legend]
Collaboration diagram for rcMiniGLTDefaultTrigger:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcTrgGem constructor
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
conditions ()
Implementation of conditions 'pure virtual' method from TrgAbstract.
sweepOnShut ()
shut (sweepEvent=None, progress=None)

Detailed Description

rcMiniGLTDefaultTrigger

Definition at line 52 of file rcDefaultTrigger.py.

Member Function Documentation

shut | ( | sweepEvent | = None,
 |  | progress | = None
 | ) |

Re-implementation of the shut function to take advantage of the fact that in rcTrgMiniGLT, trigger engine 0 is reserved for the marker.

Parameters:
sweepEvent: A sweep Event() defined by runControl
progress: An optional function that returns a non-zero value when when events are passing through the system. If omitted a fixed timeout is used.

Reimplemented from rcTrgMiniGLT.

sweepOnShut ( )

Returns whether or not shut() does a sweep event. Default true.

Returns:
a boolean

Reimplemented from rcTrgMiniGLT.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcMiniGLTSolicitedCondition Class Reference

rcDefaultTrigger::rcMiniGLTSolicitedCondition

rcMiniGLTSolicitedCondition Class Reference

Inheritance diagram for rcMiniGLTSolicitedCondition:

[legend]
Collaboration diagram for rcMiniGLTSolicitedCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgConditionsValue constructor.
solicited ()
solicited() 'pure virtual' method

Detailed Description

Define a condition where only the CNO trigger is asserted

Definition at line 118 of file rcDefaultTrigger.py.

Member Function Documentation

solicited ( )

solicited() 'pure virtual' method

Condition corresponding to a solicited trigger

Returns:
A boolean

Reimplemented from TrgConditionsValue.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcMiniGLTSolicitedEngine Class Reference

rcDefaultTrigger::rcMiniGLTSolicitedEngine

rcMiniGLTSolicitedEngine Class Reference

Inheritance diagram for rcMiniGLTSolicitedEngine:

[legend]
Collaboration diagram for rcMiniGLTSolicitedEngine:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngine constructor.
participate (conditionsValue)
participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.
prescale ()
prescale 'pure virtual' method
request ()
request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 107 of file rcDefaultTrigger.py.

Member Function Documentation

participate ( conditionsValue )

participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.

Parameters:
conditionsValue An integer
Returns:
A boolean

Reimplemented from TrgEngine.

prescale ( )

prescale 'pure virtual' method

Returns:
An integer

Reimplemented from TrgEngine.

request ( )

request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Returns:
A TrgEngineRequest object

Reimplemented from TrgEngine.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcScmCfgSelector Class Reference

rcScmCfgSelector::rcScmCfgSelector

rcScmCfgSelector Class Reference

List of all members.

Public Member Functions

__init__ (startwithDir, startwithFile, parent=None, name=None, fl=0)
getValue ()

Detailed Description

GUI for getting the SchemaConfig file to use.

Definition at line 6 of file rcScmCfgSelector.py.

The documentation for this class was generated from the following file:
  • rcScmCfgSelector.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcScmCfgSelText Class Reference

rcScmCfgSelector::rcScmCfgSelText

rcScmCfgSelText Class Reference

List of all members.

Public Member Functions

__init__ (startwith)
getValue ()

Detailed Description

Text user interface for getting the user to a SchemaConfig file

Definition at line 14 of file rcScmCfgSelector.py.

The documentation for this class was generated from the following file:
  • rcScmCfgSelector.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSecurityMan Class Reference

rcSecurityMan::rcSecurityMan

rcSecurityMan Class Reference

List of all members.

Public Member Functions

__init__ (secureDir, users)
readPermissions ()
registerPermission (role, permission, permDesc)
checkPermission (user, permission)
roleHasPermission (role, permission)
getPermissions (role=None)
getPermissionDescription (permission)
getRoles ()
authenticateUser (loginId, password)
changePassword (loginId, password, userName, oldPassword="")
addPassword (loginId, password, userName)
checkPassword (loginId)
deleteUser (loginId)

Detailed Description

Security Manager class that contains user authentication and rights management routines.

Definition at line 17 of file rcSecurityMan.py.

Member Function Documentation

addPassword | ( | loginId | ,
 |  | password | ,
 |  | userName |
 | ) |

Add a new user to the password database

Parameters:
loginId | User's login id
password | The new password for the user
userName | User's full name
Returns:
-3: Error accessing the password database -2: User already exists in password database -1: Invalid login or password 0: Added user to the password database

authenticateUser | ( | loginId | ,
 |  | password |
 | ) |

Authenticate the user based on the given login id and password.

Parameters:
loginId | User's login id
password | User's password
Returns:
-1: User authentication failed, invalid user id or password -2: Password database is not accessible 0: Access granted

changePassword | ( | loginId | ,
 |  | password | ,
 |  | userName | ,
 |  | oldPassword | = ""
 | ) |

Change an existing user's password.

Parameters:
loginId | User's login id
password | The new password for the user
userName | User's full name
oldPassword | User's old password (optional). If this parameter is not specified the old password is not verified. This is useful when the password needs to be reset due to a forgotten password.
Returns:
-1: Invalid login or password -2: Password database is not accessible -3: Error accessing the password database 0: Password changed successfully

checkPassword ( loginId )

Checks if a user already has a password

Parameters:
loginId User's login id
Returns:
-1: Password does not exist 0: Password exists

checkPermission | ( | user | ,
 |  | permission |
 | ) |

Checks if the user has been granted the specified permission

Parameters:
user | rcUser object instance
permission | Permission name
Returns:
True: If the user is granted the permission False: Otherwise

deleteUser ( loginId )

Deletes the user based on the given login id and password.

Parameters:
loginId | User's login id
password | User's password
Returns:
-1: User authentication failed, invalid user id or password -2: Password database is not accessible 0: User deleted

getPermissionDescription ( permission )

Returns the description for the specified permission. If permission does not exist, returns None.

Parameters:
permission Permission name
Returns:
Permission description string

getPermissions ( role = None )

Returns the list of all permissions defined. If role has been specified then returns all permissions defined for that role.

Parameters:
role Role name
Returns:
List of sll permissions or permissions for the specified role

getRoles ( )

Returns the list of all roles defined.

Returns:
List of all roles.

readPermissions ( )

Read permissions from the security.cfg file and update user objects.

registerPermission | ( | role | ,
 |  | permission | ,
 |  | permDesc |
 | ) |

Method available to be called by a user script that allows the script to register a permission given a role and update any user permissions who belong in that role

Parameters:
role | Role name for the permission to be included.
permission | Permission name.
permDesc | Permission description

roleHasPermission | ( | role | ,
 |  | permission |
 | ) |

Check if permission exists in role.

Parameters:
role | Role name
permission | Permission name
Returns:
True: If role has permission. False: otherwise.

The documentation for this class was generated from the following file:
  • rcSecurityMan.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSolicitedCondition Class Reference

rcDefaultTrigger::rcSolicitedCondition

rcSolicitedCondition Class Reference

Inheritance diagram for rcSolicitedCondition:

[legend]
Collaboration diagram for rcSolicitedCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgConditionsValue constructor.
solicited ()
solicited() 'pure virtual' method

Detailed Description

Define a condition where only the solicited trigger is asserted

Definition at line 92 of file rcDefaultTrigger.py.

Member Function Documentation

solicited ( )

solicited() 'pure virtual' method

Condition corresponding to a solicited trigger

Returns:
A boolean

Reimplemented from TrgConditionsValue.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSolicitedEngine Class Reference

rcDefaultTrigger::rcSolicitedEngine

rcSolicitedEngine Class Reference

Inheritance diagram for rcSolicitedEngine:

[legend]
Collaboration diagram for rcSolicitedEngine:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngine constructor.
participate (conditionsValue)
participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.
prescale ()
prescale 'pure virtual' method
request ()
request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 81 of file rcDefaultTrigger.py.

Member Function Documentation

participate ( conditionsValue )

participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.

Parameters:
conditionsValue An integer
Returns:
A boolean

Reimplemented from TrgEngine.

prescale ( )

prescale 'pure virtual' method

Returns:
An integer

Reimplemented from TrgEngine.

request ( )

request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Returns:
A TrgEngineRequest object

Reimplemented from TrgEngine.

The documentation for this class was generated from the following file:
  • rcDefaultTrigger.py
Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTestReport Class Reference

rcTestReport::rcTestReport

rcTestReport Class Reference

Test Report class for RunControl. More...

List of all members.

Public Member Functions

__init__ ()
initReport (title)
addHTML (htmlString, section=None)
addHeading (text)
addSection (caption, insert=1)
insertSection (sectionId, beforeSectionId=None)
addSectionItem (sectionId, label, text, url='')
addSectionImage (sectionId, caption, url, width='', height='')
addSectionTable (sectionId, border='1', width='')
addTableHeader (tableId, text, align='')
beginTableRow (tableId)
addTableData (text, url='', align='', width='')
findTag (node, tagName)
xmlToString ()
transformToFile (xslFileName, htmlFileName)
getReports ()
getChildNodes (node)

Detailed Description

Test Report class for RunControl.

This class provides a mechanism to create test reports in a well formed (XML) format using the provided report building methods and lets the user transform it to HTML format by providing an XSLT stylesheet template. A third-party tool called Pyana is used to do the transformation. A sample template (reportStyle.xsl.sample) is provided in the RunControl directory. For more information on XSLT see the following links:

XSL Transformations W3C Recommendation

XSLT Tutorial

Definition at line 21 of file rcTestReport.py.

Member Function Documentation

addHeading ( text )

Adds a heading to the report

Parameters:
text Heading text

addHTML | ( | htmlString | ,
 |  | section | = None
 | ) |

Adds an arbitrary HTML fragment to the end of the report or a section

Parameters:
htmlString | HTML fragment.
section | Optional section id that this HTML will be written to. If no section is specified then HTML is added to the end of the report.

addSection | ( | caption | ,
 |  | insert | = 1
 | ) |

Adds a section to the report and returns the section id.

Parameters:
caption | Section caption
insert | 0 = Do not insert the section into the report 1 = Insert the section into the report (default)
Returns:
Section id.

addSectionImage | ( | sectionId | ,
 |  | caption | ,
 |  | url | ,
 |  | width | = '',
 |  | height | = ''
 | ) |

Adds an image to a section. Images can have a caption, and an optional width and height. The url parameter specifies the location of the image.

Parameters:
sectionId | Id of the section that this image will be inserted in.
caption | Image caption
url | Image source URL
width | Optional width of the image
height | Optional height of the image

addSectionItem | ( | sectionId | ,
 |  | label | ,
 |  | text | ,
 |  | url | = ''
 | ) |

Adds a section item. Section items are entries with a label and text and an optional URL.

Parameters:
sectionId | Id of the section that this item will be inserted in.
label | Item label
text | Item text
url | Item URL

addSectionTable | ( | sectionId | ,
 |  | border | = '1',
 |  | width | = ''
 | ) |

Adds a table to a section. Border and width are optional

Parameters:
sectionId | Id of the section that this image will be inserted in.
border | Specifies whether the table will have a border or not. Default value is 1.
width | Specifies the width of the border in percentage relative to the width of the page.
Returns:
Table id.

addTableData | ( | text | ,
 |  | url | = '',
 |  | align | = '',
 |  | width | = ''
 | ) |

Adds a data column to the table row that was started by the last beginTableRow() call.

Parameters:
text | Text of the data column.
url | Optional. If the text refers to a hyperlink provide the URL here.
align | Optional text alignment.
width | Optional column width in percentage.

addTableHeader | ( | tableId | ,
 |  | text | ,
 |  | align | = ''
 | ) |

Adds one column header to the table.

Parameters:
tableId | Id of the table where column headers are being added.
text | Column header text.
align | Optional text alignment.

beginTableRow ( tableId )

Starts a table row.

Parameters:
tableId Id of the table where the row is being added.

initReport ( title )

Initializes the report class and provides a title for the report

Parameters:
title The title that will show in the window title of the HTML browser

insertSection | ( | sectionId | ,
 |  | beforeSectionId | = None
 | ) |

Inserts a previously added section (with insert=0) to the specified position in the report.

Parameters:
sectionId | Id of the section to be inserted
beforeSectionId | Id of the section that will come after the section specified by sectionId. If it is None then it is appended to the end. Defaults to None.

transformToFile | ( | xslFileName | ,
 |  | htmlFileName |
 | ) |

Based on the input template and output filename parameters creates an HTML report.

Parameters:
xslFileName | Input XSLT template file name.
htmlFileName | Output HTML filename.

The documentation for this class was generated from the following file:
  • rcTestReport.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTransitions Class Reference

rcTransitions::rcTransitions

rcTransitions Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getFailedEvents ()
Return failed event count.
getFailedEventSends ()
Return number of failed event sends.
getValidEvents ()
Return number of events successfully sent.
getDiscardedEvents ()
Return number of events discarded.
getLengthMismatchedEvents ()
Return number of length mismatched events.
getUnsentEvents ()
Return number of events filtered or prescaled.
getAvgDeadTime ()
Return the average deadtime.
getRunId ()
Return the run id.
getSchemaConfigFile ()
Return the full path of the schema file.
getAddlInputFiles ()
Return a list containing the additional input files.
getArchiveFile ()
Return the filename for the archive file (LDF file).
getBadEventsFile ()
Return the filename for the bad events archive.
getErrorEventsFile ()
Return the filename for the error events archive.
getFITSfile ()
Return the filename for the FITS file.
getHSKfile ()
Return the filename for the housekeeping FITS file.
getPauseCount ()
Return number of times the test is paused.
getPausedTime ()
Return the amount of time spent in pause.
getEventCount ()
Return number of events received.
getElapsedTime ()
Return the elapsed time spent during test execution.
getEventRate ()
Return the event rate.
getInstEventRate ()
Return the instant event rate.
getInstDatagramSize ()
Return the instant datagram size.
getAvgDatagramSize ()
Return the instant datagram size divided by the number of events.
getInstByteRate ()
Return the instant datagram byte rate.
getStartTime ()
Return the test start time.
getEndTime ()
Return the test end time.
getBadEvents ()
Return number of events with a bad GGLT status.
getErrorEvents ()
Return number of error events.
setCmdCli (cmdCli)
Set the command client instance (used in suites).
setEvtCli (evtCli)
Set the event client instance.
getEvtCli ()
Return the current event client instance.
getDataDistributor ()
Return the data distribution server instance.
setSessionVar (key, value)
Set session variable key to value value.
getSessionVar (key)
Return the session variable identified by key.
setPrefs (prefs)
Explicitly set preferences.
setCompletionStatus (completionStatus, completionStatusStr=None)
Sets the completion status of the test.
getCompletionStatus ()
Return the completion status code.
getCompletionStatusStr ()
Return the description of the completion status.
getHSK ()
Return the housekeeping class instance.
addCustomReportData (key, value)
Add custom report data to the run report.
getParameterVerifier ()
Return the parameter verifier instance.
addExportedFile (file=None, delete=False)
Add file to the list of files to be exported.
getFileTimeStamp ()
Return the formatted timestamp used to name output files.
getRawTimeStamp ()
Return the raw timestamp as returned from gmtime().
getSuite ()
Return the name of the suite that this script is a part of.
setSuite (suite)
Set name of the suite for this script.
getSuiteInstance ()
Return the suite instance that this script is a part of.
setSuiteInstance (suiteInst)
Set the suite instance for this script.
setLastSuiteScript ()
Set the script as the last one in the suite.
isLastSuiteScript ()
Check if the script is the last one.
trigger (trg=None, replaceShut=True)
Return the trigger used in this script or initialize the trigger.
isRunFromSuite ()
Check if the script is being run from a suite.
takeSnapshot (stream=sys.stdout, fileName=None, captureGTIC=1, captureGAEQ=1, trigger=None, configName='', configVersion='')
Take a snapshot of the hardware.
readConfig (cfgFileName)
Read a configuration XML file.
applyConfig (seq=None, gxbrd=None)
Apply configuration.
setArchiverClass (archiverClass)
Set a custom archiver class.
getArchiverInstance ()
Return the archiver instance.
startExcludeTime ()
Save the start time for exclusion from the run's elapsed time.
endExcludeTime ()
Strobe the end time for exclusion from the run's elapsed time.
adjustExcludeTime (dExcludeTime)
This method allows adjustment of the amount of time to be excluded from the run's elapsed time.
rcSetup ()
Setup transition method.
rcTeardown ()
rcStartRun ()
rcStopRun ()
rcStop ()
rcPause ()
rcResume ()
getName ()
setup ()
teardown ()
startRun ()
stopRun ()
pause ()
resume ()
stop ()
process (eventBuffer)

Detailed Description

Class that handles the state machine transitions issued by Run Control

Definition at line 35 of file rcTransitions.py.

Member Function Documentation

addCustomReportData | ( | key | ,
 |  | value |
 | ) |

Add custom report data to the run report.

This method allows the application to add any additional data that Run Control is not already providing to the run report (rcReport.out).

When the custom report data gets processed and written to the database, it will go under the "AdditionFields" column. Please only provide values that can be converted to a string.

Parameters:
key | Custom report data identifier.
value | Custom report data value.

addExportedFile | ( | file | = None,
 |  | delete | = False
 | ) |

Add file to the list of files to be exported.

Parameters:
file | file to be added
delete | delete original on export (default False)

adjustExcludeTime ( dExcludeTime )

This method allows adjustment of the amount of time to be excluded from the run's elapsed time.

The amount of time to be excluded from the run's elapsed time can be adjusted positivily or negativily with this method. It does not take into account any other effects on the excluded time, such as whether the run was in the PAUSED state.

Parameters:
dExcludeTime The amount of time to be excluded as given by the difference of two time.time() values.

applyConfig | ( | seq | = None,
 |  | gxbrd | = None
 | ) |

Apply configuration.

Parameters:
seq | Sequence number of the configuration. If None, then apply all configurations.
gxbrd | Apply the GXBRD configuration as well. Disabled by default.

endExcludeTime ( )

Strobe the end time for exclusion from the run's elapsed time.

This method allows excluding some amount of time from the run's elapsed time. The end time is the time that the method is called. The difference between the end time and the start time is added to the excluded time.

getAddlInputFiles ( )

Return a list containing the additional input files.

This list is automatically generated from the XML files included in the schema using the <include> tag. The list contains only the filename portion and doesn't include the full path.

Returns:
List of additional input files.

getArchiveFile ( )

Return the filename for the archive file (LDF file).

Returns:
Archive filename.

getArchiverInstance ( )

Return the archiver instance.

Returns the archiver instance. Can be used by the user application.

Returns:
Archiver instance

getAvgDatagramSize ( )

Return the instant datagram size divided by the number of events.

Returns:
Average datagram size

getAvgDeadTime ( )

Return the average deadtime.

Returns the average deadtime as a percentage.

Returns:
Average deadtime.

getBadEvents ( )

Return number of events with a bad GGLT status.

Returns:
Number of bad events

getBadEventsFile ( )

Return the filename for the bad events archive.

Returns:
Bad events archive filename.

getCompletionStatus ( )

Return the completion status code.

Returns the code set by the script or COMPL_STATUS_UNDEFINED if it hasn't been set.

Returns:
Completion status code.

getCompletionStatusStr ( )

Return the description of the completion status.

Returns the code as set by the script or 'UNDEFINED' if it hasn't been set.

Returns:
Completion status description.

getDataDistributor ( )

Return the data distribution server instance.

Returns:
Data distribution server instance.

getDiscardedEvents ( )

Return number of events discarded.

OES increments this counter when an event has been discarded. Currently this method always returns 0.

Returns:
Number of events discarded.

getElapsedTime ( )

Return the elapsed time spent during test execution.

Returns:
Elapsed time.

getEndTime ( )

Return the test end time.

Returns:
Test end time in GMT as a tuple

getErrorEvents ( )

Return number of error events.

Returns:
Number of error events

getErrorEventsFile ( )

Return the filename for the error events archive.

Returns:
Error events archive filename.

getEventCount ( )

Return number of events received.

Returns:
Event count

getEventRate ( )

Return the event rate.

Returns:
Event rate.

getEvtCli ( )

Return the current event client instance.

Returns:
An EvtCli instance

getFailedEvents ( )

Return failed event count.

OES increments this counter when there is a packet transmission error.

Returns:
Failed event count.

getFailedEventSends ( )

Return number of failed event sends.

OES increments this counter when there is a TCP transport problem between the SBC and the teststand.

Returns:
Number of failed event sends.

getFileTimeStamp ( )

Return the formatted timestamp used to name output files.

Using this method, applications can request the formatted timestamp value used in naming archive, snapshot and housekeeping files. The format is YYMMDDHHMISS.

Returns:
Formatted GMT timestamp

getFITSfile ( )

Return the filename for the FITS file.

Returns:
FITS filename.

getHSK ( )

Return the housekeeping class instance.

Returns:
Housekeeping class instance

getHSKfile ( )

Return the filename for the housekeeping FITS file.

Returns:
Housekeeping FITS filename.

getInstByteRate ( )

Return the instant datagram byte rate.

Returns:
Average datagram byte rate

getInstDatagramSize ( )

Return the instant datagram size.

Returns:
Instant datagram size.

getInstEventRate ( )

Return the instant event rate.

Returns:
Instant event rate.

getLengthMismatchedEvents ( )

Return number of length mismatched events.

OES increments this counter when an event size doesn't match the length specified in the event. Currently this method always returns 0.

Returns:
Number of length mismatched events.

getParameterVerifier ( )

Return the parameter verifier instance.

Returns:
Parameter verifier instance

getPauseCount ( )

Return number of times the test is paused.

Returns:
Pause count

getPausedTime ( )

Return the amount of time spent in pause.

Returns:
Pause time.

getRawTimeStamp ( )

Return the raw timestamp as returned from gmtime().

Returns:
Raw GMT timestamp tuple.

getRunId ( )

Return the run id.

Returns:
Run id

getSchemaConfigFile ( )

Return the full path of the schema file.

Returns:
Schema file path

getSessionVar ( key )

Return the session variable identified by key.

Parameters:
key Session variable identifier.
Returns:
Value of the session variable if it exists, otherwise None.

getStartTime ( )

Return the test start time.

Returns:
Test start time in GMT as a tuple

getSuite ( )

Return the name of the suite that this script is a part of.

Returns:
Suite name.

getSuiteInstance ( )

Return the suite instance that this script is a part of.

Returns:
Suite instance.

getUnsentEvents ( )

Return number of events filtered or prescaled.

OES increments this counter when there is a filter or prescale set that prevents the event from being transmitted.

Returns:
Number of unsent events.

getValidEvents ( )

Return number of events successfully sent.

OES increments this counter when an event has been successfully transmitted to the teststand.

Returns:
Number of valid events sent.

isRunFromSuite ( )

Check if the script is being run from a suite.

Returns:
True If the script is being run from a suite, False otherwise.

pause ( )

Method that is called on the PAUSE transition

process ( eventBuffer )

Method that is called on every data event taken

readConfig ( cfgFileName )

Read a configuration XML file.

Parameters:
cfgFileName Full path of the configuration file.
Returns:
Sequence number for this configuration. This number can later be passed to applyConfig.

resume ( )

Method that is called on the RESUME transition

setArchiverClass ( archiverClass )

Set a custom archiver class.

Set a custom archiver class. This is typically done in the __init__ method of the userApplication class.

Parameters:
The archiver class (not the instance)

setCmdCli ( cmdCli )

Set the command client instance (used in suites).

Parameters:
A CmdCli instance

setCompletionStatus | ( | completionStatus | ,
 |  | completionStatusStr | = None
 | ) |

Sets the completion status of the test.

Please use one of the following:

  • COMPL_STATUS_ABORTED = -2
  • COMPL_STATUS_ERROR = -3
  • COMPL_STATUS_FAILED = -3
  • COMPL_STATUS_SUCCESS = 0
  • COMPL_STATUS_PASSED = 0
  • COMPL_STATUS_PASSED_CONDITIONALLY = -4
  • COMPL_STATUS_MARGINAL = -5

Or a user defined completion status in which case a description needs to be supplied along with the code.

Parameters:
completionStatus | Numeric completion status code
completionStatusStr | Completion status description

setEvtCli ( evtCli )

Set the event client instance.

Used to set the custom event client.

Parameters:
A CmdCli instance

setLastSuiteScript ( )

Set the script as the last one in the suite.

Called from rcSuite.

setPrefs ( prefs )

Explicitly set preferences.

When scripts are run in standalone mode it may be necessary to pass in a script defined set of preferences.

The preferences specified in prefs get appended to the set of preferences read from the configuration file.

Parameters:
prefs Preferences as a dictionary.

setSessionVar | ( | key | ,
 |  | value |
 | ) |

Set session variable key to value value.

Session variables are data that is shared between different runs. They exist as long as the run control session they are defined in. Typical uses of session variables are to pass data from one suite script to another or to maintain state during a multiple step test run.

Parameters:
key | Session variable identifier.
value | Session variable value.

setSuite ( suite )

Set name of the suite for this script.

Called from rcSuite.

setSuiteInstance ( suiteInst )

Set the suite instance for this script.

Called from rcSuite.

setup ( )

Method that is called on the SETUP transition

startExcludeTime ( )

Save the start time for exclusion from the run's elapsed time.

This method allows excluding some amount of time from the run's elapsed time. The start time is the time that the method is called.

Note that time spent in the PAUSED state is also excluded from the elapsed time value. Overlapping time is excluded from the elapsed time only once.

startRun ( )

Method that is called on the START_RUN transition

stop ( )

Method that is called on the STOP transition

stopRun ( )

Method that is called on the STOP_RUN transition

takeSnapshot | ( | stream | = sys.stdout,
 |  | fileName | = None,
 |  | captureGTIC | = 1,
 |  | captureGAEQ | = 1,
 |  | trigger | = None,
 |  | configName | = '',
 |  | configVersion | = ''
 | ) |

Take a snapshot of the hardware.

If snapshots are enabled in Run Control preferences, two snapshots will be taken, one before and one after the test has been run. This method allows the application to take a snapshot at a specific point of the run.

It is the application's responsibility to add the resulting file to the list of exported files by calling the addExportedFile method.

Since snapshots essentially have the same format as configuration blocks, configName and configVersion parameters can be used to output a named configuration.

Parameters:
stream | Output stream for the snapshot. sys.stdout by default.
fileName | Full path of the snapshot file.
captureGTIC | Capture TEM environmental quantities. Enabled by default.
captureGAEQ | Capture AEM environmental quantities. Enabled by default.
trigger | Trigger object. If miniGLT is used as a trigger then GLT registers can be snapshot.
configName | Configuration name
configVersion | Configuration version
Returns:
True if the snapshot was successful, False if errors were encountered during snapshot

teardown ( )

Method that is called on the TEARDOWN transition

trigger | ( | trg | = None,
 |  | replaceShut | = True
 | ) |

Return the trigger used in this script or initialize the trigger.

Parameters:
trg | Trigger object.
replaceShut | Flag to specify whether the trigger's default shut logic should be wrapped by Run Control's LATsweep shut logic. Default is True.
Returns:
Trigger object.

The documentation for this class was generated from the following file:
  • rcTransitions.py
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgCoincidence Class Reference

rcTrgFunctions::rcTrgCoincidence

rcTrgCoincidence Class Reference

rcTrgCoincidence class More...

Inheritance diagram for rcTrgCoincidence:

[legend]
Collaboration diagram for rcTrgCoincidence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCoincidence constructor.
addPair (tile1, tile2)
addPair(tile1, tile2)
inCoincidence (tileNumber)
InCoincidence 'pure virtual' method To be satisfied by the user.

Detailed Description

rcTrgCoincidence class

Class to provide a function to add tiles to coincidence sets. Also does checking to see if tiles are in the allowed tile set

Definition at line 109 of file rcTrgFunctions.py.

Member Function Documentation

addPair | ( | tile1 | ,
 |  | tile2 |
 | ) |

addPair(tile1, tile2)

Parameters:
tile1 | an integer
tile2 | an integer
Add a tile pair, tile1,tile2 to a coincidence list. Note, the set of tile1 objects must be unique.

inCoincidence ( tileNumber )

InCoincidence 'pure virtual' method To be satisfied by the user.

Parameters:
tileNumber A tile number [0..107]
Returns:
An integer

Reimplemented from TrgCoincidence.

The documentation for this class was generated from the following file:
  • rcTrgFunctions.py
Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgEngines Class Reference

rcTrgFunctions::rcTrgEngines

rcTrgEngines Class Reference

rcTrgEngines Class More...

Inheritance diagram for rcTrgEngines:

[legend]
Collaboration diagram for rcTrgEngines:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcTrgEngines constructor
replaceEngine (engineNumber, engine)
replaceEngine() method
engine (engineNumber)
engine() method

Detailed Description

rcTrgEngines Class

Setup a LATTE based trigger engine system. All sixteen (16) engines are defined. [0..14] are NullEngine, the last is a reserved engine that transmits the sweep marker on transitions.

Definition at line 25 of file rcTrgFunctions.py.

Member Function Documentation

engine ( engineNumber )

engine() method

Return one of the engines

Parameters:
engineNumber: The engine to return

Reimplemented from TrgEngines.

replaceEngine | ( | engineNumber | ,
 |  | engine |
 | ) |

replaceEngine() method

Replace one of the engines.

Parameters:
engineNumber: The engine number to replace [0..14]
engine: The replacement engine

The documentation for this class was generated from the following file:
  • rcTrgFunctions.py
Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgGem Class Reference

rcTrgGem::rcTrgGem

rcTrgGem Class Reference

rcTrgGem class definition This class implements a 'threaded' model for enabling/disabling the trigger More...

Inheritance diagram for rcTrgGem:

[legend]
Collaboration diagram for rcTrgGem:

[legend]
List of all members.

Public Member Functions

__init__ ()
commit (gem=None)
public commit function
waitForMaskEnable (tmo=None)
getEnableTime ()
getDisableTime ()
getTimeStamp ()
sweepOnShut ()
enable (mask=None)
disable ()
shut (sweepEvent, progress=None)

Detailed Description

rcTrgGem class definition This class implements a 'threaded' model for enabling/disabling the trigger

Definition at line 17 of file rcTrgGem.py.

Member Function Documentation

__init__ ( )

rcTrgGem constructor

Reimplemented from TrgGem.

Reimplemented in rcGEMDefaultTrigger, and TrgUsingTiles.

commit ( gem = None )

public commit function

This function commits the configuration defined by this TrgGem object to the hardware. It does *all* the registers. This function should never be called by anyone other than Run Control.

disable ( )

Re-implementation of the disable() function to take advantage of threading

Reimplemented from TrgGem.

enable ( mask = None )

Re-implementation of the enable() function to take advantage of threading

Reimplemented from TrgGem.

getDisableTime ( )

Returns the VxWorks timestamp at the time the triggers are disabled

Returns:
Trigger disable time

getEnableTime ( )

Returns the VxWorks timestamp at the time the triggers are enabled

Returns:
Trigger enable time

getTimeStamp ( )

Returns the VxWorks timestamp for the last time a self-trigger was asserted.

Returns:
Trigger timestamp

shut | ( | sweepEvent | ,
 |  | progress | = None
 | ) |

Re-implementation of the shut function to take advantage of the fact that in rcTrgGem, trigger engine 0 is reserved for the marker.

Parameters:
sweepEvent: A sweep Event() defined by runControl
progress: An optional function that returns a non-zero value when when events are passing through the system. If omitted a fixed timeout is used.

Reimplemented in rcGEMDefaultTrigger.

sweepOnShut ( )

Returns whether or not shut() does a sweep event. Default true.

Returns:
a boolean

Reimplemented in rcGEMDefaultTrigger.

waitForMaskEnable ( tmo = None )

Waits until the enableMask() method is called. This is usually needed by non-self-triggering scripts where the _commandSynch thread needs to wait until RunControl actually enables the mask before continuing.

Parameters:
tmo Optional parameter giving the wait timeout in seconds

The documentation for this class was generated from the following file:
  • rcTrgGem.py
Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgMiniGLT Class Reference

rcTrgMiniGLT::rcTrgMiniGLT

rcTrgMiniGLT Class Reference

rcTrgMiniGLT class definition This class implements a 'threaded' model for enabling/disabling the trigger More...

Inheritance diagram for rcTrgMiniGLT:

[legend]
Collaboration diagram for rcTrgMiniGLT:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcTrgGem constructor
commit ()
public commit function This function commits the configuration defined by this TrgGem object to the hardware. It does *all* the registers. This function should never be called by anyone other than Run Control.
waitForMaskEnable (tmo=None)
getEnableTime ()
getDisableTime ()
getTimeStamp ()
sweepOnShut ()
enable (newMask=None)
disable ()
shut (sweepEvent, progress=None)

Detailed Description

rcTrgMiniGLT class definition This class implements a 'threaded' model for enabling/disabling the trigger

Definition at line 17 of file rcTrgMiniGLT.py.

Member Function Documentation

disable ( )

Re-implementation of the disable() function to take advantage of threading and timestamps

Reimplemented from TrgMiniGLT.

enable ( newMask = None )

Re-implementation of the enable() function to take advantage of threading and timestamps

Adds an argument to deal with several weird masking problems Only rcTransitions should use the above argument

getDisableTime ( )

Returns the VxWorks timestamp at the time the triggers are disabled

Returns:
Trigger disable time

getEnableTime ( )

Returns the VxWorks timestamp at the time the triggers are enabled

Returns:
Trigger enable time

getTimeStamp ( )

Returns the VxWorks timestamp for the last time a self-trigger was asserted.

Returns:
Trigger timestamp

shut | ( | sweepEvent | ,
 |  | progress | = None
 | ) |

Re-implementation of the shut function to take advantage of the fact that in rcTrgMiniGLT, trigger engine 0 is reserved for the marker.

Parameters:
sweepEvent: A sweep Event() defined by runControl
progress: An optional function that returns a non-zero value when when events are passing through the system. If omitted a fixed timeout is used.

Reimplemented in rcMiniGLTDefaultTrigger.

sweepOnShut ( )

Returns whether or not shut() does a sweep event. Default true.

Returns:
a boolean

Reimplemented in rcMiniGLTDefaultTrigger.

waitForMaskEnable ( tmo = None )

Waits until the enableMask() method is called. This is usually needed by non-self-triggering scripts where the _commandSynch thread needs to wait until RunControl actually enables the mask before continuing.

Parameters:
tmo Optional parameter giving the wait timeout in seconds

The documentation for this class was generated from the following file:
  • rcTrgMiniGLT.py
Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgTileEnables Class Reference

rcTrgFunctions::rcTrgTileEnables

rcTrgTileEnables Class Reference

rcTrgTileEnables class More...

Inheritance diagram for rcTrgTileEnables:

[legend]
Collaboration diagram for rcTrgTileEnables:

[legend]
List of all members.

Public Member Functions

__init__ ()
rcTrgTileEnables constructor
tile (tileNumber)
Tile 'pure virtual' method.
addTile (tileNumber, side)

Detailed Description

rcTrgTileEnables class

Class to abstract the additions of tiles to the input enable list. All tiles *not* in the enable list are specifically disabled

Definition at line 93 of file rcTrgFunctions.py.

Member Function Documentation

tile ( tileNumber )

Tile 'pure virtual' method.

Parameters:
tileNumber A tile number
Returns:
An integer

Reimplemented from TrgTileEnables.

The documentation for this class was generated from the following file:
  • rcTrgFunctions.py
Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUser Class Reference

rcUsers::rcUser

rcUser Class Reference

List of all members.

Public Member Functions

__init__ (userId, loginId, userName)
getId ()
getLoginId ()
getName ()
getRoles ()
getPermissions ()
addRole (role)
addPermission (permission)
isAdministrator ()
__str__ ()

Detailed Description

Class that stores security and identification information about users

Definition at line 6 of file rcUsers.py.

Member Function Documentation

addPermission ( permission )

Adds permission to this user's permissions

Parameters:
permission Permission name

addRole ( role )

Adds role to this user's roles

Parameters:
role Role name

getId ( )

Returns the three digit user id

Returns:
User Id

getLoginId ( )

Returns the user's login id

Returns:
Login id

getName ( )

Returns the user name

Returns:
User name

getPermissions ( )

Returns the list of permissions that this user has

Returns:
List of permissions

getRoles ( )

Returns the list of roles that this user belongs in

Returns:
List of roles

isAdministrator ( )

Returns the user's administrator status

Returns:
1: If this user is an administrator 0: Otherwise

The documentation for this class was generated from the following file:
  • rcUsers.py
Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUsers Class Reference

rcUsers::rcUsers

rcUsers Class Reference

List of all members.

Public Member Functions

__init__ ()
addUser (user)
deleteUser (userId)
getUserByLoginId (loginId)
getUserByName (name)
getUser (userId)
getUsers ()
getIdNameDict ()

Detailed Description

A dictionary like class that maintains a list of user objects

Definition at line 64 of file rcUsers.py.

Member Function Documentation

addUser ( user )

Adds the user to the list

Parameters:
user An rcUser object instance

deleteUser ( userId )

Deletes the user from the list based on the userId

Parameters:
userId The three digit id of the user

getIdNameDict ( )

Retrieves all users in the form of a dictionary where values are user names. Provided for backward compatibility with the old code.

Returns:
A dictionary of user names keyed by the user id

getUser ( userId )

Retrieves the user based on userid

Parameters:
Three digit of the user
Returns:
rcUser object instance

getUserByLoginId ( loginId )

Retrieves the user based on the loginId

Parameters:
loginId Login id of the user
Returns:
rcUser object instance

getUserByName ( name )

Retrieves the user based on the name

Parameters:
name Name of the user
Returns:
rcUser object instance

getUsers ( )

Retrieves all users

Returns:
A dictionary of all users keyed by the user id

The documentation for this class was generated from the following file:
  • rcUsers.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Receiver Class Reference

Receiver::Receiver

Receiver Class Reference

Abstract Receiver class. More...

Inheritance diagram for Receiver:

[legend]
List of all members.

Public Member Functions

__init__ ()
isReceiving ()
setReceiving (bool)
shutdown ()
receive ()
process (trendables)

Detailed Description

Abstract Receiver class.

Receiver objects retrieve the trendable data from some location.

Definition at line 11 of file Receiver.py.

The documentation for this class was generated from the following file:
  • Receiver.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Recorder Class Reference

Recorder::Recorder

Recorder Class Reference

Recorder class. More...

Inheritance diagram for Recorder:

[legend]
List of all members.

Public Member Functions

__init__ ()
updateTrends (trendables)
processTrends (trendables)
shutdown ()

Detailed Description

Recorder class.

Base class for the Recorder portion of the monitoring system. Recorders send on the data that the Retriever class acquires.

Definition at line 11 of file Recorder.py.

The documentation for this class was generated from the following file:
  • Recorder.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RegisterInterface Class Reference

HskRegisters::RegisterInterface

RegisterInterface Class Reference

List of all members.

Public Member Functions

__init__ (node, name)
RegisterReader constructor.
name ()
write (value)

Detailed Description

Represents a LAT housekeeping register for reading.

Definition at line 9 of file HskRegisters.py.

Member Function Documentation

__init__ | ( | node | ,
 |  | name |
 | ) |

RegisterReader constructor.

Parameters:
node: a gNode (like GAEQ)
name: a name (like env_free_1la)

write ( value )

writes to the register

The documentation for this class was generated from the following file:
  • HskRegisters.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Reloader Class Reference

rcUtil::Reloader

Reloader Class Reference

List of all members.

Public Member Functions

__init__ ()
__call__ (args, namedargs)

Detailed Description

Class allows for reloading all modules imported after the instance is created.

Definition at line 10 of file rcUtil.py.

The documentation for this class was generated from the following file:
  • rcUtil.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ReverseTrendMap Class Reference

TrendMaps::ReverseTrendMap

ReverseTrendMap Class Reference

List of all members.

Public Member Functions

__init__ (startMap)
mapSet (key, value)
mapGet (key)
mapKeys ()

Detailed Description

Class to create a reverse map from a TrendMap using gnodes as function ptrs such as GHSKTrendMap and GLATTrendMap

Definition at line 28 of file TrendMaps.py.

The documentation for this class was generated from the following file:
  • TrendMaps.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControl Class Reference

RunControl::RunControl

RunControl Class Reference

List of all members.

Public Member Functions

__init__ (common, parent=None, name=None, fl=0)
disconnected ()
timedout ()
connectClicked ()
userId ()
SetupClicked ()
TeardownClicked ()
StartRunClicked ()
StopRunClicked ()
PauseClicked ()
ResumeClicked ()
StopClicked ()
load ()
fileExit ()
ExitButtonClicked ()
doReset ()
doStop ()
doStopRun ()
doRun ()
doPause ()
doEmit (obj, signal=SIGNAL("clicked()"), args=())
normalCursor ()
waitCursor ()
getHardwareVersions (lat=None)
clearHardwareVersionsCache ()
getFSM ()
setLAT (lat)
initGUIbridges ()
isGUIthread ()
customEvent (e)
createGUI (obj, args, kwargs)
execGUImethodNR (func, args, kwargs)
execGUImethod (func, args, kwargs)

Detailed Description

Class for providing a run control framework

Definition at line 31 of file RunControl.py.

Member Function Documentation

createGUI | ( | obj | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for instantiating a GUI from a non-GUI subthread

doEmit | ( | obj | ,
 |  | signal | = SIGNAL("clicked()"),
 |  | args | = ()
 | ) |

Emit a signal, possibly from a subthread. By default the signal is 'clicked()' with no arguments.

doPause ( )

Emit a Pause button click under program control. Can be done from a subthread.

doReset ( )

Emit a Reset button click under program control. Can be done from a subthread.

doRun ( )

Emit a Run button click under program control. Can be done from a subthread.

doStop ( )

Emit a Stop button click under program control. Can be done from a subthread.

doStopRun ( )

Depricated version of doStop().

execGUImethod | ( | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread. Use this method when a response is expected from the function and when it is appropriate to wait for it (no deadlock arises)

execGUImethodNR | ( | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread. Use this method when no (useful) response is expected or when waiting for one could cause a deadlock. Any response from the function is lost.

The documentation for this class was generated from the following file:
  • RunControl.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlCommon Class Reference

RunControlCommon::RunControlCommon

RunControlCommon Class Reference

List of all members.

Public Member Functions

__init__ ()
initialize ()
connect ()
disconnect ()
readSchema (filename)
elogWebsite ()
EBFdistribution ()
setLoggingLevel (logLevel=None)
startLogger ()
options ()
prefMan ()
prefGUI ()
getMSGLogger ()
getDDS ()
getCmdCli ()
getEvtCli ()
getLAT ()
getXBRD ()
getOCS ()
getDBN ()
getSecurityMan ()
getLoginId ()
showLogin (parent)

Detailed Description

Common class for providing a run control helper functions

Definition at line 69 of file RunControlCommon.py.

Member Function Documentation

getLoginId ( )

Returns the login id for the last successful login

The documentation for this class was generated from the following file:
  • RunControlCommon.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlFileHandler Class Reference

RunControlCommon::RunControlFileHandler

RunControlFileHandler Class Reference

FileHandler class for handling multiple line log entries. More...

List of all members.

Public Member Functions

__init__ (filename, mode)
emit (record)

Detailed Description

FileHandler class for handling multiple line log entries.

If a log entry contains multiple lines, such as the case for tracebacks or exceptions a begin and end delimiter is added to the log entry so that it can be parsed by the MessageLogger

Definition at line 60 of file RunControlCommon.py.

The documentation for this class was generated from the following file:
  • RunControlCommon.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlMain Class Reference

RunControlMain::RunControlMain

RunControlMain Class Reference

List of all members.

Public Member Functions

__init__ (common, parent=None, name="RunControl", fl=0)
disconnected ()
timedout ()
connectClicked ()
applyPermissions (operator)
setEnabledTabPage (panelLabel, enable)
setOperator (operator)
setParticleType (particleType)
setOrientation (orientation)
getName ()
initApp ()
Method usually invoked by the GUI to load a new application.
loadApp (applName)
Method that can be invoked from code to load a new application.
ResetClicked ()
StopClicked ()
RunClicked ()
PauseClicked ()
doReset ()
doStop ()
doStopRun ()
doRun ()
doPause ()
doEmit (obj, signal=SIGNAL("clicked()"), args=())
normalCursor ()
waitCursor ()
handleComments (fromState, toState)
showHidePythonShell ()
verifySoftware ()
elogWebsite ()
warnFreeSpace (warn_level)
aboutRunControl ()
fileLogout ()
closeEvent (e)
login ()
getHardwareVersions (lat=None, xbrd=None)
clearHardwareVersionsCache ()
getFSM ()
getApp ()
isGUIthread ()
customEvent (e)
createGUI (obj, args, kwargs)
execGUImethodNR (func, args, kwargs)
execGUImethod (func, args, kwargs)
getSecurityMan ()

Detailed Description

Class for providing a run control framework

Definition at line 37 of file RunControlMain.py.

Member Function Documentation

createGUI | ( | obj | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for instantiating a GUI from a non-GUI subthread

customEvent ( e )

This method overrides the QObject base class's. There is generally no reason to call this method directly. It is called by the Qt infrastructure whenever the custom event is posted, e.g. by the following three methods of this class: createGUI, execGUImethodNR and execGUImethod.

doEmit | ( | obj | ,
 |  | signal | = SIGNAL("clicked()"),
 |  | args | = ()
 | ) |

Emit a signal, possibly from a subthread. By default the signal is 'clicked()' with no arguments.

doPause ( )

Emit a Pause button click under program control. Can be done from a subthread.

doReset ( )

Emit a Reset button click under program control. Can be done from a subthread.

doRun ( )

Emit a Run button click under program control. Can be done from a subthread.

doStop ( )

Emit a Stop button click under program control. Can be done from a subthread.

doStopRun ( )

Depricated version of doStop().

execGUImethod | ( | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread. Use this method when a response is expected from the function and when it is appropriate to wait for it (no deadlock arises)

execGUImethodNR | ( | func | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used for executing a GUI function from a non-GUI thread. Use this method when no (useful) response is expected or when waiting for one could cause a deadlock. Any response from the function is lost.

isGUIthread ( )

Returns True if this method is being called from the GUI thread.

loadApp ( applName )

Method that can be invoked from code to load a new application.

Parameters:
applName Name of an application to load

setEnabledTabPage | ( | panelLabel | ,
 |  | enable |
 | ) |

Find the tabPage belonging to panel identified by panelLabel

The documentation for this class was generated from the following file:
  • RunControlMain.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SGETrgEngines Class Reference

SimpleGasuExample::SGETrgEngines

SGETrgEngines Class Reference

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Class MyTrgEngines: Initialize the trigger engines list class.

Definition at line 57 of file SimpleGasuExample.py.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SGETrgEngines Class Reference

testAppAcdScalers::SGETrgEngines

SGETrgEngines Class Reference

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Class MyTrgEngines: Initialize the trigger engines list class.

Definition at line 186 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SGETrgInputEnables Class Reference

SimpleGasuExample::SGETrgInputEnables

SGETrgInputEnables Class Reference

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Class SGETrgInputEnables: Empty Input enables.

Definition at line 48 of file SimpleGasuExample.py.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SGETrgInputEnables Class Reference

testAppAcdScalers::SGETrgInputEnables

SGETrgInputEnables Class Reference

List of all members.

Public Member Functions

__init__ ()

Detailed Description

Class SGETrgInputEnables: Empty Input enables.

Definition at line 177 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SimpleGasuExample Class Reference

SimpleGasuExample::SimpleGasuExample

SimpleGasuExample Class Reference

SimpleGASU example interface to GEM. More...

List of all members.

Public Member Functions

__init__ ()
SimpleGasuExample constructor.
conditions ()
coincidences ()
Implementation of coincdences 'pure virtual' method from TrgUsingTiles.
inputEnables ()
Implementation of inputEnables 'pure virtual' method from TrgAbstract.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
useAcdAsTrigger ()

Detailed Description

SimpleGASU example interface to GEM.

Definition at line 19 of file SimpleGasuExample.py.

Member Function Documentation

useAcdAsTrigger ( )

Use ACD as a trigger source.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SimpleGasuExample Class Reference

testAppAcdScalers::SimpleGasuExample

SimpleGasuExample Class Reference

SimpleGASU example interface to GEM. More...

List of all members.

Public Member Functions

__init__ ()
SimpleGasuExample constructor.
conditions ()
coincidences ()
Implementation of coincdences 'pure virtual' method from TrgUsingTiles.
inputEnables ()
Implementation of inputEnables 'pure virtual' method from TrgAbstract.
engines ()
Implementation of engines 'pure virtual' method from TrgAbstract.
useAcdAsTrigger ()

Detailed Description

SimpleGASU example interface to GEM.

Definition at line 148 of file testAppAcdScalers.py.

Member Function Documentation

useAcdAsTrigger ( )

Use ACD as a trigger source.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: singleEvtDisplayImpl Class Reference

gosedImpl::singleEvtDisplayImpl

singleEvtDisplayImpl Class Reference

Glast Online Single Event Display (GOSED). More...

List of all members.

Public Member Functions

__init__ (filename=None, parent=None, name=None, fl=0)
createDockWindows ()
dockGOSEDTWR ()
dockGOSEDTKR ()
dockGOSEDCAL ()
dockGOSEDCALTKR ()
dockGOSEDData ()
dockGOTED ()
dockGOSEDACD ()
mousePressEvent (e)
clickTWR (id)
plot ()
replot ()
selectChange ()
clearViews ()
clearButtonGroups ()
nextClicked ()
previousClicked ()
goClicked ()
stopClicked ()
fileOpen ()
fileClose ()
fileExit ()
serverOpen (state)
serverClose ()
ServerPreferences ()
GOSEDPreferences ()
helpOnline ()
helpContents ()
helpAbout ()

Detailed Description

Glast Online Single Event Display (GOSED).

This class: 1. Manages all the GUI functions for GOSED. 2. Retreives the TKR and CAL projections' pixmaps from GOSEDPainter. 3. Loads all the information from the current event processed by GOSED_LDF,

Definition at line 42 of file gosedImpl.py.

Member Function Documentation

__init__ | ( | filename | = None,
 |  | parent | = None,
 |  | name | = None,
 |  | fl | = 0
 | ) |

singleEvtDisplayImpl contructor

Parameters:
filename | None
parent | None
name | None
fl | 0

clearButtonGroups ( )

This function unchecks all the buttons. Contrary to clearviews(), this is only necesary when opening a new file, since we may have changed a selection in only one parameter (for example RNG only), and thus we don't want to loose the other filter by unchecking it (for example TWR).

clearViews ( )

This function reloads GOSED defaults in order to process a new event.

fileClose ( )

Close file source

fileExit ( )

Exits the gui

fileOpen ( )

Load data from a file

goClicked ( )

Load events ininterruptedly in time steps selected by the user from the GOSED Preferences menu. It stops when the Stop Button is clicked.

GOSEDPreferences ( )

Calls the GOSED Preferences window stopping the timer. It also passes the new settings to GOSED.

helpAbout ( )

Displays About GOSED info

helpContents ( )

Calls GOSED Readme file for reference.

helpOnline ( )

This function opens a web browser with I&T URL for reference.

nextClicked ( )

Plots next event when called

plot ( )

Plot is the heart of GOSED. It strips the information of the event from the data string and passes it to GOSED_LDF, initializing the iteration over all the entries of the event. It manages three kinds of sources of data: 1. Data from .arch files 2. Data from .fits files 3. Data from server It also manages the reinizialization of all the gui's outputs, calling clearviews() to delete the information from a previous event

previousClicked ( )

Finds previous event in the file and then plots it. It only works for .arch files.

selectChange ( )

This function is called whenever the user makes a change of selection in TWR, RNG or Scale, to reload the event with the new filter settings.

serverClose ( )

Close network server

serverOpen ( state )

Load event data from a network server

ServerPreferences ( )

Calls the Server Preferences window stopping the timer.

stopClicked ( )

Stop the ininterrupted display of events triggered by the Go Button

The documentation for this class was generated from the following file:
  • gosedImpl.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SolicitedCondition Class Reference

testAppAcdScalers::SolicitedCondition

SolicitedCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()

Detailed Description

Define a condition where only the solicited trigger is asserted

Definition at line 207 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SolicitedCondition Class Reference

SimpleGasuExample::SolicitedCondition

SolicitedCondition Class Reference

List of all members.

Public Member Functions

__init__ ()
solicited ()

Detailed Description

Define a condition where only the solicited trigger is asserted

Definition at line 78 of file SimpleGasuExample.py.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SolicitedEngine Class Reference

SimpleGasuExample::SolicitedEngine

SolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 67 of file SimpleGasuExample.py.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SolicitedEngine Class Reference

testAppAcdScalers::SolicitedEngine

SolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. This engine is not prescaled.

Definition at line 196 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardTestReport Class Reference

standardPlotter::standardTestReport

standardTestReport Class Reference

List of all members.

Public Member Functions

__init__ ()
writeTestInformation (runId, TestName=None, Operator=None, Site=None, Device=None, Phase=None, Status=None)
statusString (status)
getColorText (Text, Color='black', Bold=False)
closeTestReport (FileName)

Detailed Description

This class provide a standard Test Report HTML file for plotter results.

Definition at line 52 of file standardPlotter.py.

Member Function Documentation

__init__ ( )

Init the TestReport and Write Heading

closeTestReport ( FileName )

Close the HTML file and save it

statusString ( status )

Write test status (Passed/Failed or Aborted) in the report

Parameters:
status : Test status ('Passed', 'Failed' or 'Aborted' if script is stopped before end).

writeTestInformation | ( | runId | ,
 |  | TestName | = None,
 |  | Operator | = None,
 |  | Site | = None,
 |  | Device | = None,
 |  | Phase | = None,
 |  | Status | = None
 | ) |

Write standard information about test routine.

Parameters:
Operator | : name of the operator who perform the test
Site | : test site
TestName | : test name
runID | : run ID given by RunControl
Device | : device under test (i.e. MCM, tray, stack, tower)

The documentation for this class was generated from the following file:
  • standardPlotter.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SweepMarkerEngine Class Reference

rcTrgFunctions::SweepMarkerEngine

SweepMarkerEngine Class Reference

SweepMarkerEngine class. More...

Inheritance diagram for SweepMarkerEngine:

[legend]
Collaboration diagram for SweepMarkerEngine:

[legend]
List of all members.

Public Member Functions

__init__ ()
SweepMarkerEngine constructor.
participate (conditionsValue)
participate() method
prescale ()
prescale() method
request ()
request() method

Detailed Description

SweepMarkerEngine class.

This class defines an engine which injects a sweep marker signal. This engine is not prescaled.

Definition at line 54 of file rcTrgFunctions.py.

Member Function Documentation

participate ( conditionsValue )

participate() method

This function always returns False as this engine never participates except when RunControl wants it to.

Reimplemented from TrgEngine.

prescale ( )

prescale() method

Returns 0. This engine isn't prescaled

Reimplemented from TrgEngine.

request ( )

request() method

Returns a TrgInjectMarker object

Reimplemented from TrgEngine.

The documentation for this class was generated from the following file:
  • rcTrgFunctions.py
Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TaskEngine Class Reference

taskEngine::TaskEngine

TaskEngine Class Reference

List of all members.

Public Member Functions

__init__ (name=None)
name ()
Method for querying the task engine's name.
spawn (task, args, kwargs)
Method used to queue a task to the task engine.
run ()
The task engine main routine.
shutdown (tmo=2.0)
Method for shutting down the task engine.

Detailed Description

A class for setting up and queueing tasks to a task engine.

A task engine is a thread that polls a task queue and runs tasks found on the queue. Tasks are functions or class methods accompanied with their arguments and keyword arguments. Each task must run to completion before the next task is pulled from the queue. Returning a return value from the task to the caller is currently not supported (easy to add, if the need arises). The queue is a FIFO queue and there is currently no way to jam a task to the head of the queue.

Definition at line 21 of file taskEngine.py.

Member Function Documentation

name ( )

Method for querying the task engine's name.

Returns:
The task engine's name

run ( )

The task engine main routine.

This method is invoked by the Thread class and should be considered 'protected'. Do not call it.

shutdown ( tmo = 2.0 )

Method for shutting down the task engine.

This method blocks (with a timeout) until the task engine has exited. It makes no sense to spawn this method to the task engine since it waits for the task engine to exit.

Parameters:
tmo The amount of time (seconds) to wait for the task engine to exit
Returns:
0 for success, -1 if the task engine didn't exit, -2 if the task engine exited prematurely

spawn | ( | task | ,
 |  | args | ,
 |  | kwargs |
 | ) |

Method used to queue a task to the task engine.

Parameters:
task | The task routine to queue
args | The arguments for the task routine
kwargs | The keyword arguments for the task routine

The documentation for this class was generated from the following file:
  • taskEngine.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TKRcontributionIterator Class Reference

GOSED_LDF::TKRcontributionIterator

TKRcontributionIterator Class Reference

TKR contribution Displayer. More...

List of all members.

Public Member Functions

__init__ (event, contribution, gui)
plot ()
strip (tower, layerEnd, hit)
TOT (tower, layerEnd, tot)

Detailed Description

TKR contribution Displayer.

This class obtains the information of TKR from EBF to setup the tkr data in GOSED. To do so it filters by event and twr, iterating over all the entries in the event.

Definition at line 114 of file GOSED_LDF.py.

Member Function Documentation

__init__ | ( | event | ,
 |  | contribution | ,
 |  | gui |
 | ) |

TKRcontributionIterator contructor

Parameters:
event | Event
contribution | Contribution
gui | GOSED

plot ( )

Plot here will call the iterateStrips() function to display the filtered event.

There are three sorts of pixmaps (and the 3 equivalent for the YZ projection): background = Background Pixmap with the skeleton of the CAL final = Final pixmap that is going to be loaded to the display. If no data passed the filter, the custom widget drawXZ_CAL will automatically load background to final for display

strip | ( | tower | ,
 |  | layerEnd | ,
 |  | hit |
 | ) |

This function iterates over all current event entries and displays all those entries that passed the filter of for TWR.

Returns:
tower, layerEnd, hit

The documentation for this class was generated from the following file:
  • GOSED_LDF.py
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgAbstract Class Reference

TrgAbstract::TrgAbstract

TrgAbstract Class Reference

Abstract trigger interface class definition. More...

Inheritance diagram for TrgAbstract:

[legend]
Collaboration diagram for TrgAbstract:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgAbstract constructor.
conditions ()
conditions 'pure virtual' method
engines ()
Engines 'pure virtual' method.
sequence ()
Sequence 'pure virtual' method.
inputEnables ()
Enables 'pure virtual' method.
version ()
Version 'pure virtual' method.
maxEngines ()
maxEngines 'pure virtual' method
maxConditions ()
maxConditions 'pure virtual' method
solicit ()
Solicit 'pure virtual' method.
enable ()
Enable 'pure virtual' method.
disable ()
disable 'pure virtual' method
shut (marker)
shut 'pure virtual' method

Detailed Description

Abstract trigger interface class definition.

Definition at line 11 of file TrgAbstract.py.

Member Function Documentation

conditions ( )

conditions 'pure virtual' method

Returns:
A TrgConditionsValue object This object specifies the set of conditions to be enabled when the enable() member function is called

Reimplemented in rcGEMDefaultTrigger, and rcMiniGLTDefaultTrigger.

disable ( )

disable 'pure virtual' method

This function returns no value.

Disables the conditions returned by the conditions() member function. Once a condition is disabled, the condition will not activate the Trigger System, independent of its presence in the LAT.

Reimplemented in rcTrgGem, rcTrgMiniGLT, TrgGem, and TrgMiniGLT.

enable ( )

Enable 'pure virtual' method.

This function returns no value.

Enables the trigger conditions returned by the conditions() member function. Once a condition is enabled and the condition occurs in the LAT, the Trigger Engines corresponding to the condition will fire and most likely cause a Trigger Message to be emitted by the Trigger System.

engines ( )

Engines 'pure virtual' method.

Returns:
A TrgEngines object This object specifies the set of engines used by the trigger

Reimplemented in rcGEMDefaultTrigger, and rcMiniGLTDefaultTrigger.

inputEnables ( )

Enables 'pure virtual' method.

Returns:
A TrgInputEnables object This object specifies the input masking definitions for the trigger

Reimplemented in rcGEMDefaultTrigger.

maxConditions ( )

maxConditions 'pure virtual' method

Returns:
An integer This value specifies the type and number of conditions supported by the Trigger System.

Reimplemented in TrgGemAbstract.

maxEngines ( )

maxEngines 'pure virtual' method

Returns:
An integer This value determines the maximum number of Trigger Engines supported by the Trigger System.

Reimplemented in TrgGemAbstract.

sequence ( )

Sequence 'pure virtual' method.

Returns:
A TrgSequence object This object specifies the initial sequence number definitions for the trigger

Reimplemented in TrgUsingTiles.

shut ( marker )

shut 'pure virtual' method

Parameters:
marker an integer representing a marker value
This function returns no value.

This function returns performs two functions: a) it disables any enabled conditions b) it solicits a trigger with a marker of the value of the input value

Reimplemented in TrgGem, and TrgMiniGLT.

solicit ( )

Solicit 'pure virtual' method.

Allows the application to assert the solicited condition. Depending on the engine (or engines) associated with this condition, asserting this condition will most likely cause a readout of the detector. This function returns no value.

Reimplemented in TrgGem, and TrgMiniGLT.

version ( )

Version 'pure virtual' method.

Returns:
An integer This value specifies (in a hardware dependent representation) the generation and revision numbers of the Trigger System.

Reimplemented in TrgGem.

The documentation for this class was generated from the following file:
  • TrgAbstract.py
Generated on Fri Jan 21 18:01:23 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCalorimeter Class Reference

TrgTower::TrgCalorimeter

TrgCalorimeter Class Reference

Trigger Calorimeter class definition. More...

Inheritance diagram for TrgCalorimeter:

[legend]
Collaboration diagram for TrgCalorimeter:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCalorimeter constructor.
useHighEnergy ()
UseHighEnergy 'virtual' method.
useLowEnergy ()
UseLowEnergy 'virtual' method.

Detailed Description

Trigger Calorimeter class definition.

Definition at line 52 of file TrgTower.py.

Member Function Documentation

useHighEnergy ( )

UseHighEnergy 'virtual' method.

Returns:
A boolean

Reimplemented in NullCal.

useLowEnergy ( )

UseLowEnergy 'virtual' method.

Returns:
A boolean

Reimplemented in NullCal.

The documentation for this class was generated from the following file:
  • TrgTower.py
Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCmdCounters Class Reference

TrgCmdCounters::TrgCmdCounters

TrgCmdCounters Class Reference

TrgCmdCounters class. More...

Inheritance diagram for TrgCmdCounters:

[legend]
Collaboration diagram for TrgCmdCounters:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCmdCounters constructor.
stats ()
stats() method
reset ()
reset() method

Detailed Description

TrgCmdCounters class.

This class controls the counters associated with the commands received and the responses sent by the GEM.

Definition at line 14 of file TrgCmdCounters.py.

Member Function Documentation

reset ( )

reset() method

Reset the command counters

Reimplemented in TrgGemCmdCounters.

stats ( )

stats() method

Get the command statistics object.

Returns:
a TrgCmdStats object

Reimplemented in TrgGemCmdCounters.

The documentation for this class was generated from the following file:
  • TrgCmdCounters.py
Generated on Fri Jan 21 18:01:24 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCmdStats Class Reference

TrgCmdCounters::TrgCmdStats

TrgCmdStats Class Reference

TrgCmdStats class. More...

Inheritance diagram for TrgCmdStats:

[legend]
Collaboration diagram for TrgCmdStats:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCmdStats constructor.
command ()
command() method
response ()
response() method

Detailed Description

TrgCmdStats class.

This class specifies the statistics returned by the command counters. cf: LAT-TD-01545 section 2.3

Definition at line 41 of file TrgCmdCounters.py.

Member Function Documentation

command ( )

command() method

Returns:
an integer

Reimplemented in TrgGemCmdStats.

response ( )

response() method

Returns:
an integer

Reimplemented in TrgGemCmdStats.

The documentation for this class was generated from the following file:
  • TrgCmdCounters.py
Generated on Fri Jan 21 18:01:24 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCnoEnables Class Reference

TrgInputEnables::TrgCnoEnables

TrgCnoEnables Class Reference

Trigger CNO Enables class definition. More...

Inheritance diagram for TrgCnoEnables:

[legend]
Collaboration diagram for TrgCnoEnables:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCnoEnables constructor.
LA1 ()
LA1 'virtual' method.
RB1 ()
RB1 'virtual' method.
LA2 ()
LA2 'virtual' method.
LB2 ()
LB2 'virtual' method.
RA2 ()
RA2 'virtual' method.
RB2 ()
RB2 'virtual' method.
LA3 ()
LA3 'virtual' method.
RB3 ()
RB3 'virtual' method.
LA4 ()
LA4 'virtual' method.
LB4 ()
LB4 'virtual' method.
RA4 ()
RA4 'virtual' method.
RB4 ()
RB4 'virtual' method.

Detailed Description

Trigger CNO Enables class definition.

Definition at line 57 of file TrgInputEnables.py.

Member Function Documentation

LA1 ( )

LA1 'virtual' method.

Returns:
A boolean

LA2 ( )

LA2 'virtual' method.

Returns:
A boolean

LA3 ( )

LA3 'virtual' method.

Returns:
A boolean

LA4 ( )

LA4 'virtual' method.

Returns:
A boolean

LB2 ( )

LB2 'virtual' method.

Returns:
A boolean

LB4 ( )

LB4 'virtual' method.

Returns:
A boolean

RA2 ( )

RA2 'virtual' method.

Returns:
A boolean

RA4 ( )

RA4 'virtual' method.

Returns:
A boolean

RB1 ( )

RB1 'virtual' method.

Returns:
A boolean

RB2 ( )

RB2 'virtual' method.

Returns:
A boolean

RB3 ( )

RB3 'virtual' method.

Returns:
A boolean

RB4 ( )

RB4 'virtual' method.

Returns:
A boolean

The documentation for this class was generated from the following file:
  • TrgInputEnables.py
Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCoincidence Class Reference

TrgCoincidences::TrgCoincidence

TrgCoincidence Class Reference

Trigger Coincidence class definition This class defines the set of tiles which will constitute any one coincidence. More...

Inheritance diagram for TrgCoincidence:

[legend]
Collaboration diagram for TrgCoincidence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCoincidence constructor.
inCoincidence (tileNumber)
InCoincidence 'pure virtual' method To be satisfied by the user.

Detailed Description

Trigger Coincidence class definition This class defines the set of tiles which will constitute any one coincidence.

Definition at line 66 of file TrgCoincidences.py.

Member Function Documentation

inCoincidence ( tileNumber )

InCoincidence 'pure virtual' method To be satisfied by the user.

Parameters:
tileNumber A tile number [0..107]
Returns:
An integer

Reimplemented in NullCoincidence, and rcTrgCoincidence.

The documentation for this class was generated from the following file:
  • TrgCoincidences.py
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCoincidences Class Reference

TrgCoincidences::TrgCoincidences

TrgCoincidences Class Reference

Trigger Coincidences class definition. More...

Inheritance diagram for TrgCoincidences:

[legend]
Collaboration diagram for TrgCoincidences:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCoincidences constructor.
coincidence (coincidenceNumber)
coincidence 'pure virtual' method Reference into the list of coincidences.

Detailed Description

Trigger Coincidences class definition.

Definition at line 47 of file TrgCoincidences.py.

Member Function Documentation

coincidence ( coincidenceNumber )

coincidence 'pure virtual' method Reference into the list of coincidences.

Parameters:
coincidenceNumber A coincidence number
Returns:
A TrgCoincidence object

Reimplemented in TrgRoiAsTiles.

The documentation for this class was generated from the following file:
  • TrgCoincidences.py
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditions Class Reference

TrgConditions::TrgConditions

TrgConditions Class Reference

Trigger Conditions Value class definition This class is used to define one combinatoric of the 128 possible conditions. More...

Inheritance diagram for TrgConditions:

[legend]
Collaboration diagram for TrgConditions:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgConditions constructor.
roi ()
roi() 'pure virtual' method
calLow ()
calLow() 'pure virtual' method
calHigh ()
calHigh() 'pure virtual' method
tkr ()
tkr() 'pure virtual' method
periodic ()
periodic() 'pure virtual' method
solicited ()
solicited() 'pure virtual' method
cno ()
cno() 'pure virtual' method
external ()
external() 'pure virtual' method

Detailed Description

Trigger Conditions Value class definition This class is used to define one combinatoric of the 128 possible conditions.

Definition at line 12 of file TrgConditions.py.

Member Function Documentation

calHigh ( )

calHigh() 'pure virtual' method

Condition corresponding to a calorimeter high-energy trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

calLow ( )

calLow() 'pure virtual' method

Condition corresponding to a calorimeter low-energy trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

cno ( )

cno() 'pure virtual' method

Condition corresponding to a CNO trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

external ( )

external() 'pure virtual' method

Condition corresponding to an external trigger source

Returns:
A boolean

Reimplemented in TrgConditionsValue, and MiniGLTTrgConditionsValue.

periodic ( )

periodic() 'pure virtual' method

Condition corresponding to a periodic trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

roi ( )

roi() 'pure virtual' method

Condition corresponding to a ROI trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

solicited ( )

solicited() 'pure virtual' method

Condition corresponding to a solicited trigger

Returns:
A boolean

Reimplemented in rcSolicitedCondition, rcMiniGLTSolicitedCondition, and TrgConditionsValue.

tkr ( )

tkr() 'pure virtual' method

Condition corresponding to a tracker 'three in a row' trigger

Returns:
A boolean

Reimplemented in TrgConditionsValue.

The documentation for this class was generated from the following file:
  • TrgConditions.py
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditionsValue Class Reference

TrgConditionsValue::TrgConditionsValue

TrgConditionsValue Class Reference

Trigger Conditions Value class definition. More...

Inheritance diagram for TrgConditionsValue:

[legend]
Collaboration diagram for TrgConditionsValue:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgConditionsValue constructor.
value ()
Value method.
roi ()
roi() 'pure virtual' method
calLow ()
calLow() 'pure virtual' method
calHigh ()
calHigh() 'pure virtual' method
tkr ()
tkr() 'pure virtual' method
periodic ()
periodic() 'pure virtual' method
solicited ()
solicited() 'pure virtual' method
cno ()
cno() 'pure virtual' method
external ()
external() 'pure virtual' method

Detailed Description

Trigger Conditions Value class definition.

Definition at line 8 of file TrgConditionsValue.py.

Member Function Documentation

calHigh ( )

calHigh() 'pure virtual' method

Condition corresponding to a calorimeter high-energy trigger

Returns:
A boolean

Reimplemented from TrgConditions.

calLow ( )

calLow() 'pure virtual' method

Condition corresponding to a calorimeter low-energy trigger

Returns:
A boolean

Reimplemented from TrgConditions.

cno ( )

cno() 'pure virtual' method

Condition corresponding to a CNO trigger

Returns:
A boolean

Reimplemented from TrgConditions.

external ( )

external() 'pure virtual' method

Condition corresponding to an external trigger source

Returns:
A boolean

Reimplemented from TrgConditions.

Reimplemented in MiniGLTTrgConditionsValue.

periodic ( )

periodic() 'pure virtual' method

Condition corresponding to a periodic trigger

Returns:
A boolean

Reimplemented from TrgConditions.

roi ( )

roi() 'pure virtual' method

Condition corresponding to a ROI trigger

Returns:
A boolean

Reimplemented from TrgConditions.

solicited ( )

solicited() 'pure virtual' method

Condition corresponding to a solicited trigger

Returns:
A boolean

Reimplemented from TrgConditions.

Reimplemented in rcSolicitedCondition, and rcMiniGLTSolicitedCondition.

tkr ( )

tkr() 'pure virtual' method

Condition corresponding to a tracker 'three in a row' trigger

Returns:
A boolean

Reimplemented from TrgConditions.

value ( )

Value method.

Returns:
integer
Returns an integer corresponding to the conditionValue integer corresponding to the WINDOW_OPEN mask register of the GEM Ref: LAT-TD-01545, S 2.9.2

Reimplemented in MiniGLTTrgConditionsValue.

The documentation for this class was generated from the following file:
  • TrgConditionsValue.py
Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgDefaultPeriodicCondition Class Reference

TrgPeriodic::TrgDefaultPeriodicCondition

TrgDefaultPeriodicCondition Class Reference

TrgDefaultPeriodicCondition class definition. More...

Inheritance diagram for TrgDefaultPeriodicCondition:

[legend]
Collaboration diagram for TrgDefaultPeriodicCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgPeriodicConditionAbstract constructor.
source ()
source() method Default is FALSE, do not use 1-PPS clock
prescale ()
prescale() method Default is 0x1fffff, 10 hz periodic function
limit ()
limit() method Default is 0, free-run the condition.

Detailed Description

TrgDefaultPeriodicCondition class definition.

Definition at line 91 of file TrgPeriodic.py.

The documentation for this class was generated from the following file:
  • TrgPeriodic.py
Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgDefaultSequence Class Reference

TrgSequence::TrgDefaultSequence

TrgDefaultSequence Class Reference

Inheritance diagram for TrgDefaultSequence:

[legend]
Collaboration diagram for TrgDefaultSequence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgDefaultSequence constructor.
eventNumber ()
eventNumber() method Returns 0
eventTag ()

Detailed Description

The class defines 'sensible' values for the initial Event and Tag numbers.

Definition at line 55 of file TrgSequence.py.

Member Function Documentation

eventTag ( )

brief eventTag() method Returns 0

Reimplemented from TrgSequenceAbstract.

The documentation for this class was generated from the following file:
  • TrgSequence.py
Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEngine Class Reference

TrgEngines::TrgEngine

TrgEngine Class Reference

Trigger Engine class definition The user inherits from this class to customize their own Trigger Engines. The user must satisfy the member function 'request', which returns an object of type TrgEngineRequest. The user must satisfy the member function 'prescale', which returns an integer. More...

Inheritance diagram for TrgEngine:

[legend]
Collaboration diagram for TrgEngine:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngine constructor.
prescale ()
prescale 'pure virtual' method
request ()
request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.
participate (conditionsValue)
participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.

Detailed Description

Trigger Engine class definition The user inherits from this class to customize their own Trigger Engines. The user must satisfy the member function 'request', which returns an object of type TrgEngineRequest. The user must satisfy the member function 'prescale', which returns an integer.

Definition at line 36 of file TrgEngines.py.

Member Function Documentation

participate ( conditionsValue )

participate 'pure virtual' method Determines whether or not this engine participates when a particular conditionsValue is satisfied in the GEM.

Parameters:
conditionsValue An integer
Returns:
A boolean

Reimplemented in NullEngine, rcSolicitedEngine, rcMiniGLTSolicitedEngine, and SweepMarkerEngine.

prescale ( )

prescale 'pure virtual' method

Returns:
An integer

Reimplemented in NullEngine, rcSolicitedEngine, rcMiniGLTSolicitedEngine, and SweepMarkerEngine.

request ( )

request 'pure virtual' method Return the TrgEngineRequest object corresponding to this engine.

Returns:
A TrgEngineRequest object

Reimplemented in NullEngine, rcSolicitedEngine, rcMiniGLTSolicitedEngine, and SweepMarkerEngine.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEngineRequest Class Reference

TrgEngines::TrgEngineRequest

TrgEngineRequest Class Reference

Trigger Engine Request class definition The TrgEngineRequest class is used to specify the parameterization of the Trigger Message associated with a given engine. More...

Inheritance diagram for TrgEngineRequest:

[legend]
Collaboration diagram for TrgEngineRequest:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngineRequest constructor.
fourRange ()
fourRange 'virtual' method Return TRUE if the four-range-readout is enabled, else FALSE.
zeroSuppress ()
zeroSuppress 'virtual' method Return TRUE if the zero-suppression is enabled, else FALSE.
destination ()
destination method
marker (markerValue=0)
marker method
sequence ()
sequence 'pure virtual' method

Detailed Description

Trigger Engine Request class definition The TrgEngineRequest class is used to specify the parameterization of the Trigger Message associated with a given engine.

See below for concrete examples.

Definition at line 71 of file TrgEngines.py.

Member Function Documentation

destination ( )

destination method

Returns:
An integer

fourRange ( )

fourRange 'virtual' method Return TRUE if the four-range-readout is enabled, else FALSE.

Returns:
A boolean

marker ( markerValue = 0 )

marker method

Parameters:
markerValue A marker value
Returns:
An integer

sequence ( )

sequence 'pure virtual' method

Returns:
An integer

Reimplemented in NullRequest, TrgInjectCharge, TrgReadout, TrgInjectChargeReadout, and TrgInjectMarker.

zeroSuppress ( )

zeroSuppress 'virtual' method Return TRUE if the zero-suppression is enabled, else FALSE.

Returns:
A boolean

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEngines Class Reference

TrgEngines::TrgEngines

TrgEngines Class Reference

Trigger Engines class definition A Trigger Engine defines what the Trigger System does when it detects a triggerable condition within the LAT. More...

Inheritance diagram for TrgEngines:

[legend]
Collaboration diagram for TrgEngines:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEngines constructor.
engine (engineNumber)
Engine 'pure virtual' method Reference into a list of engines.

Detailed Description

Trigger Engines class definition A Trigger Engine defines what the Trigger System does when it detects a triggerable condition within the LAT.

Definition at line 13 of file TrgEngines.py.

Member Function Documentation

engine ( engineNumber )

Engine 'pure virtual' method Reference into a list of engines.

Parameters:
engineNumber An integer
Returns:
A TrgEngine object

Reimplemented in rcTrgEngines.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEventCounter Class Reference

TrgEventCounter::TrgEventCounter

TrgEventCounter Class Reference

TrgEventCounter class. More...

Inheritance diagram for TrgEventCounter:

[legend]
Collaboration diagram for TrgEventCounter:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgEventCounter contructor.
stats ()
stats() method
reset ()
reset() method

Detailed Description

TrgEventCounter class.

This class controls the counters associated with the event stream received and the responses sent by the GEM.

These functions to be implemented at the hardware abstraction level.

Definition at line 16 of file TrgEventCounter.py.

Member Function Documentation

reset ( )

reset() method

Reset the event counters

Reimplemented in TrgGemEventCounter.

stats ( )

stats() method

Return the number of events seen by the counter

Returns:
an integer

Reimplemented in TrgGemEventCounter.

The documentation for this class was generated from the following file:
  • TrgEventCounter.py
Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGem Class Reference

TrgGem::TrgGem

TrgGem Class Reference

Trigger Global Trigger Electronics Module Interface class definition This class implements the hardware register access to the GEM. More...

Inheritance diagram for TrgGem:

[legend]
Collaboration diagram for TrgGem:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgGem constructor.
GEM (glt=None)
GEM function.
version ()
Version 'pure virtual' method.
solicit ()
Solicit 'pure virtual' method.
enable (mask=None)
disable ()
disable 'pure virtual' method
triggerCounters ()
triggerCounters 'pure virtual' method
tileCounters ()
tileCounters 'pure virtual' method
cmdCounters ()
cmdCounters 'pure virtual' method
eventCounter ()
eventCounter 'pure virtual' method
shut (marker)

Detailed Description

Trigger Global Trigger Electronics Module Interface class definition This class implements the hardware register access to the GEM.

Definition at line 16 of file TrgGem.py.

Member Function Documentation

cmdCounters ( )

cmdCounters 'pure virtual' method

Returns:
A TrgCmdCounters object
This object specifies an implementation of the GEM's Command/Response counters

Reimplemented from TrgGemAbstract.

disable ( )

disable 'pure virtual' method

This function returns no value.

Disables the conditions returned by the conditions() member function. Once a condition is disabled, the condition will not activate the Trigger System, independent of its presence in the LAT.

Reimplemented from TrgAbstract.

Reimplemented in rcTrgGem.

eventCounter ( )

eventCounter 'pure virtual' method

Returns:
A TrgEventCounter object
This object specifies an implementation of the GEM's events sent counter

Reimplemented from TrgGemAbstract.

GEM ( glt = None )

GEM function.

Parameters:
glt: a GGEM object
Returns:
a GGEM object
This function sets and/or the GGEM hardware implementation used by TrgGem.

shut ( marker )

Implementation of the shut function.

Reimplemented from TrgAbstract.

solicit ( )

Solicit 'pure virtual' method.

Allows the application to assert the solicited condition. Depending on the engine (or engines) associated with this condition, asserting this condition will most likely cause a readout of the detector. This function returns no value.

Reimplemented from TrgAbstract.

tileCounters ( )

tileCounters 'pure virtual' method

Returns:
A TrgTileCounters object
This object specifies an implementation of the GEM's tile counters

Reimplemented from TrgGemAbstract.

triggerCounters ( )

triggerCounters 'pure virtual' method

Returns:
A TrgTriggerCounters object
This object specifies an implementation of the GEM's trigger counters

Reimplemented from TrgGemAbstract.

version ( )

Version 'pure virtual' method.

Returns:
An integer This value specifies (in a hardware dependent representation) the generation and revision numbers of the Trigger System.

Reimplemented from TrgAbstract.

The documentation for this class was generated from the following file:
  • TrgGem.py
Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemAbstract Class Reference

TrgGemAbstract::TrgGemAbstract

TrgGemAbstract Class Reference

Trigger Global trigger Electronics Module Interface class definition. More...

Inheritance diagram for TrgGemAbstract:

[legend]
Collaboration diagram for TrgGemAbstract:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgGemAbstract constructor.
width ()
width 'pure virtual' method
useAcdAsTrigger ()
UseAcdAsTrigger 'pure virtual' method.
redundantPPS ()
RedundantPPS 'pure virtual' method.
responseHeaderParityEven ()
responseHeaderParityEven 'pure virtual' method
responseDataParityEven ()
responseDataParityEven 'pure virtual' method
eventHeaderParityEven ()
eventHeaderParityEven 'pure virtual' method
eventDataParityEven ()
eventDataParityEven 'pure virtual' method
triggerParityEven ()
TriggerParityEven 'pure virtual' method.
inhibitContribution ()
inhibitContribution 'pure virtual' method
periodicCondition ()
PeriodicCondition 'pure virtual' method.
roi ()
Roi 'pure virtual' method.
triggerCounters ()
triggerCounters 'pure virtual' method
tileCounters ()
tileCounters 'pure virtual' method
cmdCounters ()
cmdCounters 'pure virtual' method
eventCounter ()
eventCounter 'pure virtual' method
maxEngines ()
maxEngines 'pure virtual' method
maxConditions ()
maxConditions 'pure virtual' method

Detailed Description

Trigger Global trigger Electronics Module Interface class definition.

Definition at line 15 of file TrgGemAbstract.py.

Member Function Documentation

cmdCounters ( )

cmdCounters 'pure virtual' method

Returns:
A TrgCmdCounters object
This object specifies an implementation of the GEM's Command/Response counters

Reimplemented in TrgGem.

eventCounter ( )

eventCounter 'pure virtual' method

Returns:
A TrgEventCounter object
This object specifies an implementation of the GEM's events sent counter

Reimplemented in TrgGem.

eventDataParityEven ( )

eventDataParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message body initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger message bodies will have even parity. If the value returned is FALSE, trigger message bodies will have odd parity.

Reimplemented in TrgGemRegisters.

eventHeaderParityEven ( )

eventHeaderParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message header initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger message headers will have even parity. If the value returned is FALSE, trigger message headers will have odd parity.

Reimplemented in TrgGemRegisters.

inhibitContribution ( )

inhibitContribution 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the GEM transmits a contribution to the event. If the value returned is TRUE, GEM contributions are inhibited. If the value returned is FALSE, GEM contributions are sent with the event.

Reimplemented in TrgGemRegisters.

maxConditions ( )

maxConditions 'pure virtual' method

Returns:
An integer This value specifies the type and number of conditions supported by the Trigger System.

Reimplemented from TrgAbstract.

maxEngines ( )

maxEngines 'pure virtual' method

Returns:
An integer This value determines the maximum number of Trigger Engines supported by the Trigger System.

Reimplemented from TrgAbstract.

periodicCondition ( )

PeriodicCondition 'pure virtual' method.

Returns:
A TrgPeriodicCondition object
This object specifies the initial and current definition of the periodic condition

Reimplemented in TrgUsingTiles.

redundantPPS ( )

RedundantPPS 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the GEM should use the redundant 1-PPS signal. If the value returned is TRUE, the redundant 1-PPS signal will be used. If the value returned is FALSE, the primary 1-PPS signal will not be used.

Reimplemented in TrgGemRegisters.

responseDataParityEven ( )

responseDataParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a command response packet body should be sent with odd or even parity. If the value returned is TRUE, response bodies will have even parity. If the value returned is FALSE, responses will have odd parity.

Reimplemented in TrgGemRegisters.

responseHeaderParityEven ( )

responseHeaderParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a command responsepacket header should be sent with odd or even parity. If the value returned is TRUE, response headers will have even parity. If the value returned is FALSE, responses will have odd parity.

Reimplemented in TrgGemRegisters.

roi ( )

Roi 'pure virtual' method.

Returns:
A TrgRoi object
This object specifies the definition of the GEM's ROI generator

Reimplemented in TrgUsingTiles.

tileCounters ( )

tileCounters 'pure virtual' method

Returns:
A TrgTileCounters object
This object specifies an implementation of the GEM's tile counters

Reimplemented in TrgGem.

triggerCounters ( )

triggerCounters 'pure virtual' method

Returns:
A TrgTriggerCounters object
This object specifies an implementation of the GEM's trigger counters

Reimplemented in TrgGem.

triggerParityEven ( )

TriggerParityEven 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger messages will have even parity. If the value returned is FALSE, trigger messages will have odd parity.

Reimplemented in TrgGemRegisters.

useAcdAsTrigger ( )

UseAcdAsTrigger 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the the ROI generator and its ACD tile signals are be used as a trigger or as a veto. If the value returned is TRUE, the ROI generator is used as a trigger. If the value returned is FALSE, the ROI generator is used as a veto.

Reimplemented in rcGEMDefaultTrigger, and TrgUsingTiles.

width ( )

width 'pure virtual' method

Returns:
An int.
This value specifies the window of the GEM's trigger window (see [4]). The width is specified in units of system clock, where one system clock is 50 nanoseconds.

Reimplemented in TrgGemRegisters.

The documentation for this class was generated from the following file:
  • TrgGemAbstract.py
Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemCmdCounters Class Reference

TrgGemCounters::TrgGemCmdCounters

TrgGemCmdCounters Class Reference

TrgGemCmdCounters. More...

Inheritance diagram for TrgGemCmdCounters:

[legend]
Collaboration diagram for TrgGemCmdCounters:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemCmdCounters constructor.
stats ()
stats() method
reset ()
reset() member function

Detailed Description

TrgGemCmdCounters.

This class implements the HW abstraction corresponding to figure 62 of the GEM document: LAT-01545 Section 2.3.4

Definition at line 133 of file TrgGemCounters.py.

Member Function Documentation

reset ( )

reset() member function

Reset the command/response statistics register

Reimplemented from TrgCmdCounters.

stats ( )

stats() method

Get the command statistics object.

Returns:
a TrgCmdStats object

Reimplemented from TrgCmdCounters.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemCmdStats Class Reference

TrgGemCounters::TrgGemCmdStats

TrgGemCmdStats Class Reference

TrgGemCmdStats. More...

Inheritance diagram for TrgGemCmdStats:

[legend]
Collaboration diagram for TrgGemCmdStats:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemCmdStats constructor.
command ()
command() method
response ()
response() method

Detailed Description

TrgGemCmdStats.

This class implements the HW abstraction corresponding to figure 62 of the GEM document: LAT-01545 Section 2.3.4

Definition at line 154 of file TrgGemCounters.py.

Member Function Documentation

command ( )

command() method

Returns:
an integer

Reimplemented from TrgCmdStats.

response ( )

response() method

Returns:
an integer

Reimplemented from TrgCmdStats.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemEventCounter Class Reference

TrgGemCounters::TrgGemEventCounter

TrgGemEventCounter Class Reference

TrgGemEventCounter. More...

Inheritance diagram for TrgGemEventCounter:

[legend]
Collaboration diagram for TrgGemEventCounter:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemEventCounter constructor.
stats ()
stats() method
reset ()
reset() member function

Detailed Description

TrgGemEventCounter.

This class implements the HW abstraction corresponding to figure 63 of the GEM document: LAT-01545 Section 2.3.6

Definition at line 170 of file TrgGemCounters.py.

Member Function Documentation

reset ( )

reset() member function

Reset the event statistics register

Reimplemented from TrgEventCounter.

stats ( )

stats() method

Return the number of events seen by the counter

Returns:
an integer

Reimplemented from TrgEventCounter.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemPeriodicCondition Class Reference

TrgGemPeriodicCondition::TrgGemPeriodicCondition

TrgGemPeriodicCondition Class Reference

Trigger Periodic Condition class definition. More...

Inheritance diagram for TrgGemPeriodicCondition:

[legend]
Collaboration diagram for TrgGemPeriodicCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgPeriodicConditionAbstract constructor.
remaining ()
remaining() method See base class
reset ()
reset() method See base class
abort ()
abort() method See base class
source ()
source() method See base class
prescale ()
prescale() method See base class
limit ()
limit() method See base class

Detailed Description

Trigger Periodic Condition class definition.

Definition at line 11 of file TrgGemPeriodicCondition.py.

The documentation for this class was generated from the following file:
  • TrgGemPeriodicCondition.py
Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemRegisters Class Reference

TrgGemRegisters::TrgGemRegisters

TrgGemRegisters Class Reference

TrgGemRegisters class definition. More...

Inheritance diagram for TrgGemRegisters:

[legend]
Collaboration diagram for TrgGemRegisters:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgGem constructor.
configurationRegister ()
configurationRegister() method
widthRegister ()
widthRegister method
periodicRateRegister ()
periodicRateRegister method
periodicModeRegister ()
periodicModeRegister method
periodicLimitRegister ()
periodicLimitRegister method
sequenceRegister ()
sequenceRegister method
templateRegister (registerNumber)
templateRegister method
lookupTableRegister (registerNumber)
lookupTableRegister method
roiRegister (registerNumber)
roiRegister method
towerEnableRegister (registerNumber)
towerEnableRegister method
towerBusyEnableRegister ()
towerBusyEnableRegister method
cnoEnableRegister ()
cnoEnableRegister method
tileEnableRegister (registerNumber)
tileEnableRegister method
width ()
width 'pure virtual' method
redundantPPS ()
RedundantPPS 'pure virtual' method.
responseHeaderParityEven ()
responseHeaderParityEven 'pure virtual' method
responseDataParityEven ()
responseDataParityEven 'pure virtual' method
eventHeaderParityEven ()
eventHeaderParityEven 'pure virtual' method
eventDataParityEven ()
eventDataParityEven 'pure virtual' method
triggerParityEven ()
TriggerParityEven 'pure virtual' method.
inhibitContribution ()
inhibitContribution 'pure virtual' method

Detailed Description

TrgGemRegisters class definition.

Implements the register shape definitions for a GASU trigger system

Definition at line 19 of file TrgGemRegisters.py.

Member Function Documentation

cnoEnableRegister ( )

cnoEnableRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the ACD CNO enable register Ref: LAT-TD-01545, 2.9.2

configurationRegister ( )

configurationRegister() method

Method to construct the value of the GEM configuration register

Returns:
An integer

eventDataParityEven ( )

eventDataParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message body initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger message bodies will have even parity. If the value returned is FALSE, trigger message bodies will have odd parity.

Reimplemented from TrgGemAbstract.

eventHeaderParityEven ( )

eventHeaderParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message header initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger message headers will have even parity. If the value returned is FALSE, trigger message headers will have odd parity.

Reimplemented from TrgGemAbstract.

inhibitContribution ( )

inhibitContribution 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the GEM transmits a contribution to the event. If the value returned is TRUE, GEM contributions are inhibited. If the value returned is FALSE, GEM contributions are sent with the event.

Reimplemented from TrgGemAbstract.

lookupTableRegister ( registerNumber )

lookupTableRegister method

Parameters:
registerNumber A reference into the Scheduler register set
Returns:
integer
Returns a 32 bit integer referencing the TAM generator used for a particular trigger summary Ref: LAT-TD-01545, S 2.7

periodicLimitRegister ( )

periodicLimitRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the PERIODIC_LIMITS register of the GEM. Ref: LAT-TD-01545, S 2.3.3.3

periodicModeRegister ( )

periodicModeRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the PERIODIC_MODE register of the GEM. Ref: LAT-TD-01545, S 2.3.3.2

periodicRateRegister ( )

periodicRateRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the PERIODIC_RATE register of the GEM. Ref: LAT-TD-01545, S 2.3.3.1

redundantPPS ( )

RedundantPPS 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the GEM should use the redundant 1-PPS signal. If the value returned is TRUE, the redundant 1-PPS signal will be used. If the value returned is FALSE, the primary 1-PPS signal will not be used.

Reimplemented from TrgGemAbstract.

responseDataParityEven ( )

responseDataParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a command response packet body should be sent with odd or even parity. If the value returned is TRUE, response bodies will have even parity. If the value returned is FALSE, responses will have odd parity.

Reimplemented from TrgGemAbstract.

responseHeaderParityEven ( )

responseHeaderParityEven 'pure virtual' method

Returns:
A boolean
This value specifies whether or not the parity associated with a command responsepacket header should be sent with odd or even parity. If the value returned is TRUE, response headers will have even parity. If the value returned is FALSE, responses will have odd parity.

Reimplemented from TrgGemAbstract.

roiRegister ( registerNumber )

roiRegister method

Parameters:
registerNumber A reference into the ROI generator registers
Returns:
integer
Returns a 32 bit integer referencing the 54 ROI registers defined in Ref: LAT-TD-01545, S 2.8

sequenceRegister ( )

sequenceRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the SEQUENCE register of the GEM. Ref: LAT-TD-01545, S 2.3.4

templateRegister ( registerNumber )

templateRegister method

Parameters:
registerNumber An registerNumber value
Returns:
integer
Returns a 32 bit integer corresponding to the message engine template register of the TAM. Ref: LAT-TD-01545, S 2.5 Context portion is defined in 1.8.6.1

tileEnableRegister ( registerNumber )

tileEnableRegister method

Parameters:
registerNumber
Returns:
integer
Returns a 32 bit integer corresponding to the ACD tile enable register. Ref: LAT-TD-01545, 2.9.3

towerBusyEnableRegister ( )

towerBusyEnableRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the Tower Busy enable register

towerEnableRegister ( registerNumber )

towerEnableRegister method

Parameters:
registerNumber A reference into the tower enable registers
Returns:
integer
Returns a 32 bit object corresponding to figures 78/79 of the GEM documentation. This is used to construct the registers TOWERS_0_3, etc. Ref: LAT-TD-01545, 2.9.1

triggerParityEven ( )

TriggerParityEven 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the parity associated with a trigger message initiated by the GEM should be sent with odd or even parity. If the value returned is TRUE, trigger messages will have even parity. If the value returned is FALSE, trigger messages will have odd parity.

Reimplemented from TrgGemAbstract.

width ( )

width 'pure virtual' method

Returns:
An int.
This value specifies the window of the GEM's trigger window (see [4]). The width is specified in units of system clock, where one system clock is 50 nanoseconds.

Reimplemented from TrgGemAbstract.

widthRegister ( )

widthRegister method

Returns:
integer
Returns a 32 bit integer corresponding to the WINDOW_WIDTH register of the GEM. Ref: LAT-TD-01545, S 2.9.1

The documentation for this class was generated from the following file:
  • TrgGemRegisters.py
Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemSequence Class Reference

TrgGemSequence::TrgGemSequence

TrgGemSequence Class Reference

TrgGemSequence Hardware abstraction for TrgSequence. More...

Inheritance diagram for TrgGemSequence:

[legend]
Collaboration diagram for TrgGemSequence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgSequenceAbstract constructor.
eventNumber ()
eventNumber() method Returns 0
eventTag ()

Detailed Description

TrgGemSequence Hardware abstraction for TrgSequence.

Definition at line 14 of file TrgGemSequence.py.

Member Function Documentation

eventTag ( )

brief eventTag() method Returns 0

Reimplemented from TrgSequenceAbstract.

The documentation for this class was generated from the following file:
  • TrgGemSequence.py
Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemTileCounters Class Reference

TrgGemCounters::TrgGemTileCounters

TrgGemTileCounters Class Reference

TrgGemTileCounters. More...

Inheritance diagram for TrgGemTileCounters:

[legend]
Collaboration diagram for TrgGemTileCounters:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemTileCounters constructor.
stats ()
stats() member function Returns the statistics object for the tile counters
reset ()
reset() member function
assignA (tileNumber)
assignA() member function
assignB (tileNumber)
assignB() member function
assignAB (a, b)
assignAB() member function

Detailed Description

TrgGemTileCounters.

This class implements the HW abstraction corresponding to the tile counter detailed in the GEM document: LAT-01545 Section 2.6

Definition at line 75 of file TrgGemCounters.py.

Member Function Documentation

assignA ( tileNumber )

assignA() member function

Assign the 'A' tile counter to watch a particular tile Immediately after counter assignment, both counters are reset.

assignAB | ( | a | ,
 |  | b |
 | ) |

assignAB() member function

Assign both the 'A' and the'B' tile counters to watch two tiles Immediately after counter assignment, both counters are reset.

Reimplemented from TrgTileCounters.

assignB ( tileNumber )

assignB() member function

Assign the 'B' tile counter to watch a particular tile Immediately after counter assignment, both counters are reset.

reset ( )

reset() member function

Reset the tile counter register

Reimplemented from TrgTileCounters.

stats ( )

stats() member function Returns the statistics object for the tile counters

Returns:
A TrgTileStats object

Reimplemented from TrgTileCounters.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemTileStats Class Reference

TrgGemCounters::TrgGemTileStats

TrgGemTileStats Class Reference

TrgGemTileStats. More...

Inheritance diagram for TrgGemTileStats:

[legend]
Collaboration diagram for TrgGemTileStats:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemTileStats constructor.
A ()
B ()

Detailed Description

TrgGemTileStats.

This class implements the HW abstraction corresponding to figure 64 of the GEM document: LAT-01545 Section 2.5

Definition at line 117 of file TrgGemCounters.py.

Member Function Documentation

A ( )

Return the statistics for the 'A' tile counter

Returns:
an integer

Reimplemented from TrgTileStats.

B ( )

Return the statistics for the 'B' tile counter

Returns:
an integer

Reimplemented from TrgTileStats.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemTriggerCounters Class Reference

TrgGemCounters::TrgGemTriggerCounters

TrgGemTriggerCounters Class Reference

TrgGemTriggerCounters class. More...

Inheritance diagram for TrgGemTriggerCounters:

[legend]
Collaboration diagram for TrgGemTriggerCounters:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemTriggerCounters constructor.
stats ()
stats() member function Returns an object that accesses the trigger statistics
reset ()
reset() member function Reset the statistics registers

Detailed Description

TrgGemTriggerCounters class.

This class implements the HW abstraction corresponding to figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2

Definition at line 29 of file TrgGemCounters.py.

Member Function Documentation

stats ( )

stats() member function Returns an object that accesses the trigger statistics

Returns:
a TrgGemTriggerStats object

Reimplemented from TrgTriggerCounters.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemTriggerStats Class Reference

TrgGemCounters::TrgGemTriggerStats

TrgGemTriggerStats Class Reference

TrgGemTriggerStats This class implements the HW abstraction corresponding to figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2. More...

Inheritance diagram for TrgGemTriggerStats:

[legend]
Collaboration diagram for TrgGemTriggerStats:

[legend]
List of all members.

Public Member Functions

__init__ (glt)
TrgGemTriggerStats constructor.
livetime ()
livetime() method Return the system livetime
prescaled ()
prescaled() method Return the number of events that have been prescaled
discarded ()
discarded() method Return the number of events discarded
sent ()
sent() method Return the number of events sent on

Detailed Description

TrgGemTriggerStats This class implements the HW abstraction corresponding to figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2.

Note: Reading the livetime register latches all 4 registers. Rereading the livetime register unlatches the registers.

Definition at line 56 of file TrgGemCounters.py.

Member Function Documentation

discarded ( )

discarded() method Return the number of events discarded

Returns:
an integer

Reimplemented from TrgTriggerStats.

livetime ( )

livetime() method Return the system livetime

Returns:
an integer

Reimplemented from TrgTriggerStats.

prescaled ( )

prescaled() method Return the number of events that have been prescaled

Returns:
an integer

Reimplemented from TrgTriggerStats.

sent ( )

sent() method Return the number of events sent on

Returns:
an integer

Reimplemented from TrgTriggerStats.

The documentation for this class was generated from the following file:
  • TrgGemCounters.py
Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInjectCharge Class Reference

TrgEngines::TrgInjectCharge

TrgInjectCharge Class Reference

TrgInjectCharge class definition. More...

Inheritance diagram for TrgInjectCharge:

[legend]
Collaboration diagram for TrgInjectCharge:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgInjectCharge constructor.
sequence ()
sequence() method See TrgEngineRequest base class

Detailed Description

TrgInjectCharge class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the CALSTROBE command. This command will not trigger a readout of the module's Front-End Electronics.

Definition at line 117 of file TrgEngines.py.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInjectChargeReadout Class Reference

TrgEngines::TrgInjectChargeReadout

TrgInjectChargeReadout Class Reference

Trigger Inject Charge Readout class definition. More...

Inheritance diagram for TrgInjectChargeReadout:

[legend]
Collaboration diagram for TrgInjectChargeReadout:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgInjectChargeReadout constructor.
sequence ()
sequence() method See TrgEngineRequest base class

Detailed Description

Trigger Inject Charge Readout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed of a CALSTROBE followed by a TACK command. This sequence will trigger a readout of the module's Front-End Electronics.

Definition at line 157 of file TrgEngines.py.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInjectMarker Class Reference

TrgEngines::TrgInjectMarker

TrgInjectMarker Class Reference

Trigger Inject Marker class definition Directs a module to send to its Front-End Electronics a command sequence which is composed of only a TACK command. This sequence will trigger a readout of the module's Front-End Electronics. More...

Inheritance diagram for TrgInjectMarker:

[legend]
Collaboration diagram for TrgInjectMarker:

[legend]
List of all members.

Public Member Functions

__init__ (marker)
TrgInjectMarker constructor.
sequence ()
sequence() method See TrgEngineRequest base class
marker ()
marker() method See TrgEngineRequest base class

Detailed Description

Trigger Inject Marker class definition Directs a module to send to its Front-End Electronics a command sequence which is composed of only a TACK command. This sequence will trigger a readout of the module's Front-End Electronics.

Definition at line 176 of file TrgEngines.py.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInputEnables Class Reference

TrgInputEnables::TrgInputEnables

TrgInputEnables Class Reference

Trigger Input Enables class definition. More...

Inheritance diagram for TrgInputEnables:

[legend]
Collaboration diagram for TrgInputEnables:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgInputEnables constructor.
towers ()
Towers 'pure virtual' method.
cno ()
Cno 'pure virtual' method.
tiles ()
Tiles 'pure virtual' method.

Detailed Description

Trigger Input Enables class definition.

Definition at line 11 of file TrgInputEnables.py.

Member Function Documentation

cno ( )

Cno 'pure virtual' method.

Returns:
A TrgCnoEnables object

Reimplemented in NoInputsEnabled.

tiles ( )

Tiles 'pure virtual' method.

Returns:
A TrgTileEnables object

towers ( )

Towers 'pure virtual' method.

Returns:
A TrgTowerEnables object

Reimplemented in NoInputsEnabled.

The documentation for this class was generated from the following file:
  • TrgInputEnables.py
Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLT Class Reference

TrgMiniGLT::TrgMiniGLT

TrgMiniGLT Class Reference

Mini GLT Hardware abstraction implementation. More...

Inheritance diagram for TrgMiniGLT:

[legend]
Collaboration diagram for TrgMiniGLT:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgMiniGLT constructor.
GLT (glt=None)
GLT function.
solicit ()
Solicit 'pure virtual' method.
enable (mask=None)
disable ()
disable 'pure virtual' method
shut (marker)

Detailed Description

Mini GLT Hardware abstraction implementation.

Definition at line 15 of file TrgMiniGLT.py.

Member Function Documentation

disable ( )

disable 'pure virtual' method

This function returns no value.

Disables the conditions returned by the conditions() member function. Once a condition is disabled, the condition will not activate the Trigger System, independent of its presence in the LAT.

Reimplemented from TrgAbstract.

Reimplemented in rcTrgMiniGLT.

GLT ( glt = None )

GLT function.

glt: a GGLT object This function sets the GLT hardware implementation used by TrgGem.

shut ( marker )

Implementation of the shut function.

Reimplemented from TrgAbstract.

solicit ( )

Solicit 'pure virtual' method.

Allows the application to assert the solicited condition. Depending on the engine (or engines) associated with this condition, asserting this condition will most likely cause a readout of the detector. This function returns no value.

Reimplemented from TrgAbstract.

The documentation for this class was generated from the following file:
  • TrgMiniGLT.py
Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTAbstract Class Reference

TrgMiniGLTAbstract::TrgMiniGLTAbstract

TrgMiniGLTAbstract Class Reference

TrgMiniGLTAbstract Interface class definition This class inherits from TrgAbstract to define the structure of a MiniGLT trigger. More...

Inheritance diagram for TrgMiniGLTAbstract:

[legend]
Collaboration diagram for TrgMiniGLTAbstract:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgMiniGLTAbstract constructor.
parity ()
parity() member function Returns a boolean indicating the state of the parity bitfield in the configuration register of the MiniGLT
tag ()
tag() member function Returns an integer indicating the state of the tag bitfield in the configuration register of the MiniGLT
eventNumber ()
eventNumber() member function Returns an integer indicating the starting event number of the MiniGLT
destination ()
destination() member function Returns an integer indicating the state of the destination bitfield in the configuration register of the MiniGLT
marker ()
marker() member function Returns an integer indicating the state of the marker bitfield in the configuration register of the MiniGLT
tack ()
tack() member function Returns a boolean indicating the state of the tack bitfield in the configuration register of the MiniGLT
zeroSuppress ()
zeroSuppress() member function Returns a boolean indicating the state of the zeroSuppress bitfield in the configuration register of the MiniGLT
fourRangeReadout ()
fourRangeReadout() member function Returns a boolean indicating the state of the fourRangeReadout bitfield in the configuration register of the MiniGLT
calStrobe ()
calStrobe() member function Returns a boolean indicating the state of the calStrobe bitfield in the configuration register of the MiniGLT

Detailed Description

TrgMiniGLTAbstract Interface class definition This class inherits from TrgAbstract to define the structure of a MiniGLT trigger.

Definition at line 13 of file TrgMiniGLTAbstract.py.

Member Function Documentation

calStrobe ( )

calStrobe() member function Returns a boolean indicating the state of the calStrobe bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented in TrgMiniGLTRegisters.

destination ( )

destination() member function Returns an integer indicating the state of the destination bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented in TrgMiniGLTRegisters.

eventNumber ( )

eventNumber() member function Returns an integer indicating the starting event number of the MiniGLT

Returns:
an integer

Reimplemented in TrgMiniGLTRegisters.

fourRangeReadout ( )

fourRangeReadout() member function Returns a boolean indicating the state of the fourRangeReadout bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented in TrgMiniGLTRegisters.

marker ( )

marker() member function Returns an integer indicating the state of the marker bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented in TrgMiniGLTRegisters.

parity ( )

parity() member function Returns a boolean indicating the state of the parity bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented in TrgMiniGLTRegisters.

tack ( )

tack() member function Returns a boolean indicating the state of the tack bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented in TrgMiniGLTRegisters.

tag ( )

tag() member function Returns an integer indicating the state of the tag bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented in TrgMiniGLTRegisters.

zeroSuppress ( )

zeroSuppress() member function Returns a boolean indicating the state of the zeroSuppress bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented in TrgMiniGLTRegisters.

The documentation for this class was generated from the following file:
  • TrgMiniGLTAbstract.py
Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTRegisters Class Reference

TrgMiniGLTRegisters::TrgMiniGLTRegisters

TrgMiniGLTRegisters Class Reference

Register shape definition class for the MiniGLT This class defines the shapes of the registers and bitfields used in the MiniGLT. More...

Inheritance diagram for TrgMiniGLTRegisters:

[legend]
Collaboration diagram for TrgMiniGLTRegisters:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgMiniGLTAbstract constructor.
parity ()
parity() member function Returns a boolean indicating the state of the parity bitfield in the configuration register of the MiniGLT
tag ()
tag() member function Returns an integer indicating the state of the tag bitfield in the configuration register of the MiniGLT
eventNumber ()
eventNumber() member function Returns an integer indicating the starting event number of the MiniGLT
destination ()
destination() member function Returns an integer indicating the state of the destination bitfield in the configuration register of the MiniGLT
marker ()
marker() member function Returns an integer indicating the state of the marker bitfield in the configuration register of the MiniGLT
tack ()
tack() member function Returns a boolean indicating the state of the tack bitfield in the configuration register of the MiniGLT
zeroSuppress ()
zeroSuppress() member function Returns a boolean indicating the state of the zeroSuppress bitfield in the configuration register of the MiniGLT
fourRangeReadout ()
fourRangeReadout() member function Returns a boolean indicating the state of the fourRangeReadout bitfield in the configuration register of the MiniGLT
calStrobe ()
calStrobe() member function Returns a boolean indicating the state of the calStrobe bitfield in the configuration register of the MiniGLT

Detailed Description

Register shape definition class for the MiniGLT This class defines the shapes of the registers and bitfields used in the MiniGLT.

Definition at line 14 of file TrgMiniGLTRegisters.py.

Member Function Documentation

calStrobe ( )

calStrobe() member function Returns a boolean indicating the state of the calStrobe bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented from TrgMiniGLTAbstract.

destination ( )

destination() member function Returns an integer indicating the state of the destination bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented from TrgMiniGLTAbstract.

eventNumber ( )

eventNumber() member function Returns an integer indicating the starting event number of the MiniGLT

Returns:
an integer

Reimplemented from TrgMiniGLTAbstract.

fourRangeReadout ( )

fourRangeReadout() member function Returns a boolean indicating the state of the fourRangeReadout bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented from TrgMiniGLTAbstract.

marker ( )

marker() member function Returns an integer indicating the state of the marker bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented from TrgMiniGLTAbstract.

parity ( )

parity() member function Returns a boolean indicating the state of the parity bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented from TrgMiniGLTAbstract.

tack ( )

tack() member function Returns a boolean indicating the state of the tack bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented from TrgMiniGLTAbstract.

tag ( )

tag() member function Returns an integer indicating the state of the tag bitfield in the configuration register of the MiniGLT

Returns:
an integer

Reimplemented from TrgMiniGLTAbstract.

zeroSuppress ( )

zeroSuppress() member function Returns a boolean indicating the state of the zeroSuppress bitfield in the configuration register of the MiniGLT

Returns:
a boolean

Reimplemented from TrgMiniGLTAbstract.

The documentation for this class was generated from the following file:
  • TrgMiniGLTRegisters.py
Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgObject Class Reference

TrgObject::TrgObject

TrgObject Class Reference

Trigger Object class definition. More...

Inheritance diagram for TrgObject:

[legend]
List of all members.

Public Member Functions

__setattr__ (name, value)

Detailed Description

Trigger Object class definition.

Definition at line 9 of file TrgObject.py.

Member Function Documentation

__setattr__ | ( | name | ,
 |  | value |
 | ) |

Reject attempts to modify TrgObject's constants.

The documentation for this class was generated from the following file:
  • TrgObject.py
Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgPeriodicCondition Class Reference

TrgPeriodic::TrgPeriodicCondition

TrgPeriodicCondition Class Reference

Trigger Periodic Condition class definition. More...

Inheritance diagram for TrgPeriodicCondition:

[legend]
Collaboration diagram for TrgPeriodicCondition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgPeriodicConditionAbstract constructor.
definition ()
definition() method Returns an object of type TrgPeriodicConditionDefinition. This object will be used to both define the initial values for the periodic condition and is used by the reset() function to re-establish the initial limit value.
remaining ()
remaining() method Returns the number of iterations remaining before the periodic condition stops.
reset ()
reset() method Will cause the periodic condition to stop, regardless of how many iterations are remaining. It will re-initialize the limit function with the value returned by the limit function of. If the periodic condition is free running, this function has no effect.
abort ()
abort() method Will cause the periodic condition to stop, regardless of how many iterations are remaining. If the periodic condition is free running, this function has no effect.

Detailed Description

Trigger Periodic Condition class definition.

Definition at line 48 of file TrgPeriodic.py.

The documentation for this class was generated from the following file:
  • TrgPeriodic.py
Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgPeriodicConditionAbstract Class Reference

TrgPeriodic::TrgPeriodicConditionAbstract

TrgPeriodicConditionAbstract Class Reference

TrgPeriodicConditionAbstract class definition. More...

Inheritance diagram for TrgPeriodicConditionAbstract:

[legend]
Collaboration diagram for TrgPeriodicConditionAbstract:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgPeriodicConditionAbstract constructor.
source ()
source() 'virtual' method If the returned value is FALSE, the system clock is used as the source of the periodic condition. If the returned value is TRUE, the 1-PPS signal is used as the source of the condition.
prescale ()
prescale() 'virtual' method Determines how the source signal is prescaled to form the periodic condition. That is, it sets the rate of the periodic condition. A value of zero does not prescale the periodic condition. This would, for example, assuming the system clock is used as source, create a periodic condition which operates at 20 MHZ. Range: [0 .. 0xffffff]
limit ()
limit() 'virtual' method Returns the number of iterations of the periodic condition before the condition stops. A value of zero (0) will cause the periodic condition to 'free-run', or never stop.

Detailed Description

TrgPeriodicConditionAbstract class definition.

Definition at line 11 of file TrgPeriodic.py.

Member Function Documentation

limit ( )

limit() 'virtual' method Returns the number of iterations of the periodic condition before the condition stops. A value of zero (0) will cause the periodic condition to 'free-run', or never stop.

Returns:
An integer

Reimplemented in TrgGemPeriodicCondition, and TrgDefaultPeriodicCondition.

prescale ( )

prescale() 'virtual' method Determines how the source signal is prescaled to form the periodic condition. That is, it sets the rate of the periodic condition. A value of zero does not prescale the periodic condition. This would, for example, assuming the system clock is used as source, create a periodic condition which operates at 20 MHZ. Range: [0 .. 0xffffff]

Returns:
An integer

Reimplemented in TrgGemPeriodicCondition, and TrgDefaultPeriodicCondition.

source ( )

source() 'virtual' method If the returned value is FALSE, the system clock is used as the source of the periodic condition. If the returned value is TRUE, the 1-PPS signal is used as the source of the condition.

Returns:
A boolean

Reimplemented in TrgGemPeriodicCondition, and TrgDefaultPeriodicCondition.

The documentation for this class was generated from the following file:
  • TrgPeriodic.py
Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgPeriodicConditionDefinition Class Reference

TrgPeriodic::TrgPeriodicConditionDefinition

TrgPeriodicConditionDefinition Class Reference

TrgPeriodicConditionDefinition class definition. More...

Inheritance diagram for TrgPeriodicConditionDefinition:

[legend]
Collaboration diagram for TrgPeriodicConditionDefinition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgPeriodicConditionAbstract constructor.

Detailed Description

TrgPeriodicConditionDefinition class definition.

Definition at line 83 of file TrgPeriodic.py.

The documentation for this class was generated from the following file:
  • TrgPeriodic.py
Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgReadout Class Reference

TrgEngines::TrgReadout

TrgReadout Class Reference

TrgReadout class definition. More...

Inheritance diagram for TrgReadout:

[legend]
Collaboration diagram for TrgReadout:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgReadout constructor.
sequence ()
sequence() method See TrgEngineRequest base class

Detailed Description

TrgReadout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the TACK command. This command will trigger a readout of the module's Front-End Electronics.

Definition at line 137 of file TrgEngines.py.

The documentation for this class was generated from the following file:
  • TrgEngines.py
Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoi Class Reference

TrgCoincidences::TrgRoi

TrgRoi Class Reference

Trigger ROI (Region of Interest) class definition. More...

Inheritance diagram for TrgRoi:

[legend]
Collaboration diagram for TrgRoi:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgRoi constructor.
tile (tileNumber)
tile 'pure virtual' method

Detailed Description

Trigger ROI (Region of Interest) class definition.

Definition at line 29 of file TrgCoincidences.py.

Member Function Documentation

tile ( tileNumber )

tile 'pure virtual' method

Parameters:
tileNumber A tile number
Returns:
A boolean

Reimplemented in NullRoi, and AddableRoi.

The documentation for this class was generated from the following file:
  • TrgCoincidences.py
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoiAsTiles Class Reference

TrgRoiAsTiles::TrgRoiAsTiles

TrgRoiAsTiles Class Reference

Class TrgRoiAsTiles LATTE provided class to map coincidences to ROIs. More...

Inheritance diagram for TrgRoiAsTiles:

[legend]
Collaboration diagram for TrgRoiAsTiles:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgCoincidences constructor.
coincidence (coincidenceNumber)
coincidence 'pure virtual' method Reference into the list of coincidences.
roi (roiNumber)
addCoincidence (cNumber, coinc)

Detailed Description

Class TrgRoiAsTiles LATTE provided class to map coincidences to ROIs.

Definition at line 15 of file TrgRoiAsTiles.py.

Member Function Documentation

coincidence ( coincidenceNumber )

coincidence 'pure virtual' method Reference into the list of coincidences.

Parameters:
coincidenceNumber A coincidence number
Returns:
A TrgCoincidence object

Reimplemented from TrgCoincidences.

The documentation for this class was generated from the following file:
  • TrgRoiAsTiles.py
Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRois Class Reference

TrgCoincidences::TrgRois

TrgRois Class Reference

Trigger ROI (Region of Interest) list class definition. More...

Inheritance diagram for TrgRois:

[legend]
Collaboration diagram for TrgRois:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgRois constructor.
roi (regionNumber)
roi 'pure virtual' method Reference into the list of ROIs

Detailed Description

Trigger ROI (Region of Interest) list class definition.

Definition at line 11 of file TrgCoincidences.py.

Member Function Documentation

roi ( regionNumber )

roi 'pure virtual' method Reference into the list of ROIs

Parameters:
regionNumber A region number
Returns:
A TrgRoi objece

The documentation for this class was generated from the following file:
  • TrgCoincidences.py
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgSequence Class Reference

TrgSequence::TrgSequence

TrgSequence Class Reference

Trigger Sequence class definition. More...

Inheritance diagram for TrgSequence:

[legend]
Collaboration diagram for TrgSequence:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgSequenceAbstract constructor.
definition ()
definition() member

Detailed Description

Trigger Sequence class definition.

Definition at line 42 of file TrgSequence.py.

Member Function Documentation

definition ( )

definition() member

Returns:
an object of type TrgSequenceDefinition

The documentation for this class was generated from the following file:
  • TrgSequence.py
Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgSequenceAbstract Class Reference

TrgSequence::TrgSequenceAbstract

TrgSequenceAbstract Class Reference

Abstract Trigger Sequence class definition. More...

Inheritance diagram for TrgSequenceAbstract:

[legend]
Collaboration diagram for TrgSequenceAbstract:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgSequenceAbstract constructor.
eventNumber ()
EventNumber 'pure virtual' method.
eventTag ()
EventTag 'pure virtual' method.

Detailed Description

Abstract Trigger Sequence class definition.

Definition at line 11 of file TrgSequence.py.

Member Function Documentation

eventNumber ( )

EventNumber 'pure virtual' method.

Returns:
An integer containing the current event number

Reimplemented in TrgGemSequence, and TrgDefaultSequence.

eventTag ( )

EventTag 'pure virtual' method.

Returns:
An integer containing the current event tag value

Reimplemented in TrgGemSequence, and TrgDefaultSequence.

The documentation for this class was generated from the following file:
  • TrgSequence.py
Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgSequenceDefinition Class Reference

TrgSequence::TrgSequenceDefinition

TrgSequenceDefinition Class Reference

Trigger Sequence Definition class definition. More...

Inheritance diagram for TrgSequenceDefinition:

[legend]
Collaboration diagram for TrgSequenceDefinition:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgSequenceAbstract constructor.

Detailed Description

Trigger Sequence Definition class definition.

Definition at line 34 of file TrgSequence.py.

The documentation for this class was generated from the following file:
  • TrgSequence.py
Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTileCounters Class Reference

TrgTileCounters::TrgTileCounters

TrgTileCounters Class Reference

TrgTileCounters class definition This class controls the counters used to count ACD tile transitions. More...

Inheritance diagram for TrgTileCounters:

[legend]
Collaboration diagram for TrgTileCounters:

[legend]
List of all members.

Public Member Functions

__init__ ()
stats ()
stats() member function Returns the statistics object for the tile counters
reset ()
reset() member function Reset the tile statistics
assignA (a)
assignA() member function Assign the 'A' tile counter to watch a particular tile Immediately after counter assignment, both counters are reset.
assignB (B)
assignB() member function Assign the 'B' tile counter to watch a particular tile Immediately after counter assignment, both counters are reset.
assignAB (a, b)
assignAB() member function Assign both the 'A' and the'B' tile counters to watch two tiles Immediately after counter assignment, both counters are reset.

Detailed Description

TrgTileCounters class definition This class controls the counters used to count ACD tile transitions.

Definition at line 12 of file TrgTileCounters.py.

Member Function Documentation

stats ( )

stats() member function Returns the statistics object for the tile counters

Returns:
A TrgTileStats object

Reimplemented in TrgGemTileCounters.

The documentation for this class was generated from the following file:
  • TrgTileCounters.py
Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTileEnables Class Reference

TrgInputEnables::TrgTileEnables

TrgTileEnables Class Reference

Trigger Tile Enables class definition. More...

Inheritance diagram for TrgTileEnables:

[legend]
Collaboration diagram for TrgTileEnables:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTileEnables constructor.
tile (tileNumber)
Tile 'pure virtual' method.

Detailed Description

Trigger Tile Enables class definition.

Definition at line 140 of file TrgInputEnables.py.

Member Function Documentation

tile ( tileNumber )

Tile 'pure virtual' method.

Parameters:
tileNumber A tile number
Returns:
An integer

Reimplemented in NoTilesEnabled, and rcTrgTileEnables.

The documentation for this class was generated from the following file:
  • TrgInputEnables.py
Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTileStats Class Reference

TrgTileCounters::TrgTileStats

TrgTileStats Class Reference

TrgTileStats class definition This class specifies the statistics returned by the counters described by TrgTileCounters. More...

Inheritance diagram for TrgTileStats:

[legend]
Collaboration diagram for TrgTileStats:

[legend]
List of all members.

Public Member Functions

__init__ ()
A ()
B ()

Detailed Description

TrgTileStats class definition This class specifies the statistics returned by the counters described by TrgTileCounters.

Definition at line 51 of file TrgTileCounters.py.

Member Function Documentation

A ( )

Return the statistics for the 'A' tile counter

Returns:
an integer

Reimplemented in TrgGemTileStats.

B ( )

Return the statistics for the 'B' tile counter

Returns:
an integer

Reimplemented in TrgGemTileStats.

The documentation for this class was generated from the following file:
  • TrgTileCounters.py
Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTower Class Reference

TrgTower::TrgTower

TrgTower Class Reference

Trigger Tower class definition. More...

Inheritance diagram for TrgTower:

[legend]
Collaboration diagram for TrgTower:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTower constructor.
calorimeter ()
Calorimeter 'pure virtual' method.
tracker ()
Tracker 'pure virtual' method.

Detailed Description

Trigger Tower class definition.

Definition at line 29 of file TrgTower.py.

Member Function Documentation

calorimeter ( )

Calorimeter 'pure virtual' method.

Returns:
A TrgCalorimeter object

Reimplemented in NullTower.

tracker ( )

Tracker 'pure virtual' method.

Returns:
A TrgTracker object

Reimplemented in NullTower.

The documentation for this class was generated from the following file:
  • TrgTower.py
Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTowerEnables Class Reference

TrgInputEnables::TrgTowerEnables

TrgTowerEnables Class Reference

Trigger Tower Enables class definition. More...

Inheritance diagram for TrgTowerEnables:

[legend]
Collaboration diagram for TrgTowerEnables:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTowerEnables constructor.
towers ()
towers() 'pure virtual' method

Detailed Description

Trigger Tower Enables class definition.

Definition at line 40 of file TrgInputEnables.py.

Member Function Documentation

towers ( )

towers() 'pure virtual' method

Returns:
a TrgTowers object

The documentation for this class was generated from the following file:
  • TrgInputEnables.py
Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTowers Class Reference

TrgTower::TrgTowers

TrgTowers Class Reference

Trigger Towers class definition. More...

Inheritance diagram for TrgTowers:

[legend]
Collaboration diagram for TrgTowers:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTowers constructor.
tower (towerNumber)
Tower 'pure virtual' method.

Detailed Description

Trigger Towers class definition.

Definition at line 11 of file TrgTower.py.

Member Function Documentation

tower ( towerNumber )

Tower 'pure virtual' method.

Parameters:
towerNumber A tower number
Returns:
A TrgTower object

The documentation for this class was generated from the following file:
  • TrgTower.py
Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTracker Class Reference

TrgTower::TrgTracker

TrgTracker Class Reference

Trigger Tracker class definition. More...

Inheritance diagram for TrgTracker:

[legend]
Collaboration diagram for TrgTracker:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTracker constructor.
use ()
Use 'virtual' method.

Detailed Description

Trigger Tracker class definition.

Definition at line 75 of file TrgTower.py.

Member Function Documentation

use ( )

Use 'virtual' method.

Returns:
A boolean

Reimplemented in NullTkr.

The documentation for this class was generated from the following file:
  • TrgTower.py
Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTriggerCounters Class Reference

TrgTriggerCounters::TrgTriggerCounters

TrgTriggerCounters Class Reference

TrgTriggerCounters class definition This class controls the counters associated with the performance of the LAT with respect to the Trigger System. More...

Inheritance diagram for TrgTriggerCounters:

[legend]
Collaboration diagram for TrgTriggerCounters:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgTriggerCounters constructor.
stats ()
stats() method Returns the Trigger Counter Statistics object.
reset ()
reset() method Reset the trigger counters.

Detailed Description

TrgTriggerCounters class definition This class controls the counters associated with the performance of the LAT with respect to the Trigger System.

Definition at line 13 of file TrgTriggerCounters.py.

Member Function Documentation

stats ( )

stats() method Returns the Trigger Counter Statistics object.

Returns:
A TrgTriggerStats object

Reimplemented in TrgGemTriggerCounters.

The documentation for this class was generated from the following file:
  • TrgTriggerCounters.py
Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTriggerStats Class Reference

TrgTriggerCounters::TrgTriggerStats

TrgTriggerStats Class Reference

TrgTriggerStats This class specifies the statistics returned by the counters defined in TrgTriggerCounters. More...

Inheritance diagram for TrgTriggerStats:

[legend]
Collaboration diagram for TrgTriggerStats:

[legend]
List of all members.

Public Member Functions

__init__ ()
livetime ()
livetime() method Return the system livetime
prescaled ()
prescaled() method Return the number of events that have been prescaled
discarded ()
discarded() method Return the number of events discarded
sent ()
sent() method Return the number of events sent on

Detailed Description

TrgTriggerStats This class specifies the statistics returned by the counters defined in TrgTriggerCounters.

Definition at line 36 of file TrgTriggerCounters.py.

Member Function Documentation

discarded ( )

discarded() method Return the number of events discarded

Returns:
an integer

Reimplemented in TrgGemTriggerStats.

livetime ( )

livetime() method Return the system livetime

Returns:
an integer

Reimplemented in TrgGemTriggerStats.

prescaled ( )

prescaled() method Return the number of events that have been prescaled

Returns:
an integer

Reimplemented in TrgGemTriggerStats.

sent ( )

sent() method Return the number of events sent on

Returns:
an integer

Reimplemented in TrgGemTriggerStats.

The documentation for this class was generated from the following file:
  • TrgTriggerCounters.py
Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgUsingTiles Class Reference

TrgUsingTiles::TrgUsingTiles

TrgUsingTiles Class Reference

Trigger Using Tiles class definition. More...

Inheritance diagram for TrgUsingTiles:

[legend]
Collaboration diagram for TrgUsingTiles:

[legend]
List of all members.

Public Member Functions

__init__ ()
TrgUsingTiles constructor.
coincidences ()
Coincdences 'pure virtual' method.
useAcdAsTrigger ()
UseAcdAsTrigger 'pure virtual' method.
periodicCondition ()
PeriodicCondition 'pure virtual' method.
sequence ()
Sequence 'pure virtual' method.
roi ()
Roi 'pure virtual' method.

Detailed Description

Trigger Using Tiles class definition.

Definition at line 21 of file TrgUsingTiles.py.

Member Function Documentation

coincidences ( )

Coincdences 'pure virtual' method.

Returns:
A TrgCoincidences object

Reimplemented in rcGEMDefaultTrigger.

periodicCondition ( )

PeriodicCondition 'pure virtual' method.

Returns:
A TrgPeriodicCondition object
This object specifies the initial and current definition of the periodic condition

Reimplemented from TrgGemAbstract.

roi ( )

Roi 'pure virtual' method.

Returns:
A TrgRoi object
This object specifies the definition of the GEM's ROI generator

Reimplemented from TrgGemAbstract.

sequence ( )

Sequence 'pure virtual' method.

Returns:
A TrgSequence object This object specifies the initial sequence number definitions for the trigger

Reimplemented from TrgAbstract.

useAcdAsTrigger ( )

UseAcdAsTrigger 'pure virtual' method.

Returns:
A boolean
This value specifies whether or not the the ROI generator and its ACD tile signals are be used as a trigger or as a veto. If the value returned is TRUE, the ROI generator is used as a trigger. If the value returned is FALSE, the ROI generator is used as a veto.

Reimplemented from TrgGemAbstract.

Reimplemented in rcGEMDefaultTrigger.

The documentation for this class was generated from the following file:
  • TrgUsingTiles.py
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: UDPReceiver Class Reference

Receiver::UDPReceiver

UDPReceiver Class Reference

UDPReceiver class. More...

Inheritance diagram for UDPReceiver:

[legend]
Collaboration diagram for UDPReceiver:

[legend]
List of all members.

Public Member Functions

__init__ ()
receive ()
setUDPClient (name, server)
shutdown ()

Detailed Description

UDPReceiver class.

Definition at line 36 of file Receiver.py.

The documentation for this class was generated from the following file:
  • Receiver.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: UDPRecorder Class Reference

Recorder::UDPRecorder

UDPRecorder Class Reference

Example recorder that UDP broadcasts trendables. More...

Inheritance diagram for UDPRecorder:

[legend]
Collaboration diagram for UDPRecorder:

[legend]
List of all members.

Public Member Functions

__init__ ()
startUDPServer (name, server)
stopUDPServer ()
processTrends (trendables)
shutdown ()

Detailed Description

Example recorder that UDP broadcasts trendables.

Uses LATTE.tools.DataDistributionServer

Definition at line 44 of file Recorder.py.

The documentation for this class was generated from the following file:
  • Recorder.py
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppEvtTO::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 33 of file testAppEvtTO.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppEvtTO.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

hTestStrip::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()

Detailed Description

Implmentation class for a user application

Definition at line 37 of file hTestStrip.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • hTestStrip.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testSAppCal::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 34 of file testSAppCal.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testSAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

nullApp::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
stop ()
process ((status, buffer))
wait ()

Detailed Description

Implmentation class for Null application

Definition at line 9 of file nullApp.py.

Member Function Documentation

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • nullApp.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppEvt::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 53 of file testAppEvt.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppArchiver::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 36 of file testAppArchiver.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppArchiver.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppAcd::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 33 of file testAppAcd.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppAcd.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppAcdScalers::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 46 of file testAppAcdScalers.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

hTestAppEvt::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 59 of file hTestAppEvt.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • hTestAppEvt.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppEvtCli::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 37 of file testAppEvtCli.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppEvtCli.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppCal::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 35 of file testAppCal.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppLDFdump::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 46 of file testAppLDFdump.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppLDFdump.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppAlarm::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()
yellowAlarm1 (value, signal, sender, sendNode)
yellowAlarm2 (value, signal, sender, sendNode)
redAlarm (value, signal, sender)

Detailed Description

Implmentation class for a user application

Definition at line 35 of file testAppAlarm.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppAlarm.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testSAppEvt::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 54 of file testSAppEvt.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testSAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

hTestEnv::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 33 of file hTestEnv.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • hTestEnv.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

hTestAppTkr::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 39 of file hTestAppTkr.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • hTestAppTkr.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppTkr::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 35 of file testAppTkr.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppTkr.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

testAppCal_dg::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
resume ()
stop ()
teardown ()
process ((status, latDatagram))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for a user application

Definition at line 47 of file testAppCal_dg.py.

Member Function Documentation

commandSynch ( )

Method called by the command synchronization task

process ( (status, latDatagram) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • testAppCal_dg.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userApplication Class Reference

excApp::userApplication

userApplication Class Reference

List of all members.

Public Member Functions

__init__ (rc, userId, debug)
getName ()
setup ()
startRun ()
stopRun ()
stop ()
teardown ()
pause ()
resume ()
process ((status, buffer))
commandSynch ()
wait ()
sync ()

Detailed Description

Implmentation class for Null application

Definition at line 38 of file excApp.py.

Member Function Documentation

process ( (status, buffer) )

Method called back for each data event taken

The documentation for this class was generated from the following file:
  • excApp.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppEvt::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 45 of file testAppEvt.py.

The documentation for this class was generated from the following file:
  • testAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppTkr::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 27 of file testAppTkr.py.

The documentation for this class was generated from the following file:
  • testAppTkr.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testSAppCal::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 26 of file testSAppCal.py.

The documentation for this class was generated from the following file:
  • testSAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

excApp::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 30 of file excApp.py.

The documentation for this class was generated from the following file:
  • excApp.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppCal::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 27 of file testAppCal.py.

The documentation for this class was generated from the following file:
  • testAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppAlarm::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 27 of file testAppAlarm.py.

The documentation for this class was generated from the following file:
  • testAppAlarm.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

hTestEnv::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 25 of file hTestEnv.py.

The documentation for this class was generated from the following file:
  • hTestEnv.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppAcd::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 25 of file testAppAcd.py.

The documentation for this class was generated from the following file:
  • testAppAcd.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testSAppEvt::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 46 of file testSAppEvt.py.

The documentation for this class was generated from the following file:
  • testSAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

hTestAppTkr::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 31 of file hTestAppTkr.py.

The documentation for this class was generated from the following file:
  • hTestAppTkr.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppCal_dg::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 39 of file testAppCal_dg.py.

The documentation for this class was generated from the following file:
  • testAppCal_dg.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

hTestStrip::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 29 of file hTestStrip.py.

The documentation for this class was generated from the following file:
  • hTestStrip.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppEvtCli::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 29 of file testAppEvtCli.py.

The documentation for this class was generated from the following file:
  • testAppEvtCli.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppLDFdump::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 38 of file testAppLDFdump.py.

The documentation for this class was generated from the following file:
  • testAppLDFdump.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppEvtTO::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 25 of file testAppEvtTO.py.

The documentation for this class was generated from the following file:
  • testAppEvtTO.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppAcdScalers::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 38 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

hTestAppEvt::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 51 of file hTestAppEvt.py.

The documentation for this class was generated from the following file:
  • hTestAppEvt.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgText Class Reference

testAppArchiver::userArgText

userArgText Class Reference

List of all members.

Public Member Functions

__init__ ()
getValue (caption)

Detailed Description

Text user interface for getting the user to input some sort of value

Definition at line 28 of file testAppArchiver.py.

The documentation for this class was generated from the following file:
  • testAppArchiver.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppCal_dg::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 29 of file testAppCal_dg.py.

The documentation for this class was generated from the following file:
  • testAppCal_dg.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

excApp::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)
getValueExc (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 19 of file excApp.py.

The documentation for this class was generated from the following file:
  • excApp.py
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppEvt::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 35 of file testAppEvt.py.

The documentation for this class was generated from the following file:
  • testAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

hTestStrip::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 19 of file hTestStrip.py.

The documentation for this class was generated from the following file:
  • hTestStrip.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testSAppCal::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 16 of file testSAppCal.py.

The documentation for this class was generated from the following file:
  • testSAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

hTestAppTkr::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 21 of file hTestAppTkr.py.

The documentation for this class was generated from the following file:
  • hTestAppTkr.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppCal::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 17 of file testAppCal.py.

The documentation for this class was generated from the following file:
  • testAppCal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppLDFdump::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 29 of file testAppLDFdump.py.

The documentation for this class was generated from the following file:
  • testAppLDFdump.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppEvtCli::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 19 of file testAppEvtCli.py.

The documentation for this class was generated from the following file:
  • testAppEvtCli.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

hTestAppEvt::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 42 of file hTestAppEvt.py.

The documentation for this class was generated from the following file:
  • hTestAppEvt.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppAcd::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value

Definition at line 15 of file testAppAcd.py.

The documentation for this class was generated from the following file:
  • testAppAcd.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

hTestEnv::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 15 of file hTestEnv.py.

The documentation for this class was generated from the following file:
  • hTestEnv.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testSAppEvt::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 36 of file testSAppEvt.py.

The documentation for this class was generated from the following file:
  • testSAppEvt.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppTkr::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 17 of file testAppTkr.py.

The documentation for this class was generated from the following file:
  • testAppTkr.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppArchiver::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 18 of file testAppArchiver.py.

The documentation for this class was generated from the following file:
  • testAppArchiver.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppAcdScalers::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 28 of file testAppAcdScalers.py.

The documentation for this class was generated from the following file:
  • testAppAcdScalers.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppEvtTO::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 15 of file testAppEvtTO.py.

The documentation for this class was generated from the following file:
  • testAppEvtTO.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userArgument Class Reference

testAppAlarm::userArgument

userArgument Class Reference

List of all members.

Public Member Functions

__init__ (parent=None, name=None, modal=0, fl=0)
OKButtonClicked ()
CancelButtonClicked ()
getValue (caption)

Detailed Description

GUI for getting the user to input some sort of value.

Definition at line 17 of file testAppAlarm.py.

The documentation for this class was generated from the following file:
  • testAppAlarm.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userSuite Class Reference

testSuite2::userSuite

userSuite Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setupSuite ()
startSuite ()
stopSuite ()

Detailed Description

Implmentation class for a user application

Definition at line 9 of file testSuite2.py.

The documentation for this class was generated from the following file:
  • testSuite2.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userSuite Class Reference

testSuite::userSuite

userSuite Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setupSuite ()
pauseSuite ()
startSuite ()
stopSuite ()

Detailed Description

Implmentation class for a user application

Definition at line 9 of file testSuite.py.

The documentation for this class was generated from the following file:
  • testSuite.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: userSuite Class Reference

testSuiteLong::userSuite

userSuite Class Reference

List of all members.

Public Member Functions

__init__ (gui, userId, debug)
getName ()
setupSuite ()
startSuite ()
stopSuite ()

Detailed Description

Implmentation class for a user application

Definition at line 10 of file testSuiteLong.py.

The documentation for this class was generated from the following file:
  • testSuiteLong.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ZsupSolicitedEngine Class Reference

test_evt_cal::ZsupSolicitedEngine

ZsupSolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. Zero suppression is on. This engine is not prescaled.

Definition at line 104 of file test_evt_cal.py.

The documentation for this class was generated from the following file:
  • test_evt_cal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ZsupSolicitedEngine Class Reference

test_evt_tkr::ZsupSolicitedEngine

ZsupSolicitedEngine Class Reference

List of all members.

Public Member Functions

__init__ ()
participate (conditionsValue)
prescale ()
request ()

Detailed Description

This class defines an engine which reads out the detector whenever there is a solicited trigger. Zero suppression is on. This engine is not prescaled.

Definition at line 30 of file test_evt_tkr.py.

The documentation for this class was generated from the following file:
  • test_evt_tkr.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ZsupTrgInjectChargeReadout Class Reference

test_evt_cal::ZsupTrgInjectChargeReadout

ZsupTrgInjectChargeReadout Class Reference

ZsupTrgReadout class definition. More...

List of all members.

Public Member Functions

__init__ ()
TrgReadout constructor.
zeroSuppress ()

Detailed Description

ZsupTrgReadout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the TACK command. This command will trigger a readout of the module's Front-End Electronics. Zero suppression is turned on.

Definition at line 90 of file test_evt_cal.py.

The documentation for this class was generated from the following file:
  • test_evt_cal.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ZsupTrgReadout Class Reference

MiniGLTExample::ZsupTrgReadout

ZsupTrgReadout Class Reference

ZsupTrgReadout class definition. More...

List of all members.

Public Member Functions

__init__ ()
TrgReadout constructor.
zeroSuppress ()

Detailed Description

ZsupTrgReadout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the TACK command. This command will trigger a readout of the module's Front-End Electronics. Zero suppression is turned on.

Definition at line 71 of file MiniGLTExample.py.

The documentation for this class was generated from the following file:
  • MiniGLTExample.py
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ZsupTrgReadout Class Reference

SimpleGasuExample::ZsupTrgReadout

ZsupTrgReadout Class Reference

ZsupTrgReadout class definition. More...

List of all members.

Public Member Functions

__init__ ()
TrgReadout constructor.
zeroSuppress ()

Detailed Description

ZsupTrgReadout class definition.

Directs a module to send to its Front-End Electronics a command sequence which is composed only of the TACK command. This command will trigger a readout of the module's Front-End Electronics. Zero suppression is turned on.

Definition at line 92 of file SimpleGasuExample.py.

The documentation for this class was generated from the following file:
  • SimpleGasuExample.py
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Hierarchical Index

LATTE Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:

  • _Attr
  • _object
  • _Parameter
    • _Anonymous
    • _Any
  • _regList
  • AcdHWMultiplexer
  • ACDmap
  • AcdPanel
  • ACDSingleEvtDisplayImpl
  • AEM
  • AEMcontributionIterator
  • AEMcontributionIterator
  • AEQHskRegMap
  • ArgumentImpl
  • bf
  • BitField
  • BoundMethodWeakref
  • BrowserImpl
  • BrowserImpl
  • browserPreferencesImpl
  • CAL_LATcontribution
  • CALcontributionIterator
  • CALcontributionIterator2
  • ccsdsHeader
  • ccsdsPacket
    • HskPacketDecoder::HskPacketBase
  • ccsdsSocket
  • Children
  • CmdCli
  • Collector
  • Command
  • CommentEntryWidget
  • ConnectState
  • ConnectState
  • ConnectState
  • Consumer
    • consumerPlotter
  • DataDistributorAddress
  • DataDistributorClient
  • DataDistributorPoll
  • DataDistributorServer
  • DataExport
  • DIAGcontributionIterator
  • DIAGcontributionIterator
  • DispatcherError
    • DispatcherKeyError
    • DispatcherTypeError
  • drawHatACD
  • drawSide1ACD
  • drawSide2ACD
  • drawSide3ACD
  • drawSide4ACD
  • drawXZ_CAL
  • drawXZ_TKR
  • drawYZ_CAL
  • drawYZ_TKR
  • DummyRetriever
  • EBFeventIterator
  • Email
  • EmailAlarm
  • EnvMonImpl
  • ERRcontributionIterator
  • evAEM_PHA
  • evCAL_LayerLogData
  • evCAL_LogAccepts
  • evCAL_LogData
  • evCellHeader
    • gEvtCli::evCellHeader_Singleton
  • evContPacket
    • gEvtCli::evContPacket_Singleton
  • evDiag_CalLayer
  • evDiag_CalLayerEnd
  • evDiag_Data
  • evDiag_TkrTrgReq
  • evErr_CablePhase
  • evErr_CableTimeOut
  • evErr_GCCC
  • evErr_GCCC_Message
  • evErr_GTCC
  • evErr_GTCC_Message
  • evErr_Summary
  • evGEM_Veto_List
  • evSummary
    • gEvtCli::evSummary_Singleton
  • Evt
  • EvtCli
  • EvtCliIO
    • EvtCli
  • evtDataImpl
  • evTKR_Strip
  • evTKR_StripData
  • evTKR_TOTdata
  • ExceptionFSM
  • FancyTrendTree
  • FEpowerUp
  • FSM
    • RunControlFSM::RunControlFSM
  • FswMessages
  • FullCondition
  • FullEngine
  • GasuExtTrg
  • GasuExtTrgEngine
  • Gattr
    • GattrBF
    • GattrDlc
    • GattrRaw
    • GattrReg
    • GattrHsk
  • GconstraintBase
    • Gconstraint
      • GconstraintLimit
      • GconstraintLimitPegRE
      • GconstraintLimitRE
  • gConstraintViolation
  • Gdb
    • GAEM
    • GAEQ
    • GAFE
    • GARC
    • GCRU
    • GEBM
    • GEBMC
    • GEBMST
    • GGEM
    • GGEMC
    • GGEMIE
    • GGEMMG
    • GGEMSC
    • GGEMST
    • GGEMVG
    • GGEMW
    • GGLT
    • GHSK
    • HAEM
    • HARC
    • HCOM
    • HCPU
    • HEBM
    • HGEM
    • HNUL
    • HPDU
    • HTEM
    • GLAT
    • GLCB
    • GMem
    • GNAT
    • GOCS
    • GPDU
    • GPEQ
    • GCCC
    • GCFE
    • GCRC
    • GTCC
    • GTEM
    • GTFE
    • GTIC
    • GTRC
    • gTPG::GTPG
    • GTWR
    • GXBRD
    • test_db::GTest
  • GDBN
  • GEGU
    • GEGU_linear
    • GEGU_poly3
  • GEM
  • GEMcontribution
  • GEMcontribution
  • GExportException
  • Ggroup
  • GHSKTrendMap
  • GLATTrendMap
  • GlobalPanelImpl
  • GOSEDCALImpl
  • GOSEDCALTKRImpl
  • GOSEDDataImpl
  • GOSEDPreferencesImpl
  • GOSEDTKRImpl
  • GOSEDTWRImpl
  • GruleBase
    • Grule
      • GruleAlarms
      • GruleLimit
  • GUIbridge
  • GUIbridgeTest
  • Gversions
  • HskAlarm
  • HskAlarmRecorder
  • HskCfgTextReceiver
  • HskCli
  • HskCmdRxSocket
  • HskCmdTxSocket
  • HskCollector
  • HskConfiguration
  • HskFileRecorder
  • HskHandler
  • HskLatRetriever
  • HskPacketRecorder
  • HskPacketRetriever
  • HskPacketWriter
  • HskSimpleTextReceiver
  • HskSqlReceiver
  • HskSqlRecorder
  • HskTelemSocket
  • HskTestRetriever
  • LATcomponentIterator
  • LATcomponentIterator
  • LATcontributionIterator
  • LATInterfaceException
  • LATInterfaceStatus
  • LATsweep
  • LDBI_LATcontributionIterator
  • LogRecordStreamHandler
  • Loopback
  • MailAlert
  • MarkerTrgReadout
  • MiniGLTExample
  • MiniGLTExample
  • MiniGLTExample
  • MiniGltExtTrg
  • MiniGLTSolicitedCondition
  • MiniGLTSolicitedCondition
  • MiniGLTSolicitedCondition
  • MiniGLTSolicitedEngine
  • MiniGLTSolicitedEngine
  • MiniGLTSolicitedEngine
  • MiniGltTrgEngine
  • MiniGLTTrgEngines
  • MiniGLTTrgEngines
  • MiniGLTTrgEngines
  • MSGLogGUIImpl
  • MSGLogSocketReceiver
  • myLATcomponentIterator
  • myLATcomponentIterator
  • myLATcomponentIterator
  • myLATcomponentIterator
  • myTKRcontributionIterator
  • Node
  • NodeRegisterList
  • NullStream
  • OcsMessages
  • Options
  • OSWcontributionIterator
  • OSWcontributionIterator
  • Playback
  • PlotWidget
  • PowerPanelImpl
  • Preferences
  • PythonShellWidget
  • PyThreadBridge
  • QtReceiver
  • QtReceiver
  • QtReceiver
  • QtThreadBridge
  • rcArchiver
    • testArchiver::testArchiver
  • rcCommentPanel
  • rcCompletionStatus
  • rcFileSelector
  • rcFileSelector
  • rcFitsWriter
  • rcHouseKeeping
  • rcLoginImpl
  • rcParamVerifier
  • rcParamVerifyGUIImpl
  • rcPreferencesGUIImpl
  • rcPreferencesManager
  • rcPythonShell
  • rcReportGen
  • rcRunIdHelper
  • rcScmCfgSelector
  • rcScmCfgSelText
  • rcSecurityMan
  • rcStatusMonitor
  • rcStatusPanel
  • rcSuite
  • rcTestReport
  • rcTransitions
  • rcUser
  • rcUsers
  • Receiver
    • UDPReceiver
  • Recorder
    • DummyRecorder
    • Recorder::FlatFileRecorder
    • UDPRecorder
  • Register
  • RegisterInterface
  • RegViewItem
  • Reloader
  • Response
  • Retriever
  • ReverseTrendMap
  • RunControl
  • RunControlCommon
  • RunControlFileHandler
  • RunControlGUIImpl
  • RunControlMain
  • RunControlMainGUIImpl
  • RunControlSocketHandler
  • ScrollablePlotView
  • ServerPreferencesImpl
  • SGETrgEngines
  • SGETrgEngines
  • SGETrgInputEnables
  • SGETrgInputEnables
  • SimpleGasuExample
  • SimpleGasuExample
  • singleEvtDisplayImpl
  • SLACmail
  • Socket
  • SolicitedCondition
  • SolicitedCondition
  • SolicitedEngine
  • SolicitedEngine
  • standardPlotter
  • standardPlotterGuiImpl
  • standardTestReport
  • StatusItem
  • TaskEngine
  • TaskEngineTestCase
  • testEvtCli
  • TestWindow
  • TimeAxisGen
  • TimeAxisGen
  • TKRcontributionIterator
  • TKRcontributionIterator
  • towerEvtDisplayImpl
  • Trendable
  • TrendLimit
  • TrendMapBase
  • TrendPlotter
  • TrendPlotter
  • TrendPlotter
  • TrendTestGUI
  • TrendTree
  • TrgObject
    • TrgAbstract
      • TrgGemAbstract
        • TrgGemRegisters
          • TrgGem
            • rcTrgGem
              • TrgUsingTiles
                • rcGEMDefaultTrigger
      • TrgMiniGLTAbstract
        • TrgMiniGLTRegisters
          • TrgMiniGLT
            • rcTrgMiniGLT
              • rcMiniGLTDefaultTrigger
    • TrgCmdCounters
      • TrgGemCmdCounters
    • TrgCmdStats
      • TrgGemCmdStats
    • TrgCoincidence
      • NullCoincidence
      • rcTrgCoincidence
    • TrgRoi
      • NullRoi
      • AddableRoi
      • TrgRoiAsVeto::MyRoi
    • TrgRois
      • TrgCoincidences
        • TrgRoiAsTiles
      • TrgRoiAsVeto::TrgRoiAsVeto
    • TrgConditions
      • TrgConditionsValue
        • rcSolicitedCondition
        • MiniGLTTrgConditionsValue
          • rcMiniGLTSolicitedCondition
    • TrgEngine
      • NullEngine
      • rcMiniGLTSolicitedEngine
      • rcSolicitedEngine
      • SweepMarkerEngine
    • TrgEngineRequest
      • NullRequest
      • TrgInjectCharge
      • TrgInjectChargeReadout
      • TrgInjectMarker
        • rcTrgFunctions::rcTrgInjectMarker
      • TrgReadout
    • TrgEngines
      • rcTrgEngines
        • rcGEMTrgEngines
        • rcDefaultTrigger::rcMiniGLTTrgEngines
    • TrgEventCounter
      • TrgGemEventCounter
    • TrgCnoEnables
      • NoCnoEnabled
    • TrgInputEnables
      • NoInputsEnabled
    • TrgTileEnables
      • NoTilesEnabled
      • rcTrgTileEnables
    • TrgTowerEnables
      • NullObjects::NoTowersEnabled
    • TrgPeriodicConditionAbstract
      • TrgPeriodicCondition
        • TrgGemPeriodicCondition
          • DefaultPeriodicCondition
      • TrgPeriodicConditionDefinition
        • TrgDefaultPeriodicCondition
    • TrgSequenceAbstract
      • TrgSequence
        • TrgGemSequence
          • TrgUsingTiles::DefaultSequence
      • TrgSequenceDefinition
        • TrgDefaultSequence
    • TrgTileCounters
      • TrgGemTileCounters
    • TrgTileStats
      • TrgGemTileStats
    • TrgCalorimeter
      • NullCal
    • TrgTower
      • NullTower
    • TrgTowers
    • TrgTracker
      • NullTkr
    • TrgTriggerCounters
      • TrgGemTriggerCounters
    • TrgTriggerStats
      • TrgGemTriggerStats
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userApplication
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgText
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userArgument
  • userSuite
  • userSuite
  • userSuite
  • WatchItem
  • ZsupSolicitedEngine
  • ZsupSolicitedEngine
  • ZsupTrgInjectChargeReadout
  • ZsupTrgReadout
  • ZsupTrgReadout
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Class Members

All | Functions
_ | a | b | c | d | e | f | g | h | i | l | m | n | o | p | r | s | t | u | v | w | z

Here is a list of all documented class members with links to the class documentation for each member:

- _ -

  • __call__() : BoundMethodWeakref
  • __cmp__() : BoundMethodWeakref
  • __init__() : DefaultPeriodicCondition, TrgUsingTiles, TrgTriggerCounters, TrgTracker, TrgCalorimeter, TrgTower, TrgTowers, TrgDefaultSequence, TrgSequence, TrgSequenceDefinition, TrgSequenceAbstract, AddableRoi, TrgRoiAsTiles, TrgDefaultPeriodicCondition, TrgPeriodicConditionDefinition, TrgPeriodicCondition, TrgPeriodicConditionAbstract, TrgMiniGLTRegisters, TrgMiniGLTAbstract, MiniGLTTrgConditionsValue, TrgMiniGLT, TrgTileEnables, TrgCnoEnables, TrgTowerEnables, TrgInputEnables, TrgGemSequence, TrgGemRegisters, TrgGemPeriodicCondition, TrgGemEventCounter, TrgGemCmdStats, TrgGemCmdCounters, TrgGemTileStats, TrgGemTileCounters, TrgGemTriggerStats, TrgGemTriggerCounters, TrgGemAbstract, TrgGem, TrgEventCounter, TrgInjectMarker, TrgInjectChargeReadout, TrgReadout, TrgInjectCharge, TrgEngineRequest, TrgEngine, TrgEngines, TrgConditionsValue, TrgConditions, TrgCoincidence, TrgCoincidences, TrgRoi, TrgRois, TrgCmdStats, TrgCmdCounters, TrgAbstract, rcTrgMiniGLT, rcTrgGem, rcTrgCoincidence, rcTrgTileEnables, SweepMarkerEngine, rcTrgEngines, rcMiniGLTSolicitedCondition, rcMiniGLTSolicitedEngine, rcSolicitedCondition, rcSolicitedEngine, rcGEMTrgEngines, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, NullRequest, NullEngine, NullCoincidence, NullRoi, NoInputsEnabled, NoCnoEnabled, NoTilesEnabled, NullTkr, NullCal, NullTower, GUIbridge, DataDistributorPoll, DataDistributorClient, DataDistributorServer, AcdHWMultiplexer, ZsupTrgInjectChargeReadout, MiniGLTExample, SimpleGasuExample, MarkerTrgReadout, MiniGLTExample, ZsupTrgReadout, SimpleGasuExample, ZsupTrgReadout, MiniGLTExample, GDBN, FSM, RegisterInterface, drawYZ_CAL, drawXZ_CAL, drawYZ_TKR, drawXZ_TKR, drawHatACD, drawSide4ACD, drawSide3ACD, drawSide2ACD, drawSide1ACD, singleEvtDisplayImpl, myLATcomponentIterator, TKRcontributionIterator, CALcontributionIterator2, BoundMethodWeakref, GTWR, GXBRD, GTIC, GTFE, GTRC, GTCC, GCFE, GCRC, GCCC, GTEM, GruleAlarms, GruleLimit, Grule, GPEQ, GPDU, GNAT, GMem, GLCB, GLAT, HNUL, HCPU, HCOM, HPDU, HEBM, HGEM, HARC, HAEM, HTEM, GHSK, GattrHsk, GGLT, GGEMW, GGEMIE, GGEMVG, GGEMSC, GGEMST, GGEMMG, GGEMC, GGEM, GEGU_poly3, GEGU_linear, GEBMST, GEBMC, GEBM, Gdb, GCRU, Gconstraint, GattrBF, GattrReg, GattrRaw, Gattr, GAFE, GARC, GAEQ, GAEM, standardTestReport, consumerPlotter, Consumer, EvtCli, evErr_GCCC_Message, evCAL_LayerLogData, evTKR_StripData, evTKR_TOTdata, Evt
  • __new__() : BoundMethodWeakref
  • __nonzero__() : BoundMethodWeakref
  • __setattr__() : TrgObject
  • __str__() : BoundMethodWeakref
  • _eval_() : GruleAlarms, GruleLimit, Grule, GconstraintLimitPegRE, GconstraintLimit, GconstraintLimitRE, Gconstraint

- a -

  • A() : TrgTileStats, TrgGemTileStats
  • abort() : TrgPeriodicCondition, TrgGemPeriodicCondition, AcdHWMultiplexer, EvtCliIO
  • ACDcomponent() : myLATcomponentIterator
  • add_transition() : FSM
  • add_transition_any() : FSM
  • add_transition_list() : FSM
  • addCAL_LogAccept() : Evt
  • addCAL_LogData() : Evt
  • addChannel() : GNAT
  • addCompletionStatus() : rcCompletionStatus
  • addCustomReportData() : rcTransitions
  • addErrGCCCmsg() : Evt
  • addErrGTCCmsg() : Evt
  • addExportedFile() : rcTransitions
  • addHeading() : rcTestReport
  • addHTML() : rcTestReport
  • addPair() : rcTrgCoincidence
  • addPassword() : rcSecurityMan
  • addPermission() : rcUser
  • addPHA() : AEM
  • addr() : Gdb
  • addRole() : rcUser
  • addSection() : rcTestReport
  • addSectionImage() : rcTestReport
  • addSectionItem() : rcTestReport
  • addSectionTable() : rcTestReport
  • addTableData() : rcTestReport
  • addTableHeader() : rcTestReport
  • addTKRaccept() : Evt
  • addTKRstrip() : Evt
  • addTKRtot() : Evt
  • addUser() : rcUsers
  • adjustExcludeTime() : rcTransitions
  • allAFE() : GARC
  • allARC() : GAEM
  • allCCC() : GTEM
  • allCFE() : GCRC
  • allCRC() : GCCC
  • allTCC() : GTEM
  • allTFE() : GTRC
  • allTRC() : GTCC
  • applyConfig() : rcTransitions
  • archiveClose() : Consumer
  • archiveOpen() : Consumer
  • assignA() : TrgTileCounters, TrgGemTileCounters
  • assignAB() : TrgTileCounters, TrgGemTileCounters
  • assignB() : TrgTileCounters, TrgGemTileCounters
  • authenticateUser() : rcSecurityMan

- b -

  • B() : TrgTileStats, TrgGemTileStats
  • beginTableRow() : rcTestReport

- c -

  • CALcomponent() : myLATcomponentIterator
  • calculateKey() : BoundMethodWeakref
  • calHigh() : TrgConditionsValue, TrgConditions
  • calLow() : TrgConditionsValue, TrgConditions
  • calorimeter() : TrgTower, NullTower
  • calStrobe() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • category() : Grule, Gconstraint
  • CCCcnt() : GTEM
  • changePassword() : rcSecurityMan
  • checkGGLTstatus() : EvtCli
  • checkOnlineStatus() : EvtCli
  • checkPassword() : rcSecurityMan
  • checkPermission() : rcSecurityMan
  • clearAllActions() : Grule
  • clearBuffer() : GNAT
  • clearButtonGroups() : singleEvtDisplayImpl
  • clearEvent() : Evt, AEM
  • clearViews() : singleEvtDisplayImpl
  • close() : EvtCliIO
  • closeTestReport() : standardTestReport
  • cmdCounters() : TrgGemAbstract, TrgGem
  • cno() : TrgInputEnables, TrgConditionsValue, TrgConditions, NoInputsEnabled
  • cnoEnableRegister() : TrgGemRegisters
  • coincidence() : TrgRoiAsTiles, TrgCoincidences
  • coincidences() : TrgUsingTiles, rcGEMDefaultTrigger, SimpleGasuExample
  • command() : TrgGemCmdStats, TrgCmdStats
  • commandSynch() : userApplication
  • commit() : rcTrgMiniGLT, rcTrgGem
  • conditions() : TrgAbstract, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, MiniGLTExample
  • configurationRegister() : TrgGemRegisters
  • connect() : DataDistributorClient, DataDistributorServer, HskHandler, HskCli
  • createGUI() : GUIbridge, RunControlMain, RunControl
  • customEvent() : RunControlMain

- d -

  • dataSize() : Consumer
  • definition() : DefaultPeriodicCondition, TrgSequence, TrgPeriodicCondition
  • deleteUser() : rcUsers, rcSecurityMan
  • destination() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgEngineRequest
  • diagnostic() : myLATcomponentIterator
  • disable() : TrgMiniGLT, TrgGem, TrgAbstract, rcTrgMiniGLT, rcTrgGem, Grule, Gconstraint
  • disableMask() : GGLT
  • discarded() : TrgTriggerStats, TrgGemTriggerStats
  • disconnect() : DataDistributorClient, DataDistributorServer, HskCli
  • disconnected() : HskHandler
  • doEmit() : RunControlMain, RunControl
  • doPause() : RunControlMain, RunControl
  • doReset() : RunControlMain, RunControl
  • doRun() : RunControlMain, RunControl
  • doStop() : RunControlMain, RunControl
  • doStopRun() : RunControlMain, RunControl
  • downAEM() : GLAT
  • downAEQ() : GAEM
  • downAFE() : GARC
  • downARC() : GAEM
  • downCCC() : GTEM
  • downCFE() : GCRC
  • downCRC() : GCCC
  • downCRU() : GLAT
  • downEBM() : GLAT
  • downEBMC() : GEBM
  • downEBMST() : GEBM
  • downGEM() : GLAT
  • downGEMC() : GGEM
  • downGEMIE() : GGEM
  • downGEMMG() : GGEM
  • downGEMSC() : GGEM
  • downGEMST() : GGEM
  • downGEMVG() : GGEM
  • downGEMW() : GGEM
  • downGLT() : GXBRD
  • downHAEM() : GHSK
  • downHARC() : HAEM
  • downHCOM() : GHSK
  • downHCPU() : GHSK
  • downHEBM() : GHSK
  • downHGEM() : GHSK
  • downHNUL() : GHSK
  • downHPDU() : GHSK
  • downHTEM() : GHSK
  • downLCB() : GLAT
  • downPDU() : GLAT
  • downPEQ() : GPDU
  • downTCC() : GTEM
  • downTEM() : GLAT
  • downTFE() : GTRC
  • downTIC() : GTEM
  • downTRC() : GTCC
  • downTWR() : GXBRD
  • dumpContributionData() : EvtCli
  • dwell() : AcdHWMultiplexer

- e -

  • egu() : GEGU_poly3, GEGU_linear, GEGU
  • enable() : TrgAbstract, rcTrgMiniGLT, rcTrgGem, Grule, Gconstraint
  • enabled() : Grule, Gconstraint
  • enableMask() : GGLT
  • endExcludeTime() : rcTransitions
  • engine() : TrgEngines, rcTrgEngines
  • engines() : TrgAbstract, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, MiniGLTExample, SimpleGasuExample, MiniGLTExample, SimpleGasuExample, MiniGLTExample
  • error() : myLATcomponentIterator
  • evaluate() : Grule, Gconstraint
  • evBitCount() : EvtCli
  • evDumpAEM_Accepts() : EvtCli
  • evDumpAEM_PHA() : EvtCli
  • evDumpAEM_Vetos() : EvtCli
  • evDumpCAL_LogAccepts() : EvtCli
  • evDumpCAL_Logs() : EvtCli
  • evDumpDiagnostic() : EvtCli
  • evDumpEventAEM() : EvtCli
  • evDumpEventAEM_G2() : EvtCli
  • evDumpGEM() : EvtCli
  • evDumpGEM_Veto_List() : EvtCli
  • evDumpSummary() : EvtCli
  • evDumpTEM_Error() : EvtCli
  • evDumpTKR() : EvtCli
  • eventCounter() : TrgGemAbstract, TrgGem
  • eventDataParityEven() : TrgGemRegisters, TrgGemAbstract
  • eventHeaderParityEven() : TrgGemRegisters, TrgGemAbstract
  • eventNumber() : TrgDefaultSequence, TrgSequenceAbstract, TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgGemSequence
  • eventTag() : TrgDefaultSequence, TrgSequenceAbstract, TrgGemSequence
  • evGetAEM_PHA() : EvtCli
  • evGetAEM_Vec() : EvtCli
  • evGetCAL_LogAccepts() : EvtCli
  • evGetCAL_Logs() : EvtCli
  • evGetCAL_NumAccepts() : EvtCli
  • evGetSummary() : EvtCli
  • evGetTEM_Diagnostic() : EvtCli
  • evGetTEM_Error() : EvtCli
  • evGetTimebase() : EvtCli
  • evGetTimestamp() : EvtCli
  • evGetTKR_Accepts() : EvtCli
  • evGetTKR_NumAccepts() : EvtCli
  • evGetTKR_NumStrips() : EvtCli
  • evGetTKR_StripN() : EvtCli
  • evGetTKR_TOT() : EvtCli
  • evtHandlerPrescaleExternal() : GOCS
  • evtHandlerSendAcdScalers() : GOCS
  • evtHandlerSendAll() : GOCS
  • evtHandlerSendErrorsOnly() : GOCS
  • evtHandlerSendNothing() : GOCS
  • evtHandlerSendPrescaled() : GOCS
  • evtHandlerSetVerbosity() : GOCS
  • execGUImethod() : GUIbridge, RunControlMain, RunControl
  • execGUImethodNR() : GUIbridge, RunControlMain, RunControl
  • existsAEM() : GLAT
  • existsAEQ() : GAEM
  • existsAFE() : GARC
  • existsARC() : GAEM
  • existsCCC() : GTEM
  • existsCFE() : GCRC
  • existsCRC() : GCCC
  • existsCRU() : GLAT
  • existsEBM() : GLAT
  • existsEBMC() : GEBM
  • existsEBMST() : GEBM
  • existsGEM() : GLAT
  • existsGEMC() : GGEM
  • existsGEMIE() : GGEM
  • existsGEMMG() : GGEM
  • existsGEMSC() : GGEM
  • existsGEMST() : GGEM
  • existsGEMVG() : GGEM
  • existsGEMW() : GGEM
  • existsGLT() : GXBRD
  • existsHAEM() : GHSK
  • existsHARC() : HAEM
  • existsHCOM() : GHSK
  • existsHCPU() : GHSK
  • existsHEBM() : GHSK
  • existsHGEM() : GHSK
  • existsHPDU() : GHSK
  • existsHTEM() : GHSK
  • existsLCB() : GLAT
  • existsPDU() : GLAT
  • existsPEQ() : GPDU
  • existsTCC() : GTEM
  • existsTEM() : GLAT
  • existsTFE() : GTRC
  • existsTIC() : GTEM
  • existsTRC() : GTCC
  • existsTWR() : GXBRD
  • export() : DataExport
  • exportDir() : DataExport
  • exportFile() : DataExport
  • external() : MiniGLTTrgConditionsValue, TrgConditionsValue, TrgConditions

- f -

  • fileClose() : singleEvtDisplayImpl, Consumer
  • fileExit() : singleEvtDisplayImpl
  • fileOpen() : singleEvtDisplayImpl, Consumer
  • flushPlaybackFIFO() : GNAT
  • flushRecordFIFO() : GNAT
  • fourRange() : TrgEngineRequest
  • fourRangeReadout() : TrgMiniGLTRegisters, TrgMiniGLTAbstract

- g -

  • GEM() : TrgGem
  • GEMcomponent() : myLATcomponentIterator
  • get() : GattrHsk, GattrBF, GattrReg, GattrRaw
  • get_transition() : FSM
  • getAcdPeds() : myLATcomponentIterator
  • getAddlInputFiles() : rcTransitions
  • getAllOpaque() : GLAT
  • getAllSerialNos() : GLAT
  • getArchiveFile() : rcTransitions
  • getArchiverInstance() : rcTransitions
  • getAvgDatagramSize() : rcTransitions
  • getAvgDeadTime() : rcTransitions
  • getBadEvents() : rcTransitions
  • getBadEventsFile() : rcTransitions
  • getByte() : EvtCli
  • getCalPeds() : myLATcomponentIterator
  • getCompletionStatus() : rcTransitions, rcCompletionStatus
  • getCompletionStatusStr() : rcTransitions, rcCompletionStatus
  • getConfigurations() : GXBRD, GLAT, GHSK
  • getConstraint() : _Attr, Gattr
  • getContributionList() : EvtCli
  • getContributionStatus() : EvtCli
  • getContributionStatusStr() : EvtCli
  • getCurrentContribution() : EvtCli
  • getDataDistributor() : rcTransitions
  • getDeadChannels() : GTRC
  • getDeclarations() : GXBRD, GLAT, GHSK
  • getDisableTime() : rcTrgMiniGLT, rcTrgGem, GGLT
  • getDiscardedEvents() : rcTransitions
  • getDWord() : EvtCli
  • getEGU() : _Attr, Gattr
  • getElapsedTime() : rcTransitions
  • getEnableTime() : rcTrgMiniGLT, rcTrgGem, GGLT
  • getEndTime() : rcTransitions
  • getErrorEvents() : rcTransitions
  • getErrorEventsFile() : rcTransitions
  • getEventCount() : rcTransitions
  • getEventRate() : rcTransitions
  • getEvtCli() : rcTransitions
  • getEvtSize() : EvtCli
  • getEvtStatus() : EvtCli
  • getFailedEvents() : rcTransitions
  • getFailedEventSends() : rcTransitions
  • getFileTimeStamp() : rcTransitions
  • getFITSfile() : rcTransitions
  • getGGLTStatus() : EvtCli
  • getGGLTStatusStr() : EvtCli
  • getHSK() : rcTransitions
  • getHSKfile() : rcTransitions
  • getId() : rcUser
  • getIdNameDict() : rcUsers
  • getIdTuple() : Gdb
  • getInstByteRate() : rcTransitions
  • getInstDatagramSize() : rcTransitions
  • getInstEventRate() : rcTransitions
  • getLengthMismatchedEvents() : rcTransitions
  • getLoginId() : RunControlCommon, rcUser
  • getName() : rcUser
  • getNextEvent() : Consumer
  • getNoisyChannels() : GTRC
  • getOnlineStatus() : EvtCli
  • getOnlineStatusStr() : EvtCli
  • getOpaque() : GHSK, Gdb
  • getParameterVerifier() : rcTransitions
  • getPauseCount() : rcTransitions
  • getPausedTime() : rcTransitions
  • getPermissionDescription() : rcSecurityMan
  • getPermissions() : rcUser, rcSecurityMan
  • getRawTimeStamp() : rcTransitions
  • getRoles() : rcUser, rcSecurityMan
  • getRule() : _Attr, Gattr
  • getRules() : GLAT, GHSK
  • getRunId() : rcTransitions
  • getSchemaConfigFile() : rcTransitions
  • getSerialNos() : Gdb
  • getSessionVar() : rcTransitions
  • getStartTime() : rcTransitions
  • getSuite() : rcTransitions
  • getSuiteInstance() : rcTransitions
  • getTimeout() : EvtCliIO
  • getTimeStamp() : rcTrgMiniGLT, rcTrgGem, _Attr
  • getUnsentEvents() : rcTransitions
  • getUser() : rcUsers
  • getUserByLoginId() : rcUsers
  • getUserByName() : rcUsers
  • getUserId() : EvtCli
  • getUsers() : rcUsers
  • getValidEvents() : rcTransitions
  • getVersion() : GOCS
  • getWord() : EvtCli
  • GLT() : TrgMiniGLT
  • GLTcomponent() : myLATcomponentIterator
  • gMEMbusToLocal() : GMem
  • gMEMload() : GMem
  • gMEMlocalToBus() : GMem
  • gMEMread() : GMem
  • goClicked() : singleEvtDisplayImpl
  • GOSEDPreferences() : singleEvtDisplayImpl

- h -

  • handle() : LogRecordStreamHandler
  • helpAbout() : singleEvtDisplayImpl
  • helpContents() : singleEvtDisplayImpl
  • helpOnline() : singleEvtDisplayImpl

- i -

  • id() : Gdb
  • inCoincidence() : TrgCoincidence, rcTrgCoincidence, NullCoincidence
  • inhibitContribution() : TrgGemRegisters, TrgGemAbstract
  • initApp() : RunControlMain
  • initHandle() : GNAT
  • initReport() : rcTestReport
  • inputEnables() : TrgAbstract, rcGEMDefaultTrigger, SimpleGasuExample
  • insertSection() : rcTestReport
  • isAdministrator() : rcUser
  • isCompletionStatus() : rcCompletionStatus
  • isErrorEvent() : EvtCli
  • isGGLTStatus() : EvtCli
  • isGUIthread() : GUIbridge, RunControlMain
  • isLastSuiteScript() : rcTransitions
  • isMaskDirty() : GGLT
  • isNoDirectAccess() : _Attr, Gattr
  • isReadOnly() : _Attr, Gattr
  • isReadWrite() : _Attr, Gattr
  • isRunFromSuite() : rcTransitions
  • isSweepEvent() : EvtCli
  • isTimeoutEnabled() : EvtCliIO
  • isWriteOnly() : _Attr, Gattr

- l -

  • LA1() : TrgCnoEnables
  • LA2() : TrgCnoEnables
  • LA3() : TrgCnoEnables
  • LA4() : TrgCnoEnables
  • LB2() : TrgCnoEnables
  • LB4() : TrgCnoEnables
  • limit() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition
  • livetime() : TrgTriggerStats, TrgGemTriggerStats
  • loadApp() : RunControlMain
  • loadFIFO() : GNAT
  • log() : CALcontributionIterator2
  • lookup() : DataDistributorAddress
  • lookupTableRegister() : TrgGemRegisters

- m -

  • marker() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgInjectMarker, TrgEngineRequest
  • maxConditions() : TrgGemAbstract, TrgAbstract
  • maxEngines() : TrgGemAbstract, TrgAbstract
  • md5sum() : DataExport

- n -

  • name() : TaskEngine, Grule, Gconstraint
  • nextClicked() : singleEvtDisplayImpl

- o -

  • open() : EvtCliIO
  • OSWcomponent() : myLATcomponentIterator

- p -

  • paintEvent() : drawYZ_CAL, drawXZ_CAL, drawYZ_TKR, drawXZ_TKR, drawHatACD, drawSide4ACD, drawSide3ACD, drawSide2ACD, drawSide1ACD
  • parity() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • parseEvent() : consumerPlotter, Consumer
  • participate() : TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • pause() : rcTransitions
  • periodic() : TrgConditionsValue, TrgConditions
  • periodicCondition() : TrgUsingTiles, TrgGemAbstract
  • periodicLimitRegister() : TrgGemRegisters
  • periodicModeRegister() : TrgGemRegisters
  • periodicRateRegister() : TrgGemRegisters
  • plot() : singleEvtDisplayImpl, TKRcontributionIterator, CALcontributionIterator2
  • port() : DataDistributorAddress
  • prescale() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition, TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • prescaled() : TrgTriggerStats, TrgGemTriggerStats
  • previousClicked() : singleEvtDisplayImpl
  • print_EOE_Warning() : EvtCli
  • process() : userApplication, rcTransitions, FSM
  • process_list() : FSM
  • publish() : DataDistributorServer

- r -

  • RA2() : TrgCnoEnables
  • RA4() : TrgCnoEnables
  • raw() : GEGU_poly3, GEGU_linear, GEGU
  • RB1() : TrgCnoEnables
  • RB2() : TrgCnoEnables
  • RB3() : TrgCnoEnables
  • RB4() : TrgCnoEnables
  • rcSetup() : rcTransitions
  • readConfig() : rcTransitions
  • readEvent() : EvtCli
  • readFile() : EvtCliIO
  • readPedestals() : myLATcomponentIterator
  • readPermissions() : rcSecurityMan
  • readSocket() : EvtCliIO
  • receive() : DataDistributorPoll, DataDistributorClient
  • redundantPPS() : TrgGemRegisters, TrgGemAbstract
  • refreshMask() : GGLT
  • registerAction() : Grule
  • registerPermission() : rcSecurityMan
  • reject() : Gconstraint
  • remaining() : TrgPeriodicCondition, TrgGemPeriodicCondition
  • replaceEngine() : rcTrgEngines
  • request() : TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • reset() : TrgTriggerCounters, TrgTileCounters, TrgPeriodicCondition, TrgGemPeriodicCondition, TrgGemEventCounter, TrgGemCmdCounters, TrgGemTileCounters, TrgGemTriggerCounters, TrgEventCounter, TrgCmdCounters, FSM, Grule, Gconstraint
  • response() : TrgGemCmdStats, TrgCmdStats
  • responseDataParityEven() : TrgGemRegisters, TrgGemAbstract
  • responseHeaderParityEven() : TrgGemRegisters, TrgGemAbstract
  • resume() : AcdHWMultiplexer, rcTransitions
  • returnNone() : DataDistributorClient
  • roi() : TrgUsingTiles, TrgGemAbstract, TrgConditionsValue, TrgConditions, TrgRois
  • roiRegister() : TrgGemRegisters
  • roleHasPermission() : rcSecurityMan
  • root() : Gdb
  • run() : TaskEngine

- s -

  • satCtrDisable() : GTIC
  • satCtrEnable() : GTIC
  • satCtrLoopDisable() : GTIC
  • satCtrLoopEnable() : GTIC
  • satCtrSetLoopDelay() : GTIC
  • selectChange() : singleEvtDisplayImpl
  • sendAction() : Grule
  • sent() : TrgTriggerStats, TrgGemTriggerStats
  • sequence() : TrgUsingTiles, TrgInjectMarker, TrgInjectChargeReadout, TrgReadout, TrgInjectCharge, TrgEngineRequest, TrgAbstract, NullRequest
  • sequenceRegister() : TrgGemRegisters
  • serverClose() : singleEvtDisplayImpl, Consumer
  • serverOpen() : singleEvtDisplayImpl, Consumer
  • ServerPreferences() : singleEvtDisplayImpl
  • set() : GattrHsk, GattrBF, GattrDlc, GattrReg, GattrRaw
  • set_default_transition() : FSM
  • setActions() : Grule
  • setArchiverClass() : rcTransitions
  • setCmdCli() : rcTransitions
  • setCompletionStatus() : rcTransitions
  • setConstraint() : _Attr, Gattr
  • setCurrentContribution() : EvtCli
  • setDebug() : EvtCli
  • setDestinationOverride() : GGLT
  • setEGU() : _Attr, Gattr
  • setEnabledTabPage() : RunControlMain
  • setEvtCli() : rcTransitions
  • setEvtEnable() : GLCB
  • setLastSuiteScript() : rcTransitions
  • setLATpMode() : GNAT
  • setPrefs() : rcTransitions
  • setRule() : _Attr, Gattr
  • setSessionVar() : rcTransitions
  • setSuite() : rcTransitions
  • setSuiteInstance() : rcTransitions
  • setTimeout() : EvtCliIO
  • setTimeoutEnabled() : EvtCliIO
  • setup() : rcTransitions
  • shut() : TrgMiniGLT, TrgGem, TrgAbstract, rcTrgMiniGLT, rcTrgGem, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger
  • shutdown() : TaskEngine, GUIbridge, AcdHWMultiplexer
  • size() : _Attr, Gattr
  • solicit() : TrgMiniGLT, TrgGem, TrgAbstract
  • solicited() : TrgConditionsValue, TrgConditions, rcMiniGLTSolicitedCondition, rcSolicitedCondition
  • source() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition
  • spawn() : TaskEngine
  • start() : DataDistributorPoll, AcdHWMultiplexer
  • startExcludeTime() : rcTransitions
  • startPlayback() : GNAT
  • startRun() : rcTransitions
  • stats() : TrgTriggerCounters, TrgTileCounters, TrgGemEventCounter, TrgGemCmdCounters, TrgGemTileCounters, TrgGemTriggerCounters, TrgEventCounter, TrgCmdCounters, AcdHWMultiplexer
  • statusString() : standardTestReport
  • stop() : DataDistributorPoll, AcdHWMultiplexer, rcTransitions
  • stopClicked() : singleEvtDisplayImpl
  • stopRun() : rcTransitions
  • strip() : TKRcontributionIterator
  • subsystem() : Grule, Gconstraint
  • sweepOnShut() : rcTrgMiniGLT, rcTrgGem, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger
  • synch() : DataExport
  • synchronize() : GOCS

- t -

  • tack() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • tag() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • takeSnapshot() : rcTransitions
  • TCCcnt() : GTEM
  • teardown() : rcTransitions
  • TEMcnt() : GLAT
  • templateRegister() : TrgGemRegisters
  • tile() : AddableRoi, TrgTileEnables, TrgRoi, rcTrgTileEnables, NullRoi, NoTilesEnabled
  • tileCounters() : TrgGemAbstract, TrgGem
  • tileEnableRegister() : TrgGemRegisters
  • tileList() : AcdHWMultiplexer
  • tiles() : TrgInputEnables
  • timedout() : HskHandler
  • tkr() : TrgConditionsValue, TrgConditions
  • TKRcomponent() : myLATcomponentIterator
  • tower() : TrgTowers
  • towerBusyEnableRegister() : TrgGemRegisters
  • towerEnableRegister() : TrgGemRegisters
  • towers() : TrgTowerEnables, TrgInputEnables, NoInputsEnabled
  • tracker() : TrgTower, NullTower
  • transformToFile() : rcTestReport
  • trigger() : rcTransitions
  • triggerCounters() : TrgGemAbstract, TrgGem
  • triggerParityEven() : TrgGemRegisters, TrgGemAbstract
  • triggersDisabled() : GGLT

- u -

  • units() : GEGU
  • unpack() : EvtCliIO
  • unregisterAction() : Grule
  • up() : Gdb
  • use() : TrgTracker, NullTkr
  • useAcdAsTrigger() : TrgUsingTiles, TrgGemAbstract, rcGEMDefaultTrigger, SimpleGasuExample
  • useHighEnergy() : TrgCalorimeter, NullCal
  • useLowEnergy() : TrgCalorimeter, NullCal

- v -

  • value() : MiniGLTTrgConditionsValue, TrgConditionsValue
  • verifyVersion() : GOCS
  • version() : TrgGem, TrgAbstract

- w -

  • waitForMaskEnable() : rcTrgMiniGLT, rcTrgGem, GGLT
  • width() : TrgGemRegisters, TrgGemAbstract
  • widthRegister() : TrgGemRegisters
  • write() : RegisterInterface
  • writeFIFO() : GNAT
  • writeFIFO32() : GNAT
  • writeTestInformation() : standardTestReport

- z -

  • zeroSuppress() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgEngineRequest
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Namespace Index

LATTE Namespace List

Here is a list of all documented namespaces with brief descriptions:
AcdHWMultiplexer | Module "AcdHWMultiplexer"
AcdPanel | Module "AcdPanel"
ArgumentImpl | Module "ArgumentImpl"
BrowserImpl | Module "BrowserImpl"
browserPreferencesImpl | Module "browserPreferencesImpl"
cfitsio | Module "cfitsio"
Collector | Module "Collector"
colorScale | Module "colorScale"
consumer | Module "consumer"
consumerPlotter | Module "consumerPlotter"
copyright_SLAC | Module "copyright_SLAC"
createDigestData | Module "createDigestData"
DataDistributor | Module "DataDistributor"
DataDistributorPoll | Module "DataDistributorPoll"
DataExport | Module "DataExport"
dispatcher |
EnvMonImpl | Module "EnvMonImpl"
errors |
evtCli | Event handler classes
evtDataImpl | Module "evtDataImpl"
excApp | Module "excApp"
FEpowerUp | Module "FEpowerUp"
fits2ldf | Module "fits2ldf"
FreeSpace | Module "FreeSpace"
FSM |
gAEM | Module "gAEM"
gAttr | GLAST LAT record attribute definitions
gBits | Module "gBits"
gCmdCli | Module "gCmdCli"
gCommand | Module "gCommand"
gConstraint | Module "gConstraint"
gCRU | Module "gCRU"
gDb | Module "gDb"
gEBM | Module "gEBM"
gEGU | Module "gEGU"
gEvtCli | Module "gEvtCli"
gException | Module "gException"
gFswMessages | Module "gFswMessages"
gGEM | Module "gGEM"
gGLT | Module "gGLT"
gGroup | Module "gGroup"
gHdb | Module "gHdb"
gHSK | GLAST LAT record definitions
gLAT | GLAST LAT record definitions
gLCB | Module "gLCB"
GlobalPanelImpl | Module "GlobalPanelImpl"
gLog | Module "gLog"
gLoopback | Module "gLoopback"
gMem | Module "gMem"
gNAT | Module "gNAT"
gNode | Module "gNode"
gOCS | Module "gOCS"
gOcsMessages | Module "gOcsMessages"
gOptions | Module "gOptions"
GOSED_LDF | Module "GOSED_LDF"
GOSEDACDImpl | Module "GOSEDACDImpl"
GOSEDCALImpl | Module "GOSEDCALImpl"
GOSEDCALTKRImpl | Module "GOSEDCALTKRImpl"
GOSEDDataImpl | Module "GOSEDDataImpl"
gosedImpl | Module "gosedImpl"
GOSEDPainter | Module "GOSEDPainter"
GOSEDPreferencesImpl | Module "GOSEDPreferencesImpl"
GOSEDTKRImpl | Module "GOSEDTKRImpl"
GOSEDTWRImpl | Module "GOSEDTWRImpl"
GOTEDImpl | Module "GOTEDImpl"
gPDU | Module "gPDU"
gRegister | Module "gRegister"
gResponse | Module "gResponse"
gRule | Module "gRule"
gSchemaConfig | Module "gSchemaConfig"
gSocket | Module "gSocket"
gTEM | Module "gTEM"
gTPG | Module "gTPG"
guiBridges | Module "guiBridges"
gVersions |
gXBR | Module "gXBR"
HskAlarms | Module "HskAlarms"
HskCli | Module "HskCli"
HskCollector | Module "HskCollector"
HskGuiReceiver | Module "HskGuiReceiver"
HskPacketDecoder | Module "HskPacketDecoder"
HskPacketRetriever | Module "HskPacketRetriever"
HskReceiver | Module "HskReceiver"
HskRecorder | Module "HskRecorder"
HskRegisters | Module "HskRegisters"
HskRetriever | Module "HskRetriever"
HskSqlGuiReceiver | Module "HskSqlGuiReceiver"
HskSqlInterface | Module "HskSqlInterface"
HskSqlSvr | Module "HskSqlSvr"
HskSvr | Module "HskSvr"
HskTestSvr | Module "HskTestSvr"
hTestAppEvt | Module "hTestAppEvt"
hTestAppTkr | Module "hTestAppTkr"
hTestEnv | Module "hTestEnv"
hTestStrip | Module "hTestStrip"
LATsweep | Module "LATsweep"
ldf2fits | Module "ldf2fits"
MailAlert | Module "MailAlert"
MiniGLTExample | Interface for Coincidence based Trigger System
MSGLogGUIImpl | Module "MSGLogGUIImpl"
nullApp | Module "nullApp"
NullObjects |
parseFswHsk | Module "parseFswHsk"
PowerPanelImpl | Module "PowerPanelImpl"
pythfilter | Module "pythfilter"
rcArchiver | Module "rcArchiver"
rcCommentPanel | Module "rcCommentPanel"
rcComplStatus | Module "rcComplStatus"
rcDefaultTrigger | Module "rcDefaultTrigger"
rcFitsWriter | Module "rcFitsWriter"
rcHouseKeeping | Module "rcHouseKeeping"
rcLoginImpl | Module "rcLoginImpl"
rcParamVerifier | Module "rcParamVerifier"
rcParamVerifyGUIImpl | Module "rcParamVerifyGUIImpl"
rcPreferencesGUIImpl | Module "rcPreferencesGUIImpl"
rcPreferencesManager | Module "rcPreferencesManager"
rcPythonShell | Module "rcPythonShell"
rcReportGen | Module "rcReportGen"
rcRunIdHelper | Module "rcRunIdHelper"
rcScmCfgSelector | Module "rcScmCfgSelector"
rcSecurityMan | Module "rcSecurityMan"
rcStatusMonitor | Module "rcStatusMonitor"
rcSuite | Module "rcSuite"
rcTestReport | Module "rcTestReport"
rcTransitions | Module "rcTransitions"
rcTrgFunctions |
rcTrgGem |
rcTrgMiniGLT |
rcUsers | Module "rcUsers"
rcUtil | Module "rcUtil"
Receiver | Module "Receiver"
Recorder | Module "Recorder"
Retriever | Module "Retriever"
robustapply |
RunControl | Module "RunControl"
RunControlCommon | Module "RunControlCommon"
RunControlFSM | Module "RunControlFSM"
RunControlGUIImpl | Module "RunControlGUIImpl"
RunControlMain | Module "RunControlMain"
RunControlMainGUIImpl | Module "RunControlMainGUIImpl"
saferef |
searchTextBrowserImpl | Module "searchTextBrowserImpl"
ServerPreferencesImpl | Module "ServerPreferencesImpl"
setup | Module "setup"
SimpleGasuExample | Interface for Coincidence based Trigger System
standardLDF | Module "standardLDF"
standardPlotter | Module "standardPlotter"
standardPlotterGuiImpl | Module "standardPlotterGuiImpl"
startupGUI | Module "startupGUI"
startupMainGUI | Module "startupMainGUI"
taskEngine | Module "taskEngine"
test_aem | Module "test_aem"
test_aeq | Module "test_aeq"
test_cmd |
test_cmdrsp | Module "test_cmdrsp"
test_db |
test_evt_aem |
test_evt_cal |
test_evt_exttrg |
test_evt_filters |
test_evt_tkr |
test_gafe | Module "test_gafe"
test_garc | Module "test_garc"
test_glt | Module "test_glt"
test_lat | Module "test_lat"
test_loopback | Module "test_loopback"
test_mem | Module "test_mem"
test_options | Module "test_options"
test_playback | Module "test_playback"
test_rate | Module "test_rate"
test_schema | Module "test_schema"
test_tem |
test_twoclients | Module "test_twoclients"
testAppAcd | Module "testAppAcd"
testAppAcdScalers | Module "testAppAcdScalers"
testAppAlarm | Module "testAppAlarm"
testAppArchiver | Module "testAppArchiver"
testAppCal | Module "testAppCal"
testAppCal_dg | Module "testAppCal_dg"
testAppEvt | Module "testAppEvt"
testAppEvtCli | Module "testAppEvtCli"
testAppEvtTO | Module "testAppEvtTO"
testAppLDFdump | Module "testAppLDFdump"
testAppTkr | Module "testAppTkr"
testArchiver | Module "testArchiver"
testEvtCli | Module "testEvtCli"
testSAppCal | Module "testSAppCal"
testSAppEvt | Module "testSAppEvt"
testSuite | Module "testSuite"
testSuite2 | Module "testSuite2"
testSuiteLong | Module "testSuiteLong"
testTrending | Module "testTrending"
Trendable | Module "Trendable"
TrendMaps | Module "TrendMaps"
TrgAbstract |
TrgCmdCounters |
TrgCoincidences |
TrgConditions |
TrgConditionsValue | Module "TrgConditionsValue"
TrgEngines |
TrgEventCounter |
TrgGem |
TrgGemAbstract |
TrgGemCounters |
TrgGemPeriodicCondition |
TrgGemRegisterGeometry |
TrgGemRegisters |
TrgGemSequence |
TrgInputEnables |
TrgMiniGLT |
TrgMiniGLTAbstract |
TrgMiniGLTRegisters |
TrgObject |
TrgPeriodic |
TrgRoiAsTiles |
TrgRoiAsVeto |
TrgSequence |
TrgTileCounters |
TrgTower |
TrgTriggerCounters |
TrgUsingTiles |
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AcdHWMultiplexer Namespace Reference

AcdHWMultiplexer Namespace Reference

Module "AcdHWMultiplexer". More...

Classes

class AcdHWMultiplexer
AcdHWMultiplexer class. More...

Detailed Description

Module "AcdHWMultiplexer".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AcdPanel Namespace Reference

AcdPanel Namespace Reference

Module "AcdPanel". More...

Classes

class AcdPanel

Functions

__tr (self, s, c=None)

Detailed Description

Module "AcdPanel".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ArgumentImpl Namespace Reference

ArgumentImpl Namespace Reference

Module "ArgumentImpl". More...

Classes

class ArgumentImpl

Detailed Description

Module "ArgumentImpl".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: BrowserImpl Namespace Reference

BrowserImpl Namespace Reference

Module "BrowserImpl". More...

Classes

class | BrowserImpl
class | RegViewItem

Detailed Description

Module "BrowserImpl".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: browserPreferencesImpl Namespace Reference

browserPreferencesImpl Namespace Reference

Module "browserPreferencesImpl". More...

Classes

class browserPreferencesImpl

Detailed Description

Module "browserPreferencesImpl".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: cfitsio Namespace Reference

cfitsio Namespace Reference

Module "cfitsio". More...

Classes

class _object

Functions

_swig_setattr (self, class_type, name, value)
_swig_getattr (self, class_type, name)

Detailed Description

Module "cfitsio".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Collector Namespace Reference

Collector Namespace Reference

Module "Collector". More...

Classes

class Collector

Functions

testCollector ()

Detailed Description

Module "Collector".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: colorScale Namespace Reference

colorScale Namespace Reference

Module "colorScale". More...

Functions

colorScale (value)
Method for returning a color scale RGB tuple given a percentage.

Detailed Description

Module "colorScale".

Function Documentation

colorScale ( value )

Method for returning a color scale RGB tuple given a percentage.

Return a tuple giving the RGB values for a color chosen from a color scale: black for value < 0.0 blue (cold) for value >= 0.0 red (hot) for value <= 1.0 white for value > 1.0

Parameters:
value - A number between 0.0 and 1.0
Returns:
A tuple containing the RGB values corresponding to the input value

Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: consumer Namespace Reference

consumer Namespace Reference

Module "consumer". More...

Classes

class Consumer
Consumer class to consume LDF data This class just handles file open/close or server open/close. More...

Detailed Description

Module "consumer".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: consumerPlotter Namespace Reference

consumerPlotter Namespace Reference

Module "consumerPlotter". More...

Classes

class consumerPlotter
Consumer class to consume LDF data This class just handles file open/close or server open/close. More...

Detailed Description

Module "consumerPlotter".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: copyright_SLAC Namespace Reference

copyright_SLAC Namespace Reference

Module "copyright_SLAC". More...

Detailed Description

Module "copyright_SLAC".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: createDigestData Namespace Reference

createDigestData Namespace Reference

Module "createDigestData". More...

Detailed Description

Module "createDigestData".
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributor Namespace Reference

DataDistributor Namespace Reference

Module "DataDistributor". More...

Classes

class | DataDistributorServer
Data Distributor Server. More...
class | DataDistributorClient
Data distributor client class. More...
class | DataDistributorAddress
Data distributor address class containing static methods that govern the picking of multicast ports and addresses. More...

Functions

sender ()
receiver ()

Detailed Description

Module "DataDistributor".

Function Documentation

receiver ( )

data = data + (1400 - len(data)) * ''

Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorPoll Namespace Reference

DataDistributorPoll Namespace Reference

Module "DataDistributorPoll". More...

Classes

class DataDistributorPoll
Data distributor client that polls for samples of data. More...

Detailed Description

Module "DataDistributorPoll".
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataExport Namespace Reference

DataExport Namespace Reference

Module "DataExport". More...

Classes

class | GExportException
class | DataExport

Functions

usage ()

Detailed Description

Module "DataExport".
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: dispatcher Namespace Reference

dispatcher Namespace Reference

Classes

class | _Parameter
class | _Any
class | _Anonymous

Functions

connect (receiver, signal=Any, sender=Any, weak=True)
disconnect (receiver, signal=Any, sender=Any, weak=True)
getReceivers (sender=Any, signal=Any)
liveReceivers (receivers)
getAllReceivers (sender=Any, signal=Any)
send (signal=Any, sender=Anonymous, arguments, named)
sendExact (signal=Any, sender=Anonymous, arguments, named)
_removeReceiver (receiver)
_cleanupConnections (senderkey, signal)
_removeSender (senderkey)

Detailed Description

Multiple-producer-multiple-consumer signal-dispatching

dispatcher is the core of the PyDispatcher system, providing the primary API and the core logic for the system.

Module attributes of note:

Any -- Singleton used to signal either "Any Sender" or "Any Signal". See documentation of the _Any class. Anonymous -- Singleton used to signal "Anonymous Sender" See documentation of the _Anonymous class.

Internal attributes: WEAKREF_TYPES -- tuple of types/classes which represent weak references to receivers, and thus must be de- referenced on retrieval to retrieve the callable object connections -- { senderkey (id) : { signal : [receivers...]}} senders -- { senderkey (id) : weakref(sender) } used for cleaning up sender references on sender deletion sendersBack -- { receiverkey (id) : [senderkey (id)...] } used for cleaning up receiver references on receiver deletion, (considerably speeds up the cleanup process vs. the original code.)

Function Documentation

_cleanupConnections | ( | senderkey | ,
 |  | signal |
 | ) |

Delete any empty signals for senderkey. Delete senderkey if empty.

_removeReceiver ( receiver )

Remove receiver from connections.

_removeSender ( senderkey )

Remove senderkey from connections.

connect | ( | receiver | ,
 |  | signal | = Any,
 |  | sender | = Any,
 |  | weak | = True
 | ) |

Connect receiver to sender for signal

receiver -- a callable Python object which is to receive messages/signals/events. Receivers must be hashable objects.

if weak is True, then receiver must be weak-referencable (more precisely saferef.safeRef() must be able to create a reference to the receiver).

Receivers are fairly flexible in their specification, as the machinery in the robustApply module takes care of most of the details regarding figuring out appropriate subsets of the sent arguments to apply to a given receiver.

Note: if receiver is itself a weak reference (a callable), it will be de-referenced by the system's machinery, so *generally* weak references are not suitable as receivers, though some use might be found for the facility whereby a higher-level library passes in pre-weakrefed receiver references.

signal -- the signal to which the receiver should respond

if Any, receiver will receive any signal from the indicated sender (which might also be Any, but is not necessarily Any).

Otherwise must be a hashable Python object other than None (DispatcherError raised on None).

sender -- the sender to which the receiver should respond

if Any, receiver will receive the indicated signals from any sender.

if Anonymous, receiver will only receive indicated signals from send/sendExact which do not specify a sender, or specify Anonymous explicitly as the sender.

Otherwise can be any python object.

weak -- whether to use weak references to the receiver By default, the module will attempt to use weak references to the receiver objects. If this parameter is false, then strong references will be used.

returns None, may raise DispatcherTypeError

disconnect | ( | receiver | ,
 |  | signal | = Any,
 |  | sender | = Any,
 |  | weak | = True
 | ) |

Disconnect receiver from sender for signal

receiver -- the registered receiver to disconnect signal -- the registered signal to disconnect sender -- the registered sender to disconnect weak -- the weakref state to disconnect

disconnect reverses the process of connect, the semantics for the individual elements are logically equivalent to a tuple of (receiver, signal, sender, weak) used as a key to be deleted from the internal routing tables. (The actual process is slightly more complex but the semantics are basically the same).

Note: Using disconnect is not required to cleanup routing when an object is deleted, the framework will remove routes for deleted objects automatically. It's only necessary to disconnect if you want to stop routing to a live object.

returns None, may raise DispatcherTypeError or DispatcherKeyError

getAllReceivers | ( | sender | = Any,
 |  | signal | = Any
 | ) |

Get list of all receivers from global tables

This gets all receivers which should receive the given signal from sender, each receiver should be produced only once by the resulting generator

getReceivers | ( | sender | = Any,
 |  | signal | = Any
 | ) |

Get list of receivers from global tables

This utility function allows you to retrieve the raw list of receivers from the connections table for the given sender and signal pair.

Note: there is no guarantee that this is the actual list stored in the connections table, so the value should be treated as a simple iterable/truth value rather than, for instance a list to which you might append new records.

Normally you would use liveReceivers( getReceivers( ...)) to retrieve the actual receiver objects as an iterable object.

liveReceivers ( receivers )

Filter sequence of receivers to get resolved, live receivers

This is a generator which will iterate over the passed sequence, checking for weak references and resolving them, then returning all live receivers.

send | ( | signal | = Any,
 |  | sender | = Anonymous,
 |  | arguments | ,
 |  | named |
 | ) |

Send signal from sender to all connected receivers.

signal -- (hashable) signal value, see connect for details

sender -- the sender of the signal

if Any, only receivers registered for Any will receive the message.

if Anonymous, only receivers registered to receive messages from Anonymous or Any will receive the message

Otherwise can be any python object (normally one registered with a connect if you actually want something to occur).

arguments -- positional arguments which will be passed to all* receivers. Note that this may raise TypeErrors if the receivers do not allow the particular arguments. Note also that arguments are applied before named arguments, so they should be used with care.

named -- named arguments which will be filtered according to the parameters of the receivers to only provide those acceptable to the receiver.

Return a list of tuple pairs [(receiver, response), ... ]

if any receiver raises an error, the error propagates back through send, terminating the dispatch loop, so it is quite possible to not have all receivers called if a raises an error.

sendExact | ( | signal | = Any,
 |  | sender | = Anonymous,
 |  | arguments | ,
 |  | named |
 | ) |

Send signal only to those receivers registered for exact message

sendExact allows for avoiding Any/Anonymous registered handlers, sending only to those receivers explicitly registered for a particular signal on a particular sender.

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: EnvMonImpl Namespace Reference

EnvMonImpl Namespace Reference

Module "EnvMonImpl". More...

Classes

class | EnvMonImpl
class | PlotWidget
class | ScrollablePlotView

Detailed Description

Module "EnvMonImpl".
Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: errors Namespace Reference

errors Namespace Reference

Classes

class | DispatcherError
class | DispatcherKeyError
class | DispatcherTypeError

Detailed Description

Error types for dispatcher mechanism

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evtCli Namespace Reference

evtCli Namespace Reference

Event handler classes. More...

Detailed Description

Event handler classes.

Event objects:

The following list contains the objects populated during parsing. Please refer to the individual classes to find out how to access event data stored in these objects:

  • CAL_LogAccepts -- List of evCAL_LogAccepts

  • CAL_LogData -- List of evCAL_LayerLogData

  • TKRstrips -- List of evTKR_StripData

  • TKRaccepts -- List of int

  • TKRtots -- List of evTKR_TOTdata

  • diag -- evDiag_Data

  • errSummary -- evErr_Summary

  • errGCCCmsg -- List of evErr_GCCC_Message

  • errGTCCmsg -- List of evErr_GTCC_Message

  • errCablePhase -- evErr_CablePhase

  • errCableTimeOut -- evErr_CableTimeOut

  • aem -- AEM

  • aem.PHA -- Dictionary of evAEM_PHA indexed by cable number

  • gem -- GEM

  • gem.vetoList -- evGEM_Veto_List

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evtDataImpl Namespace Reference

evtDataImpl Namespace Reference

Module "evtDataImpl". More...

Classes

class evtDataImpl

Detailed Description

Module "evtDataImpl".
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: excApp Namespace Reference

excApp Namespace Reference

Module "excApp". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "excApp".
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FEpowerUp Namespace Reference

FEpowerUp Namespace Reference

Module "FEpowerUp". More...

Classes

class FEpowerUp

Detailed Description

Module "FEpowerUp".
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: fits2ldf Namespace Reference

fits2ldf Namespace Reference

Module "fits2ldf". More...

Functions

__usage ()

Detailed Description

Module "fits2ldf".
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FreeSpace Namespace Reference

FreeSpace Namespace Reference

Module "FreeSpace". More...

Functions

FreeSpace (filePath=None)

Detailed Description

Module "FreeSpace".

Function Documentation

FreeSpace ( filePath = None )

freespace(path) -> long Return the number of bytes available to the user on the file system pointed to by path.

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FSM Namespace Reference

FSM Namespace Reference

Classes

class | ExceptionFSM
class | FSM

Functions

BeginBuildNumber (fsm)
BuildNumber (fsm)
EndBuildNumber (fsm)
DoOperator (fsm)
DoEqual (fsm)
Error (fsm)
example ()

Detailed Description

This module implements a Finite State Machine (FSM). In addition to state this FSM also maintains a user defined "something". This "something" is effectively memory, so this FSM could be considered a Push-down Automata (PDA) since a PDA is a FSM + memory.

The following describes how the FSM works, but you will probably also need to see the example function to understand how the FSM is used in practice.

You define an FSM by building tables of transitions. For a given input symbol the process() method uses these tables to decide what action to call and what the next state will be. The FSM has a table of transitions that associate: (input_symbol, current_state) --> (action, next_state) where "action" is a function you define. The symbols and states can be any objects. You use the add_transition() and add_transition_list() methods to add to the transition table. The FSM also has a table of transitions that associate: (current_state) --> (action, next_state) You use the add_transition_any() method to add to this transition table. The FSM also has one default transition that is not associated with any specific input_symbol or state. You use the set_default_transition() method to set the default transition.

When an action function is called it is passed a reference to the FSM. The action function may then access attributes of the FSM such as input_symbol, current_state, or "something". The "something" attribute can be any object that you want to pass along to the action functions. It is not used by the FSM. For parsing you would typically pass a list to be used as a stack.

The processing sequence is as follows. The process() method is given an input_symbol to process. The FSM will search the table of transitions that associate: (input_symbol, current_state) --> (action, next_state) If the pair (input_symbol, current_state) is found then process() will call the associated action function and then set the current state to the next_state.

If the FSM cannot find a match for (input_symbol, current_state) it will then search the table of transitions that associate: (current_state) --> (action, next_state) If the current_state is found then the process() method will call the associated action function and then set the current state to the next_state. Notice that this table lacks an input_symbol. It lets you define transitions for a current_state and ANY input_symbol. Hence, it is called the "any" table. Remember, it is always checked after first searching the table for a specific (input_symbol, current_state).

For the case where the FSM did not match either of the previous two cases the FSM will try to use the default transition. If the default transition is defined then the process() method will call the associated action function and then set the current state to the next_state. This lets you define a default transition as a catch-all case. You can think of it as an exception handler. There can be only one default transition.

Finally, if none of the previous cases are defined for an input_symbol and current_state then the FSM will raise an exception. This may be desirable, but you can always prevent this just by defining a default transition.

Noah Spurrier 20020822

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gAEM Namespace Reference

gAEM Namespace Reference

Module "gAEM". More...

Classes

class | GAEM
ACD Common Controller. More...
class | GAEQ
ACD Environmental Monitors. More...
class | GARC
ACD Readout Controller. More...
class | GAFE
ACD Front-End Controller. More...

Detailed Description

Module "gAEM".
Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gAttr Namespace Reference

gAttr Namespace Reference

GLAST LAT record attribute definitions. More...

Classes

class | Gattr
Base class which is instantiated once for each attribute kind. More...
class | GattrRaw
Class which is instantiated for each raw register kind. More...
class | GattrReg
Class which is instantiated for each register. More...
class | GattrDlc
class | GattrBF
Bit field class which is instantiated for each bit field kind. More...
class | _Attr

Detailed Description

GLAST LAT record attribute definitions.

Contents:

GLAST LAT functional block hierarchy representation in Python See The Tower Electronics Module (TEM) - Programming ICD specification (LAT-TD-00605-D1) for more info

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gBits Namespace Reference

gBits Namespace Reference

Module "gBits". More...

Classes

class | bf
class | BitField

Functions

hexConvert (s, size=1, outPutStyle="0x%s ")
lhex (x, size=8)
q (cond, on_true, on_false)

Detailed Description

Module "gBits".

Function Documentation

hexConvert | ( | s | ,
 |  | size | = 1,
 |  | outPutStyle | = "0x%s "
 | ) |

Convert binary string s to a hex format

Keyword arguments:

'size' -- How large should each hex value be

'outPutStyle' -- How should each value be formatted

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCmdCli Namespace Reference

gCmdCli Namespace Reference

Module "gCmdCli". More...

Classes

class CmdCli

Detailed Description

Module "gCmdCli".
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCommand Namespace Reference

gCommand Namespace Reference

Module "gCommand". More...

Classes

class Command

Functions

packstring (arg, type)

Detailed Description

Module "gCommand".
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gConstraint Namespace Reference

gConstraint Namespace Reference

Module "gConstraint". More...

Classes

class | gConstraintViolation
Constraint Violation Class. More...
class | GconstraintBase
Base constraint class for use when no constraint is appropriate. More...
class | Gconstraint
Base class for describing constraints. More...
class | GconstraintLimitRE
On Constraint Limit Raise Exception. More...
class | GconstraintLimit
Limit Constraint. More...
class | GconstraintLimitPegRE
Pegged Limit Constraint. More...

Detailed Description

Module "gConstraint".
Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCRU Namespace Reference

gCRU Namespace Reference

Module "gCRU". More...

Classes

class GCRU
CRU node. More...

Detailed Description

Module "gCRU".
Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gDb Namespace Reference

gDb Namespace Reference

Module "gDb". More...

Classes

class | Gdb
Base class for all GLAST LAT functional blocks. More...
class | _regList
class | Children

Detailed Description

Module "gDb".
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEBM Namespace Reference

gEBM Namespace Reference

Module "gEBM". More...

Classes

class | GEBM
GEBM node. More...
class | GEBMC
EBM Controller node. More...
class | GEBMST
EBM Event Statistics node. More...

Detailed Description

Module "gEBM".
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEGU Namespace Reference

gEGU Namespace Reference

Module "gEGU". More...

Classes

class | GEGU
Base class for raw/engineering unit conversions. More...
class | GEGU_linear
EGU class for performing linear conversions. More...
class | GEGU_poly3
EGU class for performing 3rd degree polynominal conversions. More...

Detailed Description

Module "gEGU".
Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEvtCli Namespace Reference

gEvtCli Namespace Reference

Module "gEvtCli". More...

Classes

class | AEM
AEM event object. More...
class | evAEM_PHA
PHA object. More...
class | GEM
GEM event object. More...
class | evGEM_Veto_List
GEM Veto List object. More...
class | Evt
Event object. More...
class | evErr_Summary
Error summary bitfields. More...
class | evSummary
Event summary bitfields. More...
class | evSummary_Singleton
class | evContPacket
Contribution Packet bitfields. More...
class | evContPacket_Singleton
class | evTKR_TOTdata
TKR TOT data class. More...
class | evTKR_Strip
TKR strip bitfields. More...
class | evTKR_StripData
TKR StripData class. More...
class | evCAL_LogAccepts
Log Accepts bitfields. More...
class | evCAL_LayerLogData
Class that associates a layer with the log data. More...
class | evCAL_LogData
Log Data bitfields. More...
class | evDiag_CalLayerEnd
Calorimeter Layer End bitfields. More...
class | evDiag_CalLayer
Calorimeter Layer class. More...
class | evDiag_TkrTrgReq
TKR Trigger Request bitfields. More...
class | evErr_GCCC
GCCC Error bitfields. More...
class | evErr_GCCC_Message
GCCC Error Message object. More...
class | evErr_CablePhase
Cable Controller Phasing Error bitfields. More...
class | evErr_GTCC
GTCC Error bitfields. More...
class | evErr_GTCC_Message
GTCC Error Message object. More...
class | evErr_CableTimeOut
Cable Timeout Error bitfields. More...
class | evDiag_Data
Diagnostic Data class. More...
class | evCellHeader
Cell Header bitfields. More...
class | evCellHeader_Singleton
class | EvtCliIO
Event client input/output class. More...
class | EvtCli
Event handler client. More...

Detailed Description

Module "gEvtCli".
Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gException Namespace Reference

gException Namespace Reference

Module "gException". More...

Classes

class | LATInterfaceStatus
class | LATInterfaceException

Detailed Description

Module "gException".
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gFswMessages Namespace Reference

gFswMessages Namespace Reference

Module "gFswMessages". More...

Classes

class FswMessages

Detailed Description

Module "gFswMessages".
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGEM Namespace Reference

gGEM Namespace Reference

Module "gGEM". More...

Classes

class | GGEM
GGEM node. More...
class | GGEMC
GEMC sub-node of GGEM (controller). More...
class | GGEMMG
GEMMG sub-node of GGEM (TAM generator). More...
class | GGEMST
GEMST sub-node of GGEM (statistics). More...
class | GGEMSC
GEMSC sub-node of GGEM (scheduler). More...
class | GGEMVG
GEMVG sub-node of GGEM (ROI generator). More...
class | GGEMIE
GEMIE sub-node of GGEM (input enables). More...
class | GGEMW
GEMW sub-node of GGEM. More...

Detailed Description

Module "gGEM".
Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGLT Namespace Reference

gGLT Namespace Reference

Module "gGLT". More...

Classes

class GGLT
Global Trigger. More...

Detailed Description

Module "gGLT".
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGroup Namespace Reference

gGroup Namespace Reference

Module "gGroup". More...

Classes

class Ggroup

Detailed Description

Module "gGroup".
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gHdb Namespace Reference

gHdb Namespace Reference

Module "gHdb". More...

Classes

class GattrHsk
Class which is instantiated for each housekeeping quantity. More...

Detailed Description

Module "gHdb".
Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gHSK Namespace Reference

gHSK Namespace Reference

GLAST LAT record definitions. More...

Classes

class | GHSK
GLAST HSK node Record. More...
class | HTEM
GLAST TEM HSK node record. More...
class | HAEM
GLAST AEM HSK node Record. More...
class | HARC
GLAST ARC HSK node record. More...
class | HGEM
GLAST GEM HSK node record. More...
class | HEBM
GLAST EBM HSK node record. More...
class | HPDU
GLAST PDU HSK node record. More...
class | HCOM
GLAST Communications statistics HSK node record. More...
class | HCPU
GLAST CPU metrics HSK node record. More...
class | HNUL
GLAST HSK null record. More...

Functions

processGHSK (isSchema, ghdb, node, declarations)
processHTEM (isSchema, ghdb, node, declarations)
processHAEM (isSchema, ghdb, node, declarations)
processHARC (isSchema, ghdb, node, declarations)
processHGEM (isSchema, ghdb, node, declarations)
processHEBM (isSchema, ghdb, node, declarations)
processHPDU (isSchema, ghdb, node, declarations)
processHCOM (isSchema, ghdb, node, declarations)
processHCPU (isSchema, ghdb, node, declarations)
readHskConfig (ghsk, cfgFileName)
applyHskConfig (ghsk, seq=None)
processHskConfigProperties (ghsk, node, declarations)
__privateFn (cls, function)

Detailed Description

GLAST LAT record definitions.

Contents:

Overview:

This module provides classes that are used as the building blocks for the Housekeeping hierarchy.

Function Documentation

applyHskConfig | ( | ghsk | ,
 |  | seq | = None
 | ) |

Applies the configuration that may have existed when the schema is read. The configuration portion of the schema is stored as a DOM reference in the GHSK node. This function accesses that DOM and sets the attributes accordingly

Input ::

(1) GHSK root of the object model (2) Optional sequence number of the configuration

Output: None

Usage::

applyConfig(ghsk)

readHskConfig | ( | ghsk | ,
 |  | cfgFileName |
 | ) |

Read a hsk configuration XML file and add its DOM to the dictionary of configurations.

Parameters:
ghsk | Populated schema
cfgFileName | Name of the configuration file in XML format
Returns:
The numeric key value of the dictionary entry. -1 if it fails to read the configuration file.

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLAT Namespace Reference

gLAT Namespace Reference

GLAST LAT record definitions. More...

Classes

class GLAT
GLAST LAT node Record. More...

Detailed Description

GLAST LAT record definitions.

Contents:

GLAST LAT functional block hierarchy representation in Python. See the following documents for more info:

The Tower Electronics Module (TEM) - Programming ICD specification (LAT-TD-00605-D1)

ACD Electronics Module (AEM) - Programming ICD specification (LAT-TD-00639-D1)

The Event Builder Module - Programming ICD specification (LAT-TD-01546)

The GLT Electronics Module - Programming ICD specification (LAT-TD-01545)

The Command/Response Unit - Programming ICD specification (LAT-TD-01547)

The Power Distribution Unit - Programming ICD specification (LAT-TD-01543)

Overview:

This module provides classes that are used as the building blocks for the LAT hierarchy. All classes inherit from Gnode class and add their own member methods and functions where necessary. Here is a list of classes defined:

  • GLAT: Root node for the hierarchy
  • GPDU: Power Distribution Unit
  • GPDUC: PDU Controller
  • GPEQ: PDU Environmental Monitors
  • GTWR: Tower
  • GTEM: Tower Electronics Module
  • GCCC: Calorimeter Cable Controller
  • GCRC: Calorimeter Readout Controller
  • GCFE: Calorimeter Front-end Controller
  • GTCC: Tracker Cable Controller
  • GTRC: Tracker Readout Controller
  • GTFE: Tracker Front-end Controller
  • GTIC: Trigger Interface Controller
  • GAEM: ACD Common Controller
  • GAEQ: ACD Environmental Monitors
  • GARC: ACD Readout Controller
  • GAFE: ACD Front-End Controller
  • GGLT: Global Trigger
  • GEBM: Event Builder Module
  • GEBMC: Event Builder Module Controller
  • GEBMST: Event Builder Module Statistics
  • GGEM: GLT Electronics Module
  • GGEMC: GLT Electronics Module Controller
  • GGEMMG: GLT Electronics Module TAM generator
  • GGEMST: GLT Electronics Module Statistics
  • GGEMSC: GLT Electronics Module Scheduler
  • GGEMVG: GLT Electronics Module ROI generator
  • GGEMIE: GLT Electronics Module Input enables
  • GGEMW: GLT Electronics Module Window
  • GCRU: Command Response Unit

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLCB Namespace Reference

gLCB Namespace Reference

Module "gLCB". More...

Classes

class GLCB
LCB node. More...

Detailed Description

Module "gLCB".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GlobalPanelImpl Namespace Reference

GlobalPanelImpl Namespace Reference

Module "GlobalPanelImpl". More...

Classes

class | GlobalPanelImpl
class | NullStream

Detailed Description

Module "GlobalPanelImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLog Namespace Reference

gLog Namespace Reference

Module "gLog". More...

Functions

logStack ()
logException (msg="")
__stripLineFeed (str)

Detailed Description

Module "gLog".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLoopback Namespace Reference

gLoopback Namespace Reference

Module "gLoopback". More...

Classes

class Loopback

Detailed Description

Module "gLoopback".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gMem Namespace Reference

gMem Namespace Reference

Module "gMem". More...

Classes

class GMem
Memory node. More...

Detailed Description

Module "gMem".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gNAT Namespace Reference

gNAT Namespace Reference

Module "gNAT". More...

Classes

class GNAT
GNAT node Record. More...

Detailed Description

Module "gNAT".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gNode Namespace Reference

gNode Namespace Reference

Module "gNode". More...

Classes

class Node

Detailed Description

Module "gNode".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOCS Namespace Reference

gOCS Namespace Reference

Module "gOCS". More...

Classes

class GOCS
OCS node. More...

Detailed Description

Module "gOCS".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOcsMessages Namespace Reference

gOcsMessages Namespace Reference

Module "gOcsMessages". More...

Classes

class OcsMessages

Detailed Description

Module "gOcsMessages".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOptions Namespace Reference

gOptions Namespace Reference

Module "gOptions". More...

Classes

class Options

Detailed Description

Module "gOptions".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSED_LDF Namespace Reference

GOSED_LDF Namespace Reference

Module "GOSED_LDF". More...

Classes

class | GEMcontribution
class | AEMcontributionIterator
class | CALcontributionIterator2
CAL contribution Displayer. More...
class | TKRcontributionIterator
TKR contribution Displayer. More...
class | OSWcontributionIterator
class | DIAGcontributionIterator
class | ERRcontributionIterator
class | myLATcomponentIterator
LAT component Displayer. More...

Detailed Description

Module "GOSED_LDF".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDACDImpl Namespace Reference

GOSEDACDImpl Namespace Reference

Module "GOSEDACDImpl". More...

Classes

class ACDSingleEvtDisplayImpl

Detailed Description

Module "GOSEDACDImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDCALImpl Namespace Reference

GOSEDCALImpl Namespace Reference

Module "GOSEDCALImpl". More...

Classes

class GOSEDCALImpl

Detailed Description

Module "GOSEDCALImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDCALTKRImpl Namespace Reference

GOSEDCALTKRImpl Namespace Reference

Module "GOSEDCALTKRImpl". More...

Classes

class GOSEDCALTKRImpl

Detailed Description

Module "GOSEDCALTKRImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDDataImpl Namespace Reference

GOSEDDataImpl Namespace Reference

Module "GOSEDDataImpl". More...

Classes

class GOSEDDataImpl

Detailed Description

Module "GOSEDDataImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gosedImpl Namespace Reference

gosedImpl Namespace Reference

Module "gosedImpl". More...

Classes

class singleEvtDisplayImpl
Glast Online Single Event Display (GOSED). More...

Detailed Description

Module "gosedImpl".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDPainter Namespace Reference

GOSEDPainter Namespace Reference

Module "GOSEDPainter". More...

Classes

class | drawSide1ACD
class | drawSide2ACD
class | drawSide3ACD
class | drawSide4ACD
class | drawHatACD
class | drawXZ_TKR
class | drawYZ_TKR
class | drawXZ_CAL
class | drawYZ_CAL

Detailed Description

Module "GOSEDPainter".
Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDPreferencesImpl Namespace Reference

GOSEDPreferencesImpl Namespace Reference

Module "GOSEDPreferencesImpl". More...

Classes

class GOSEDPreferencesImpl

Detailed Description

Module "GOSEDPreferencesImpl".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDTKRImpl Namespace Reference

GOSEDTKRImpl Namespace Reference

Module "GOSEDTKRImpl". More...

Classes

class GOSEDTKRImpl

Detailed Description

Module "GOSEDTKRImpl".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDTWRImpl Namespace Reference

GOSEDTWRImpl Namespace Reference

Module "GOSEDTWRImpl". More...

Classes

class GOSEDTWRImpl

Detailed Description

Module "GOSEDTWRImpl".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOTEDImpl Namespace Reference

GOTEDImpl Namespace Reference

Module "GOTEDImpl". More...

Classes

class towerEvtDisplayImpl

Detailed Description

Module "GOTEDImpl".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gPDU Namespace Reference

gPDU Namespace Reference

Module "gPDU". More...

Classes

class | GPDU
PDU Controller. More...
class | GPEQ
PDU Environmental Monitors. More...

Detailed Description

Module "gPDU".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gRegister Namespace Reference

gRegister Namespace Reference

Module "gRegister". More...

Classes

class Register

Detailed Description

Module "gRegister".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gResponse Namespace Reference

gResponse Namespace Reference

Module "gResponse". More...

Classes

class Response

Detailed Description

Module "gResponse".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gRule Namespace Reference

gRule Namespace Reference

Module "gRule". More...

Classes

class | GruleBase
Base rule class for use when no rule is appropriate. More...
class | Grule
Base class for describing rules. More...
class | GruleLimit
Rule class that limits a passed in value to given limits. More...
class | GruleAlarms
Alarm rule. More...

Detailed Description

Module "gRule".
Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gSchemaConfig Namespace Reference

gSchemaConfig Namespace Reference

Module "gSchemaConfig". More...

Functions

readSchema (glat, fileName)
addOpaque (gnode, xnode)
addSerialNos (gnode, snode)
processIncludes (doc, node, includeFiles, mainFilePath)
processConfigProperties (node, declarations)
readConfig (glat, cfgFileName)
applyConfig (glat, seq=None, gxbrd=None)
processGLAT (isSchema, glat, node, declarations)
setRegister (gattr, node, declarations)
extractRegisterValue (node)
processGXBRD (isSchema, gxbrd, node, declarations)
processGTWR (isSchema, gxbrd, node, declarations)
processGGLT (isSchema, gxbrd, node, declarations)
processGPDU (isSchema, glat, node, declarations)
processGPEQ (isSchema, gpdu, node, declarations)
processGEBM (isSchema, glat, node, declarations)
processGEBMC (isSchema, gebm, node, declarations)
processGEBMST (isSchema, gebm, node, declarations)
processGGEM (isSchema, glat, node, declarations)
processGGEMC (isSchema, ggem, node, declarations)
processGGEMMG (isSchema, ggem, node, declarations)
processGGEMST (isSchema, ggem, node, declarations)
processGGEMSC (isSchema, ggem, node, declarations)
processGGEMVG (isSchema, ggem, node, declarations)
processGGEMIE (isSchema, ggem, node, declarations)
processGGEMW (isSchema, ggem, node, declarations)
processGCRU (isSchema, glat, node, declarations)
processGTEM (isSchema, glat, node, declarations)
configureGTEM (glat, gtemIdSeq, node)
configureGCCC (node)
checkForDuplicateNode (node)
checkForConfigurationNode (node)
processGCCC (isSchema, gtem, node, declarations)
processGTCC (isSchema, gtem, node, declarations)
processGTIC (isSchema, gtem, node, declarations)
processGCRC (isSchema, gccc, node, declarations)
processGTRC (isSchema, gtcc, node, declarations)
processGCFE (isSchema, gcrc, node, declarations)
processGTFE (isSchema, gtrc, node, declarations)
processGAEM (isSchema, glat, node, declarations)
processGAEQ (isSchema, gaem, node, declarations)
processGARC (isSchema, gaem, node, declarations)
processGAFE (isSchema, garc, node, declarations)
printTree (node)
getChildNodes (node)
isNumber (s)
getParameterValue (parValue)
processConstraints (node, groups, constraints)
processRules (node, groups, rules)
processEGUs (node, egus)
processDeclarations (isSchema, node, declarations)
processBooleanDeclarationOption (on, declarations)
processBadChannels (node, badChannels, mapLayerToCable=None, mapDetectorToLayer=None, temId=None)
readBadChannels (fileName, mapLayerToCable=None, mapDetectorToLayer=None, temId=None)
instantiateClass (classModStr, classNameStr, parList)
takeSnapshot (glat, stream=sys.stdout, fileName=None, captureGTIC=1, captureGAEQ=1, trigger=None, configName='', configVersion='')
writeConfig (glat, stream=sys.stdout, seq=None)
writeRegisters (node, doc, xnode)
writeSchema (glat, stream=sys.stdout, snapshotMode=0, captureGTIC=1, captureGAEQ=1, trigger=None, configName='', configVersion='')
getPath (gnode, explicitBroadcastNodes)
uncompressSequence (seqStr, sepChar=',')
compressSequence (idTuple, sepChar=',')
toPrettyXML (doc, writer, indent="\t", newl="\n", encoding=None)
writeXML (n, writer, indent="", addindent="", newl="")
_write_data (writer, data)

Detailed Description

Module "gSchemaConfig".

Function Documentation

_write_data | ( | writer | ,
 |  | data |
 | ) |

Writes datachars to writer.

applyConfig | ( | glat | ,
 |  | seq | = None,
 |  | gxbrd | = None
 | ) |

Applies the configuration that may have existed when the schema is read. The configuration portion of the schema is stored as a DOM reference in the GLAT node. This function accesses that DOM and sets the registers accordingly

Input ::

(1) GLAT root of the object model (2) Optional sequence number of the configuration

Output: None

Usage::

applyConfig(lat)

readConfig | ( | glat | ,
 |  | cfgFileName |
 | ) |

Read a configuration XML file and add its DOM to the dictionary of configurations.

Parameters:
glat | Populated schema
cfgFileName | Name of the configuration file in XML format
Returns:
The numeric key value of the dictionary entry. -1 if it fails to read the configuration file.

readSchema | ( | glat | ,
 |  | fileName |
 | ) |

Reads a LAT schema/config document from an XML file and returns the object model

Input ::

(1) Filename of the XML (2) Optional active (connected) command client reference. Not needed if the document does not contain a 'configuration' section

Output::

GLAT root of the object model

Usage::

lat = readSchema('testSchema.xml')

writeSchema | ( | glat | ,
 |  | stream | = sys.stdout,
 |  | snapshotMode | = 0,
 |  | captureGTIC | = 1,
 |  | captureGAEQ | = 1,
 |  | trigger | = None,
 |  | configName | = '',
 |  | configVersion | = ''
 | ) |

Writes a LAT object model to an XML schema

Inputs::

GLAT root of the object model Output stream (defaults to sys.stdout if omitted)

Output: None

Usage::

f = open('mySchema.xml', 'w') writeSchema(lat, f) f.close() or writeSchema(lat) to output to sys.stdout.

Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gSocket Namespace Reference

gSocket Namespace Reference

Module "gSocket". More...

Classes

class Socket

Detailed Description

Module "gSocket".
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gTEM Namespace Reference

gTEM Namespace Reference

Module "gTEM". More...

Classes

class | GTEM
TEM node Record. More...
class | GCCC
Calorimeter Cable Controller node Record. More...
class | GCRC
Calorimeter Readout Controller node Record. More...
class | GCFE
Calorimeter Front End node Record. More...
class | GTCC
Tracker Cable Controller node record. More...
class | GTRC
Tracker Readout Controller node Record. More...
class | GTFE
Tracker Front-End node Record. More...
class | GTIC
Trigger Interface Controller. More...

Detailed Description

Module "gTEM".
Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gTPG Namespace Reference

gTPG Namespace Reference

Module "gTPG". More...

Classes

class GTPG

Detailed Description

Module "gTPG".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: guiBridges Namespace Reference

guiBridges Namespace Reference

Module "guiBridges". More...

Classes

class | GUIbridge
Class for providing a bridge between the GUI thread and other threads. More...
class | QtThreadBridge
class | PyThreadBridge
class | GUIbridgeTest
class | TestWindow

Functions

startTest (args)

Detailed Description

Module "guiBridges".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gVersions Namespace Reference

gVersions Namespace Reference

Classes

class Gversions

Detailed Description

Version retrieval utility class

Contents:

Provides accessor methods to retrieve version information from both the software and hardware. Displays version info from loaded libraries. Used for troubleshooting problems.

Overview:

Each driver on VxWorks side and each module on the client side provides its version number through functions. When the function cmd.getVersions() is called the command server packetizes this information and sends it over the socket to the command client which gets decoded into a tuple. The getModuleVersions() function converts this tuple to a dictionary and adds the python module versions to it.

Usage:

To retrieve version information one can write::

python versions.py

or

import versions versions.Gversions.getModuleVersions()

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gXBR Namespace Reference

gXBR Namespace Reference

Module "gXBR". More...

Classes

class | GXBRD
Tower controller node Record. More...
class | GTWR
Tower node Record. More...

Detailed Description

Module "gXBR".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskAlarms Namespace Reference

HskAlarms Namespace Reference

Module "HskAlarms". More...

Classes

class | HskAlarm
class | EmailAlarm

Functions

yellowPrintMessage (value, signal, sender, node)
redPrintMessage (value, signal, sender, node)
NodeString (node)

Detailed Description

Module "HskAlarms".

Function Documentation

NodeString ( node )

Useful little recursive function to generate a string representation of a gDb-like object.

Parameters:
node Any gDb-like object. (i.e. GLAT, GHSK) Object must support getName(), up() and id() methods.

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCli Namespace Reference

HskCli Namespace Reference

Module "HskCli". More...

Classes

class | HskCli
Housekeeping client input/output class. More...
class | ccsdsSocket
class | HskCmdRxSocket
class | HskCmdTxSocket
class | HskTelemSocket
class | ConnectState
class | HskHandler
HskHandler class. More...

Detailed Description

Module "HskCli".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCollector Namespace Reference

HskCollector Namespace Reference

Module "HskCollector". More...

Classes

class | HskConfiguration
class | HskCollector
Configurable housekeeping collector. More...

Detailed Description

Module "HskCollector".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskGuiReceiver Namespace Reference

HskGuiReceiver Namespace Reference

Module "HskGuiReceiver". More...

Classes

class | QtReceiver
class | TrendPlotter
class | TimeAxisGen

Functions

memget ()
startup ()
startQT (dataFile, startTime, keyList)
usage ()

Detailed Description

Module "HskGuiReceiver".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskPacketDecoder Namespace Reference

HskPacketDecoder Namespace Reference

Module "HskPacketDecoder". More...

Classes

class | ccsdsPacket
Interface to a generic CCSDS packet. More...
class | ccsdsHeader
CCSDS Header bitfield definition. More...
class | HskPacketBase

Functions

packetFactory (packet)

Detailed Description

Module "HskPacketDecoder".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskPacketRetriever Namespace Reference

HskPacketRetriever Namespace Reference

Module "HskPacketRetriever". More...

Classes

class HskPacketRetriever

Detailed Description

Module "HskPacketRetriever".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskReceiver Namespace Reference

HskReceiver Namespace Reference

Module "HskReceiver". More...

Classes

class | HskSimpleTextReceiver
class | HskCfgTextReceiver

Functions

parseKeyFile (keyFile)
startup ()
usage ()

Detailed Description

Module "HskReceiver".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRecorder Namespace Reference

HskRecorder Namespace Reference

Module "HskRecorder". More...

Classes

class | HskAlarmRecorder
class | HskFileRecorder
class | HskPacketRecorder

Detailed Description

Module "HskRecorder".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRegisters Namespace Reference

HskRegisters Namespace Reference

Module "HskRegisters". More...

Classes

class | RegisterInterface
class | NodeRegisterList
class | AEQHskRegMap

Detailed Description

Module "HskRegisters".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRetriever Namespace Reference

HskRetriever Namespace Reference

Module "HskRetriever". More...

Classes

class | HskLatRetriever
class | HskTestRetriever

Detailed Description

Module "HskRetriever".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlGuiReceiver Namespace Reference

HskSqlGuiReceiver Namespace Reference

Module "HskSqlGuiReceiver". More...

Classes

class | QtReceiver
class | TrendPlotter
class | TimeAxisGen

Functions

memget ()
startup ()
startQT (sqlDB, timeDepth, keyList, source)
usage ()

Detailed Description

Module "HskSqlGuiReceiver".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlInterface Namespace Reference

HskSqlInterface Namespace Reference

Module "HskSqlInterface". More...

Classes

class | HskSqlRecorder
class | HskSqlReceiver

Detailed Description

Module "HskSqlInterface".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlSvr Namespace Reference

HskSqlSvr Namespace Reference

Module "HskSqlSvr". More...

Functions

startup ()
testCollector (sqlDB)
alarmSetup (hskDB, cmdDB)
usage ()

Detailed Description

Module "HskSqlSvr".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSvr Namespace Reference

HskSvr Namespace Reference

Module "HskSvr". More...

Functions

HskStartup (cfgFile)
alarmSetup (hskDB, cmdDB)
usage ()

Detailed Description

Module "HskSvr".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskTestSvr Namespace Reference

HskTestSvr Namespace Reference

Module "HskTestSvr". More...

Functions

testCollector ()

Detailed Description

Module "HskTestSvr".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestAppEvt Namespace Reference

hTestAppEvt Namespace Reference

Module "hTestAppEvt". More...

Classes

class | myTKRcontributionIterator
class | myLATcomponentIterator
class | userArgument
class | userArgText
class | userApplication

Functions

_unsigned (arg)
Convert an unsigned int argument to an unsigned long.

Detailed Description

Module "hTestAppEvt".

Function Documentation

_unsigned ( arg )

Convert an unsigned int argument to an unsigned long.

This funtion exists to help format unsigned ints greater than 0x7fffffff, which in Python 2.4 and up will be displayed as signed strings.

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestAppTkr Namespace Reference

hTestAppTkr Namespace Reference

Module "hTestAppTkr". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "hTestAppTkr".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestEnv Namespace Reference

hTestEnv Namespace Reference

Module "hTestEnv". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "hTestEnv".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestStrip Namespace Reference

hTestStrip Namespace Reference

Module "hTestStrip". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "hTestStrip".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: LATsweep Namespace Reference

LATsweep Namespace Reference

Module "LATsweep". More...

Classes

class LATsweep

Detailed Description

Module "LATsweep".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ldf2fits Namespace Reference

ldf2fits Namespace Reference

Module "ldf2fits". More...

Functions

__usage ()

Detailed Description

Module "ldf2fits".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MailAlert Namespace Reference

MailAlert Namespace Reference

Module "MailAlert". More...

Classes

class | MailAlert
class | SLACmail
class | Email

Detailed Description

Module "MailAlert".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTExample Namespace Reference

MiniGLTExample Namespace Reference

Interface for Coincidence based Trigger System. More...

Classes

class | MiniGLTExample
MiniTower example interface to MiniGLT. More...
class | MiniGLTTrgEngines
class | MiniGLTSolicitedEngine
class | MiniGLTSolicitedCondition
class | ZsupTrgReadout
ZsupTrgReadout class definition. More...

Detailed Description

Interface for Coincidence based Trigger System.
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MSGLogGUIImpl Namespace Reference

MSGLogGUIImpl Namespace Reference

Module "MSGLogGUIImpl". More...

Classes

class | LogRecordStreamHandler
class | MSGLogSocketReceiver
class | MSGLogGUIImpl

Detailed Description

Module "MSGLogGUIImpl".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: nullApp Namespace Reference

nullApp Namespace Reference

Module "nullApp". More...

Classes

class userApplication

Detailed Description

Module "nullApp".
Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullObjects Namespace Reference

NullObjects Namespace Reference

Classes

class | NullTower
class | NullCal
class | NullTkr
class | NoTowersEnabled
class | NoTilesEnabled
class | NoCnoEnabled
class | NoInputsEnabled
class | NullRoi
class | NullCoincidence
class | NullEngine
class | NullRequest

Detailed Description

NullObjects: Interfaces for when there are no objects in the system

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: parseFswHsk Namespace Reference

parseFswHsk Namespace Reference

Module "parseFswHsk". More...

Classes

class HskPacketWriter

Functions

readCATH (fileName, codeFile, sqlFile)
processTlmFld (node, codeFile)
processTlmPkt (node, codeFile, sqlFile)
processTlmPayload (node, packetCode)
processTlmITOS (node, packetCode)
processMnemonic (node, packetCode)
startHeader (codeFile)
endHeader (codeFile)

Detailed Description

Module "parseFswHsk".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: PowerPanelImpl Namespace Reference

PowerPanelImpl Namespace Reference

Module "PowerPanelImpl". More...

Classes

class PowerPanelImpl

Detailed Description

Module "PowerPanelImpl".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: pythfilter Namespace Reference

pythfilter Namespace Reference

Module "pythfilter". More...

Functions

output (s, spos, immediate=0)
rec_name_n_param (type, tok)
start_recording ()
is_recording_finished ()
gather_comment (type, tok, spos)
print_comment (spos)
set_state (s)
get_state ()
push_state (s)
pop_state ()
tok_eater (type, tok, spos, epos, line)
dump (filename)
filter (filename)
filterFile (filename, out=sys.stdout)
preparePath (path)
isNewer (file1, file2)
convert (srcpath, destpath)

Detailed Description

Module "pythfilter".

Function Documentation

convert | ( | srcpath | ,
 |  | destpath |
 | ) |

Convert a Python source tree into a C+ stub tree.

All *.py files in srcpath (including sub-directories) are filtered and written to destpath. If destpath exists, only the files that have been modified are filtered again. Files that were deleted from srcpath are also deleted in destpath if they are still present. The function returns the number of processed *.py files.

gather_comment | ( | type | ,
 |  | tok | ,
 |  | spos |
 | ) |

Gather comment block

isNewer | ( | file1 | ,
 |  | file2 |
 | ) |

Check if file1 is newer than file2.

file1 must be an existing file.

preparePath ( path )

Prepare a path.

Checks if the path exists and creates it if it does not exist.

print_comment ( spos )

Output comment block and empty buffer.

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcArchiver Namespace Reference

rcArchiver Namespace Reference

Module "rcArchiver". More...

Classes

class rcArchiver
Event Archiver. More...

Detailed Description

Module "rcArchiver".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcCommentPanel Namespace Reference

rcCommentPanel Namespace Reference

Module "rcCommentPanel". More...

Classes

class | rcCommentPanel
class | CommentEntryWidget

Detailed Description

Module "rcCommentPanel".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcComplStatus Namespace Reference

rcComplStatus Namespace Reference

Module "rcComplStatus". More...

Classes

class rcCompletionStatus

Detailed Description

Module "rcComplStatus".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcDefaultTrigger Namespace Reference

rcDefaultTrigger Namespace Reference

Module "rcDefaultTrigger". More...

Classes

class | rcGEMDefaultTrigger
rcGEMDefaultTrigger More...
class | rcMiniGLTDefaultTrigger
rcMiniGLTDefaultTrigger More...
class | rcGEMTrgEngines
class | rcSolicitedEngine
class | rcSolicitedCondition
class | rcMiniGLTTrgEngines
class | rcMiniGLTSolicitedEngine
class | rcMiniGLTSolicitedCondition

Detailed Description

Module "rcDefaultTrigger".
Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcFitsWriter Namespace Reference

rcFitsWriter Namespace Reference

Module "rcFitsWriter". More...

Classes

class rcFitsWriter

Functions

getFileNameFromTS (ts)

Detailed Description

Module "rcFitsWriter".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcHouseKeeping Namespace Reference

rcHouseKeeping Namespace Reference

Module "rcHouseKeeping". More...

Classes

class rcHouseKeeping

Functions

getFileNameFromTS (ts)

Detailed Description

Module "rcHouseKeeping".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcLoginImpl Namespace Reference

rcLoginImpl Namespace Reference

Module "rcLoginImpl". More...

Classes

class rcLoginImpl

Detailed Description

Module "rcLoginImpl".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcParamVerifier Namespace Reference

rcParamVerifier Namespace Reference

Module "rcParamVerifier". More...

Classes

class rcParamVerifier

Detailed Description

Module "rcParamVerifier".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcParamVerifyGUIImpl Namespace Reference

rcParamVerifyGUIImpl Namespace Reference

Module "rcParamVerifyGUIImpl". More...

Classes

class rcParamVerifyGUIImpl

Detailed Description

Module "rcParamVerifyGUIImpl".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPreferencesGUIImpl Namespace Reference

rcPreferencesGUIImpl Namespace Reference

Module "rcPreferencesGUIImpl". More...

Classes

class rcPreferencesGUIImpl

Detailed Description

Module "rcPreferencesGUIImpl".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPreferencesManager Namespace Reference

rcPreferencesManager Namespace Reference

Module "rcPreferencesManager". More...

Classes

class | rcPreferencesManager
class | Preferences
Preferences dictionary Preferences needs a special dictionary class since the data it stores may have macros and environment variables in it. More...

Detailed Description

Module "rcPreferencesManager".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPythonShell Namespace Reference

rcPythonShell Namespace Reference

Module "rcPythonShell". More...

Classes

class | rcPythonShell
class | PythonShellWidget

Detailed Description

Module "rcPythonShell".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcReportGen Namespace Reference

rcReportGen Namespace Reference

Module "rcReportGen". More...

Classes

class rcReportGen

Detailed Description

Module "rcReportGen".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcRunIdHelper Namespace Reference

rcRunIdHelper Namespace Reference

Module "rcRunIdHelper". More...

Classes

class rcRunIdHelper

Detailed Description

Module "rcRunIdHelper".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcScmCfgSelector Namespace Reference

rcScmCfgSelector Namespace Reference

Module "rcScmCfgSelector". More...

Classes

class | rcScmCfgSelector
class | rcScmCfgSelText

Detailed Description

Module "rcScmCfgSelector".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSecurityMan Namespace Reference

rcSecurityMan Namespace Reference

Module "rcSecurityMan". More...

Classes

class rcSecurityMan

Detailed Description

Module "rcSecurityMan".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcStatusMonitor Namespace Reference

rcStatusMonitor Namespace Reference

Module "rcStatusMonitor". More...

Classes

class | StatusItem
class | WatchItem
class | rcStatusPanel
class | rcStatusMonitor

Detailed Description

Module "rcStatusMonitor".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSuite Namespace Reference

rcSuite Namespace Reference

Module "rcSuite". More...

Classes

class rcSuite

Detailed Description

Module "rcSuite".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTestReport Namespace Reference

rcTestReport Namespace Reference

Module "rcTestReport". More...

Classes

class rcTestReport
Test Report class for RunControl. More...

Detailed Description

Module "rcTestReport".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTransitions Namespace Reference

rcTransitions Namespace Reference

Module "rcTransitions". More...

Classes

class rcTransitions

Detailed Description

Module "rcTransitions".
Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgFunctions Namespace Reference

rcTrgFunctions Namespace Reference

Classes

class | rcTrgEngines
rcTrgEngines Class More...
class | SweepMarkerEngine
SweepMarkerEngine class. More...
class | rcTrgInjectMarker
class | rcTrgTileEnables
rcTrgTileEnables class More...
class | rcTrgCoincidence
rcTrgCoincidence class More...

Detailed Description

rcTrgFunctions: Run control Interfaces for Trigger modules

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgGem Namespace Reference

rcTrgGem Namespace Reference

Classes

class rcTrgGem
rcTrgGem class definition This class implements a 'threaded' model for enabling/disabling the trigger More...

Detailed Description

rcTrgGem: This class implements a 'threaded' model for enabling/disabling the trigger

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgMiniGLT Namespace Reference

rcTrgMiniGLT Namespace Reference

Classes

class rcTrgMiniGLT
rcTrgMiniGLT class definition This class implements a 'threaded' model for enabling/disabling the trigger More...

Detailed Description

rcTrgMiniGLT: This class implements a 'threaded' model for enabling/disabling the trigger

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUsers Namespace Reference

rcUsers Namespace Reference

Module "rcUsers". More...

Classes

class | rcUser
class | rcUsers

Detailed Description

Module "rcUsers".
Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUtil Namespace Reference

rcUtil Namespace Reference

Module "rcUtil". More...

Classes

class Reloader

Functions

deleteModule (moduleName)
importModule (appName, reload=1, dontReloadList=None)

Detailed Description

Module "rcUtil".

Function Documentation

importModule | ( | appName | ,
 |  | reload | = 1,
 |  | dontReloadList | = None
 | ) |

Import a RunControl application or suite

Parameters:
appName | Name of the module or pathname of the python script
reload | 1 = Reload all modules that have been loaded since RunControl started (default) 0 = Do not reload modules (used if a suite is being loaded)
dontReloadList | Optional parameter which specifies the additional list of module prefixes that should not be reloaded. If this parameter is missing then the default list (Reloader.DONT_RELOAD_LIST) is used, if it is specified then it gets appended to the default list.
Returns:
The name of the module and the resolved pathname

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Receiver Namespace Reference

Receiver Namespace Reference

Module "Receiver". More...

Classes

class | Receiver
Abstract Receiver class. More...
class | UDPReceiver
UDPReceiver class. More...

Detailed Description

Module "Receiver".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Recorder Namespace Reference

Recorder Namespace Reference

Module "Recorder". More...

Classes

class | Recorder
Recorder class. More...
class | DummyRecorder
Example recorder that dumps the trendables to a logger. More...
class | FlatFileRecorder
class | UDPRecorder
Example recorder that UDP broadcasts trendables. More...

Detailed Description

Module "Recorder".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Retriever Namespace Reference

Retriever Namespace Reference

Module "Retriever". More...

Classes

class | Retriever
class | DummyRetriever

Detailed Description

Module "Retriever".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: robustapply Namespace Reference

robustapply Namespace Reference

Functions

function (receiver)
robustApply (receiver, arguments, named)

Detailed Description

Robust apply mechanism

Provides a function "call", which can sort out what arguments a given callable object can take, and subset the given arguments to match only those which are acceptable.

Function Documentation

function ( receiver )

Get function-like callable object for given receiver

returns (function_or_method, codeObject, fromMethod)

If fromMethod is true, then the callable already has its first argument bound

robustApply | ( | receiver | ,
 |  | arguments | ,
 |  | named |
 | ) |

Call receiver with arguments and an appropriate subset of named

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControl Namespace Reference

RunControl Namespace Reference

Module "RunControl". More...

Classes

class | ConnectState
class | RunControl

Detailed Description

Module "RunControl".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlCommon Namespace Reference

RunControlCommon Namespace Reference

Module "RunControlCommon". More...

Classes

class | GDBN
Database node record. More...
class | RunControlSocketHandler
class | RunControlFileHandler
FileHandler class for handling multiple line log entries. More...
class | RunControlCommon

Detailed Description

Module "RunControlCommon".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlFSM Namespace Reference

RunControlFSM Namespace Reference

Module "RunControlFSM". More...

Classes

class RunControlFSM

Detailed Description

Module "RunControlFSM".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlGUIImpl Namespace Reference

RunControlGUIImpl Namespace Reference

Module "RunControlGUIImpl". More...

Classes

class | RunControlGUIImpl
class | rcFileSelector

Detailed Description

Module "RunControlGUIImpl".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlMain Namespace Reference

RunControlMain Namespace Reference

Module "RunControlMain". More...

Classes

class | ConnectState
class | RunControlMain

Detailed Description

Module "RunControlMain".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlMainGUIImpl Namespace Reference

RunControlMainGUIImpl Namespace Reference

Module "RunControlMainGUIImpl". More...

Classes

class | RunControlMainGUIImpl
class | rcFileSelector

Detailed Description

Module "RunControlMainGUIImpl".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: saferef Namespace Reference

saferef Namespace Reference

Classes

class BoundMethodWeakref

Functions

safeRef (target, onDelete=None)

Detailed Description

Refactored "safe reference" from dispatcher.py

Function Documentation

safeRef | ( | target | ,
 |  | onDelete | = None
 | ) |

Return a *safe* weak reference to a callable target

target -- the object to be weakly referenced, if it's a bound method reference, will create a BoundMethodWeakref, otherwise creates a simple weakref. onDelete -- if provided, will have a hard reference stored to the callable to be called after the safe reference goes out of scope with the reference object, (either a weakref or a BoundMethodWeakref) as argument.

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: searchTextBrowserImpl Namespace Reference

searchTextBrowserImpl Namespace Reference

Module "searchTextBrowserImpl". More...

Classes

class BrowserImpl

Detailed Description

Module "searchTextBrowserImpl".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ServerPreferencesImpl Namespace Reference

ServerPreferencesImpl Namespace Reference

Module "ServerPreferencesImpl". More...

Classes

class ServerPreferencesImpl

Detailed Description

Module "ServerPreferencesImpl".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: setup Namespace Reference

setup Namespace Reference

Module "setup". More...

Detailed Description

Module "setup".
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SimpleGasuExample Namespace Reference

SimpleGasuExample Namespace Reference

Interface for Coincidence based Trigger System. More...

Classes

class | SimpleGasuExample
SimpleGASU example interface to GEM. More...
class | SGETrgInputEnables
class | SGETrgEngines
class | SolicitedEngine
class | SolicitedCondition
class | ZsupTrgReadout
ZsupTrgReadout class definition. More...

Detailed Description

Interface for Coincidence based Trigger System.
Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardLDF Namespace Reference

standardLDF Namespace Reference

Module "standardLDF". More...

Classes

class | LATcomponentIterator
class | CALcontributionIterator
class | TKRcontributionIterator
class | AEMcontributionIterator
class | OSWcontributionIterator
class | DIAGcontributionIterator
class | GEMcontribution
class | LATcontributionIterator
class | EBFeventIterator

Functions

hexdump (chars, sep, width)
quotechars (chars)

Detailed Description

Module "standardLDF".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardPlotter Namespace Reference

standardPlotter Namespace Reference

Module "standardPlotter". More...

Classes

class | standardPlotter
class | standardTestReport

Detailed Description

Module "standardPlotter".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardPlotterGuiImpl Namespace Reference

standardPlotterGuiImpl Namespace Reference

Module "standardPlotterGuiImpl". More...

Classes

class standardPlotterGuiImpl

Detailed Description

Module "standardPlotterGuiImpl".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: startupGUI Namespace Reference

startupGUI Namespace Reference

Module "startupGUI". More...

Functions

startup ()

Detailed Description

Module "startupGUI".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: startupMainGUI Namespace Reference

startupMainGUI Namespace Reference

Module "startupMainGUI". More...

Functions

startupMainGui ()
initstyle (rcCommon)

Detailed Description

Module "startupMainGUI".

Function Documentation

startupMainGui ( )

Start up run control.

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: taskEngine Namespace Reference

taskEngine Namespace Reference

Module "taskEngine". More...

Classes

class | TaskEngine
class | TaskEngineTestCase

Functions

_unbound1 (a, b, c, x, y, z)
_doException ()
_unbound2 ()
suite ()
test ()

Detailed Description

Module "taskEngine".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_aem Namespace Reference

test_aem Namespace Reference

Module "test_aem". More...

Functions

test_aem ()

Detailed Description

Module "test_aem".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_aeq Namespace Reference

test_aeq Namespace Reference

Module "test_aeq". More...

Functions

test_aeq ()

Detailed Description

Module "test_aeq".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_cmd Namespace Reference

test_cmd Namespace Reference

Functions

test (cmd=None, disconnectOnExit=True)

Detailed Description

Test script for commanding Contents: Sample script for testing write command throughput

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_cmdrsp Namespace Reference

test_cmdrsp Namespace Reference

Module "test_cmdrsp". More...

Functions

test_cmdrsp ()

Detailed Description

Module "test_cmdrsp".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_db Namespace Reference

test_db Namespace Reference

Classes

class GTest

Functions

test (cmd=None, disconnectOnExit=True)

Detailed Description

Test script for commanding Contents: Sample script for testing commanding throughput

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_aem Namespace Reference

test_evt_aem Namespace Reference

Functions

test (cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1)

Detailed Description

Test script for taking AEM events

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_cal Namespace Reference

test_evt_cal Namespace Reference

Classes

class | MiniGLTExample
MiniTower example interface to MiniGLT. More...
class | MiniGLTTrgEngines
class | MiniGLTSolicitedEngine
class | MiniGLTSolicitedCondition
class | ZsupTrgInjectChargeReadout
ZsupTrgReadout class definition. More...
class | ZsupSolicitedEngine

Functions

test (cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1, lowlevel=0)

Detailed Description

Test script for measuring event taking throughput.

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_exttrg Namespace Reference

test_evt_exttrg Namespace Reference

Classes

class | GasuExtTrg
class | GasuExtTrgEngine
class | MiniGltExtTrg
class | MiniGltTrgEngine

Functions

__init__ (self)
external (self)
test (cmd=None, debug=0, disconnectOnExit=1, parse=1, lowlevel=0)

Detailed Description

Test script for external trigger functionality.

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_filters Namespace Reference

test_evt_filters Namespace Reference

Functions

test (cmd=None, debug=0, count=10, disconnectOnExit=1)
countEvents (count, printSize=False)
testEHSendErrors (test, count)
testEHSendNothing (test, count)
testEHSendPrescale (test, count, prescale)
testEHSendAcd (test, count, marker, prescale)
testEHSendAll (test, count)

Detailed Description

Test of callbacks in OES

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_tkr Namespace Reference

test_evt_tkr Namespace Reference

Classes

class ZsupSolicitedEngine

Functions

test (cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1, lowlevel=0)

Detailed Description

Test script for taking TKR events

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_gafe Namespace Reference

test_gafe Namespace Reference

Module "test_gafe". More...

Functions

test_aem ()

Detailed Description

Module "test_gafe".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_garc Namespace Reference

test_garc Namespace Reference

Module "test_garc". More...

Functions

test_aem ()

Detailed Description

Module "test_garc".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_glt Namespace Reference

test_glt Namespace Reference

Module "test_glt". More...

Functions

test_glt ()

Detailed Description

Module "test_glt".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_lat Namespace Reference

test_lat Namespace Reference

Module "test_lat". More...

Functions

test_lat ()

Detailed Description

Module "test_lat".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_loopback Namespace Reference

test_loopback Namespace Reference

Module "test_loopback". More...

Classes

class EvtCli

Detailed Description

Module "test_loopback".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_mem Namespace Reference

test_mem Namespace Reference

Module "test_mem". More...

Functions

test_lat ()

Detailed Description

Module "test_mem".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_options Namespace Reference

test_options Namespace Reference

Module "test_options". More...

Functions

test_cmdrsp ()

Detailed Description

Module "test_options".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_playback Namespace Reference

test_playback Namespace Reference

Module "test_playback". More...

Classes

class Playback

Functions

test_playback ()

Detailed Description

Module "test_playback".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_rate Namespace Reference

test_rate Namespace Reference

Module "test_rate". More...

Functions

test_rate ()

Detailed Description

Module "test_rate".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_schema Namespace Reference

test_schema Namespace Reference

Module "test_schema". More...

Functions

test_schema ()

Detailed Description

Module "test_schema".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_tem Namespace Reference

test_tem Namespace Reference

Functions

test (c=None, disconnectOnExit=1)

Detailed Description

TEM test Contents: Script for testing TEM

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_twoclients Namespace Reference

test_twoclients Namespace Reference

Module "test_twoclients". More...

Functions

test_twoclients ()

Detailed Description

Module "test_twoclients".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAcd Namespace Reference

testAppAcd Namespace Reference

Module "testAppAcd". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppAcd".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAcdScalers Namespace Reference

testAppAcdScalers Namespace Reference

Module "testAppAcdScalers". More...

Classes

class | userArgument
class | userArgText
class | userApplication
class | MiniGLTExample
MiniTower example interface to MiniGLT. More...
class | MiniGLTTrgEngines
class | MiniGLTSolicitedEngine
class | MiniGLTSolicitedCondition
class | MarkerTrgReadout
MarkerTrgReadout class definition. More...
class | LDBI_LATcontributionIterator
LDBI_LATcontributionIterator implementation. More...
class | SimpleGasuExample
SimpleGASU example interface to GEM. More...
class | SGETrgInputEnables
class | SGETrgEngines
class | SolicitedEngine
class | SolicitedCondition
class | FullCondition
class | FullEngine

Detailed Description

Module "testAppAcdScalers".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAlarm Namespace Reference

testAppAlarm Namespace Reference

Module "testAppAlarm". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppAlarm".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppArchiver Namespace Reference

testAppArchiver Namespace Reference

Module "testAppArchiver". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppArchiver".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppCal Namespace Reference

testAppCal Namespace Reference

Module "testAppCal". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppCal".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppCal_dg Namespace Reference

testAppCal_dg Namespace Reference

Module "testAppCal_dg". More...

Classes

class | CAL_LATcontribution
class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppCal_dg".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvt Namespace Reference

testAppEvt Namespace Reference

Module "testAppEvt". More...

Classes

class | myLATcomponentIterator
class | userArgument
class | userArgText
class | userApplication

Functions

_unsigned (arg)
Convert an unsigned int argument to an unsigned long.

Detailed Description

Module "testAppEvt".

Function Documentation

_unsigned ( arg )

Convert an unsigned int argument to an unsigned long.

This funtion exists to help format unsigned ints greater than 0x7fffffff, which in Python 2.4 and up will be displayed as signed strings.

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvtCli Namespace Reference

testAppEvtCli Namespace Reference

Module "testAppEvtCli". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppEvtCli".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvtTO Namespace Reference

testAppEvtTO Namespace Reference

Module "testAppEvtTO". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppEvtTO".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppLDFdump Namespace Reference

testAppLDFdump Namespace Reference

Module "testAppLDFdump". More...

Classes

class | LATcomponentIterator
class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppLDFdump".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppTkr Namespace Reference

testAppTkr Namespace Reference

Module "testAppTkr". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testAppTkr".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testArchiver Namespace Reference

testArchiver Namespace Reference

Module "testArchiver". More...

Classes

class testArchiver

Detailed Description

Module "testArchiver".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testEvtCli Namespace Reference

testEvtCli Namespace Reference

Module "testEvtCli". More...

Classes

class testEvtCli

Detailed Description

Module "testEvtCli".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSAppCal Namespace Reference

testSAppCal Namespace Reference

Module "testSAppCal". More...

Classes

class | userArgument
class | userArgText
class | userApplication

Detailed Description

Module "testSAppCal".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSAppEvt Namespace Reference

testSAppEvt Namespace Reference

Module "testSAppEvt". More...

Classes

class | myLATcomponentIterator
class | userArgument
class | userArgText
class | userApplication

Functions

_unsigned (arg)
Convert an unsigned int argument to an unsigned long.

Detailed Description

Module "testSAppEvt".

Function Documentation

_unsigned ( arg )

Convert an unsigned int argument to an unsigned long.

This funtion exists to help format unsigned ints greater than 0x7fffffff, which in Python 2.4 and up will be displayed as signed strings.

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuite Namespace Reference

testSuite Namespace Reference

Module "testSuite". More...

Classes

class userSuite

Detailed Description

Module "testSuite".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuite2 Namespace Reference

testSuite2 Namespace Reference

Module "testSuite2". More...

Classes

class userSuite

Detailed Description

Module "testSuite2".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuiteLong Namespace Reference

testSuiteLong Namespace Reference

Module "testSuiteLong". More...

Classes

class userSuite

Detailed Description

Module "testSuiteLong".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testTrending Namespace Reference

testTrending Namespace Reference

Module "testTrending". More...

Classes

class | QtReceiver
class | TrendTestGUI
class | TrendTree
class | TrendPlotter
class | FancyTrendTree

Functions

testQtReceiver (args)
testReceiver ()

Detailed Description

Module "testTrending".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Trendable Namespace Reference

Trendable Namespace Reference

Module "Trendable". More...

Classes

class | Trendable
class | TrendLimit

Detailed Description

Module "Trendable".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrendMaps Namespace Reference

TrendMaps Namespace Reference

Module "TrendMaps". More...

Classes

class | TrendMapBase
class | GHSKTrendMap
class | GLATTrendMap
class | ReverseTrendMap

Functions

makeSimpleMap (trendables, trendMap)

Detailed Description

Module "TrendMaps".
Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgAbstract Namespace Reference

TrgAbstract Namespace Reference

Classes

class TrgAbstract
Abstract trigger interface class definition. More...

Detailed Description

TrgAbstract: Interface for Coincidence based Trigger System

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCmdCounters Namespace Reference

TrgCmdCounters Namespace Reference

Classes

class | TrgCmdCounters
TrgCmdCounters class. More...
class | TrgCmdStats
TrgCmdStats class. More...

Detailed Description

TrgCmdCounters: Interface for Command Response system

Generated on Fri Jan 21 18:01:23 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCoincidences Namespace Reference

TrgCoincidences Namespace Reference

Classes

class | TrgRois
Trigger ROI (Region of Interest) list class definition. More...
class | TrgRoi
Trigger ROI (Region of Interest) class definition. More...
class | TrgCoincidences
Trigger Coincidences class definition. More...
class | TrgCoincidence
Trigger Coincidence class definition This class defines the set of tiles which will constitute any one coincidence. More...

Detailed Description

TrgCoincidences: Interface for Trigger Coincidence classes

Generated on Fri Jan 21 18:01:24 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditions Namespace Reference

TrgConditions Namespace Reference

Classes

class TrgConditions
Trigger Conditions Value class definition This class is used to define one combinatoric of the 128 possible conditions. More...

Detailed Description

TrgConditions: Interface for Trigger Conditions

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditionsValue Namespace Reference

TrgConditionsValue Namespace Reference

Module "TrgConditionsValue". More...

Classes

class TrgConditionsValue
Trigger Conditions Value class definition. More...

Detailed Description

Module "TrgConditionsValue".
Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEngines Namespace Reference

TrgEngines Namespace Reference

Classes

class | TrgEngines
Trigger Engines class definition A Trigger Engine defines what the Trigger System does when it detects a triggerable condition within the LAT. More...
class | TrgEngine
Trigger Engine class definition The user inherits from this class to customize their own Trigger Engines. The user must satisfy the member function 'request', which returns an object of type TrgEngineRequest. The user must satisfy the member function 'prescale', which returns an integer. More...
class | TrgEngineRequest
Trigger Engine Request class definition The TrgEngineRequest class is used to specify the parameterization of the Trigger Message associated with a given engine. More...
class | TrgInjectCharge
TrgInjectCharge class definition. More...
class | TrgReadout
TrgReadout class definition. More...
class | TrgInjectChargeReadout
Trigger Inject Charge Readout class definition. More...
class | TrgInjectMarker
Trigger Inject Marker class definition Directs a module to send to its Front-End Electronics a command sequence which is composed of only a TACK command. This sequence will trigger a readout of the module's Front-End Electronics. More...

Detailed Description

TrgEngines: Interface for the Trigger Engine classes

Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEventCounter Namespace Reference

TrgEventCounter Namespace Reference

Classes

class TrgEventCounter
TrgEventCounter class. More...

Detailed Description

TrgEventCounter: Interface for event counters.

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGem Namespace Reference

TrgGem Namespace Reference

Classes

class TrgGem
Trigger Global Trigger Electronics Module Interface class definition This class implements the hardware register access to the GEM. More...

Detailed Description

TrgGem: This file implements the hardware register access to the GEM

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemAbstract Namespace Reference

TrgGemAbstract Namespace Reference

Classes

class TrgGemAbstract
Trigger Global trigger Electronics Module Interface class definition. More...

Detailed Description

TrgGemAbstract: Abstract interface for GEM based systems.

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemCounters Namespace Reference

TrgGemCounters Namespace Reference

Classes

class | TrgGemTriggerCounters
TrgGemTriggerCounters class. More...
class | TrgGemTriggerStats
TrgGemTriggerStats This class implements the HW abstraction corresponding to figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2. More...
class | TrgGemTileCounters
TrgGemTileCounters. More...
class | TrgGemTileStats
TrgGemTileStats. More...
class | TrgGemCmdCounters
TrgGemCmdCounters. More...
class | TrgGemCmdStats
TrgGemCmdStats. More...
class | TrgGemEventCounter
TrgGemEventCounter. More...

Detailed Description

TrgGemCounters: Trigger GEM counter hardware implementation class

Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemPeriodicCondition Namespace Reference

TrgGemPeriodicCondition Namespace Reference

Classes

class TrgGemPeriodicCondition
Trigger Periodic Condition class definition. More...

Detailed Description

TrgGemPeriodicCondition: Hardware implementation of TrgPeriodicCondition

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemRegisterGeometry Namespace Reference

TrgGemRegisterGeometry Namespace Reference

Classes

class ACDmap

Detailed Description

TrgGemRegisterGeometry: Define the mapping between tile number and tile name

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemRegisters Namespace Reference

TrgGemRegisters Namespace Reference

Classes

class TrgGemRegisters
TrgGemRegisters class definition. More...

Detailed Description

TrgGemRegisters: Register shape defintions for a GASU trigger system

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemSequence Namespace Reference

TrgGemSequence Namespace Reference

Classes

class TrgGemSequence
TrgGemSequence Hardware abstraction for TrgSequence. More...

Detailed Description

TrgGemSequence: Hardware implementation of TrgSequence

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInputEnables Namespace Reference

TrgInputEnables Namespace Reference

Classes

class | TrgInputEnables
Trigger Input Enables class definition. More...
class | TrgTowerEnables
Trigger Tower Enables class definition. More...
class | TrgCnoEnables
Trigger CNO Enables class definition. More...
class | TrgTileEnables
Trigger Tile Enables class definition. More...

Detailed Description

TrgInputEnables: Interface for Trigger Input Enables

Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLT Namespace Reference

TrgMiniGLT Namespace Reference

Classes

class | TrgMiniGLT
Mini GLT Hardware abstraction implementation. More...
class | MiniGLTTrgConditionsValue

Detailed Description

TrgMiniGLT: This file implements the hardware register access to the MiniGLT

Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTAbstract Namespace Reference

TrgMiniGLTAbstract Namespace Reference

Classes

class TrgMiniGLTAbstract
TrgMiniGLTAbstract Interface class definition This class inherits from TrgAbstract to define the structure of a MiniGLT trigger. More...

Detailed Description

TrgMiniGLTAbstract: Abstract interface for MiniGLT based systems.

Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTRegisters Namespace Reference

TrgMiniGLTRegisters Namespace Reference

Classes

class TrgMiniGLTRegisters
Register shape definition class for the MiniGLT This class defines the shapes of the registers and bitfields used in the MiniGLT. More...

Detailed Description

TrgMiniGLTRegisters: Register shape definitions for a MiniGLT based trigger system

Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgObject Namespace Reference

TrgObject Namespace Reference

Classes

class TrgObject
Trigger Object class definition. More...

Detailed Description

TrgObject: Base class for the trigger. Defines useful quantities

Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgPeriodic Namespace Reference

TrgPeriodic Namespace Reference

Classes

class | TrgPeriodicConditionAbstract
TrgPeriodicConditionAbstract class definition. More...
class | TrgPeriodicCondition
Trigger Periodic Condition class definition. More...
class | TrgPeriodicConditionDefinition
TrgPeriodicConditionDefinition class definition. More...
class | TrgDefaultPeriodicCondition
TrgDefaultPeriodicCondition class definition. More...

Detailed Description

TrgPeriodic: Interface for the Periodic Trigger

Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoiAsTiles Namespace Reference

TrgRoiAsTiles Namespace Reference

Classes

class | TrgRoiAsTiles
Class TrgRoiAsTiles LATTE provided class to map coincidences to ROIs. More...
class | AddableRoi

Detailed Description

TrgRoiAsTiles: Map coincidences to Regions of Interest

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoiAsVeto Namespace Reference

TrgRoiAsVeto Namespace Reference

Classes

class | TrgRoiAsVeto
class | MyRoi

Detailed Description

TrgRoiAsVeto: Implement an ROI based veto system.

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgSequence Namespace Reference

TrgSequence Namespace Reference

Classes

class | TrgSequenceAbstract
Abstract Trigger Sequence class definition. More...
class | TrgSequenceDefinition
Trigger Sequence Definition class definition. More...
class | TrgSequence
Trigger Sequence class definition. More...
class | TrgDefaultSequence

Detailed Description

TrgSequence: Interface for Trigger Sequences

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTileCounters Namespace Reference

TrgTileCounters Namespace Reference

Classes

class | TrgTileCounters
TrgTileCounters class definition This class controls the counters used to count ACD tile transitions. More...
class | TrgTileStats
TrgTileStats class definition This class specifies the statistics returned by the counters described by TrgTileCounters. More...

Detailed Description

TrgTileCounters: Trigger GEM tile counter abstract class

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTower Namespace Reference

TrgTower Namespace Reference

Classes

class | TrgTowers
Trigger Towers class definition. More...
class | TrgTower
Trigger Tower class definition. More...
class | TrgCalorimeter
Trigger Calorimeter class definition. More...
class | TrgTracker
Trigger Tracker class definition. More...

Detailed Description

TrgTower: Abstract interfaces for Trigger Tower classes

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTriggerCounters Namespace Reference

TrgTriggerCounters Namespace Reference

Classes

class | TrgTriggerCounters
TrgTriggerCounters class definition This class controls the counters associated with the performance of the LAT with respect to the Trigger System. More...
class | TrgTriggerStats
TrgTriggerStats This class specifies the statistics returned by the counters defined in TrgTriggerCounters. More...

Detailed Description

TrgTriggerCounters: Abstract interface to trigger counters

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgUsingTiles Namespace Reference

TrgUsingTiles Namespace Reference

Classes

class | TrgUsingTiles
Trigger Using Tiles class definition. More...
class | DefaultPeriodicCondition
DefaultPeriodicCondition class. More...
class | DefaultSequence

Detailed Description

TrgUsingTiles: Implementation of a tile-based trigger system

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Directory Hierarchy

LATTE Directories

This directory hierarchy is sorted roughly, but not completely, alphabetically:
  • browser
  • client
  • consumer
  • database
  • dispatch
  • ext
    • cfitsio_swig
      • build
        • lib.win32-2.3
          • cfitsio
      • src
  • gosed
  • logger
  • monitoring
    • tools
  • runcontrol
  • start
  • tests
    • apps
      • support
  • tools
  • trigger
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/browser/ Directory Reference

browser

browser Directory Reference

Files

file | BrowserImpl.py [code]
file | browserPreferencesImpl.py [code]
file | searchTextBrowserImpl.py [code]
Generated on Fri Jan 21 18:00:54 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/client/ Directory Reference

client

client Directory Reference

Files

file | gBits.py [code]
file | gCmdCli.py [code]
file | gCommand.py [code]
file | gEvtCli.py [code]
file | gException.py [code]
file | gFswMessages.py [code]
file | gLog.py [code]
file | gLoopback.py [code]
file | gNode.py [code]
file | gOcsMessages.py [code]
file | gOptions.py [code]
file | gRegister.py [code]
file | gResponse.py [code]
file | gSocket.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/consumer/ Directory Reference

consumer

consumer Directory Reference

Files

file | consumer.py [code]
file | consumerPlotter.py [code]
file | standardLDF.py [code]
file | standardPlotter.py [code]
file | standardPlotterGuiImpl.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/database/ Directory Reference

database

database Directory Reference

Files

file | gAEM.py [code]
file | gAttr.py [code]
file | gConstraint.py [code]
file | gCRU.py [code]
file | gDb.py [code]
file | gEBM.py [code]
file | gEGU.py [code]
file | gGEM.py [code]
file | gGLT.py [code]
file | gGroup.py [code]
file | gHdb.py [code]
file | gHSK.py [code]
file | gLAT.py [code]
file | gLCB.py [code]
file | gMem.py [code]
file | gNAT.py [code]
file | gOCS.py [code]
file | gPDU.py [code]
file | gRule.py [code]
file | gSchemaConfig.py [code]
file | gTEM.py [code]
file | gTPG.py [code]
file | gVersions.py [code]
file | gXBR.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/dispatch/ Directory Reference

dispatch

dispatch Directory Reference

Files

file | dispatcher.py [code]
file | errors.py [code]
file | robustapply.py [code]
file | saferef.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/ Directory Reference

ext

ext Directory Reference

Directories

directory cfitsio_swig
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/cfitsio_swig/ Directory Reference

ext / cfitsio_swig

cfitsio_swig Directory Reference

Directories

directory | build
directory | src

Files

file | setup.py [code]
Generated on Fri Jan 21 18:00:55 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/cfitsio_swig/build/ Directory Reference

ext / cfitsio_swig / build

build Directory Reference

Directories

directory lib.win32-2.3
Generated on Fri Jan 21 18:00:55 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/cfitsio_swig/build/lib.win32-2.3/ Directory Reference

ext / cfitsio_swig / build / lib.win32-2.3

lib.win32-2.3 Directory Reference

Directories

directory cfitsio
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/cfitsio_swig/build/lib.win32-2.3/cfitsio/ Directory Reference

ext / cfitsio_swig / build / lib.win32-2.3 / cfitsio

cfitsio Directory Reference

Files

file build/lib.win32-2.3/cfitsio/cfitsio.py [code]
Generated on Fri Jan 21 18:00:55 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/ext/cfitsio_swig/src/ Directory Reference

ext / cfitsio_swig / src

src Directory Reference

Files

file src/cfitsio.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/gosed/ Directory Reference

gosed

gosed Directory Reference

Files

file | colorScale.py [code]
file | GOSED_LDF.py [code]
file | GOSEDACDImpl.py [code]
file | GOSEDCALImpl.py [code]
file | GOSEDCALTKRImpl.py [code]
file | GOSEDDataImpl.py [code]
file | gosedImpl.py [code]
file | GOSEDPainter.py [code]
file | GOSEDPreferencesImpl.py [code]
file | GOSEDTKRImpl.py [code]
file | GOSEDTWRImpl.py [code]
file | GOTEDImpl.py [code]
file | ServerPreferencesImpl.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/logger/ Directory Reference

logger

logger Directory Reference

Files

file MSGLogGUIImpl.py [code]
Generated on Fri Jan 21 18:00:56 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/monitoring/ Directory Reference

monitoring

monitoring Directory Reference

Directories

directory | tools

Files

file | Collector.py [code]
file | HskAlarms.py [code]
file | HskCli.py [code]
file | HskCollector.py [code]
file | HskGuiReceiver.py [code]
file | HskPacketDecoder.py [code]
file | HskPacketRetriever.py [code]
file | HskReceiver.py [code]
file | HskRecorder.py [code]
file | HskRegisters.py [code]
file | HskRetriever.py [code]
file | HskSqlGuiReceiver.py [code]
file | HskSqlInterface.py [code]
file | HskSqlSvr.py [code]
file | HskSvr.py [code]
file | HskTestSvr.py [code]
file | Receiver.py [code]
file | Recorder.py [code]
file | Retriever.py [code]
file | testTrending.py [code]
file | Trendable.py [code]
file | TrendMaps.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/monitoring/tools/ Directory Reference

monitoring / tools

tools Directory Reference

Files

file parseFswHsk.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/runcontrol/ Directory Reference

runcontrol

runcontrol Directory Reference

Files

file | AcdPanel.py [code]
file | ArgumentImpl.py [code]
file | EnvMonImpl.py [code]
file | evtDataImpl.py [code]
file | FEpowerUp.py [code]
file | fits2ldf.py [code]
file | FSM.py [code]
file | GlobalPanelImpl.py [code]
file | LATsweep.py [code]
file | ldf2fits.py [code]
file | PowerPanelImpl.py [code]
file | rcArchiver.py [code]
file | rcCommentPanel.py [code]
file | rcComplStatus.py [code]
file | rcFitsWriter.py [code]
file | rcHouseKeeping.py [code]
file | rcLoginImpl.py [code]
file | rcParamVerifier.py [code]
file | rcParamVerifyGUIImpl.py [code]
file | rcPreferencesGUIImpl.py [code]
file | rcPreferencesManager.py [code]
file | rcPythonShell.py [code]
file | rcReportGen.py [code]
file | rcRunIdHelper.py [code]
file | rcScmCfgSelector.py [code]
file | rcSecurityMan.py [code]
file | rcStatusMonitor.py [code]
file | rcSuite.py [code]
file | rcTestReport.py [code]
file | rcTransitions.py [code]
file | rcUsers.py [code]
file | rcUtil.py [code]
file | RunControl.py [code]
file | RunControlCommon.py [code]
file | RunControlFSM.py [code]
file | RunControlGUIImpl.py [code]
file | RunControlMain.py [code]
file | RunControlMainGUIImpl.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/start/ Directory Reference

start

start Directory Reference

Files

file | startupGUI.py [code]
file | startupMainGUI.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/tests/ Directory Reference

tests

tests Directory Reference

Directories

directory | apps

Files

file | test_aem.py [code]
file | test_aeq.py [code]
file | test_cmd.py [code]
file | test_cmdrsp.py [code]
file | test_db.py [code]
file | test_evt_aem.py [code]
file | test_evt_cal.py [code]
file | test_evt_exttrg.py [code]
file | test_evt_filters.py [code]
file | test_evt_tkr.py [code]
file | test_gafe.py [code]
file | test_garc.py [code]
file | test_glt.py [code]
file | test_lat.py [code]
file | test_loopback.py [code]
file | test_mem.py [code]
file | test_options.py [code]
file | test_playback.py [code]
file | test_rate.py [code]
file | test_schema.py [code]
file | test_tem.py [code]
file | test_twoclients.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/tests/apps/ Directory Reference

tests / apps

apps Directory Reference

Directories

directory | support

Files

file | excApp.py [code]
file | hTestAppEvt.py [code]
file | hTestAppTkr.py [code]
file | hTestEnv.py [code]
file | hTestStrip.py [code]
file | nullApp.py [code]
file | testAppAcd.py [code]
file | testAppAcdScalers.py [code]
file | testAppAlarm.py [code]
file | testAppArchiver.py [code]
file | testAppCal.py [code]
file | testAppCal_dg.py [code]
file | testAppEvt.py [code]
file | testAppEvtCli.py [code]
file | testAppEvtTO.py [code]
file | testAppLDFdump.py [code]
file | testAppTkr.py [code]
file | testSAppCal.py [code]
file | testSAppEvt.py [code]
file | testSuite.py [code]
file | testSuite2.py [code]
file | testSuiteLong.py [code]
Generated on Fri Jan 21 18:00:54 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/tests/apps/support/ Directory Reference

tests / apps / support

support Directory Reference

Files

file | MiniGLTExample.py [code]
file | SimpleGasuExample.py [code]
file | testArchiver.py [code]
file | testEvtCli.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/tools/ Directory Reference

tools

tools Directory Reference

Files

file | AcdHWMultiplexer.py [code]
file | DataDistributor.py [code]
file | DataDistributorPoll.py [code]
file | DataExport.py [code]
file | FreeSpace.py [code]
file | guiBridges.py [code]
file | MailAlert.py [code]
file | taskEngine.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: c:/temp/Online/LATTE/trigger/ Directory Reference

trigger

trigger Directory Reference

Files

file | NullObjects.py [code]
file | rcDefaultTrigger.py [code]
file | rcTrgFunctions.py [code]
file | rcTrgGem.py [code]
file | rcTrgMiniGLT.py [code]
file | TrgAbstract.py [code]
file | TrgCmdCounters.py [code]
file | TrgCoincidences.py [code]
file | TrgConditions.py [code]
file | TrgConditionsValue.py [code]
file | TrgEngines.py [code]
file | TrgEventCounter.py [code]
file | TrgGem.py [code]
file | TrgGemAbstract.py [code]
file | TrgGemCounters.py [code]
file | TrgGemPeriodicCondition.py [code]
file | TrgGemRegisterGeometry.py [code]
file | TrgGemRegisters.py [code]
file | TrgGemSequence.py [code]
file | TrgInputEnables.py [code]
file | TrgMiniGLT.py [code]
file | TrgMiniGLTAbstract.py [code]
file | TrgMiniGLTRegisters.py [code]
file | TrgObject.py [code]
file | TrgPeriodic.py [code]
file | TrgRoiAsTiles.py [code]
file | TrgRoiAsVeto.py [code]
file | TrgSequence.py [code]
file | TrgTileCounters.py [code]
file | TrgTower.py [code]
file | TrgTriggerCounters.py [code]
file | TrgUsingTiles.py [code]
Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Namespace Members

All | Functions
_ | a | c | d | f | g | h | i | l | n | p | r | s | w

Here is a list of all documented namespace members with links to the namespaces they belong to:

- _ -

  • _cleanupConnections() : dispatcher
  • _removeReceiver() : dispatcher
  • _removeSender() : dispatcher
  • _unsigned() : testSAppEvt, testAppEvt, hTestAppEvt
  • _write_data() : gSchemaConfig

- a -

  • applyConfig() : gSchemaConfig
  • applyHskConfig() : gHSK

- c -

  • colorScale() : colorScale
  • connect() : dispatcher
  • convert() : pythfilter

- d -

  • disconnect() : dispatcher

- f -

  • FreeSpace() : FreeSpace
  • function() : robustapply

- g -

  • gather_comment() : pythfilter
  • getAllReceivers() : dispatcher
  • getReceivers() : dispatcher

- h -

  • hexConvert() : gBits

- i -

  • importModule() : rcUtil
  • isNewer() : pythfilter

- l -

  • liveReceivers() : dispatcher

- n -

  • NodeString() : HskAlarms

- p -

  • preparePath() : pythfilter
  • print_comment() : pythfilter

- r -

  • readConfig() : gSchemaConfig
  • readHskConfig() : gHSK
  • readSchema() : gSchemaConfig
  • receiver() : DataDistributor
  • robustApply() : robustapply

- s -

  • safeRef() : saferef
  • send() : dispatcher
  • sendExact() : dispatcher
  • startupMainGui() : startupMainGUI

- w -

  • writeSchema() : gSchemaConfig
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Page Index

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

LATTE Related Pages

Here is a list of all related documentation pages:
  • Deprecated List
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Deprecated List

Deprecated List

Class GAFE
  • lld_dac Use 'veto_vernier' instead

Class GARC
  • rqst_hvbs Use 'hvbs' instead
  • rqst_hvsaa Use 'saa' instead
  • hvbs Use 'use_hv_normal' instead
  • hvsaa Use 'use_hv_saa' instead

Class GGLT
  • configuration Use the bit fields instead
  • options Use the bit fields instead
  • aem_counter_mask Use 'counter_mask' instead
  • aem_counter Use 'counter' instead
Generated on Fri Jan 21 18:00:54 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Graphical Class Hierarchy

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

LATTE Graphical Class Hierarchy

Go to the textual class hierarchy

Generated on Fri Jan 21 18:01:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AcdHWMultiplexer.py Source File

tools

AcdHWMultiplexer.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT data export routines"
00012 __author__   = "J. Panetta <panetta@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/08 21:03:12 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                           time
00021 from Numeric                     import array, zeros
00022
00023 from LATTE.tools.taskEngine      import TaskEngine
00024 from LATTE.database.gLAT         import *
00025 from LATTE.trigger.TrgObject     import TrgObject
00026 from thread                      import allocate_lock
00027
00028 class AcdHWMultiplexer(object):
00029   """\brief AcdHWMultiplexer class
00030
00031   A class to multiplex the two ACD hardware scalers defined in
00032   section 2.6.2 of the GEM document, LAT-TD-01545 into up to 108
00033   separate counters.
00034
00035   """
00036   __DEFAULT_DWELL_TIME             = 1    # Default to 1 second
00037
00038   def __init__(self, GEM):
00039     """\brief AcdHWMultiplexer constructor
00040
00041     \param GEM  a GEM object
00042     """
00043     self.__gemst = GEM.downGEMST()
00044     self.__gemie = GEM.downGEMIE()
00045
00046     self.__dwell = None
00047     self.__tList = None
00048     self.__stats = None
00049
00050     self.__accumEngine = TaskEngine("AcdHWMultiplexer")
00051     self.__accumEngine.start()
00052
00053     self.__statsLock  = allocate_lock()
00054
00055     self.__setupDone  = False
00056     self.__stopAccum  = False
00057     self.__abortAccum = False
00058
00059     self.__sortIEregs()
00060
00061   def start(self):
00062     """\brief Method for starting the accumulation of ACD hardware scalers
00063
00064     Start the integration of the hardware counters.
00065     At the start of integration, the counters are all reset to zero (0).
00066     """
00067     # invalidate setup to reset stats, etc.
00068     self.__setupDone = False
00069     # spawn the accumulate engine
00070     self.__accumEngine.spawn(self.__accumulate)
00071
00072   def stop(self):
00073     """\brief Method for stopping the accumulation of ACD hardware scalers
00074
00075     Stop the integration of the hardware counters.
00076     The stop occurs at the end of the current cycle, and
00077     the counts from the current cycle are integrated into the count
00078     statistics
00079     """
00080     self.__stopAccum = True
00081
00082   def resume(self):
00083     """\brief Method for resuming the accumulation of ACD hardware scalers after a stop
00084
00085     Resume the integration of the hardware counters after a stop()
00086     call.  At resume of integration, the internal counters are not reset, but
00087     continue from their previous values.
00088     """
00089     # spawn the accumulate engine
00090     self.__stopAccum = False
00091     self.__accumEngine.spawn(self.__accumulate)
00092
00093   def abort(self):
00094     """\brief Method for aborting the accumulation of ACD hardware scalers
00095
00096     Abort the integration of the hardware counters.  The cycle
00097     stops immediately, and the set of counts from the current cycle
00098     is discarded.
00099     """
00100     self.__abortAccum = True
00101
00102   def shutdown(self):
00103     """\brief Method for shutting down the Multiplexer.
00104
00105     Shut down the thread the multiplexer is running in.  Should be
00106     called during endRun.
00107     """
00108     self.__accumEngine.shutdown()
00109
00110   def dwell(self, d=None):
00111     """\brief Method to set the dwell time for scaler integration
00112
00113     Set the dwell time (in seconds) for integration.
00114     Total time in a cycle through the scalers will be dwell * nTiles.
00115     Minimum dwell time is 0.1 seconds.  Default is 1 second.
00116     \param   dwell  Dwell time in seconds, default = 1 second
00117     """
00118     if d is not None:
00119       if d < 0.1:
00120         d = 0.1
00121       self.__dwell = d
00122       self.__setupDone = False      # invalidate setup, need to recompute stuff
00123     return self.__dwell
00124
00125   def tileList(self, tList=None):
00126     """\brief Method to set which tiles are integrated
00127
00128     Defines the list of tiles which are being integrated.
00129     Ex: range(108); [0,2,4,6]
00130
00131     \param   tList  The list of tiles to be integrated.
00132     \return  The list of tiles that are being integrated
00133     """
00134     if tList is not None:
00135       self.__tList = tList
00136       self.__setupDone = False      # invalidate setup, need to recompute stuff
00137     return self.__tList
00138
00139   def stats(self):
00140     """\brief Method to access the counter statistics
00141
00142     Provides the user with the a list containing the counter statistics.
00143     This list corresponds to the tiles in tileList.
00144
00145     \return The list of the tile statistics.
00146     """
00147     # Prevent multithread access to self.__stats with a lock
00148     self.__statsLock.acquire()
00149     s = self.__stats.tolist()
00150     self.__statsLock.release()
00151     return s
00152
00153
00154 # private:
00155   def __setup(self):
00156     """Set up the system
00157     """
00158     # Make sure we're able to run.
00159     self.__stopAccum  = False
00160     self.__abortAccum = False
00161     self.__setupDone  = True
00162
00163     # error checking
00164     if self.__tList is None:
00165       msg = "No list of tiles defined for the multiplexer."
00166       raise Exception, msg
00167
00168     # No dwell time specified?
00169     if self.__dwell is None:
00170       self.__dwell = AcdHWMultiplexer.__DEFAULT_DWELL_TIME
00171
00172     # Check integrity of tile list
00173     for tile in self.__tList:
00174       if tile < TrgObject.TILE_NUMBER_MIN or \
00175          tile > TrgObject.TILE_NUMBER_MAX:
00176         msg = "Tile number %d is out of range [%d, %d]" % \
00177         ( tile, TrgObject.TILE_NUMBER_MIN, TrgObject.TILE_NUMBER_MAX )
00178         raise IndexError, msg
00179
00180     # set up internal array structure
00181     self.__tListInt = array( self.__tList )
00182
00183     # create our internal and external stats arrays
00184     self.__statsInt = zeros( self.__tListInt.shape )
00185     self.__stats    = zeros( self.__tListInt.shape )
00186
00187   def __accumulate(self):
00188     """ This is where the work is really done.
00189     """
00190     if not self.__setupDone:
00191       self.__setup()
00192
00193     sweepSize = len(self.__tListInt)
00194
00195     while ( not self.__stopAccum ):
00196       for tileSet in range(0,sweepSize,2):
00197         # Check for abort here
00198         if self.__abortAccum:
00199           print "abort"
00200           return
00201
00202         tile_0 = self.__tListInt[tileSet]
00203         if tileSet+1 < sweepSize:
00204           tile_1 = self.__tListInt[tileSet+1]
00205         else:
00206           tile_1 = None
00207
00208         # cache input enables
00209         regList  = self.__gemie.regs.values()
00210         self.__regCache = zeros( (len(regList)) )
00211         for reg in regList:
00212           if reg.size() > 0:
00213             self.__regCache[reg.id()] = reg.get()
00214
00215         # set up counters
00216         self.__gemst.TILE_0 = tile_0
00217         if tile_1 is not None:
00218           self.__gemst.TILE_1 = tile_1
00219
00220         # enable the proper tiles
00221         self.__setIE(tile_0)
00222         if tile_1 is not None:
00223           self.__setIE(tile_1)
00224
00225         self.__gemst.TILE_COUNTERS = 0
00226         # Accumulate
00227         time.sleep(self.__dwell)
00228         count = self.__gemst.TILE_COUNTERS
00229
00230         # reset the input enables
00231         self.__resetIE(tile_0)
00232         if tile_1 is not None:
00233           self.__resetIE(tile_1)
00234
00235         # pull counters
00236         self.__statsInt[tileSet] = ( count >>  0 ) & 0xffff
00237         if tile_1 is not None:
00238           self.__statsInt[tileSet+1] = ( count >> 16 ) & 0xffff
00239
00240       # Send internal stats into external stats
00241       # Prevent multithread access to self.__stats with a lock
00242       self.__statsLock.acquire()
00243       self.__stats += self.__statsInt
00244       self.__statsLock.release()
00245     print "stopped"
00246
00247   def __setIE(self,tile):
00248     # set the corresponding bits in the IE on for a tile
00249
00250     reg,bit = divmod(tile,9)
00251     value   = ( 1 << bit ) + ( 1 << bit+9 )  # two nine bit fields
00252     self.__gemieDict[reg+5].set( self.__gemieDict[reg+5].get() | value )         # tile enables start at 5
00253
00254   def __resetIE(self,tile):
00255     # reset the changed input enables to their cached values
00256     reg,bit = divmod(tile,9)
00257     self.__gemieDict[reg+5].set( self.__regCache[reg+5] )
00258
00259   def __sortIEregs(self):
00260     # create a lookup table based on register number
00261     regList  = self.__gemie.regs.values()
00262     self.__gemieDict = {}
00263     for reg in regList:
00264       if reg.size() > 0:
00265         self.__gemieDict[reg.id()] = reg
00266
Generated on Fri Jan 21 18:00:47 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: AcdPanel.py Source File

runcontrol

AcdPanel.py

00001 # -*- coding: utf-8 -*-
00002
00003 # Form implementation generated from reading ui file 'AcdPanel.ui'
00004 #
00005 # Created: Tue Mar 30 12:57:54 2004
00006 #      by: The PyQt User Interface Compiler (pyuic) 3.11
00007 #
00008 # WARNING! All changes made in this file will be lost!
00009
00010
00011 from qt import *
00012
00013
00014 class AcdPanel(QWidget):
00015     def __init__(self,parent = None,name = None,fl = 0):
00016         QWidget.__init__(self,parent,name,fl)
00017
00018         if not name:
00019             self.setName("AcdPanel")
00020
00021         self.setSizePolicy(QSizePolicy(5,5,0,0,self.sizePolicy().hasHeightForWidth()))
00022
00023         AcdPanelLayout = QGridLayout(self,1,1,11,6,"AcdPanelLayout")
00024
00025         self.buttonGroup63 = QButtonGroup(self,"buttonGroup63")
00026         self.buttonGroup63.setSizePolicy(QSizePolicy(5,0,0,0,self.buttonGroup63.sizePolicy().hasHeightForWidth()))
00027         self.buttonGroup63.setMinimumSize(QSize(0,100))
00028         self.buttonGroup63.setColumnLayout(0,Qt.Vertical)
00029         self.buttonGroup63.layout().setSpacing(6)
00030         self.buttonGroup63.layout().setMargin(11)
00031         buttonGroup63Layout = QGridLayout(self.buttonGroup63.layout())
00032         buttonGroup63Layout.setAlignment(Qt.AlignTop)
00033
00034         self.pushButton_acdEgse = QPushButton(self.buttonGroup63,"pushButton_acdEgse")
00035         self.pushButton_acdEgse.setSizePolicy(QSizePolicy(7,7,0,0,self.pushButton_acdEgse.sizePolicy().hasHeightForWidth()))
00036         pushButton_acdEgse_font = QFont(self.pushButton_acdEgse.font())
00037         pushButton_acdEgse_font.setFamily("Arial")
00038         pushButton_acdEgse_font.setPointSize(7)
00039         self.pushButton_acdEgse.setFont(pushButton_acdEgse_font)
00040
00041         buttonGroup63Layout.addWidget(self.pushButton_acdEgse,0,0)
00042
00043         self.pushButton_Histogram = QPushButton(self.buttonGroup63,"pushButton_Histogram")
00044         self.pushButton_Histogram.setSizePolicy(QSizePolicy(7,7,0,0,self.pushButton_Histogram.sizePolicy().hasHeightForWidth()))
00045         pushButton_Histogram_font = QFont(self.pushButton_Histogram.font())
00046         pushButton_Histogram_font.setFamily("Arial")
00047         pushButton_Histogram_font.setPointSize(7)
00048         self.pushButton_Histogram.setFont(pushButton_Histogram_font)
00049
00050         buttonGroup63Layout.addWidget(self.pushButton_Histogram,0,1)
00051
00052         self.pushButton_garcDisplay = QPushButton(self.buttonGroup63,"pushButton_garcDisplay")
00053         self.pushButton_garcDisplay.setSizePolicy(QSizePolicy(7,7,0,0,self.pushButton_garcDisplay.sizePolicy().hasHeightForWidth()))
00054         pushButton_garcDisplay_font = QFont(self.pushButton_garcDisplay.font())
00055         pushButton_garcDisplay_font.setFamily("Arial")
00056         pushButton_garcDisplay_font.setPointSize(7)
00057         self.pushButton_garcDisplay.setFont(pushButton_garcDisplay_font)
00058
00059         buttonGroup63Layout.addWidget(self.pushButton_garcDisplay,0,2)
00060
00061         self.pushButton_PowerSupply = QPushButton(self.buttonGroup63,"pushButton_PowerSupply")
00062         self.pushButton_PowerSupply.setSizePolicy(QSizePolicy(7,7,0,0,self.pushButton_PowerSupply.sizePolicy().hasHeightForWidth()))
00063         pushButton_PowerSupply_font = QFont(self.pushButton_PowerSupply.font())
00064         pushButton_PowerSupply_font.setFamily("Arial")
00065         pushButton_PowerSupply_font.setPointSize(7)
00066         self.pushButton_PowerSupply.setFont(pushButton_PowerSupply_font)
00067
00068         buttonGroup63Layout.addWidget(self.pushButton_PowerSupply,0,3)
00069
00070         self.pushButton_TilesDisplay = QPushButton(self.buttonGroup63,"pushButton_TilesDisplay")
00071         self.pushButton_TilesDisplay.setSizePolicy(QSizePolicy(7,7,0,0,self.pushButton_TilesDisplay.sizePolicy().hasHeightForWidth()))
00072         pushButton_TilesDisplay_font = QFont(self.pushButton_TilesDisplay.font())
00073         pushButton_TilesDisplay_font.setFamily("Arial")
00074         pushButton_TilesDisplay_font.setPointSize(7)
00075         self.pushButton_TilesDisplay.setFont(pushButton_TilesDisplay_font)
00076
00077         buttonGroup63Layout.addWidget(self.pushButton_TilesDisplay,0,4)
00078
00079         AcdPanelLayout.addWidget(self.buttonGroup63,0,0)
00080         spacer16 = QSpacerItem(31,170,QSizePolicy.Minimum,QSizePolicy.Expanding)
00081         AcdPanelLayout.addItem(spacer16,1,0)
00082         spacer17 = QSpacerItem(9,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
00083         AcdPanelLayout.addItem(spacer17,0,1)
00084
00085         self.languageChange()
00086
00087         self.resize(QSize(357,288).expandedTo(self.minimumSizeHint()))
00088         self.clearWState(Qt.WState_Polished)
00089
00090
00091     def languageChange(self):
00092         self.setCaption(self.__tr("AcdPanel"))
00093         self.buttonGroup63.setTitle(self.__tr("Launch GUIs"))
00094         self.pushButton_acdEgse.setText(self.__tr("H/W\n"
00095 "I/F\n"
00096 "TOOL"))
00097         self.pushButton_Histogram.setText(self.__tr("HISTO-\n"
00098 "GRAMS"))
00099         self.pushButton_garcDisplay.setText(self.__tr("H/W\n"
00100 "MONITOR"))
00101         self.pushButton_PowerSupply.setText(self.__tr("POWER\n"
00102 "SUPPLY"))
00103         self.pushButton_TilesDisplay.setText(self.__tr("TILES\n"
00104 "DISPLAY"))
00105
00106
00107     def __tr(self,s,c = None):
00108         return qApp.translate("AcdPanel",s,c)
Generated on Fri Jan 21 18:00:47 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ArgumentImpl.py Source File

runcontrol

ArgumentImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Argument GUI implementation module"
00012 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/20/2003"
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import sys
00020 from qt import *
00021 from Argument import Argument
00022
00023
00024 class ArgumentImpl(Argument):
00025
00026   def __init__(self,parent = None,name = None,modal = 0,fl = 0):
00027     Argument.__init__(self,parent,name,modal,fl)
00028
00029     self.__label = 0
00030
00031     self.connect(self.OKButton,SIGNAL("clicked()"),self.OKButtonClicked)
00032     self.connect(self.CancelButton,SIGNAL("clicked()"),self.CancelButtonClicked)
00033
00034   def OKButtonClicked(self):
00035     self.__value = int(self.ArgumentList.text().latin1())
00036     self.close()
00037
00038   def getValue(self, caption):
00039     self.ArgLabel.setText(caption)
00040     self.show()
00041     self.exec_loop()
00042     return self.__value
00043
00044   def CancelButtonClicked(self):
00045     self.close()
00046
00047 if __name__ == "__main__":
00048     a = QApplication(sys.argv)
00049     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00050     w = ArgumentImpl()
00051     a.setMainWidget(w)
00052     w.show()
00053     a.exec_loop()
Generated on Fri Jan 21 18:00:47 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: BrowserImpl.py Source File

browser

BrowserImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST Online Register Browser"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = "5/15/2003"
00015 __version__  = "$Revision: 2.8.2.1 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import os
00021 import sys
00022 import time
00023 import math
00024 import string
00025 from qt import *
00026 from Browser import Browser
00027 from browserPreferencesImpl import browserPreferencesImpl
00028 from BrowserReadme import BrowserReadme
00029 import threading
00030
00031 from LATTE.client.gException import LATInterfaceException
00032
00033 from LATTE.database.gLAT     import GLAT
00034 from LATTE.database.gTEM     import GTEM, GCCC, GCRC, GCFE
00035 from LATTE.database.gTEM     import GTCC, GTRC, GTFE, GTIC
00036 from LATTE.database.gAEM     import GAEM, GAEQ, GARC, GAFE
00037 from LATTE.database.gEBM     import GEBM, GEBMC, GEBMST
00038 from LATTE.database.gGEM     import GGEM, GGEMC, GGEMMG, GGEMST
00039 from LATTE.database.gGEM     import GGEMSC, GGEMVG, GGEMIE, GGEMW
00040 from LATTE.database.gCRU     import GCRU
00041 from LATTE.database.gGLT     import GGLT
00042
00043
00044 #from gLAT import *
00045 #from gSchemaConfig import *
00046
00047 # Pix map of OPEN FOLDER to shown an element of the hierarchy loaded
00048 image0_data = [
00049 "16 13 7 1",
00050 "d c #000000",
00051 "# c #a0a000",
00052 "c c #c0c080",
00053 "e c #e0c080",
00054 "b c #e0e080",
00055 "a c #fffbf0",
00056 ". c #ffffff",
00057 "...#####........",
00058 "..#aaaaa#.......",
00059 ".#abbbbba######.",
00060 ".#abbbbbbbaaaacd",
00061 ".#abbbbbbbbbbbcd",
00062 "############cbcd",
00063 "#abbbbbbebecdccd",
00064 "#abbbbebbebcdccd",
00065 ".#abbbbbebee#d#d",
00066 ".#abbebebeeecd#d",
00067 "..#aebebeeeec#dd",
00068 "..############dd",
00069 "...ddddddddddddd"
00070 ]
00071
00072
00073 class BrowserImpl(Browser):
00074   def __init__(self, lat, xbrd, parent = None, name = None, fl = 0):
00075     Browser.__init__(self,parent,name,fl)
00076
00077     self.__image0 = QPixmap(image0_data)
00078
00079     # Initialize file parameters
00080     self.printer    = QPrinter()
00081     self.__filename = QString.null
00082     self.__openFile = 0
00083     self.__lat      = lat
00084     self.__xbrd     = xbrd
00085
00086     # Initialize Hierarchy Dictionary
00087     self.__treeMap = {}
00088     self.__labelMap = {}
00089
00090     # Initialize register views' dictionary
00091     self.registerView =  [self.GLAT_Regs,
00092                           self.GAEM_Regs,
00093                           self.GAEQ_Regs,
00094                           self.GARC_Regs,
00095                           self.GAFE_Regs,
00096                           self.GTEM_Regs,
00097                           self.GTEM_Regs2,
00098                           self.GCCC_Regs,
00099                           self.GCRC_Regs,
00100                           self.GCFE_Regs,
00101                           self.GTCC_Regs,
00102                           self.GTRC_Regs,
00103                           self.GTFE_Regs,
00104                           self.GTIC_Regs,
00105                           self.GEBM_Regs,
00106                           self.GEBMC_Regs,
00107                           self.GEBMST_Regs,
00108                           self.GGEM_Regs,
00109                           self.GGEMC_Regs,
00110                           self.GGEMMG_Regs,
00111                           self.GGEMST_Regs,
00112                           self.GGEMSC_Regs,
00113                           self.GGEMVG_Regs,
00114                           self.GGEMIE_Regs,
00115                           self.GGEMW_Regs,
00116                           self.GCRU_Regs,
00117                           self.GGLT_Regs]
00118
00119     # Initialize Context Menu
00120     self.contextMenu = QPopupMenu( self )
00121     self.contextMenu.insertItem( "Copy &Cell", self.copyToClipboard, Qt.CTRL+Qt.Key_C)
00122     self.contextMenu.insertItem( "Copy &Line", self.copyLineToClipboard, Qt.CTRL+Qt.Key_L)
00123
00124     # Initialize clip board
00125     self.clip = QApplication.clipboard()
00126
00127     #~ self.explicitBroadcastNodes = 0
00128
00129     self.Hierarchy.setSorting(-1)
00130     #~ self.Hierarchy.sort()
00131     self.Hierarchy.setEnabled(1)
00132     self.TEMTab.setEnabled(1)
00133     self.TEMTab.setCurrentPage(1)
00134
00135     self.Conversion.setText("RAW")
00136     self.__base = 1
00137
00138     self.browserPreferences = browserPreferencesImpl()
00139     self.browserPreferences.hexButton.setChecked(1)
00140     self.browserPreferences.rawButton.setChecked(1)
00141
00142     #~ self.Browsing.setText("TEM All, GCCC All, GCRC All, GCFE All")
00143
00144     self.__lock = threading.Lock()
00145
00146     # Set the Timer
00147     self.__timer = QTimer(self)
00148     QObject.connect(self.__timer, SIGNAL("timeout()"), self.updateView)
00149     self.__step = float(str(self.browserPreferences.timestepValue.text()))
00150     self.__timer.start(self.__step*1000, False)   # seconds in milliseconds
00151
00152     self.connect(self.UpdateButton, SIGNAL('clicked()'), self.updateView)
00153
00154     # Set connections
00155     #self.connect(self.Hierarchy, SIGNAL('clicked(QListViewItem*)'), \
00156     #  self.selectItem)
00157     self.connect(self.Hierarchy, SIGNAL('currentChanged(QListViewItem*)'), \
00158       self.selectItem)
00159
00160     # Load Schema if LAT has been created
00161     self.Hierarchy.clear()
00162     self.loadHierarchy(lat, xbrd)
00163     self.populateRegs(lat)
00164     self.__ApplyChanges = 0
00165     self.explicitBroadcastNodes = 0
00166
00167     # Cut and Paste capability
00168     for view in self.registerView:
00169       #~ self.__statusPanel = rcStatusPanel(view)
00170       self.connect(view,
00171                    SIGNAL("contextMenuRequested(QListViewItem*,const QPoint&,int)"),
00172                    self.contextMenuShow)
00173
00174   #~ def rightButtonPressed(self, item, point, column):
00175     #~ print item, point, column
00176
00177   def contextMenuShow(self, item, point, column):
00178     self.selectedItem = item
00179     self.__column = column
00180     self.contextMenu.exec_loop(point)
00181
00182   def copyToClipboard(self):
00183     self.clip.setText(self.selectedItem.text(self.__column))
00184
00185   def copyLineToClipboard(self):
00186     text = ""
00187     for col in range(0,4):
00188       text += str(self.selectedItem.text(col)) + "  "
00189     self.clip.setText(text)
00190
00191   def updateView(self):
00192     if self.__lat is None:
00193       return
00194     #~ if str(self.getCurrentItem().text(0)) == "GLAT":
00195       #~ return
00196     self.fillViews()
00197
00198 ##   def loadSchema(self, filename):
00199 ##     """ This function reads the xml file and creates the hierarchy tree in
00200 ##         the Hierarchy window. To do so It calls the loadHierarchy function"""
00201
00202
00203 ##     lat = readSchema(filename)
00204 ##     # Load Schema if LAT has been created
00205 ##     self.setupSchema(lat)
00206
00207 ##     self.TEMTab.setEnabled(1)
00208 ##     self.Hierarchy.setEnabled(1)
00209
00210 ##     self.__step = float(str(self.browserPreferences.timestepValue.text()))
00211 ##     self.__timer.start(self.__step*1000, False)   # seconds in milliseconds
00212
00213
00214 ##   def setupSchema(self, lat):
00215 ##     ''' This function creates the Hierarchy tree and treeMap from the selected
00216 ##         Schema.xml file '''
00217
00218 ##     if lat.getCmd() is None:
00219 ##       lat.setCmd(self.__cmd)
00220
00221 ##     self.Hierarchy.clear()
00222 ##     self.loadHierarchy(lat)
00223 ##     self.populateRegs(lat)
00224
00225 ##     self.__ApplyChanges = 0
00226 ##     self.explicitBroadcastNodes = 0
00227
00228 ##     self.__lat = lat
00229
00230 ##     options = self.__lat._GLAT__declarations['options']
00231
00232 ##     self.explicitBroadcastNodes = options['explicitbroadcastnodes']
00233
00234   def loadHierarchy(self, lat, xbrd):
00235
00236     latItem = QListViewItem(self.Hierarchy)
00237     latItem.setPixmap(0, self.__image0)
00238     latItem.setText(0,self.trUtf8("GLAT"))
00239     latItem.setExpandable(1)
00240     latItem.setOpen(1)
00241
00242     self.Hierarchy.setCurrentItem(latItem)
00243
00244     self.__treeMap[latItem] = lat
00245     self.__labelMap[latItem] = None
00246
00247     #~ AEM Leg
00248     aem = lat.downAEM()
00249     if aem is not None:
00250       aemItem = QListViewItem(latItem)
00251       aemItem.setText(0,"GAEM")
00252       aemItem.setPixmap(0, self.__image0)
00253       aemItem.setOpen(1)
00254
00255       self.__treeMap[aemItem] = aem
00256       self.__labelMap[aemItem] = self.GAEMLabel
00257
00258       arcItem = None
00259       afeItem = None
00260
00261       for (arcId, arc) in aem.ARC.items():
00262         arcNewItem = QListViewItem(aemItem, arcItem)
00263         arcNewItem.setPixmap(0, self.__image0)
00264         arcNewItem.setText(0, "GARC " + str(arcId))
00265
00266         self.__treeMap[arcNewItem] = arc
00267         self.__labelMap[arcNewItem] = self.GARCLabel
00268
00269         for (afeId, afe) in arc.AFE.items():
00270           afeNewItem = QListViewItem(arcNewItem, afeItem)
00271           afeNewItem.setPixmap(0, self.__image0)
00272           afeNewItem.setText(0,"GAFE " + str(afeId))
00273
00274           self.__treeMap[afeNewItem] = afe
00275           self.__labelMap[afeNewItem] = self.GAFELabel
00276           afeItem = afeNewItem
00277         arcItem = arcNewItem
00278
00279       if aem.existsAEQ():
00280         aeq = aem.downAEQ()
00281         aeqItem = QListViewItem(aemItem)
00282         aeqItem.setText(0,"GAEQ")
00283         aeqItem.setPixmap(0, self.__image0)
00284
00285         self.__treeMap[aeqItem] = aeq
00286         self.__labelMap[aeqItem] = self.GAEQLabel
00287
00288     #~ TEM Leg
00289
00290     # Initialize this parameters to store the list view items in the right order:
00291     # after the previous item. For example tccNewItem = QListViewItem(temNewItem, tccItem)
00292     temItem = None
00293     cccItem = None
00294     crcItem = None
00295     cfeItem = None
00296     tccItem = None
00297     trcItem = None
00298     tfeItem = None
00299
00300     for (temId, tem) in lat.TEM.items():
00301       #~ print "TEM ID: ", temId
00302       self.TEMTab.setCurrentPage(2)
00303
00304       temNewItem = QListViewItem(latItem, temItem)
00305       temNewItem.setText(0,"GTEM " + str(temId))
00306       temNewItem.setPixmap(0, self.__image0)
00307
00308       self.__treeMap[temNewItem] = tem
00309       self.__labelMap[temNewItem] = self.GTEMLabel
00310
00311
00312
00313       for (tccId, tcc) in tem.TCC.items():
00314         if tccId != 255:
00315           tccNewItem = QListViewItem(temNewItem, tccItem)
00316           tccNewItem.setPixmap(0, self.__image0)
00317           tccNewItem.setText(0,"GTCC " + str(tccId))
00318
00319           self.__treeMap[tccNewItem] = tcc
00320           self.__labelMap[tccNewItem] = self.GTCCLabel
00321
00322           for (trcId, trc) in tcc.TRC.items():
00323             if trcId != 255:
00324               trcNewItem = QListViewItem(tccNewItem, trcItem)
00325               trcNewItem.setPixmap(0, self.__image0)
00326               trcNewItem.setText(0,"GTRC " + str(trcId))
00327
00328               self.__treeMap[trcNewItem] = trc
00329               self.__labelMap[trcNewItem] = self.GTRCLabel
00330
00331               for (tfeId, tfe) in trc.TFE.items():
00332                 if tfeId != 255:
00333                   tfeNewItem = QListViewItem(trcNewItem, tfeItem)
00334                   tfeNewItem.setPixmap(0, self.__image0)
00335                   tfeNewItem.setText(0,"GTFE " + str(tfeId))
00336
00337                   self.__treeMap[tfeNewItem] = tfe
00338                   self.__labelMap[tfeNewItem] = self.GTFELabel
00339
00340                   tfeItem = tfeNewItem
00341               trcItem = trcNewItem
00342           tccItem = tccNewItem
00343       temItem = temNewItem
00344
00345       for (cccId, ccc) in tem.CCC.items():
00346         if cccId != 255:
00347           cccNewItem = QListViewItem(temNewItem, cccItem)
00348           cccNewItem.setPixmap(0, self.__image0)
00349           cccNewItem.setText(0,"GCCC " + str(cccId))
00350
00351           self.__treeMap[cccNewItem] = ccc
00352           self.__labelMap[cccNewItem] = self.GCCCLabel
00353
00354           for (crcId, crc) in ccc.CRC.items():
00355             if crcId != 255:
00356               crcNewItem = QListViewItem(cccNewItem, crcItem)
00357               crcNewItem.setPixmap(0, self.__image0)
00358               crcNewItem.setText(0,"GCRC " + str(crcId))
00359
00360               self.__treeMap[crcNewItem] = crc
00361               self.__labelMap[crcNewItem] = self.GCRCLabel
00362
00363               for (cfeId, cfe) in crc.CFE.items():
00364                 if cfeId != 255:
00365                   cfeNewItem = QListViewItem(crcNewItem, cfeItem)
00366                   cfeNewItem.setPixmap(0, self.__image0)
00367                   cfeNewItem.setText(0,"GCFE " + str(cfeId))
00368
00369                   self.__treeMap[cfeNewItem] = cfe
00370                   self.__labelMap[cfeNewItem] = self.GCFELabel
00371
00372                   cfeItem = cfeNewItem
00373               crcItem = crcNewItem
00374           cccItem = cccNewItem
00375       temItem = temNewItem
00376
00377       if tem.existsTIC():
00378         tic = tem.downTIC()
00379         ticItem = QListViewItem(temItem)
00380         ticItem.setText(0,"GTIC")
00381         ticItem.setPixmap(0, self.__image0)
00382
00383         self.__treeMap[ticItem] = tic
00384         self.__labelMap[ticItem] = self.GTICLabel
00385
00386     #~ PDU Leg
00387     #~ pdu = lat.downPDU()
00388     #~ if pdu is not None:
00389       #~ pduItem = QListViewItem(latItem)
00390       #~ pduItem.setText(0,self.trUtf8("GPDU"))
00391       #~ pduItem.setPixmap(0, self.__image0)
00392       #~ pduItem.setOpen(1)
00393
00394       #~ for twrId in pdu._GPDU__childrenTWR.items():
00395         #~ twrNewItem = QListViewItem(pduItem)
00396         #~ twrNewItem.setPixmap(0, self.__image0)
00397         #~ twrNewItem.setText(0,self.trUtf8("GTWR " + str(twrId)))
00398
00399     #~ EBM Leg
00400     ebm = lat.downEBM()
00401     if ebm is not None:
00402       ebmItem = QListViewItem(latItem)
00403       ebmItem.setText(0,self.trUtf8("GEBM"))
00404       ebmItem.setPixmap(0, self.__image0)
00405       ebmItem.setOpen(1)
00406
00407       self.__treeMap[ebmItem] = ebm
00408       self.__labelMap[ebmItem] = self.GEBMLabel
00409
00410       if ebm.existsEBMST():
00411         ebmst = ebm.downEBMST()
00412         ebmstItem = QListViewItem(ebmItem)
00413         ebmstItem.setText(0,"GEBMST")
00414         ebmstItem.setPixmap(0, self.__image0)
00415
00416         self.__treeMap[ebmstItem] = ebmst
00417         self.__labelMap[ebmstItem] = self.GEBMSTLabel
00418
00419       if ebm.existsEBMC():
00420         ebmc = ebm.downEBMC()
00421         ebmcItem = QListViewItem(ebmItem)
00422         ebmcItem.setText(0,"GEBMC")
00423         ebmcItem.setPixmap(0, self.__image0)
00424
00425         self.__treeMap[ebmcItem] = ebmc
00426         self.__labelMap[ebmcItem] = self.GEBMCLabel
00427
00428     #~ GEM Leg
00429     gem = lat.downGEM()
00430     if gem is not None:
00431       gemItem = QListViewItem(latItem)
00432       gemItem.setText(0,self.trUtf8("GGEM"))
00433       gemItem.setPixmap(0, self.__image0)
00434       gemItem.setOpen(1)
00435
00436       self.__treeMap[gemItem] = gem
00437       self.__labelMap[gemItem] = self.GGEMLabel
00438
00439
00440       if gem.existsGEMW():
00441         gemw = gem.downGEMW()
00442         gemwItem = QListViewItem(gemItem)
00443         gemwItem.setText(0,"GGEMW")
00444         gemwItem.setPixmap(0, self.__image0)
00445
00446         self.__treeMap[gemwItem] = gemw
00447         self.__labelMap[gemwItem] = self.GGEMWLabel
00448
00449       if gem.existsGEMIE():
00450         gemie = gem.downGEMIE()
00451         gemieItem = QListViewItem(gemItem)
00452         gemieItem.setText(0,"GGEMIE")
00453         gemieItem.setPixmap(0, self.__image0)
00454
00455         self.__treeMap[gemieItem] = gemie
00456         self.__labelMap[gemieItem] = self.GGEMIELabel
00457
00458       if gem.existsGEMVG():
00459         gemvg = gem.downGEMVG()
00460         gemvgItem = QListViewItem(gemItem)
00461         gemvgItem.setText(0,"GGEMVG")
00462         gemvgItem.setPixmap(0, self.__image0)
00463
00464         self.__treeMap[gemvgItem] = gemvg
00465         self.__labelMap[gemvgItem] = self.GGEMVGLabel
00466
00467       if gem.existsGEMSC():
00468         gemsc = gem.downGEMSC()
00469         gemscItem = QListViewItem(gemItem)
00470         gemscItem.setText(0,"GGEMSC")
00471         gemscItem.setPixmap(0, self.__image0)
00472
00473         self.__treeMap[gemscItem] = gemsc
00474         self.__labelMap[gemscItem] = self.GGEMSCLabel
00475
00476       if gem.existsGEMST():
00477         gemst = gem.downGEMST()
00478         gemstItem = QListViewItem(gemItem)
00479         gemstItem.setText(0,"GGEMST")
00480         gemstItem.setPixmap(0, self.__image0)
00481
00482         self.__treeMap[gemstItem] = gemst
00483         self.__labelMap[gemstItem] = self.GGEMSTLabel
00484
00485       if gem.existsGEMMG():
00486         gemmg = gem.downGEMMG()
00487         gemmgItem = QListViewItem(gemItem)
00488         gemmgItem.setText(0,"GGEMMG")
00489         gemmgItem.setPixmap(0, self.__image0)
00490
00491         self.__treeMap[gemmgItem] = gemmg
00492         self.__labelMap[gemmgItem] = self.GGEMMGLabel
00493
00494       if gem.existsGEMC():
00495         gemc = gem.downGEMC()
00496         gemcItem = QListViewItem(gemItem)
00497         gemcItem.setText(0,"GGEMC")
00498         gemcItem.setPixmap(0, self.__image0)
00499
00500         self.__treeMap[gemcItem] = gemc
00501         self.__labelMap[gemcItem] = self.GGEMCLabel
00502
00503     #~ CRU Leg
00504     cru = lat.downCRU()
00505     if cru is not None:
00506       cruItem = QListViewItem(latItem)
00507       cruItem.setText(0,self.trUtf8("GCRU"))
00508       cruItem.setPixmap(0, self.__image0)
00509       cruItem.setOpen(1)
00510
00511       self.__treeMap[cruItem] = cru
00512       self.__labelMap[cruItem] = self.GCRULabel
00513
00514     #~ GLT Leg
00515     if xbrd is not None:
00516       glt = xbrd.downGLT()
00517       if glt is not None:
00518         gltItem = QListViewItem(latItem)
00519         gltItem.setText(0,self.trUtf8("GGLT"))
00520         gltItem.setPixmap(0, self.__image0)
00521         gltItem.setOpen(1)
00522
00523         self.__treeMap[gltItem] = glt
00524         self.__labelMap[gltItem] = self.GGLTLabel
00525
00526   def populateRegs(self, lat):
00527     #~ lat = self.__lat
00528     self.TEMTab.setCurrentPage(0)
00529     self.updateList(GLAT._GLAT__attrs, self.GLAT_Regs)
00530
00531     #~ AEM LEg
00532     self.updateList(GAEM._GAEM__attrs, self.GAEM_Regs)
00533
00534     self.updateList(GAEQ._GAEQ__attrs, self.GAEQ_Regs)
00535
00536     self.updateList(GARC._GARC__attrs, self.GARC_Regs)
00537
00538     self.updateList(GAFE._GAFE__attrs, self.GAFE_Regs)
00539
00540     #~ TEM LEg
00541     tem = None
00542     #if lat._GLAT__childrenTEM.keys() is not None:
00543     self.updateList(GTEM._GTEM__attrs, self.GTEM_Regs)
00544     self.updateList(GTEM._GTEM__attrs, self.GTEM_Regs2)
00545
00546     #~ tem = lat.downTEM(temId)
00547     self.updateList(GCCC._GCCC__attrs, self.GCCC_Regs)
00548     self.updateList(GCRC._GCRC__attrs, self.GCRC_Regs)
00549     self.updateList(GCFE._GCFE__attrs, self.GCFE_Regs)
00550     self.updateList(GTCC._GTCC__attrs, self.GTCC_Regs)
00551     self.updateList(GTRC._GTRC__attrs, self.GTRC_Regs)
00552     self.updateList(GTFE._GTFE__attrs, self.GTFE_Regs)
00553     self.updateList(GTIC._GTIC__attrs, self.GTIC_Regs)
00554
00555     #~ EBM Leg
00556     self.updateList(GEBM._GEBM__attrs, self.GEBM_Regs)
00557     self.updateList(GEBMC._GEBMC__attrs, self.GEBMC_Regs)
00558     self.updateList(GEBMST._GEBMST__attrs, self.GEBMST_Regs)
00559
00560     #~ GEM Leg
00561     self.updateList(GGEM._GGEM__attrs, self.GGEM_Regs)
00562     self.updateList(GGEMC._GGEMC__attrs, self.GGEMC_Regs)
00563     self.updateList(GGEMMG._GGEMMG__attrs, self.GGEMMG_Regs)
00564     self.updateList(GGEMST._GGEMST__attrs, self.GGEMST_Regs)
00565     self.updateList(GGEMSC._GGEMSC__attrs, self.GGEMSC_Regs)
00566     self.updateList(GGEMVG._GGEMVG__attrs, self.GGEMVG_Regs)
00567     self.updateList(GGEMIE._GGEMIE__attrs, self.GGEMIE_Regs)
00568     self.updateList(GGEMW._GGEMW__attrs, self.GGEMW_Regs)
00569
00570     #~ CRU Leg
00571     self.updateList(GCRU._GCRU__attrs, self.GCRU_Regs)
00572
00573     #~ GLT Leg
00574     self.updateList(GGLT._GGLT__attrs, self.GGLT_Regs)
00575
00576
00577 #  def updateList(self, parent, regList, listView):
00578 #    listView.clear()
00579 #    #listView.setFont(QFont("Tahoma"))
00580 #    listView.header().setMovingEnabled(0)
00581 #    listView.setColumnWidth(0,160)
00582 #    listView.setColumnWidth(1,20)
00583 #    listView.setColumnAlignment(1,self.AlignRight)
00584 #    listView.setColumnAlignment(2,self.AlignRight)
00585 #    listView.setColumnAlignment(3,self.AlignRight)
00586 #    listView.setColumnWidth(2,80)
00587
00588 #    regList.sort()
00589
00590 #    for reg in regList:
00591 #      if parent.regs[str(reg)].size() != 0 and not \
00592 #         ( parent.regs[str(reg)].isWriteOnly()  or \
00593 #           parent.regs[str(reg)].isNoDirectAccess() ):
00594 #        item = RegViewItem(listView)
00595 #        item.setText(0, str(reg))
00596
00597   def updateList(self, regList, listView):
00598     def cmpByName(r1, r2):
00599       return cmp(r1.getName(), r2.getName())
00600
00601     listView.clear()
00602     #listView.setFont(QFont("Tahoma"))
00603     listView.header().setMovingEnabled(0)
00604     listView.setColumnWidth(0,160)
00605     listView.setColumnWidth(1,20)
00606     listView.setColumnAlignment(1,self.AlignRight)
00607     listView.setColumnAlignment(2,self.AlignRight)
00608     listView.setColumnAlignment(3,self.AlignRight)
00609     listView.setColumnWidth(2,80)
00610
00611     regList.sort(cmpByName)
00612
00613     for reg in regList:
00614       if reg.size() != 0 and not \
00615          ( reg.isWriteOnly()  or \
00616            reg.isNoDirectAccess() ):
00617         item = RegViewItem(listView)
00618         item.setText(0, reg.getName())
00619
00620   def selectItem(self, item):
00621     """ This function calls the clearViews function to clear all the register lists
00622         from the Tab window and then shows the registers of the selected Hierarchy
00623         node as well as upper level nodes """
00624
00625     #~ if str(self.__filename) == "":
00626       #~ print "No Schema loaded"
00627       #~ self.statusBar().message('No Schema loaded', 2000)
00628       #~ return
00629
00630     # Setup Defaults
00631     self.setDefaults()
00632
00633     # Update selected Item
00634     #self.updateSelection()
00635
00636     self.__lock.acquire()
00637     label = self.__labelMap[self.getCurrentItem()]
00638     parentLabel = self.__labelMap[self.getCurrentParent()]
00639     grandParentLabel = self.__labelMap[self.getCurrentGrandParent()]
00640     greatGrandParentLabel = self.__labelMap[self.getCurrentGreatGrandParent()]
00641     self.__lock.release()
00642
00643     text = "GLAT"
00644     if label is not None:
00645       label.setText(self.getCurrentItem().text(0))
00646       text = str(label.text())
00647
00648     if parentLabel is not None:
00649       parentLabel.setText(self.getCurrentParent().text(0))
00650       text = str(parentLabel.text()) + ", " + text
00651       #~ browseLabel = str(self.getCurrentGreatGrandParent().text(0))
00652
00653     if grandParentLabel is not None:
00654       grandParentLabel.setText(self.getCurrentGrandParent().text(0))
00655       text = str(grandParentLabel.text()) + ", " + text
00656
00657     if greatGrandParentLabel is not None:
00658       greatGrandParentLabel.setText(self.getCurrentGreatGrandParent().text(0))
00659       text = str(greatGrandParentLabel.text()) + ", " + text
00660
00661     self.Browsing.setText(text)
00662
00663     if str(self.Browsing.text()) == "GLAT":
00664       self.TEMTab.setCurrentPage(0)
00665
00666     if self.Browsing.text().contains("GAEM"):
00667       self.TEMTab.setCurrentPage(1)
00668
00669     if self.Browsing.text().contains("GTEM"):
00670       self.TEMTab.setCurrentPage(2)
00671
00672     if self.Browsing.text().contains("GCCC"):
00673       self.TEMTab.setCurrentPage(2)
00674
00675     if self.Browsing.text().contains("GTCC"):
00676       self.TEMTab.setCurrentPage(3)
00677
00678     if self.Browsing.text().contains("GTIC"):
00679       self.TEMTab.setCurrentPage(4)
00680
00681     if self.Browsing.text().contains("GEBM"):
00682       self.TEMTab.setCurrentPage(5)
00683
00684     if self.Browsing.text().contains("GGEM"):
00685       self.TEMTab.setCurrentPage(6)
00686
00687     if self.Browsing.text().contains("GGEMC"):
00688       self.TEMTab.setCurrentPage(6)
00689
00690     if self.Browsing.text().contains("GGEMMG"):
00691       self.TEMTab.setCurrentPage(6)
00692
00693     if self.Browsing.text().contains("GGEMST"):
00694       self.TEMTab.setCurrentPage(6)
00695
00696     if self.Browsing.text().contains("GGEMSC"):
00697       self.TEMTab.setCurrentPage(7)
00698
00699     if self.Browsing.text().contains("GGEMVG"):
00700       self.TEMTab.setCurrentPage(7)
00701
00702     if self.Browsing.text().contains("GGEMIE"):
00703       self.TEMTab.setCurrentPage(7)
00704
00705     if self.Browsing.text().contains("GGEMW"):
00706       self.TEMTab.setCurrentPage(7)
00707
00708     if self.Browsing.text().contains("GCRU"):
00709       self.TEMTab.setCurrentPage(8)
00710
00711     if self.Browsing.text().contains("GGLT"):
00712       self.TEMTab.setCurrentPage(9)
00713
00714     #self.__lock.acquire()
00715     self.fillViews()
00716     #self.__lock.release()
00717
00718
00719   def fillViews(self):
00720     node = self.__treeMap[self.getCurrentItem()]
00721
00722     #~ parentNode = self.__treeMap[self.getCurrentParent()]
00723     #~ grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00724     #~ greatGrandParentNode = self.__treeMap[self.getCurrentGreatGrandParent()]
00725
00726     #~ self.TEMTab.setCurrentPage(0)
00727
00728     if self.getCurrentItem().text(0).startsWith("GLAT"):
00729       self.fillRegsView(node, self.GLAT_Regs)
00730       return
00731
00732     #~ AEM Leg
00733     if self.getCurrentItem().text(0).startsWith("GAEM"):
00734       #~ self.TEMTab.setCurrentPage(0)
00735       self.fillRegsView(node, self.GAEM_Regs)
00736       return
00737
00738     elif self.getCurrentItem().text(0).startsWith("GAEQ"):
00739       #~ self.TEMTab.setCurrentPage(0)
00740       parentNode = self.__treeMap[self.getCurrentParent()]
00741       self.fillRegsView(node, self.GAEQ_Regs)
00742       self.fillRegsView(parentNode, self.GAEM_Regs)
00743       return
00744
00745     elif self.getCurrentItem().text(0).startsWith("GARC"):
00746       #~ self.TEMTab.setCurrentPage(0)
00747       parentNode = self.__treeMap[self.getCurrentParent()]
00748       self.fillRegsView(node, self.GARC_Regs)
00749       self.fillRegsView(parentNode, self.GAEM_Regs)
00750       return
00751
00752     elif self.getCurrentItem().text(0).startsWith("GAFE"):
00753       #~ self.TEMTab.setCurrentPage(0)
00754       parentNode = self.__treeMap[self.getCurrentParent()]
00755       grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00756       self.fillRegsView(node, self.GAFE_Regs)
00757       self.fillRegsView(parentNode, self.GARC_Regs)
00758       self.fillRegsView(grandParentNode, self.GAEM_Regs)
00759       return
00760
00761     #~ TEM Leg
00762     #~ self.TEMTab.setCurrentPage(2)
00763
00764     if self.getCurrentItem().text(0).startsWith("GTEM"):
00765       #~ self.TEMTab.setCurrentPage(2)
00766       self.GTEMLabel2.setText(self.getCurrentItem().text(0))
00767       self.fillRegsView(node, self.GTEM_Regs)
00768       self.fillRegsView(node, self.GTEM_Regs2)
00769       return
00770
00771     elif self.getCurrentItem().text(0).startsWith("GTCC"):
00772       #~ self.TEMTab.setCurrentPage(2)
00773       self.GTEMLabel2.setText(self.getCurrentParent().text(0))
00774       parentNode = self.__treeMap[self.getCurrentParent()]
00775       self.fillRegsView(node, self.GTCC_Regs)
00776       self.fillRegsView(parentNode, self.GTEM_Regs)
00777       self.fillRegsView(parentNode, self.GTEM_Regs2)
00778       return
00779
00780     elif self.getCurrentItem().text(0).startsWith("GTRC"):
00781       #~ self.TEMTab.setCurrentPage(2)
00782       self.GTEMLabel2.setText(self.getCurrentGrandParent().text(0))
00783       parentNode = self.__treeMap[self.getCurrentParent()]
00784       grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00785       self.fillRegsView(node, self.GTRC_Regs)
00786       self.fillRegsView(parentNode, self.GTCC_Regs)
00787       self.fillRegsView(grandParentNode, self.GTEM_Regs)
00788       self.fillRegsView(grandParentNode, self.GTEM_Regs2)
00789       return
00790
00791     elif self.getCurrentItem().text(0).startsWith("GTFE"):
00792       #~ self.TEMTab.setCurrentPage(2)
00793       self.GTEMLabel2.setText(self.getCurrentGreatGrandParent().text(0))
00794       parentNode = self.__treeMap[self.getCurrentParent()]
00795       grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00796       greatGrandParentNode = self.__treeMap[self.getCurrentGreatGrandParent()]
00797       self.fillRegsView(node, self.GTFE_Regs)
00798       self.fillRegsView(parentNode, self.GTRC_Regs)
00799       self.fillRegsView(grandParentNode, self.GTCC_Regs)
00800       self.fillRegsView(greatGrandParentNode, self.GTEM_Regs)
00801       self.fillRegsView(greatGrandParentNode, self.GTEM_Regs2)
00802       return
00803
00804     #~ self.TEMTab.setCurrentPage(1)
00805
00806     if self.getCurrentItem().text(0).startsWith("GCCC"):
00807       #~ self.TEMTab.setCurrentPage(1)
00808       parentNode = self.__treeMap[self.getCurrentParent()]
00809       self.fillRegsView(node, self.GCCC_Regs)
00810       self.fillRegsView(parentNode, self.GTEM_Regs)
00811       self.fillRegsView(parentNode, self.GTEM_Regs2)
00812       return
00813
00814     elif self.getCurrentItem().text(0).startsWith("GCRC"):
00815       #~ self.TEMTab.setCurrentPage(1)
00816       parentNode = self.__treeMap[self.getCurrentParent()]
00817       grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00818       self.fillRegsView(node, self.GCRC_Regs)
00819       self.fillRegsView(parentNode, self.GCCC_Regs)
00820       self.fillRegsView(grandParentNode, self.GTEM_Regs)
00821       self.fillRegsView(grandParentNode, self.GTEM_Regs2)
00822       return
00823
00824     elif self.getCurrentItem().text(0).startsWith("GCFE"):
00825       #~ self.TEMTab.setCurrentPage(1)
00826       parentNode = self.__treeMap[self.getCurrentParent()]
00827       grandParentNode = self.__treeMap[self.getCurrentGrandParent()]
00828       greatGrandParentNode = self.__treeMap[self.getCurrentGreatGrandParent()]
00829       self.fillRegsView(node, self.GCFE_Regs)
00830       self.fillRegsView(parentNode, self.GCRC_Regs)
00831       self.fillRegsView(grandParentNode, self.GCCC_Regs)
00832       self.fillRegsView(greatGrandParentNode, self.GTEM_Regs)
00833       self.fillRegsView(greatGrandParentNode, self.GTEM_Regs2)
00834       return
00835
00836     if self.getCurrentItem().text(0).startsWith("GTIC"):
00837       self.fillRegsView(node, self.GTIC_Regs)
00838       return
00839
00840     #~ EBM Leg
00841     if self.getCurrentItem().text(0).endsWith("GEBM"):
00842       #~ self.TEMTab.setCurrentPage(5)
00843       self.fillRegsView(node, self.GEBM_Regs)
00844       return
00845
00846     if self.getCurrentItem().text(0).endsWith("GEBMC"):
00847       #~ self.TEMTab.setCurrentPage(0)
00848       parentNode = self.__treeMap[self.getCurrentParent()]
00849       self.fillRegsView(node, self.GEBMC_Regs)
00850       self.fillRegsView(parentNode, self.GEBM_Regs)
00851       return
00852
00853     elif self.getCurrentItem().text(0).endsWith("GEBMST"):
00854       #~ self.TEMTab.setCurrentPage(0)
00855       parentNode = self.__treeMap[self.getCurrentParent()]
00856       self.fillRegsView(node, self.GEBMST_Regs)
00857       self.fillRegsView(parentNode, self.GEBM_Regs)
00858       return
00859
00860     #~ GEM Leg
00861     if self.getCurrentItem().text(0).endsWith("GGEM"):
00862       #~ self.TEMTab.setCurrentPage(5)
00863       self.fillRegsView(node, self.GGEM_Regs)
00864       return
00865
00866     elif self.getCurrentItem().text(0).endsWith("GGEMC"):
00867       #~ self.TEMTab.setCurrentPage(6)
00868       parentNode = self.__treeMap[self.getCurrentParent()]
00869       self.fillRegsView(node, self.GGEMC_Regs)
00870       self.fillRegsView(parentNode, self.GGEM_Regs)
00871       return
00872
00873     elif self.getCurrentItem().text(0).endsWith("GGEMMG"):
00874       #~ self.TEMTab.setCurrentPage(6)
00875       parentNode = self.__treeMap[self.getCurrentParent()]
00876       self.fillRegsView(node, self.GGEMMG_Regs)
00877       self.fillRegsView(parentNode, self.GGEM_Regs)
00878       return
00879
00880     elif self.getCurrentItem().text(0).endsWith("GGEMST"):
00881       #~ self.TEMTab.setCurrentPage(6)
00882       parentNode = self.__treeMap[self.getCurrentParent()]
00883       self.fillRegsView(node, self.GGEMST_Regs)
00884       self.fillRegsView(parentNode, self.GGEM_Regs)
00885       return
00886
00887     elif self.getCurrentItem().text(0).endsWith("GGEMSC"):
00888       #~ self.TEMTab.setCurrentPage(7)
00889       parentNode = self.__treeMap[self.getCurrentParent()]
00890       self.fillRegsView(node, self.GGEMSC_Regs)
00891       self.fillRegsView(parentNode, self.GGEM_Regs)
00892       return
00893
00894     elif self.getCurrentItem().text(0).endsWith("GGEMVG"):
00895       #~ self.TEMTab.setCurrentPage(7)
00896       parentNode = self.__treeMap[self.getCurrentParent()]
00897       self.fillRegsView(node, self.GGEMVG_Regs)
00898       self.fillRegsView(parentNode, self.GGEM_Regs)
00899       return
00900
00901     elif self.getCurrentItem().text(0).endsWith("GGEMIE"):
00902       #~ self.TEMTab.setCurrentPage(7)
00903       parentNode = self.__treeMap[self.getCurrentParent()]
00904       self.fillRegsView(node, self.GGEMIE_Regs)
00905       self.fillRegsView(parentNode, self.GGEM_Regs)
00906       return
00907
00908     elif self.getCurrentItem().text(0).endsWith("GGEMW"):
00909       #~ self.TEMTab.setCurrentPage(7)
00910       parentNode = self.__treeMap[self.getCurrentParent()]
00911       self.fillRegsView(node, self.GGEMW_Regs)
00912       self.fillRegsView(parentNode, self.GGEM_Regs)
00913       return
00914
00915     #~ CRU Leg
00916     if self.getCurrentItem().text(0).startsWith("GCRU"):
00917       #~ self.TEMTab.setCurrentPage(8)
00918       self.fillRegsView(node, self.GCRU_Regs)
00919       return
00920
00921     #~ GLT Leg
00922     if self.getCurrentItem().text(0).startsWith("GGLT"):
00923       #~ self.TEMTab.setCurrentPage(9)
00924       self.fillRegsView(node, self.GGLT_Regs)
00925       return
00926
00927
00928   def getCurrentItem(self):
00929     currentItem = self.Hierarchy.currentItem()
00930     return currentItem
00931
00932   def getCurrentParent(self):
00933     if self.getCurrentItem().parent() is not None:
00934       currentParent = self.getCurrentItem().parent()
00935     else:
00936       currentParent = self.Hierarchy.firstChild()
00937     return currentParent
00938
00939   def getCurrentGrandParent(self):
00940     if self.getCurrentParent().parent() is not None:
00941       currentGrandParent = self.getCurrentParent().parent()
00942     else:
00943       currentGrandParent = self.Hierarchy.firstChild()
00944     return currentGrandParent
00945
00946   def getCurrentGreatGrandParent(self):
00947     if self.getCurrentGrandParent().parent() is not None:
00948       currentGreatGrandParent = self.getCurrentGrandParent().parent()
00949     else:
00950       currentGreatGrandParent = self.Hierarchy.firstChild()
00951     return currentGreatGrandParent
00952
00953
00954   def fillRegsView(self, parent, listView):
00955     listItem = listView.firstChild()
00956
00957     while listItem != None:
00958       name = str(listItem.text(0))
00959       if parent.regs[name].isWriteOnly():
00960         continue
00961
00962       if parent.regs[name].isNoDirectAccess():
00963         continue
00964
00965       try:
00966         if QString.compare(self.Conversion.text(), "EGU") == 0:
00967           value = parent.regs[name].get(bypass = 1)
00968         else:
00969           value = parent.regs[name].get()
00970
00971         size = parent.regs[name].size()
00972         listItem.setText(1,str(size))
00973
00974         if self.__base == 1:
00975           fmt = "0x%0" + str(size*2) + "x "
00976           listItem.setText(3, fmt % value)
00977         else:
00978           listItem.setText(3,str(value) + " ")
00979
00980         tstamp = parent.regs[name].getTimeStamp()
00981         if tstamp == -1:
00982           strTime = ''
00983         else:
00984           strTime = time.strftime('%H:%M:%S', time.gmtime(tstamp)) + " + %03d" % (math.modf(tstamp)[0]*1000)
00985         listItem.setText(2,strTime)
00986         listItem.setError(0)
00987       except LATInterfaceException:
00988         listItem.setText(3, "%s - %s (0x%08x)"
00989                             % (sys.exc_info()[1].errstr()[0], sys.exc_info()[1].errstr()[1], sys.exc_info()[1].status)
00990                         )
00991         listItem.setError(1)
00992       listItem = listItem.nextSibling()
00993
00994   def setDefaults(self):
00995
00996     self.TEMTab.setEnabled(1)
00997
00998     #~ self.GAEM_Regs.setEnabled(0)
00999     #~ self.GARC_Regs.setEnabled(0)
01000     #~ self.GAFE_Regs.setEnabled(0)
01001
01002     #~ self.GTEM_Regs.setEnabled(0)
01003     #~ self.GCCC_Regs.setEnabled(0)
01004     #~ self.GCRC_Regs.setEnabled(0)
01005     #~ self.GCFE_Regs.setEnabled(0)
01006
01007     #~ self.GTEM_Regs2.setEnabled(0)
01008     #~ self.GTCC_Regs.setEnabled(0)
01009     #~ self.GTRC_Regs.setEnabled(0)
01010     #~ self.GTFE_Regs.setEnabled(0)
01011
01012
01013     #~ self.TEMTab.page(0).setEnabled(0)
01014     #~ self.TEMTab.page(1).setEnabled(0)
01015     #~ self.TEMTab.page(2).setEnabled(0)
01016
01017     #~ self.TEMTab.setTabLabel(self.TEMTab.page(1), self.trUtf8("ACD") )
01018     #~ self.TEMTab.setTabLabel(self.TEMTab.page(2), self.trUtf8("CAL") )
01019     #~ self.TEMTab.setTabLabel(self.TEMTab.page(3), self.trUtf8("TKR") )
01020
01021     self.GAEMLabel.setText("GAEM")
01022     self.GAEQLabel.setText("GAEQ")
01023     self.GARCLabel.setText("GARC")
01024     self.GAFELabel.setText("GAFE")
01025
01026     self.GTEMLabel.setText("GTEM")
01027     self.GTEMLabel2.setText("GTEM")
01028
01029     self.GCCCLabel.setText("GCCC")
01030     self.GCRCLabel.setText("GCRC")
01031     self.GCFELabel.setText("GCFE")
01032
01033     self.GTCCLabel.setText("GTCC")
01034     self.GTRCLabel.setText("GTRC")
01035     self.GTFELabel.setText("GTFE")
01036
01037     self.GEBMLabel.setText("GEBM")
01038     self.GEBMCLabel.setText("GEBMC")
01039     self.GEBMSTLabel.setText("GEBMST")
01040
01041     self.GGEMLabel.setText("GGEM")
01042     self.GGEMCLabel.setText("GGEMC")
01043     self.GGEMCLabel.setText("GGEMMG")
01044     self.GGEMSTLabel.setText("GGEMST")
01045     self.GGEMCLabel.setText("GGEMSC")
01046     self.GGEMCLabel.setText("GGEMVG")
01047     self.GGEMCLabel.setText("GGEMIE")
01048     self.GGEMCLabel.setText("GGEMW")
01049
01050     self.GCRULabel.setText("GCRU")
01051
01052     self.GGLTLabel.setText("GGLT")
01053
01054     self.clearViews()
01055
01056   def clearViews(self):
01057
01058     self.clearValues(self.GAEM_Regs)
01059     self.clearValues(self.GAEQ_Regs)
01060
01061     self.clearValues(self.GARC_Regs)
01062     self.clearValues(self.GAFE_Regs)
01063
01064     self.clearValues(self.GTEM_Regs)
01065     self.clearValues(self.GTEM_Regs2)
01066
01067     self.clearValues(self.GCCC_Regs)
01068     self.clearValues(self.GCRC_Regs)
01069     self.clearValues(self.GCFE_Regs)
01070
01071     self.clearValues(self.GTCC_Regs)
01072     self.clearValues(self.GTRC_Regs)
01073     self.clearValues(self.GTFE_Regs)
01074
01075     self.clearValues(self.GTIC_Regs)
01076
01077     self.clearValues(self.GEBM_Regs)
01078     self.clearValues(self.GEBMC_Regs)
01079     self.clearValues(self.GEBMST_Regs)
01080
01081     self.clearValues(self.GGEM_Regs)
01082     self.clearValues(self.GGEMC_Regs)
01083     self.clearValues(self.GGEMMG_Regs)
01084     self.clearValues(self.GGEMST_Regs)
01085     self.clearValues(self.GGEMSC_Regs)
01086     self.clearValues(self.GGEMVG_Regs)
01087     self.clearValues(self.GGEMIE_Regs)
01088     self.clearValues(self.GGEMW_Regs)
01089
01090     self.clearValues(self.GCRU_Regs)
01091
01092     self.clearValues(self.GGLT_Regs)
01093
01094   def clearValues(self, listView):
01095     regItem = listView.firstChild()
01096     while regItem != None:
01097       regItem.setError(0)
01098       regItem.setText(1, "" )
01099       regItem.setText(2, "" )
01100       regItem.setText(3, "" )
01101       if self.__openFile == 1:
01102         regItem.setText(0, "" )
01103       regItem = regItem.nextSibling()
01104
01105   def browserPreferences(self):
01106     self.__timer.stop()
01107     self.browserPreferences.exec_loop()
01108     self.__step = float(str(self.browserPreferences.timestepValue.text()))
01109     self.__timer.start(self.__step*1000, False)
01110     if self.browserPreferences.decButton.isChecked():
01111       self.__base = 0
01112     elif self.browserPreferences.hexButton.isChecked():
01113       self.__base = 1
01114
01115     if self.browserPreferences.rawButton.isChecked():
01116       self.Conversion.setText("RAW")
01117     elif self.browserPreferences.eguButton.isChecked():
01118       self.Conversion.setText("EGU")
01119
01120     if QString.compare(self.__filename, QString.null) != 0:
01121       self.selectItem(self.Hierarchy.currentItem())
01122
01123   def selectFile(self):
01124     fn = QFileDialog.getOpenFileName( QString.null, "(*.xml)", self )
01125     if not fn.isEmpty():
01126       self.__filename = fn
01127       self.loadSchema(str(self.__filename))
01128
01129   def fileNew(self):
01130     print "BrowserImpl.fileNew(): Not implemented yet"
01131   # public slot
01132
01133   def fileOpen(self):
01134     self.__timer.stop()
01135     #~ self.__lock.acquire()
01136
01137     self.__openFile = 1
01138     self.clearViews()
01139     self.__openFile = 0
01140
01141     self.selectFile()
01142     #~ self.__lock.release()
01143
01144
01145   def fileSave(self):
01146     print "BrowserImpl.fileSave(): Not implemented yet"
01147   # public slot
01148
01149   def fileSaveAs(self):
01150     print "BrowserImpl.fileSaveAs(): Not implemented yet"
01151   # public slot
01152
01153   def filePrint(self):
01154     Margin = 50
01155     self.__pageNo = 1
01156     #~ self.__column = [0, 130, 180]#, 180, 260, 400]#, 325] # Magic numbers
01157
01158     # If there are no items, don't try to print
01159     #~ if QString.compare(str(self.__filename), "") == 0:
01160     #if not self.Hierarchy.firstChild():
01161       #~ print "Can't print a non-loaded Browser"
01162       #~ return
01163
01164     if self.printer.setup(self):
01165       self.statusBar().message('Printing...')
01166
01167       self.__p = QPainter()
01168       self.__p.begin(self.printer)
01169       self.__p.setFont(self.GAEM_Regs.font())
01170       self.__yPos = 0
01171       self.__fm = self.__p.fontMetrics()
01172       self.__metrics = QPaintDeviceMetrics(self.printer)
01173
01174       self.__header = "GLAT Browser. Browsing: " + str(options.schema)
01175
01176       page = "Page: 1"
01177       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
01178                 Qt.ExpandTabs | Qt.DontClip, self.__header)
01179       self.__yPos = self.__yPos + self.__fm.lineSpacing()
01180       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
01181                 Qt.ExpandTabs | Qt.DontClip, page)
01182       self.__yPos = self.__yPos + self.__fm.lineSpacing()
01183
01184       #~ self.__currentItem = self.Hierarchy.self.__currentItem()
01185
01186       #~ if self.__currentItem.parent() is not None:
01187         #~ self.getCurrentParent() = self.__currentItem.parent()
01188       #~ else:
01189         #~ self.getCurrentParent() = self.Hierarchy.firstChild()
01190
01191       #~ if self.getCurrentParent().parent() is not None:
01192         #~ self.getCurrentGrandParent() = self.getCurrentParent().parent()
01193       #~ else:
01194         #~ self.getCurrentGrandParent() = self.Hierarchy.firstChild()
01195
01196       #~ if self.getCurrentGrandParent().parent() is not None:
01197         #~ self.getCurrentGreatGrandParent() = self.getCurrentGrandParent().parent()
01198       #~ else:
01199         #~ self.getCurrentGreatGrandParent() = self.Hierarchy.firstChild()
01200
01201       self.printRegList(self.GAEM_Regs, "AEM Registers")
01202       self.printRegList(self.GAEQ_Regs, "GAEQ Registers")
01203       self.printRegList(self.GARC_Regs, str(self.GARCLabel.text()) + " Registers")
01204       self.printRegList(self.GAFE_Regs, str(self.GAFELabel.text()) + " Registers")
01205
01206       self.printRegList(self.GTEM_Regs, str(self.GTEMLabel.text()) + " Registers")
01207       self.printRegList(self.GCCC_Regs, str(self.GCCCLabel.text()) + " Registers")
01208       self.printRegList(self.GCRC_Regs, str(self.GCRCLabel.text()) + " Registers")
01209       self.printRegList(self.GCFE_Regs, str(self.GCFELabel.text()) + " Registers")
01210
01211       self.printRegList(self.GTCC_Regs, str(self.GTCCLabel.text()) + " Registers")
01212       self.printRegList(self.GTRC_Regs, str(self.GTRCLabel.text()) + " Registers")
01213       self.printRegList(self.GTFE_Regs, str(self.GTFELabel.text()) + " Registers")
01214
01215       self.printRegList(self.GTIC_Regs, str(self.GTICLabel.text()) + " Registers")
01216
01217       self.printRegList(self.GEBM_Regs, str(self.GEBMLabel.text()) + " Registers")
01218       self.printRegList(self.GEBMC_Regs, str(self.GEBMCLabel.text()) + " Registers")
01219       self.printRegList(self.GEBMST_Regs, str(self.GEBMSTLabel.text()) + " Registers")
01220
01221       self.printRegList(self.GGEM_Regs, str(self.GGEMLabel.text()) + " Registers")
01222       self.printRegList(self.GGEMC_Regs, str(self.GGEMCLabel.text()) + " Registers")
01223       self.printRegList(self.GGEMMG_Regs, str(self.GGEMMGLabel.text()) + " Registers")
01224       self.printRegList(self.GGEMST_Regs, str(self.GGEMSTLabel.text()) + " Registers")
01225       self.printRegList(self.GGEMSC_Regs, str(self.GGEMSCLabel.text()) + " Registers")
01226       self.printRegList(self.GGEMVG_Regs, str(self.GGEMVGLabel.text()) + " Registers")
01227       self.printRegList(self.GGEMIE_Regs, str(self.GGEMIELabel.text()) + " Registers")
01228       self.printRegList(self.GGEMW_Regs, str(self.GGEMWLabel.text()) + " Registers")
01229
01230       self.printRegList(self.GCRU_Regs, str(self.GCRULabel.text()) + " Registers")
01231
01232       self.printRegList(self.GGLT_Regs, str(self.GGLTLabel.text()) + " Registers")
01233
01234       self.__p.end()
01235       self.statusBar().message('Printing completed',2000)
01236     else:
01237       self.statusBar().message('Printing aborted',2000)
01238
01239   def printRegList(self, regList, listHeader):
01240       Margin = 50
01241
01242       # If there are no items, don't try to print
01243       if not regList.firstChild():
01244         return
01245
01246       # If the selected node is a broadcast node or is not selected, don't print:
01247       if QString.compare(regList.firstChild().text(1),"") == 0 :
01248         return
01249
01250       column = [50, 200, 260, 390]
01251       columnHeader = ['Register','Size','Time Stamp','Value']#,'Time','Source','Message']
01252
01253       self.__yPos = self.__yPos + self.__fm.lineSpacing()
01254       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
01255                 Qt.ExpandTabs | Qt.DontClip, listHeader)
01256       self.__yPos = self.__yPos + self.__fm.lineSpacing()
01257
01258       for i in range (0,4):
01259           self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01260                     Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
01261       self.__yPos = self.__yPos + self.__fm.lineSpacing()
01262
01263       item = regList.firstChild()
01264       for j in range(regList.childCount()):
01265         if Margin + self.__yPos > self.__metrics.height() - Margin:
01266           self.__pageNo = self.__pageNo + 1
01267           page = "Page: " + str(self.__pageNo)
01268           self.statusBar().message('Printing (page %d)...' % (self.__pageNo))
01269           self.printer.newPage()
01270           self.__yPos = 0
01271           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01272                   Qt.ExpandTabs | Qt.DontClip, self.__header)
01273           self.__yPos = self.__yPos + self.__fm.lineSpacing()
01274           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01275                   Qt.ExpandTabs | Qt.DontClip, page)
01276           self.__yPos = self.__yPos + 2*self.__fm.lineSpacing()
01277
01278           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01279                   Qt.ExpandTabs | Qt.DontClip, listHeader)
01280           self.__yPos = self.__yPos + self.__fm.lineSpacing()
01281
01282           for i in range (0,4):
01283             self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01284                       Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
01285           self.__yPos = self.__yPos + self.__fm.lineSpacing()
01286
01287         for i in range (0,4):
01288           self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
01289                     Qt.ExpandTabs | Qt.DontClip,item.text(i))
01290         self.__yPos = self.__yPos + self.__fm.lineSpacing()
01291         item = item.nextSibling()
01292
01293   def fileExit(self):
01294     self.close()
01295
01296   def editUndo(self):
01297     print "BrowserImpl.editUndo(): Not implemented yet"
01298   # public slot
01299
01300   def editRedo(self):
01301     print "BrowserImpl.editRedo(): Not implemented yet"
01302   # public slot
01303
01304   def editCut(self):
01305     print "BrowserImpl.editCut(): Not implemented yet"
01306   # public slot
01307
01308   def editCopy(self):
01309     print "BrowserImpl.editCopy(): Not implemented yet"
01310   # public slot
01311
01312   def editPaste(self):
01313     print "BrowserImpl.editPaste(): Not implemented yet"
01314   # public slot
01315
01316   def editFind(self):
01317     print "BrowserImpl.editFind(): Not implemented yet"
01318   # public slot
01319
01320   def helpOnline(self):
01321     import webbrowser
01322     webbrowser.open('http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/Default.htm')
01323
01324   def helpContents(self):
01325     self.browserReadme = BrowserReadme()
01326     self.browserReadme.exec_loop()
01327
01328   def helpAbout(self):
01329     QMessageBox.about(self,'Help About',
01330             '                                     GLAST Online Browser\n                               I&T Online - Alicia T. Kavelaars\nhttp://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/contact.htm\n                                       Copyright 2003 by\n       The Board of Trustees of the Leland Stanford Junior University.\n                                       All rights reserved.')
01331
01332 class RegViewItem(QListViewItem):
01333   def __init__(self, *args):
01334     QListViewItem.__init__(self, *args)
01335     self.__error = 0
01336
01337   def paintCell(self, p, cg, column, width, align):
01338     g = QColorGroup(cg)
01339     g.setColor( QColorGroup.Base, Qt.white)
01340     g.setColor( QColorGroup.Foreground, Qt.black)
01341     if self.__error:
01342       g.setColor( QColorGroup.Text, Qt.red)
01343     else:
01344       g.setColor( QColorGroup.Text, Qt.black)
01345
01346     # Do the standard painting
01347     QListViewItem.paintCell(self,p,g,column,width,align)
01348
01349     p.setPen( QPen( cg.dark(), 1 ) )
01350     p.drawLine( 0, self.height() - 1, width, self.height() - 1 )
01351     p.drawLine( width - 1, 0, width - 1, self.height() )
01352
01353   def setError(self, error):
01354     self.__error = error
01355
01356
01357
01358 if __name__ == "__main__":
01359   from LATTE.client.gOptions import Options
01360   from LATTE.client.gCmdCli  import CmdCli
01361   from LATTE.database.gLAT   import GLAT
01362   from LATTE.database.gXBRD  import GXBRD
01363
01364   options = Options(['server', 'schema'])
01365   try:
01366     options.parse()
01367   except Exception, msg:
01368     options.usage(str(msg))
01369     sys.exit(1)
01370
01371   cmd = CmdCli()
01372   cmd.connect(options.server)
01373
01374   lat = GLAT(cmd)
01375   lat.readSchema(options.schema)
01376
01377   xbrd = GXBRD(cmd)
01378   xbrd.readSchema(options.schema)
01379
01380   a = QApplication(sys.argv)
01381   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
01382   w = BrowserImpl(lat, xbrd)
01383   a.setMainWidget(w)
01384   w.show()
01385   a.exec_loop()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: browserPreferencesImpl.py Source File

browser

browserPreferencesImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Browser preferences GUI implementation module"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:56:48 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import sys
00022 from qt import *
00023 from BrowserPreferences import BrowserPreferences
00024
00025
00026 class browserPreferencesImpl(BrowserPreferences):
00027
00028   def __init__(self,parent = None,name = None,modal = 0,fl = 0):
00029     BrowserPreferences.__init__(self,parent,name,modal,fl)
00030
00031     self.timestepValue.setText("1")
00032     self.connect(self.timestepSlider, SIGNAL('valueChanged(int)'), self.changeStepValue)
00033
00034   def changeStepValue(self):
00035     self.timestepValue.setText(str(float(self.timestepSlider.value())/10.))
00036
00037 if __name__ == "__main__":
00038   a = QApplication(sys.argv)
00039   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00040   w = BrowserPreferences()
00041   a.setMainWidget(w)
00042   w.show()
00043   a.exec_loop()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: cfitsio.py Source File

ext / cfitsio_swig / build / lib.win32-2.3 / cfitsio

build/lib.win32-2.3/cfitsio/cfitsio.py

00001 # This file was created automatically by SWIG.
00002 # Don't modify this file, modify the SWIG interface instead.
00003 # This file is compatible with both classic and new-style classes.
00004 import _cfitsio
00005 def _swig_setattr(self,class_type,name,value):
00006     if (name == "this"):
00007         if isinstance(value, class_type):
00008             self.__dict__[name] = value.this
00009             if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
00010             del value.thisown
00011             return
00012     method = class_type.__swig_setmethods__.get(name,None)
00013     if method: return method(self,value)
00014     self.__dict__[name] = value
00015
00016 def _swig_getattr(self,class_type,name):
00017     method = class_type.__swig_getmethods__.get(name,None)
00018     if method: return method(self)
00019     raise AttributeError,name
00020
00021 import types
00022 try:
00023     _object = types.ObjectType
00024     _newclass = 1
00025 except AttributeError:
00026     class _object : pass
00027     _newclass = 0
00028
00029
00030 new_longp = _cfitsio.new_longp
00031
00032 copy_longp = _cfitsio.copy_longp
00033
00034 delete_longp = _cfitsio.delete_longp
00035
00036 longp_assign = _cfitsio.longp_assign
00037
00038 longp_value = _cfitsio.longp_value
00039
00040 FLEN_FILENAME = _cfitsio.FLEN_FILENAME
00041 FLEN_KEYWORD = _cfitsio.FLEN_KEYWORD
00042 FLEN_CARD = _cfitsio.FLEN_CARD
00043 FLEN_VALUE = _cfitsio.FLEN_VALUE
00044 FLEN_COMMENT = _cfitsio.FLEN_COMMENT
00045 FLEN_ERRMSG = _cfitsio.FLEN_ERRMSG
00046 FLEN_STATUS = _cfitsio.FLEN_STATUS
00047 TBIT = _cfitsio.TBIT
00048 TBYTE = _cfitsio.TBYTE
00049 TLOGICAL = _cfitsio.TLOGICAL
00050 TSTRING = _cfitsio.TSTRING
00051 TUSHORT = _cfitsio.TUSHORT
00052 TSHORT = _cfitsio.TSHORT
00053 TUINT = _cfitsio.TUINT
00054 TINT = _cfitsio.TINT
00055 TULONG = _cfitsio.TULONG
00056 TLONG = _cfitsio.TLONG
00057 TINT32BIT = _cfitsio.TINT32BIT
00058 TFLOAT = _cfitsio.TFLOAT
00059 TLONGLONG = _cfitsio.TLONGLONG
00060 TDOUBLE = _cfitsio.TDOUBLE
00061 TCOMPLEX = _cfitsio.TCOMPLEX
00062 TDBLCOMPLEX = _cfitsio.TDBLCOMPLEX
00063 TYP_STRUC_KEY = _cfitsio.TYP_STRUC_KEY
00064 TYP_CMPRS_KEY = _cfitsio.TYP_CMPRS_KEY
00065 TYP_SCAL_KEY = _cfitsio.TYP_SCAL_KEY
00066 TYP_NULL_KEY = _cfitsio.TYP_NULL_KEY
00067 TYP_DIM_KEY = _cfitsio.TYP_DIM_KEY
00068 TYP_RANG_KEY = _cfitsio.TYP_RANG_KEY
00069 TYP_UNIT_KEY = _cfitsio.TYP_UNIT_KEY
00070 TYP_DISP_KEY = _cfitsio.TYP_DISP_KEY
00071 TYP_HDUID_KEY = _cfitsio.TYP_HDUID_KEY
00072 TYP_CKSUM_KEY = _cfitsio.TYP_CKSUM_KEY
00073 TYP_WCS_KEY = _cfitsio.TYP_WCS_KEY
00074 TYP_REFSYS_KEY = _cfitsio.TYP_REFSYS_KEY
00075 TYP_COMM_KEY = _cfitsio.TYP_COMM_KEY
00076 TYP_CONT_KEY = _cfitsio.TYP_CONT_KEY
00077 TYP_USER_KEY = _cfitsio.TYP_USER_KEY
00078 BYTE_IMG = _cfitsio.BYTE_IMG
00079 SHORT_IMG = _cfitsio.SHORT_IMG
00080 LONG_IMG = _cfitsio.LONG_IMG
00081 LONGLONG_IMG = _cfitsio.LONGLONG_IMG
00082 FLOAT_IMG = _cfitsio.FLOAT_IMG
00083 DOUBLE_IMG = _cfitsio.DOUBLE_IMG
00084 IMAGE_HDU = _cfitsio.IMAGE_HDU
00085 ASCII_TBL = _cfitsio.ASCII_TBL
00086 BINARY_TBL = _cfitsio.BINARY_TBL
00087 ANY_HDU = _cfitsio.ANY_HDU
00088 READONLY = _cfitsio.READONLY
00089 READWRITE = _cfitsio.READWRITE
00090 MAX_COMPRESS_DIM = _cfitsio.MAX_COMPRESS_DIM
00091 RICE_1 = _cfitsio.RICE_1
00092 GZIP_1 = _cfitsio.GZIP_1
00093 PLIO_1 = _cfitsio.PLIO_1
00094 HCOMPRESS_1 = _cfitsio.HCOMPRESS_1
00095 CASESEN = _cfitsio.CASESEN
00096 CASEINSEN = _cfitsio.CASEINSEN
00097 GT_ID_ALL_URI = _cfitsio.GT_ID_ALL_URI
00098 GT_ID_REF = _cfitsio.GT_ID_REF
00099 GT_ID_POS = _cfitsio.GT_ID_POS
00100 GT_ID_ALL = _cfitsio.GT_ID_ALL
00101 GT_ID_REF_URI = _cfitsio.GT_ID_REF_URI
00102 GT_ID_POS_URI = _cfitsio.GT_ID_POS_URI
00103 OPT_RM_GPT = _cfitsio.OPT_RM_GPT
00104 OPT_RM_ENTRY = _cfitsio.OPT_RM_ENTRY
00105 OPT_RM_MBR = _cfitsio.OPT_RM_MBR
00106 OPT_RM_ALL = _cfitsio.OPT_RM_ALL
00107 OPT_GCP_GPT = _cfitsio.OPT_GCP_GPT
00108 OPT_GCP_MBR = _cfitsio.OPT_GCP_MBR
00109 OPT_GCP_ALL = _cfitsio.OPT_GCP_ALL
00110 OPT_MCP_ADD = _cfitsio.OPT_MCP_ADD
00111 OPT_MCP_NADD = _cfitsio.OPT_MCP_NADD
00112 OPT_MCP_REPL = _cfitsio.OPT_MCP_REPL
00113 OPT_MCP_MOV = _cfitsio.OPT_MCP_MOV
00114 OPT_MRG_COPY = _cfitsio.OPT_MRG_COPY
00115 OPT_MRG_MOV = _cfitsio.OPT_MRG_MOV
00116 OPT_CMT_MBR = _cfitsio.OPT_CMT_MBR
00117 OPT_CMT_MBR_DEL = _cfitsio.OPT_CMT_MBR_DEL
00118 SKIP_TABLE = _cfitsio.SKIP_TABLE
00119 SKIP_IMAGE = _cfitsio.SKIP_IMAGE
00120 SKIP_NULL_PRIMARY = _cfitsio.SKIP_NULL_PRIMARY
00121 USE_MEM_BUFF = _cfitsio.USE_MEM_BUFF
00122 OVERFLOW_ERR = _cfitsio.OVERFLOW_ERR
00123 PREPEND_PRIMARY = _cfitsio.PREPEND_PRIMARY
00124 SAME_FILE = _cfitsio.SAME_FILE
00125 TOO_MANY_FILES = _cfitsio.TOO_MANY_FILES
00126 FILE_NOT_OPENED = _cfitsio.FILE_NOT_OPENED
00127 FILE_NOT_CREATED = _cfitsio.FILE_NOT_CREATED
00128 WRITE_ERROR = _cfitsio.WRITE_ERROR
00129 END_OF_FILE = _cfitsio.END_OF_FILE
00130 READ_ERROR = _cfitsio.READ_ERROR
00131 FILE_NOT_CLOSED = _cfitsio.FILE_NOT_CLOSED
00132 ARRAY_TOO_BIG = _cfitsio.ARRAY_TOO_BIG
00133 READONLY_FILE = _cfitsio.READONLY_FILE
00134 MEMORY_ALLOCATION = _cfitsio.MEMORY_ALLOCATION
00135 BAD_FILEPTR = _cfitsio.BAD_FILEPTR
00136 NULL_INPUT_PTR = _cfitsio.NULL_INPUT_PTR
00137 SEEK_ERROR = _cfitsio.SEEK_ERROR
00138 BAD_URL_PREFIX = _cfitsio.BAD_URL_PREFIX
00139 TOO_MANY_DRIVERS = _cfitsio.TOO_MANY_DRIVERS
00140 DRIVER_INIT_FAILED = _cfitsio.DRIVER_INIT_FAILED
00141 NO_MATCHING_DRIVER = _cfitsio.NO_MATCHING_DRIVER
00142 URL_PARSE_ERROR = _cfitsio.URL_PARSE_ERROR
00143 RANGE_PARSE_ERROR = _cfitsio.RANGE_PARSE_ERROR
00144 SHARED_ERRBASE = _cfitsio.SHARED_ERRBASE
00145 SHARED_BADARG = _cfitsio.SHARED_BADARG
00146 SHARED_NULPTR = _cfitsio.SHARED_NULPTR
00147 SHARED_TABFULL = _cfitsio.SHARED_TABFULL
00148 SHARED_NOTINIT = _cfitsio.SHARED_NOTINIT
00149 SHARED_IPCERR = _cfitsio.SHARED_IPCERR
00150 SHARED_NOMEM = _cfitsio.SHARED_NOMEM
00151 SHARED_AGAIN = _cfitsio.SHARED_AGAIN
00152 SHARED_NOFILE = _cfitsio.SHARED_NOFILE
00153 SHARED_NORESIZE = _cfitsio.SHARED_NORESIZE
00154 HEADER_NOT_EMPTY = _cfitsio.HEADER_NOT_EMPTY
00155 KEY_NO_EXIST = _cfitsio.KEY_NO_EXIST
00156 KEY_OUT_BOUNDS = _cfitsio.KEY_OUT_BOUNDS
00157 VALUE_UNDEFINED = _cfitsio.VALUE_UNDEFINED
00158 NO_QUOTE = _cfitsio.NO_QUOTE
00159 BAD_KEYCHAR = _cfitsio.BAD_KEYCHAR
00160 BAD_ORDER = _cfitsio.BAD_ORDER
00161 NOT_POS_INT = _cfitsio.NOT_POS_INT
00162 NO_END = _cfitsio.NO_END
00163 BAD_BITPIX = _cfitsio.BAD_BITPIX
00164 BAD_NAXIS = _cfitsio.BAD_NAXIS
00165 BAD_NAXES = _cfitsio.BAD_NAXES
00166 BAD_PCOUNT = _cfitsio.BAD_PCOUNT
00167 BAD_GCOUNT = _cfitsio.BAD_GCOUNT
00168 BAD_TFIELDS = _cfitsio.BAD_TFIELDS
00169 NEG_WIDTH = _cfitsio.NEG_WIDTH
00170 NEG_ROWS = _cfitsio.NEG_ROWS
00171 COL_NOT_FOUND = _cfitsio.COL_NOT_FOUND
00172 BAD_SIMPLE = _cfitsio.BAD_SIMPLE
00173 NO_SIMPLE = _cfitsio.NO_SIMPLE
00174 NO_BITPIX = _cfitsio.NO_BITPIX
00175 NO_NAXIS = _cfitsio.NO_NAXIS
00176 NO_NAXES = _cfitsio.NO_NAXES
00177 NO_XTENSION = _cfitsio.NO_XTENSION
00178 NOT_ATABLE = _cfitsio.NOT_ATABLE
00179 NOT_BTABLE = _cfitsio.NOT_BTABLE
00180 NO_PCOUNT = _cfitsio.NO_PCOUNT
00181 NO_GCOUNT = _cfitsio.NO_GCOUNT
00182 NO_TFIELDS = _cfitsio.NO_TFIELDS
00183 NO_TBCOL = _cfitsio.NO_TBCOL
00184 NO_TFORM = _cfitsio.NO_TFORM
00185 NOT_IMAGE = _cfitsio.NOT_IMAGE
00186 BAD_TBCOL = _cfitsio.BAD_TBCOL
00187 NOT_TABLE = _cfitsio.NOT_TABLE
00188 COL_TOO_WIDE = _cfitsio.COL_TOO_WIDE
00189 COL_NOT_UNIQUE = _cfitsio.COL_NOT_UNIQUE
00190 BAD_ROW_WIDTH = _cfitsio.BAD_ROW_WIDTH
00191 UNKNOWN_EXT = _cfitsio.UNKNOWN_EXT
00192 UNKNOWN_REC = _cfitsio.UNKNOWN_REC
00193 END_JUNK = _cfitsio.END_JUNK
00194 BAD_HEADER_FILL = _cfitsio.BAD_HEADER_FILL
00195 BAD_DATA_FILL = _cfitsio.BAD_DATA_FILL
00196 BAD_TFORM = _cfitsio.BAD_TFORM
00197 BAD_TFORM_DTYPE = _cfitsio.BAD_TFORM_DTYPE
00198 BAD_TDIM = _cfitsio.BAD_TDIM
00199 BAD_HEAP_PTR = _cfitsio.BAD_HEAP_PTR
00200 BAD_HDU_NUM = _cfitsio.BAD_HDU_NUM
00201 BAD_COL_NUM = _cfitsio.BAD_COL_NUM
00202 NEG_FILE_POS = _cfitsio.NEG_FILE_POS
00203 NEG_BYTES = _cfitsio.NEG_BYTES
00204 BAD_ROW_NUM = _cfitsio.BAD_ROW_NUM
00205 BAD_ELEM_NUM = _cfitsio.BAD_ELEM_NUM
00206 NOT_ASCII_COL = _cfitsio.NOT_ASCII_COL
00207 NOT_LOGICAL_COL = _cfitsio.NOT_LOGICAL_COL
00208 BAD_ATABLE_FORMAT = _cfitsio.BAD_ATABLE_FORMAT
00209 BAD_BTABLE_FORMAT = _cfitsio.BAD_BTABLE_FORMAT
00210 NO_NULL = _cfitsio.NO_NULL
00211 NOT_VARI_LEN = _cfitsio.NOT_VARI_LEN
00212 BAD_DIMEN = _cfitsio.BAD_DIMEN
00213 BAD_PIX_NUM = _cfitsio.BAD_PIX_NUM
00214 ZERO_SCALE = _cfitsio.ZERO_SCALE
00215 NEG_AXIS = _cfitsio.NEG_AXIS
00216 NOT_GROUP_TABLE = _cfitsio.NOT_GROUP_TABLE
00217 HDU_ALREADY_MEMBER = _cfitsio.HDU_ALREADY_MEMBER
00218 MEMBER_NOT_FOUND = _cfitsio.MEMBER_NOT_FOUND
00219 GROUP_NOT_FOUND = _cfitsio.GROUP_NOT_FOUND
00220 BAD_GROUP_ID = _cfitsio.BAD_GROUP_ID
00221 TOO_MANY_HDUS_TRACKED = _cfitsio.TOO_MANY_HDUS_TRACKED
00222 HDU_ALREADY_TRACKED = _cfitsio.HDU_ALREADY_TRACKED
00223 BAD_OPTION = _cfitsio.BAD_OPTION
00224 IDENTICAL_POINTERS = _cfitsio.IDENTICAL_POINTERS
00225 BAD_GROUP_ATTACH = _cfitsio.BAD_GROUP_ATTACH
00226 BAD_GROUP_DETACH = _cfitsio.BAD_GROUP_DETACH
00227 BAD_I2C = _cfitsio.BAD_I2C
00228 BAD_F2C = _cfitsio.BAD_F2C
00229 BAD_INTKEY = _cfitsio.BAD_INTKEY
00230 BAD_LOGICALKEY = _cfitsio.BAD_LOGICALKEY
00231 BAD_FLOATKEY = _cfitsio.BAD_FLOATKEY
00232 BAD_DOUBLEKEY = _cfitsio.BAD_DOUBLEKEY
00233 BAD_C2I = _cfitsio.BAD_C2I
00234 BAD_C2F = _cfitsio.BAD_C2F
00235 BAD_C2D = _cfitsio.BAD_C2D
00236 BAD_DATATYPE = _cfitsio.BAD_DATATYPE
00237 BAD_DECIM = _cfitsio.BAD_DECIM
00238 NUM_OVERFLOW = _cfitsio.NUM_OVERFLOW
00239 BAD_DATE = _cfitsio.BAD_DATE
00240 PARSE_SYNTAX_ERR = _cfitsio.PARSE_SYNTAX_ERR
00241 PARSE_BAD_TYPE = _cfitsio.PARSE_BAD_TYPE
00242 PARSE_LRG_VECTOR = _cfitsio.PARSE_LRG_VECTOR
00243 PARSE_NO_OUTPUT = _cfitsio.PARSE_NO_OUTPUT
00244 PARSE_BAD_COL = _cfitsio.PARSE_BAD_COL
00245 PARSE_BAD_OUTPUT = _cfitsio.PARSE_BAD_OUTPUT
00246 ANGLE_TOO_BIG = _cfitsio.ANGLE_TOO_BIG
00247 BAD_WCS_VAL = _cfitsio.BAD_WCS_VAL
00248 WCS_ERROR = _cfitsio.WCS_ERROR
00249 BAD_WCS_PROJ = _cfitsio.BAD_WCS_PROJ
00250 NO_WCS_KEY = _cfitsio.NO_WCS_KEY
00251 APPROX_WCS_KEY = _cfitsio.APPROX_WCS_KEY
00252 NO_CLOSE_ERROR = _cfitsio.NO_CLOSE_ERROR
00253 NGP_ERRBASE = _cfitsio.NGP_ERRBASE
00254 NGP_OK = _cfitsio.NGP_OK
00255 NGP_NO_MEMORY = _cfitsio.NGP_NO_MEMORY
00256 NGP_READ_ERR = _cfitsio.NGP_READ_ERR
00257 NGP_NUL_PTR = _cfitsio.NGP_NUL_PTR
00258 NGP_EMPTY_CURLINE = _cfitsio.NGP_EMPTY_CURLINE
00259 NGP_UNREAD_QUEUE_FULL = _cfitsio.NGP_UNREAD_QUEUE_FULL
00260 NGP_INC_NESTING = _cfitsio.NGP_INC_NESTING
00261 NGP_ERR_FOPEN = _cfitsio.NGP_ERR_FOPEN
00262 NGP_EOF = _cfitsio.NGP_EOF
00263 NGP_BAD_ARG = _cfitsio.NGP_BAD_ARG
00264 NGP_TOKEN_NOT_EXPECT = _cfitsio.NGP_TOKEN_NOT_EXPECT
00265 fits_get_token = _cfitsio.fits_get_token
00266
00267 fits_parse_input_url = _cfitsio.fits_parse_input_url
00268
00269 fits_parse_rootname = _cfitsio.fits_parse_rootname
00270
00271 fits_parse_extspec = _cfitsio.fits_parse_extspec
00272
00273 fits_parse_extnum = _cfitsio.fits_parse_extnum
00274
00275 fits_url_type = _cfitsio.fits_url_type
00276
00277 fits_parse_binspec = _cfitsio.fits_parse_binspec
00278
00279 fits_parse_binrange = _cfitsio.fits_parse_binrange
00280
00281 ffimport_file = _cfitsio.ffimport_file
00282
00283 fits_parse_range = _cfitsio.fits_parse_range
00284
00285 fits_open_memfile = _cfitsio.fits_open_memfile
00286
00287 fits_open_file = _cfitsio.fits_open_file
00288
00289 fits_open_data = _cfitsio.fits_open_data
00290
00291 fits_open_table = _cfitsio.fits_open_table
00292
00293 fits_open_image = _cfitsio.fits_open_image
00294
00295 fits_reopen_file = _cfitsio.fits_reopen_file
00296
00297 fits_create_file = _cfitsio.fits_create_file
00298
00299 fits_create_memfile = _cfitsio.fits_create_memfile
00300
00301 fits_create_template = _cfitsio.fits_create_template
00302
00303 fits_flush_file = _cfitsio.fits_flush_file
00304
00305 fits_flush_buffer = _cfitsio.fits_flush_buffer
00306
00307 fits_close_file = _cfitsio.fits_close_file
00308
00309 fits_delete_file = _cfitsio.fits_delete_file
00310
00311 fits_file_name = _cfitsio.fits_file_name
00312
00313 fits_file_mode = _cfitsio.fits_file_mode
00314
00315 fits_get_version = _cfitsio.fits_get_version
00316
00317 fits_uppercase = _cfitsio.fits_uppercase
00318
00319 fits_get_errstatus = _cfitsio.fits_get_errstatus
00320
00321 fits_write_errmsg = _cfitsio.fits_write_errmsg
00322
00323 fits_write_errmark = _cfitsio.fits_write_errmark
00324
00325 fits_read_errmsg = _cfitsio.fits_read_errmsg
00326
00327 fits_clear_errmsg = _cfitsio.fits_clear_errmsg
00328
00329 fits_clear_errmark = _cfitsio.fits_clear_errmark
00330
00331 fits_report_error = _cfitsio.fits_report_error
00332
00333 fits_compare_str = _cfitsio.fits_compare_str
00334
00335 fits_test_keyword = _cfitsio.fits_test_keyword
00336
00337 fits_test_record = _cfitsio.fits_test_record
00338
00339 fits_null_check = _cfitsio.fits_null_check
00340
00341 fits_make_keyn = _cfitsio.fits_make_keyn
00342
00343 fits_make_nkey = _cfitsio.fits_make_nkey
00344
00345 fits_get_keyclass = _cfitsio.fits_get_keyclass
00346
00347 fits_get_keytype = _cfitsio.fits_get_keytype
00348
00349 fits_parse_value = _cfitsio.fits_parse_value
00350
00351 fits_get_keyname = _cfitsio.fits_get_keyname
00352
00353 fits_parse_template = _cfitsio.fits_parse_template
00354
00355 fits_ascii_tform = _cfitsio.fits_ascii_tform
00356
00357 fits_binary_tform = _cfitsio.fits_binary_tform
00358
00359 fits_get_tbcol = _cfitsio.fits_get_tbcol
00360
00361 fits_get_section_range = _cfitsio.fits_get_section_range
00362
00363 fits_write_key = _cfitsio.fits_write_key
00364
00365 fits_write_record = _cfitsio.fits_write_record
00366
00367 fits_write_comment = _cfitsio.fits_write_comment
00368
00369 fits_write_key_unit = _cfitsio.fits_write_key_unit
00370
00371 fits_write_history = _cfitsio.fits_write_history
00372
00373 fits_write_date = _cfitsio.fits_write_date
00374
00375 fits_get_system_time = _cfitsio.fits_get_system_time
00376
00377 fits_get_system_date = _cfitsio.fits_get_system_date
00378
00379 fits_date2str = _cfitsio.fits_date2str
00380
00381 fits_time2str = _cfitsio.fits_time2str
00382
00383 fits_str2date = _cfitsio.fits_str2date
00384
00385 fits_str2time = _cfitsio.fits_str2time
00386
00387 fits_write_key_null = _cfitsio.fits_write_key_null
00388
00389 fits_write_key_str = _cfitsio.fits_write_key_str
00390
00391 fits_write_key_longstr = _cfitsio.fits_write_key_longstr
00392
00393 fits_write_key_longwarn = _cfitsio.fits_write_key_longwarn
00394
00395 fits_write_key_log = _cfitsio.fits_write_key_log
00396
00397 fits_write_key_lng = _cfitsio.fits_write_key_lng
00398
00399 fits_write_key_fixflt = _cfitsio.fits_write_key_fixflt
00400
00401 fits_write_key_flt = _cfitsio.fits_write_key_flt
00402
00403 fits_write_key_fixdbl = _cfitsio.fits_write_key_fixdbl
00404
00405 fits_write_key_dbl = _cfitsio.fits_write_key_dbl
00406
00407 fits_write_key_cmp = _cfitsio.fits_write_key_cmp
00408
00409 fits_write_key_dblcmp = _cfitsio.fits_write_key_dblcmp
00410
00411 fits_write_key_fixcmp = _cfitsio.fits_write_key_fixcmp
00412
00413 fits_write_key_fixdblcmp = _cfitsio.fits_write_key_fixdblcmp
00414
00415 fits_write_key_triple = _cfitsio.fits_write_key_triple
00416
00417 fits_write_tdim = _cfitsio.fits_write_tdim
00418
00419 fits_write_keys_str = _cfitsio.fits_write_keys_str
00420
00421 fits_write_keys_log = _cfitsio.fits_write_keys_log
00422
00423 fits_write_keys_lng = _cfitsio.fits_write_keys_lng
00424
00425 fits_write_keys_fixflt = _cfitsio.fits_write_keys_fixflt
00426
00427 fits_write_keys_flt = _cfitsio.fits_write_keys_flt
00428
00429 fits_write_keys_fixdbl = _cfitsio.fits_write_keys_fixdbl
00430
00431 fits_write_keys_dbl = _cfitsio.fits_write_keys_dbl
00432
00433 fits_copy_key = _cfitsio.fits_copy_key
00434
00435 fits_write_imghdr = _cfitsio.fits_write_imghdr
00436
00437 fits_write_grphdr = _cfitsio.fits_write_grphdr
00438
00439 fits_write_atblhdr = _cfitsio.fits_write_atblhdr
00440
00441 fits_write_btblhdr = _cfitsio.fits_write_btblhdr
00442
00443 fits_write_key_template = _cfitsio.fits_write_key_template
00444
00445 fits_get_hdrspace = _cfitsio.fits_get_hdrspace
00446
00447 fits_get_hdrpos = _cfitsio.fits_get_hdrpos
00448
00449 fits_movabs_key = _cfitsio.fits_movabs_key
00450
00451 fits_movrel_key = _cfitsio.fits_movrel_key
00452
00453 fits_find_nextkey = _cfitsio.fits_find_nextkey
00454
00455 fits_read_record = _cfitsio.fits_read_record
00456
00457 fits_read_card = _cfitsio.fits_read_card
00458
00459 fits_read_key_unit = _cfitsio.fits_read_key_unit
00460
00461 fits_read_keyn = _cfitsio.fits_read_keyn
00462
00463 fits_read_keyword = _cfitsio.fits_read_keyword
00464
00465 fits_read_key = _cfitsio.fits_read_key
00466
00467 fits_read_key_str = _cfitsio.fits_read_key_str
00468
00469 fits_read_key_longstr = _cfitsio.fits_read_key_longstr
00470
00471 fits_read_key_log = _cfitsio.fits_read_key_log
00472
00473 fits_read_key_lng = _cfitsio.fits_read_key_lng
00474
00475 fits_read_key_flt = _cfitsio.fits_read_key_flt
00476
00477 fits_read_key_dbl = _cfitsio.fits_read_key_dbl
00478
00479 fits_read_key_cmp = _cfitsio.fits_read_key_cmp
00480
00481 fits_read_key_dblcmp = _cfitsio.fits_read_key_dblcmp
00482
00483 fits_read_key_triple = _cfitsio.fits_read_key_triple
00484
00485 fits_read_tdim = _cfitsio.fits_read_tdim
00486
00487 fits_decode_tdim = _cfitsio.fits_decode_tdim
00488
00489 fits_read_keys_str = _cfitsio.fits_read_keys_str
00490
00491 fits_read_keys_log = _cfitsio.fits_read_keys_log
00492
00493 fits_read_keys_lng = _cfitsio.fits_read_keys_lng
00494
00495 fits_read_keys_flt = _cfitsio.fits_read_keys_flt
00496
00497 fits_read_keys_dbl = _cfitsio.fits_read_keys_dbl
00498
00499 fits_header2str = _cfitsio.fits_header2str
00500
00501 fits_read_imghdr = _cfitsio.fits_read_imghdr
00502
00503 fits_read_atblhdr = _cfitsio.fits_read_atblhdr
00504
00505 fits_read_btblhdr = _cfitsio.fits_read_btblhdr
00506
00507 fits_update_key = _cfitsio.fits_update_key
00508
00509 fits_update_card = _cfitsio.fits_update_card
00510
00511 fits_update_key_null = _cfitsio.fits_update_key_null
00512
00513 fits_update_key_str = _cfitsio.fits_update_key_str
00514
00515 fits_update_key_longstr = _cfitsio.fits_update_key_longstr
00516
00517 fits_update_key_log = _cfitsio.fits_update_key_log
00518
00519 fits_update_key_lng = _cfitsio.fits_update_key_lng
00520
00521 fits_update_key_fixflt = _cfitsio.fits_update_key_fixflt
00522
00523 fits_update_key_flt = _cfitsio.fits_update_key_flt
00524
00525 fits_update_key_fixdbl = _cfitsio.fits_update_key_fixdbl
00526
00527 fits_update_key_dbl = _cfitsio.fits_update_key_dbl
00528
00529 fits_update_key_cmp = _cfitsio.fits_update_key_cmp
00530
00531 fits_update_key_dblcmp = _cfitsio.fits_update_key_dblcmp
00532
00533 fits_update_key_fixcmp = _cfitsio.fits_update_key_fixcmp
00534
00535 fits_update_key_fixdblcmp = _cfitsio.fits_update_key_fixdblcmp
00536
00537 fits_modify_record = _cfitsio.fits_modify_record
00538
00539 fits_modify_card = _cfitsio.fits_modify_card
00540
00541 fits_modify_name = _cfitsio.fits_modify_name
00542
00543 fits_modify_comment = _cfitsio.fits_modify_comment
00544
00545 fits_modify_key_null = _cfitsio.fits_modify_key_null
00546
00547 fits_modify_key_str = _cfitsio.fits_modify_key_str
00548
00549 fits_modify_key_longstr = _cfitsio.fits_modify_key_longstr
00550
00551 fits_modify_key_log = _cfitsio.fits_modify_key_log
00552
00553 fits_modify_key_lng = _cfitsio.fits_modify_key_lng
00554
00555 fits_modify_key_fixflt = _cfitsio.fits_modify_key_fixflt
00556
00557 fits_modify_key_flt = _cfitsio.fits_modify_key_flt
00558
00559 fits_modify_key_fixdbl = _cfitsio.fits_modify_key_fixdbl
00560
00561 fits_modify_key_dbl = _cfitsio.fits_modify_key_dbl
00562
00563 fits_modify_key_cmp = _cfitsio.fits_modify_key_cmp
00564
00565 fits_modify_key_dblcmp = _cfitsio.fits_modify_key_dblcmp
00566
00567 fits_modify_key_fixcmp = _cfitsio.fits_modify_key_fixcmp
00568
00569 fits_modify_key_fixdblcmp = _cfitsio.fits_modify_key_fixdblcmp
00570
00571 fits_insert_record = _cfitsio.fits_insert_record
00572
00573 fits_insert_card = _cfitsio.fits_insert_card
00574
00575 fits_insert_key_null = _cfitsio.fits_insert_key_null
00576
00577 fits_insert_key_str = _cfitsio.fits_insert_key_str
00578
00579 fits_insert_key_longstr = _cfitsio.fits_insert_key_longstr
00580
00581 fits_insert_key_log = _cfitsio.fits_insert_key_log
00582
00583 fits_insert_key_lng = _cfitsio.fits_insert_key_lng
00584
00585 fits_insert_key_fixflt = _cfitsio.fits_insert_key_fixflt
00586
00587 fits_insert_key_flt = _cfitsio.fits_insert_key_flt
00588
00589 fits_insert_key_fixdbl = _cfitsio.fits_insert_key_fixdbl
00590
00591 fits_insert_key_dbl = _cfitsio.fits_insert_key_dbl
00592
00593 fits_insert_key_cmp = _cfitsio.fits_insert_key_cmp
00594
00595 fits_insert_key_dblcmp = _cfitsio.fits_insert_key_dblcmp
00596
00597 fits_insert_key_fixcmp = _cfitsio.fits_insert_key_fixcmp
00598
00599 fits_insert_key_fixdblcmp = _cfitsio.fits_insert_key_fixdblcmp
00600
00601 fits_delete_key = _cfitsio.fits_delete_key
00602
00603 fits_delete_record = _cfitsio.fits_delete_record
00604
00605 fits_get_hdu_num = _cfitsio.fits_get_hdu_num
00606
00607 fits_get_hdu_type = _cfitsio.fits_get_hdu_type
00608
00609 fits_get_hduaddr = _cfitsio.fits_get_hduaddr
00610
00611 fits_get_hduoff = _cfitsio.fits_get_hduoff
00612
00613 fits_get_img_param = _cfitsio.fits_get_img_param
00614
00615 fits_get_img_type = _cfitsio.fits_get_img_type
00616
00617 fits_get_img_dim = _cfitsio.fits_get_img_dim
00618
00619 fits_get_img_size = _cfitsio.fits_get_img_size
00620
00621 fits_movabs_hdu = _cfitsio.fits_movabs_hdu
00622
00623 fits_movrel_hdu = _cfitsio.fits_movrel_hdu
00624
00625 fits_movnam_hdu = _cfitsio.fits_movnam_hdu
00626
00627 fits_get_num_hdus = _cfitsio.fits_get_num_hdus
00628
00629 fits_create_hdu = _cfitsio.fits_create_hdu
00630
00631 fits_create_img = _cfitsio.fits_create_img
00632
00633 fits_create_tbl = _cfitsio.fits_create_tbl
00634
00635 fits_insert_img = _cfitsio.fits_insert_img
00636
00637 fits_insert_atbl = _cfitsio.fits_insert_atbl
00638
00639 fits_insert_btbl = _cfitsio.fits_insert_btbl
00640
00641 fits_resize_img = _cfitsio.fits_resize_img
00642
00643 fits_delete_hdu = _cfitsio.fits_delete_hdu
00644
00645 fits_copy_hdu = _cfitsio.fits_copy_hdu
00646
00647 fits_copy_file = _cfitsio.fits_copy_file
00648
00649 fits_copy_header = _cfitsio.fits_copy_header
00650
00651 fits_copy_data = _cfitsio.fits_copy_data
00652
00653 ffchfl = _cfitsio.ffchfl
00654
00655 ffcdfl = _cfitsio.ffcdfl
00656
00657 fits_set_hdustruc = _cfitsio.fits_set_hdustruc
00658
00659 fits_set_hdrsize = _cfitsio.fits_set_hdrsize
00660
00661 fits_write_theap = _cfitsio.fits_write_theap
00662
00663 ffcsum = _cfitsio.ffcsum
00664
00665 fits_encode_chksum = _cfitsio.fits_encode_chksum
00666
00667 fits_decode_chksum = _cfitsio.fits_decode_chksum
00668
00669 fits_write_chksum = _cfitsio.fits_write_chksum
00670
00671 fits_update_chksum = _cfitsio.fits_update_chksum
00672
00673 fits_verify_chksum = _cfitsio.fits_verify_chksum
00674
00675 fits_get_chksum = _cfitsio.fits_get_chksum
00676
00677 fits_set_bscale = _cfitsio.fits_set_bscale
00678
00679 fits_set_imgnull = _cfitsio.fits_set_imgnull
00680
00681 fits_set_tscale = _cfitsio.fits_set_tscale
00682
00683 fits_set_btblnull = _cfitsio.fits_set_btblnull
00684
00685 fits_set_atblnull = _cfitsio.fits_set_atblnull
00686
00687 fits_get_colnum = _cfitsio.fits_get_colnum
00688
00689 fits_get_colname = _cfitsio.fits_get_colname
00690
00691 fits_get_coltype = _cfitsio.fits_get_coltype
00692
00693 fits_get_num_cols = _cfitsio.fits_get_num_cols
00694
00695 fits_get_num_rows = _cfitsio.fits_get_num_rows
00696
00697 fits_get_acolparms = _cfitsio.fits_get_acolparms
00698
00699 fits_get_bcolparms = _cfitsio.fits_get_bcolparms
00700
00701 fits_get_rowsize = _cfitsio.fits_get_rowsize
00702
00703 fits_get_col_display_width = _cfitsio.fits_get_col_display_width
00704
00705 fits_read_pix = _cfitsio.fits_read_pix
00706
00707 fits_read_pixnull = _cfitsio.fits_read_pixnull
00708
00709 fits_read_subset = _cfitsio.fits_read_subset
00710
00711 fits_read_img = _cfitsio.fits_read_img
00712
00713 fits_read_imgnull = _cfitsio.fits_read_imgnull
00714
00715 fits_read_img_byt = _cfitsio.fits_read_img_byt
00716
00717 fits_read_img_usht = _cfitsio.fits_read_img_usht
00718
00719 fits_read_img_sht = _cfitsio.fits_read_img_sht
00720
00721 fits_read_img_ulng = _cfitsio.fits_read_img_ulng
00722
00723 fits_read_img_lng = _cfitsio.fits_read_img_lng
00724
00725 fits_read_img_lnglng = _cfitsio.fits_read_img_lnglng
00726
00727 fits_read_img_uint = _cfitsio.fits_read_img_uint
00728
00729 fits_read_img_int = _cfitsio.fits_read_img_int
00730
00731 fits_read_img_flt = _cfitsio.fits_read_img_flt
00732
00733 fits_read_img_dbl = _cfitsio.fits_read_img_dbl
00734
00735 fits_read_imgnull_byt = _cfitsio.fits_read_imgnull_byt
00736
00737 fits_read_imgnull_usht = _cfitsio.fits_read_imgnull_usht
00738
00739 fits_read_imgnull_sht = _cfitsio.fits_read_imgnull_sht
00740
00741 fits_read_imgnull_ulng = _cfitsio.fits_read_imgnull_ulng
00742
00743 fits_read_imgnull_lng = _cfitsio.fits_read_imgnull_lng
00744
00745 fits_read_imgnull_lnglng = _cfitsio.fits_read_imgnull_lnglng
00746
00747 fits_read_imgnull_uint = _cfitsio.fits_read_imgnull_uint
00748
00749 fits_read_imgnull_int = _cfitsio.fits_read_imgnull_int
00750
00751 fits_read_imgnull_flt = _cfitsio.fits_read_imgnull_flt
00752
00753 fits_read_imgnull_dbl = _cfitsio.fits_read_imgnull_dbl
00754
00755 fits_read_2d_byt = _cfitsio.fits_read_2d_byt
00756
00757 fits_read_2d_usht = _cfitsio.fits_read_2d_usht
00758
00759 fits_read_2d_sht = _cfitsio.fits_read_2d_sht
00760
00761 fits_read_2d_ulng = _cfitsio.fits_read_2d_ulng
00762
00763 fits_read_2d_lng = _cfitsio.fits_read_2d_lng
00764
00765 fits_read_2d_lnglng = _cfitsio.fits_read_2d_lnglng
00766
00767 fits_read_2d_uint = _cfitsio.fits_read_2d_uint
00768
00769 fits_read_2d_int = _cfitsio.fits_read_2d_int
00770
00771 fits_read_2d_flt = _cfitsio.fits_read_2d_flt
00772
00773 fits_read_2d_dbl = _cfitsio.fits_read_2d_dbl
00774
00775 fits_read_3d_byt = _cfitsio.fits_read_3d_byt
00776
00777 fits_read_3d_usht = _cfitsio.fits_read_3d_usht
00778
00779 fits_read_3d_sht = _cfitsio.fits_read_3d_sht
00780
00781 fits_read_3d_ulng = _cfitsio.fits_read_3d_ulng
00782
00783 fits_read_3d_lng = _cfitsio.fits_read_3d_lng
00784
00785 fits_read_3d_lnglng = _cfitsio.fits_read_3d_lnglng
00786
00787 fits_read_3d_uint = _cfitsio.fits_read_3d_uint
00788
00789 fits_read_3d_int = _cfitsio.fits_read_3d_int
00790
00791 fits_read_3d_flt = _cfitsio.fits_read_3d_flt
00792
00793 fits_read_3d_dbl = _cfitsio.fits_read_3d_dbl
00794
00795 fits_read_subset_byt = _cfitsio.fits_read_subset_byt
00796
00797 fits_read_subset_usht = _cfitsio.fits_read_subset_usht
00798
00799 fits_read_subset_sht = _cfitsio.fits_read_subset_sht
00800
00801 fits_read_subset_ulng = _cfitsio.fits_read_subset_ulng
00802
00803 fits_read_subset_lng = _cfitsio.fits_read_subset_lng
00804
00805 fits_read_subset_lnglng = _cfitsio.fits_read_subset_lnglng
00806
00807 fits_read_subset_uint = _cfitsio.fits_read_subset_uint
00808
00809 fits_read_subset_int = _cfitsio.fits_read_subset_int
00810
00811 fits_read_subset_flt = _cfitsio.fits_read_subset_flt
00812
00813 fits_read_subset_dbl = _cfitsio.fits_read_subset_dbl
00814
00815 fits_read_subsetnull_byt = _cfitsio.fits_read_subsetnull_byt
00816
00817 fits_read_subsetnull_usht = _cfitsio.fits_read_subsetnull_usht
00818
00819 fits_read_subsetnull_sht = _cfitsio.fits_read_subsetnull_sht
00820
00821 fits_read_subsetnull_ulng = _cfitsio.fits_read_subsetnull_ulng
00822
00823 fits_read_subsetnull_lng = _cfitsio.fits_read_subsetnull_lng
00824
00825 fits_read_subsetnull_lnglng = _cfitsio.fits_read_subsetnull_lnglng
00826
00827 fits_read_subsetnull_uint = _cfitsio.fits_read_subsetnull_uint
00828
00829 fits_read_subsetnull_int = _cfitsio.fits_read_subsetnull_int
00830
00831 fits_read_subsetnull_flt = _cfitsio.fits_read_subsetnull_flt
00832
00833 fits_read_subsetnull_dbl = _cfitsio.fits_read_subsetnull_dbl
00834
00835 fits_read_grppar_byt = _cfitsio.fits_read_grppar_byt
00836
00837 fits_read_grppar_usht = _cfitsio.fits_read_grppar_usht
00838
00839 fits_read_grppar_sht = _cfitsio.fits_read_grppar_sht
00840
00841 fits_read_grppar_ulng = _cfitsio.fits_read_grppar_ulng
00842
00843 fits_read_grppar_lng = _cfitsio.fits_read_grppar_lng
00844
00845 fits_read_grppar_lnglng = _cfitsio.fits_read_grppar_lnglng
00846
00847 fits_read_grppar_uint = _cfitsio.fits_read_grppar_uint
00848
00849 fits_read_grppar_int = _cfitsio.fits_read_grppar_int
00850
00851 fits_read_grppar_flt = _cfitsio.fits_read_grppar_flt
00852
00853 fits_read_grppar_dbl = _cfitsio.fits_read_grppar_dbl
00854
00855 fits_read_col = _cfitsio.fits_read_col
00856
00857 fits_read_colnull = _cfitsio.fits_read_colnull
00858
00859 fits_read_col_str = _cfitsio.fits_read_col_str
00860
00861 ffgcl = _cfitsio.ffgcl
00862
00863 fits_read_col_log = _cfitsio.fits_read_col_log
00864
00865 fits_read_col_byt = _cfitsio.fits_read_col_byt
00866
00867 fits_read_col_usht = _cfitsio.fits_read_col_usht
00868
00869 fits_read_col_sht = _cfitsio.fits_read_col_sht
00870
00871 fits_read_col_ulng = _cfitsio.fits_read_col_ulng
00872
00873 fits_read_col_lng = _cfitsio.fits_read_col_lng
00874
00875 fits_read_col_lnglng = _cfitsio.fits_read_col_lnglng
00876
00877 fits_read_col_uint = _cfitsio.fits_read_col_uint
00878
00879 fits_read_col_int = _cfitsio.fits_read_col_int
00880
00881 fits_read_col_flt = _cfitsio.fits_read_col_flt
00882
00883 fits_read_col_dbl = _cfitsio.fits_read_col_dbl
00884
00885 fits_read_col_cmp = _cfitsio.fits_read_col_cmp
00886
00887 fits_read_col_dblcmp = _cfitsio.fits_read_col_dblcmp
00888
00889 fits_read_col_bit = _cfitsio.fits_read_col_bit
00890
00891 fits_read_col_bit_usht = _cfitsio.fits_read_col_bit_usht
00892
00893 fits_read_col_bit_uint = _cfitsio.fits_read_col_bit_uint
00894
00895 fits_read_colnull_str = _cfitsio.fits_read_colnull_str
00896
00897 fits_read_colnull_log = _cfitsio.fits_read_colnull_log
00898
00899 fits_read_colnull_byt = _cfitsio.fits_read_colnull_byt
00900
00901 fits_read_colnull_usht = _cfitsio.fits_read_colnull_usht
00902
00903 fits_read_colnull_sht = _cfitsio.fits_read_colnull_sht
00904
00905 fits_read_colnull_ulng = _cfitsio.fits_read_colnull_ulng
00906
00907 fits_read_colnull_lng = _cfitsio.fits_read_colnull_lng
00908
00909 fits_read_colnull_lnglng = _cfitsio.fits_read_colnull_lnglng
00910
00911 fits_read_colnull_uint = _cfitsio.fits_read_colnull_uint
00912
00913 fits_read_colnull_int = _cfitsio.fits_read_colnull_int
00914
00915 fits_read_colnull_flt = _cfitsio.fits_read_colnull_flt
00916
00917 fits_read_colnull_dbl = _cfitsio.fits_read_colnull_dbl
00918
00919 fits_read_colnull_cmp = _cfitsio.fits_read_colnull_cmp
00920
00921 fits_read_colnull_dblcmp = _cfitsio.fits_read_colnull_dblcmp
00922
00923 fits_read_descript = _cfitsio.fits_read_descript
00924
00925 fits_read_descripts = _cfitsio.fits_read_descripts
00926
00927 fits_test_heap = _cfitsio.fits_test_heap
00928
00929 fits_compress_heap = _cfitsio.fits_compress_heap
00930
00931 fits_read_tblbytes = _cfitsio.fits_read_tblbytes
00932
00933 fits_write_pix = _cfitsio.fits_write_pix
00934
00935 fits_write_pixnull = _cfitsio.fits_write_pixnull
00936
00937 fits_write_img = _cfitsio.fits_write_img
00938
00939 fits_write_img_byt = _cfitsio.fits_write_img_byt
00940
00941 fits_write_img_usht = _cfitsio.fits_write_img_usht
00942
00943 fits_write_img_sht = _cfitsio.fits_write_img_sht
00944
00945 fits_write_img_ulng = _cfitsio.fits_write_img_ulng
00946
00947 fits_write_img_lng = _cfitsio.fits_write_img_lng
00948
00949 fits_write_img_uint = _cfitsio.fits_write_img_uint
00950
00951 fits_write_img_int = _cfitsio.fits_write_img_int
00952
00953 fits_write_img_flt = _cfitsio.fits_write_img_flt
00954
00955 fits_write_img_dbl = _cfitsio.fits_write_img_dbl
00956
00957 fits_write_img_lnglng = _cfitsio.fits_write_img_lnglng
00958
00959 fits_write_img_null = _cfitsio.fits_write_img_null
00960
00961 fits_write_null_img = _cfitsio.fits_write_null_img
00962
00963 fits_write_imgnull = _cfitsio.fits_write_imgnull
00964
00965 fits_write_imgnull_byt = _cfitsio.fits_write_imgnull_byt
00966
00967 fits_write_imgnull_usht = _cfitsio.fits_write_imgnull_usht
00968
00969 fits_write_imgnull_sht = _cfitsio.fits_write_imgnull_sht
00970
00971 fits_write_imgnull_lng = _cfitsio.fits_write_imgnull_lng
00972
00973 fits_write_imgnull_ulng = _cfitsio.fits_write_imgnull_ulng
00974
00975 fits_write_imgnull_uint = _cfitsio.fits_write_imgnull_uint
00976
00977 fits_write_imgnull_int = _cfitsio.fits_write_imgnull_int
00978
00979 fits_write_imgnull_flt = _cfitsio.fits_write_imgnull_flt
00980
00981 fits_write_imgnull_dbl = _cfitsio.fits_write_imgnull_dbl
00982
00983 fits_write_imgnull_lnglng = _cfitsio.fits_write_imgnull_lnglng
00984
00985 fits_write_2d_byt = _cfitsio.fits_write_2d_byt
00986
00987 fits_write_2d_usht = _cfitsio.fits_write_2d_usht
00988
00989 fits_write_2d_sht = _cfitsio.fits_write_2d_sht
00990
00991 fits_write_2d_ulng = _cfitsio.fits_write_2d_ulng
00992
00993 fits_write_2d_lng = _cfitsio.fits_write_2d_lng
00994
00995 fits_write_2d_uint = _cfitsio.fits_write_2d_uint
00996
00997 fits_write_2d_int = _cfitsio.fits_write_2d_int
00998
00999 fits_write_2d_flt = _cfitsio.fits_write_2d_flt
01000
01001 fits_write_2d_dbl = _cfitsio.fits_write_2d_dbl
01002
01003 fits_write_2d_lnglng = _cfitsio.fits_write_2d_lnglng
01004
01005 fits_write_3d_byt = _cfitsio.fits_write_3d_byt
01006
01007 fits_write_3d_usht = _cfitsio.fits_write_3d_usht
01008
01009 fits_write_3d_sht = _cfitsio.fits_write_3d_sht
01010
01011 fits_write_3d_ulng = _cfitsio.fits_write_3d_ulng
01012
01013 fits_write_3d_lng = _cfitsio.fits_write_3d_lng
01014
01015 fits_write_3d_uint = _cfitsio.fits_write_3d_uint
01016
01017 fits_write_3d_int = _cfitsio.fits_write_3d_int
01018
01019 fits_write_3d_flt = _cfitsio.fits_write_3d_flt
01020
01021 fits_write_3d_dbl = _cfitsio.fits_write_3d_dbl
01022
01023 fits_write_3d_lnglng = _cfitsio.fits_write_3d_lnglng
01024
01025 fits_write_subset = _cfitsio.fits_write_subset
01026
01027 fits_write_subset_byt = _cfitsio.fits_write_subset_byt
01028
01029 fits_write_subset_usht = _cfitsio.fits_write_subset_usht
01030
01031 fits_write_subset_sht = _cfitsio.fits_write_subset_sht
01032
01033 fits_write_subset_ulng = _cfitsio.fits_write_subset_ulng
01034
01035 fits_write_subset_lng = _cfitsio.fits_write_subset_lng
01036
01037 fits_write_subset_uint = _cfitsio.fits_write_subset_uint
01038
01039 fits_write_subset_int = _cfitsio.fits_write_subset_int
01040
01041 fits_write_subset_flt = _cfitsio.fits_write_subset_flt
01042
01043 fits_write_subset_dbl = _cfitsio.fits_write_subset_dbl
01044
01045 fits_write_subset_lnglng = _cfitsio.fits_write_subset_lnglng
01046
01047 fits_write_grppar_byt = _cfitsio.fits_write_grppar_byt
01048
01049 fits_write_grppar_usht = _cfitsio.fits_write_grppar_usht
01050
01051 fits_write_grppar_sht = _cfitsio.fits_write_grppar_sht
01052
01053 fits_write_grppar_ulng = _cfitsio.fits_write_grppar_ulng
01054
01055 fits_write_grppar_lng = _cfitsio.fits_write_grppar_lng
01056
01057 fits_write_grppar_uint = _cfitsio.fits_write_grppar_uint
01058
01059 fits_write_grppar_int = _cfitsio.fits_write_grppar_int
01060
01061 fits_write_grppar_flt = _cfitsio.fits_write_grppar_flt
01062
01063 fits_write_grppar_dbl = _cfitsio.fits_write_grppar_dbl
01064
01065 fits_write_grppar_lnglng = _cfitsio.fits_write_grppar_lnglng
01066
01067 fits_iter_set_by_name = _cfitsio.fits_iter_set_by_name
01068
01069 fits_iter_set_by_num = _cfitsio.fits_iter_set_by_num
01070
01071 fits_iter_set_file = _cfitsio.fits_iter_set_file
01072
01073 fits_iter_set_colname = _cfitsio.fits_iter_set_colname
01074
01075 fits_iter_set_colnum = _cfitsio.fits_iter_set_colnum
01076
01077 fits_iter_set_datatype = _cfitsio.fits_iter_set_datatype
01078
01079 fits_iter_set_iotype = _cfitsio.fits_iter_set_iotype
01080
01081 fits_iter_get_file = _cfitsio.fits_iter_get_file
01082
01083 fits_iter_get_colname = _cfitsio.fits_iter_get_colname
01084
01085 fits_iter_get_colnum = _cfitsio.fits_iter_get_colnum
01086
01087 fits_iter_get_datatype = _cfitsio.fits_iter_get_datatype
01088
01089 fits_iter_get_iotype = _cfitsio.fits_iter_get_iotype
01090
01091 fits_iter_get_array = _cfitsio.fits_iter_get_array
01092
01093 fits_iter_get_tlmin = _cfitsio.fits_iter_get_tlmin
01094
01095 fits_iter_get_tlmax = _cfitsio.fits_iter_get_tlmax
01096
01097 fits_iter_get_repeat = _cfitsio.fits_iter_get_repeat
01098
01099 fits_iter_get_tunit = _cfitsio.fits_iter_get_tunit
01100
01101 fits_iter_get_tdisp = _cfitsio.fits_iter_get_tdisp
01102
01103 fits_iterate_data = _cfitsio.fits_iterate_data
01104
01105 fits_write_col = _cfitsio.fits_write_col
01106
01107 fits_write_col_str = _cfitsio.fits_write_col_str
01108
01109 fits_write_col_log = _cfitsio.fits_write_col_log
01110
01111 fits_write_col_byt = _cfitsio.fits_write_col_byt
01112
01113 fits_write_col_usht = _cfitsio.fits_write_col_usht
01114
01115 fits_write_col_sht = _cfitsio.fits_write_col_sht
01116
01117 fits_write_col_ulng = _cfitsio.fits_write_col_ulng
01118
01119 fits_write_col_lng = _cfitsio.fits_write_col_lng
01120
01121 fits_write_col_uint = _cfitsio.fits_write_col_uint
01122
01123 fits_write_col_int = _cfitsio.fits_write_col_int
01124
01125 fits_write_col_flt = _cfitsio.fits_write_col_flt
01126
01127 fits_write_col_dbl = _cfitsio.fits_write_col_dbl
01128
01129 fits_write_col_cmp = _cfitsio.fits_write_col_cmp
01130
01131 fits_write_col_dblcmp = _cfitsio.fits_write_col_dblcmp
01132
01133 fits_write_col_null = _cfitsio.fits_write_col_null
01134
01135 fits_write_col_bit = _cfitsio.fits_write_col_bit
01136
01137 fits_write_col_lnglng = _cfitsio.fits_write_col_lnglng
01138
01139 fits_write_colnull = _cfitsio.fits_write_colnull
01140
01141 fits_write_colnull_str = _cfitsio.fits_write_colnull_str
01142
01143 fits_write_colnull_log = _cfitsio.fits_write_colnull_log
01144
01145 fits_write_colnull_byt = _cfitsio.fits_write_colnull_byt
01146
01147 fits_write_colnull_usht = _cfitsio.fits_write_colnull_usht
01148
01149 fits_write_colnull_sht = _cfitsio.fits_write_colnull_sht
01150
01151 fits_write_colnull_ulng = _cfitsio.fits_write_colnull_ulng
01152
01153 fits_write_colnull_lng = _cfitsio.fits_write_colnull_lng
01154
01155 fits_write_colnull_uint = _cfitsio.fits_write_colnull_uint
01156
01157 fits_write_colnull_int = _cfitsio.fits_write_colnull_int
01158
01159 fits_write_colnull_flt = _cfitsio.fits_write_colnull_flt
01160
01161 fits_write_colnull_dbl = _cfitsio.fits_write_colnull_dbl
01162
01163 fits_write_colnull_lnglng = _cfitsio.fits_write_colnull_lnglng
01164
01165 fits_write_descript = _cfitsio.fits_write_descript
01166
01167 fits_write_tblbytes = _cfitsio.fits_write_tblbytes
01168
01169 fits_insert_rows = _cfitsio.fits_insert_rows
01170
01171 fits_delete_rows = _cfitsio.fits_delete_rows
01172
01173 fits_delete_rowrange = _cfitsio.fits_delete_rowrange
01174
01175 fits_delete_rowlist = _cfitsio.fits_delete_rowlist
01176
01177 fits_insert_col = _cfitsio.fits_insert_col
01178
01179 fits_insert_cols = _cfitsio.fits_insert_cols
01180
01181 fits_modify_vector_len = _cfitsio.fits_modify_vector_len
01182
01183 fits_delete_col = _cfitsio.fits_delete_col
01184
01185 fits_copy_col = _cfitsio.fits_copy_col
01186
01187 fits_read_img_coord = _cfitsio.fits_read_img_coord
01188
01189 fits_read_tbl_coord = _cfitsio.fits_read_tbl_coord
01190
01191 fits_pix_to_world = _cfitsio.fits_pix_to_world
01192
01193 fits_world_to_pix = _cfitsio.fits_world_to_pix
01194
01195 fits_test_expr = _cfitsio.fits_test_expr
01196
01197 fits_find_rows = _cfitsio.fits_find_rows
01198
01199 fits_find_first_row = _cfitsio.fits_find_first_row
01200
01201 fits_find_rows_cmp = _cfitsio.fits_find_rows_cmp
01202
01203 fits_select_rows = _cfitsio.fits_select_rows
01204
01205 fits_calc_rows = _cfitsio.fits_calc_rows
01206
01207 fits_calculator_rng = _cfitsio.fits_calculator_rng
01208
01209 fits_calculator = _cfitsio.fits_calculator
01210
01211 ffhist = _cfitsio.ffhist
01212
01213 fits_select_image_section = _cfitsio.fits_select_image_section
01214
01215 fits_create_group = _cfitsio.fits_create_group
01216
01217 fits_insert_group = _cfitsio.fits_insert_group
01218
01219 fits_change_group = _cfitsio.fits_change_group
01220
01221 fits_remove_group = _cfitsio.fits_remove_group
01222
01223 fits_copy_group = _cfitsio.fits_copy_group
01224
01225 fits_merge_groups = _cfitsio.fits_merge_groups
01226
01227 fits_compact_group = _cfitsio.fits_compact_group
01228
01229 fits_verify_group = _cfitsio.fits_verify_group
01230
01231 fits_open_group = _cfitsio.fits_open_group
01232
01233 fits_add_group_member = _cfitsio.fits_add_group_member
01234
01235 fits_get_num_members = _cfitsio.fits_get_num_members
01236
01237 fits_get_num_groups = _cfitsio.fits_get_num_groups
01238
01239 fits_open_member = _cfitsio.fits_open_member
01240
01241 fits_copy_member = _cfitsio.fits_copy_member
01242
01243 fits_transfer_member = _cfitsio.fits_transfer_member
01244
01245 fits_remove_member = _cfitsio.fits_remove_member
01246
01247 fits_execute_template = _cfitsio.fits_execute_template
01248
01249 fits_set_compression_type = _cfitsio.fits_set_compression_type
01250
01251 fits_set_tile_dim = _cfitsio.fits_set_tile_dim
01252
01253 fits_set_noise_bits = _cfitsio.fits_set_noise_bits
01254
01255 fits_get_compression_type = _cfitsio.fits_get_compression_type
01256
01257 fits_get_tile_dim = _cfitsio.fits_get_tile_dim
01258
01259 fits_get_noise_bits = _cfitsio.fits_get_noise_bits
01260
01261 fits_compress_img = _cfitsio.fits_compress_img
01262
01263 fits_is_compressed_image = _cfitsio.fits_is_compressed_image
01264
01265 fits_decompress_img = _cfitsio.fits_decompress_img
01266
01267
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

AcdHWMultiplexer Member List

This is the complete list of members for AcdHWMultiplexer, including all inherited members.

__init__(GEM) | AcdHWMultiplexer
abort() | AcdHWMultiplexer
dwell(d=None) | AcdHWMultiplexer
resume() | AcdHWMultiplexer
shutdown() | AcdHWMultiplexer
start() | AcdHWMultiplexer
stats() | AcdHWMultiplexer
stop() | AcdHWMultiplexer
tileList(tList=None) | AcdHWMultiplexer

Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Consumer Member List

This is the complete list of members for Consumer, including all inherited members.

__init__(argv) | Consumer
archiveClose(fn) | Consumer
archiveOpen(fn) | Consumer
checkUDF() (defined in Consumer) | Consumer
dataSize() | Consumer
fileClose() | Consumer
fileOpen(fn) | Consumer
getNextEvent() | Consumer
getRunId() (defined in Consumer) | Consumer
loop() (defined in Consumer) | Consumer
parseArgs(argv) (defined in Consumer) | Consumer
parseEvent() | Consumer
serverClose() | Consumer
serverOpen(server="1") | Consumer
setRunId(runId) (defined in Consumer) | Consumer
usage() (defined in Consumer) | Consumer

Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

consumerPlotter Member List

This is the complete list of members for consumerPlotter, including all inherited members.

__init__(argv) | consumerPlotter
addExportedFile(file, delete=False) (defined in consumerPlotter) | consumerPlotter
archiveClose(fn) | Consumer
archiveOpen(fn) | Consumer
checkLimits() (defined in consumerPlotter) | consumerPlotter
checkUDF() (defined in consumerPlotter) | consumerPlotter
dataSize() | Consumer
exportFiles() (defined in consumerPlotter) | consumerPlotter
fileClose() | Consumer
fileOpen(fn) | Consumer
getCompletionStatus() (defined in consumerPlotter) | consumerPlotter
getCompletionStatusStr() (defined in consumerPlotter) | consumerPlotter
getName() (defined in consumerPlotter) | consumerPlotter
getNextEvent() | Consumer
getRunId() (defined in Consumer) | Consumer
loop() (defined in Consumer) | Consumer
parseArgs(argv) (defined in Consumer) | Consumer
parseEvent() | consumerPlotter
serverClose() | Consumer
serverOpen(server="1") | Consumer
setCompletionStatus(status) (defined in consumerPlotter) | consumerPlotter
setRunId(runId) (defined in Consumer) | Consumer
usage() (defined in Consumer) | Consumer

Generated on Fri Jan 21 18:00:57 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DataDistributorAddress Member List

This is the complete list of members for DataDistributorAddress, including all inherited members.

lookup(port, server) | DataDistributorAddress | [static]
port(name) | DataDistributorAddress | [static]

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DataDistributorClient Member List

This is the complete list of members for DataDistributorClient, including all inherited members.

__init__(name=None, length=4096) | DataDistributorClient
connect(server) | DataDistributorClient
disconnect() | DataDistributorClient
receive() | DataDistributorClient
returnNone() | DataDistributorClient

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DataDistributorServer Member List

This is the complete list of members for DataDistributorServer, including all inherited members.

__init__(name=None) | DataDistributorServer
connect(server) | DataDistributorServer
disconnect() | DataDistributorServer
publish(data) | DataDistributorServer

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DataDistributorPoll Member List

This is the complete list of members for DataDistributorPoll, including all inherited members.

__init__(name) | DataDistributorPoll
receive() | DataDistributorPoll
start() | DataDistributorPoll
stop() | DataDistributorPoll

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DataExport Member List

This is the complete list of members for DataExport, including all inherited members.

__init__() (defined in DataExport) | DataExport
export(source, dest) | DataExport
exportDir(sourceDir, destDir) | DataExport
exportFile(sourceFile, destFile) | DataExport
md5sum(fname) | DataExport
setPurge(purge) (defined in DataExport) | DataExport
synch(source, dest) | DataExport

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GExportException Member List

This is the complete list of members for GExportException, including all inherited members.

__init__(status) (defined in GExportException) | GExportException
__str__() (defined in GExportException) | GExportException

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

_Anonymous Member List

This is the complete list of members for _Anonymous, including all inherited members.

__repr__() (defined in _Parameter) _Parameter

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

_Any Member List

This is the complete list of members for _Any, including all inherited members.

__repr__() (defined in _Parameter) _Parameter

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

_Parameter Member List

This is the complete list of members for _Parameter, including all inherited members.

__repr__() (defined in _Parameter) _Parameter

Generated on Fri Jan 21 18:00:58 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Alphabetical List

LATTE Class Index

_ | A | B | C | D | E | F | G | H | L | M | N | P | R | S | T | U | Z

_
GAEM (gAEM) HskCollector (HskCollector) SGETrgEngines (SimpleGasuExample) TrgTriggerStats (TrgTriggerCounters)
_Anonymous (dispatcher) GAEQ (gAEM) HskFileRecorder (HskRecorder) SGETrgEngines (testAppAcdScalers) TrgUsingTiles (TrgUsingTiles)
_Any (dispatcher) GAFE (gAEM) HskHandler (HskCli) SGETrgInputEnables (SimpleGasuExample)
U
_Attr (gAttr) GARC (gAEM) HskLatRetriever (HskRetriever) SGETrgInputEnables (testAppAcdScalers) UDPReceiver (Receiver)
_Parameter (dispatcher) Gattr (gAttr) HskPacketRetriever (HskPacketRetriever) SimpleGasuExample (SimpleGasuExample) UDPRecorder (Recorder)
A
GattrBF (gAttr) HskTestRetriever (HskRetriever) SimpleGasuExample (testAppAcdScalers) userApplication (testAppEvtTO)
AcdHWMultiplexer (AcdHWMultiplexer) GattrDlc (gAttr) HTEM (gHSK) singleEvtDisplayImpl (gosedImpl) userApplication (hTestStrip)
ACDmap (TrgGemRegisterGeometry) GattrHsk (gHdb)
L
SolicitedCondition (testAppAcdScalers) userApplication (testSAppCal)
AddableRoi (TrgRoiAsTiles) GattrRaw (gAttr) LATsweep (LATsweep) SolicitedCondition (SimpleGasuExample) userApplication (nullApp)
AEM (gEvtCli) GattrReg (gAttr) LDBI_LATcontributionIterator (testAppAcdScalers) SolicitedEngine (SimpleGasuExample) userApplication (testAppEvt)
B
GCCC (gTEM) LogRecordStreamHandler (MSGLogGUIImpl) SolicitedEngine (testAppAcdScalers) userApplication (testAppArchiver)
BoundMethodWeakref (saferef) GCFE (gTEM)
M
standardTestReport (standardPlotter) userApplication (testAppAcd)
C
Gconstraint (gConstraint) MarkerTrgReadout (testAppAcdScalers) SweepMarkerEngine (rcTrgFunctions) userApplication (testAppAcdScalers)
CALcontributionIterator2 (GOSED_LDF) GconstraintBase (gConstraint) MiniGLTExample (MiniGLTExample)
T
userApplication (hTestAppEvt)
ccsdsHeader (HskPacketDecoder) GconstraintLimit (gConstraint) MiniGLTExample (testAppAcdScalers) TaskEngine (taskEngine) userApplication (testAppEvtCli)
ccsdsPacket (HskPacketDecoder) GconstraintLimitPegRE (gConstraint) MiniGLTExample (test_evt_cal) TKRcontributionIterator (GOSED_LDF) userApplication (testAppCal)
Consumer (consumer) GconstraintLimitRE (gConstraint) MiniGLTSolicitedCondition (MiniGLTExample) TrgAbstract (TrgAbstract) userApplication (testAppLDFdump)
consumerPlotter (consumerPlotter) gConstraintViolation (gConstraint) MiniGLTSolicitedCondition (testAppAcdScalers) TrgCalorimeter (TrgTower) userApplication (testAppAlarm)
D
GCRC (gTEM) MiniGLTSolicitedCondition (test_evt_cal) TrgCmdCounters (TrgCmdCounters) userApplication (testSAppEvt)
DataDistributorAddress (DataDistributor) GCRU (gCRU) MiniGLTSolicitedEngine (MiniGLTExample) TrgCmdStats (TrgCmdCounters) userApplication (hTestEnv)
DataDistributorClient (DataDistributor) Gdb (gDb) MiniGLTSolicitedEngine (testAppAcdScalers) TrgCnoEnables (TrgInputEnables) userApplication (hTestAppTkr)
DataDistributorPoll (DataDistributorPoll) GDBN (RunControlCommon) MiniGLTSolicitedEngine (test_evt_cal) TrgCoincidence (TrgCoincidences) userApplication (testAppTkr)
DataDistributorServer (DataDistributor) GEBM (gEBM) MiniGLTTrgConditionsValue (TrgMiniGLT) TrgCoincidences (TrgCoincidences) userApplication (testAppCal_dg)
DataExport (DataExport) GEBMC (gEBM) myLATcomponentIterator (GOSED_LDF) TrgConditions (TrgConditions) userApplication (excApp)
DefaultPeriodicCondition (TrgUsingTiles) GEBMST (gEBM)
N
TrgConditionsValue (TrgConditionsValue) userArgText (testAppEvt)
DispatcherError (errors) GEGU (gEGU) NoCnoEnabled (NullObjects) TrgDefaultPeriodicCondition (TrgPeriodic) userArgText (testAppTkr)
DispatcherKeyError (errors) GEGU_linear (gEGU) NoInputsEnabled (NullObjects) TrgDefaultSequence (TrgSequence) userArgText (testSAppCal)
DispatcherTypeError (errors) GEGU_poly3 (gEGU) NoTilesEnabled (NullObjects) TrgEngine (TrgEngines) userArgText (excApp)
drawHatACD (GOSEDPainter) GEM (gEvtCli) NullCal (NullObjects) TrgEngineRequest (TrgEngines) userArgText (testAppCal)
drawSide1ACD (GOSEDPainter) GExportException (DataExport) NullCoincidence (NullObjects) TrgEngines (TrgEngines) userArgText (testAppAlarm)
drawSide2ACD (GOSEDPainter) GGEM (gGEM) NullEngine (NullObjects) TrgEventCounter (TrgEventCounter) userArgText (hTestEnv)
drawSide3ACD (GOSEDPainter) GGEMC (gGEM) NullRequest (NullObjects) TrgGem (TrgGem) userArgText (testAppAcd)
drawSide4ACD (GOSEDPainter) GGEMIE (gGEM) NullRoi (NullObjects) TrgGemAbstract (TrgGemAbstract) userArgText (testSAppEvt)
drawXZ_CAL (GOSEDPainter) GGEMMG (gGEM) NullStream (GlobalPanelImpl) TrgGemCmdCounters (TrgGemCounters) userArgText (hTestAppTkr)
drawXZ_TKR (GOSEDPainter) GGEMSC (gGEM) NullTkr (NullObjects) TrgGemCmdStats (TrgGemCounters) userArgText (testAppCal_dg)
drawYZ_CAL (GOSEDPainter) GGEMST (gGEM) NullTower (NullObjects) TrgGemEventCounter (TrgGemCounters) userArgText (hTestStrip)
drawYZ_TKR (GOSEDPainter) GGEMVG (gGEM)
P
TrgGemPeriodicCondition (TrgGemPeriodicCondition) userArgText (testAppEvtCli)
DummyRecorder (Recorder) GGEMW (gGEM) Preferences (rcPreferencesManager) TrgGemRegisters (TrgGemRegisters) userArgText (testAppLDFdump)
DummyRetriever (Retriever) GGLT (gGLT)
R
TrgGemSequence (TrgGemSequence) userArgText (testAppEvtTO)
E
GHSK (gHSK) rcArchiver (rcArchiver) TrgGemTileCounters (TrgGemCounters) userArgText (testAppAcdScalers)
evAEM_PHA (gEvtCli) GLAT (gLAT) rcCompletionStatus (rcComplStatus) TrgGemTileStats (TrgGemCounters) userArgText (hTestAppEvt)
evCAL_LayerLogData (gEvtCli) GLCB (gLCB) rcGEMDefaultTrigger (rcDefaultTrigger) TrgGemTriggerCounters (TrgGemCounters) userArgText (testAppArchiver)
evCAL_LogAccepts (gEvtCli) GMem (gMem) rcGEMTrgEngines (rcDefaultTrigger) TrgGemTriggerStats (TrgGemCounters) userArgument (testAppCal_dg)
evCAL_LogData (gEvtCli) GNAT (gNAT) rcMiniGLTDefaultTrigger (rcDefaultTrigger) TrgInjectCharge (TrgEngines) userArgument (excApp)
evCellHeader (gEvtCli) GOCS (gOCS) rcMiniGLTSolicitedCondition (rcDefaultTrigger) TrgInjectChargeReadout (TrgEngines) userArgument (testAppEvt)
evContPacket (gEvtCli) GPDU (gPDU) rcMiniGLTSolicitedEngine (rcDefaultTrigger) TrgInjectMarker (TrgEngines) userArgument (hTestStrip)
evDiag_CalLayer (gEvtCli) GPEQ (gPDU) rcScmCfgSelector (rcScmCfgSelector) TrgInputEnables (TrgInputEnables) userArgument (testSAppCal)
evDiag_CalLayerEnd (gEvtCli) Grule (gRule) rcScmCfgSelText (rcScmCfgSelector) TrgMiniGLT (TrgMiniGLT) userArgument (hTestAppTkr)
evDiag_Data (gEvtCli) GruleAlarms (gRule) rcSecurityMan (rcSecurityMan) TrgMiniGLTAbstract (TrgMiniGLTAbstract) userArgument (testAppCal)
evDiag_TkrTrgReq (gEvtCli) GruleBase (gRule) rcSolicitedCondition (rcDefaultTrigger) TrgMiniGLTRegisters (TrgMiniGLTRegisters) userArgument (testAppLDFdump)
evErr_CablePhase (gEvtCli) GruleLimit (gRule) rcSolicitedEngine (rcDefaultTrigger) TrgObject (TrgObject) userArgument (testAppEvtCli)
evErr_CableTimeOut (gEvtCli) GTCC (gTEM) rcTestReport (rcTestReport) TrgPeriodicCondition (TrgPeriodic) userArgument (hTestAppEvt)
evErr_GCCC (gEvtCli) GTEM (gTEM) rcTransitions (rcTransitions) TrgPeriodicConditionAbstract (TrgPeriodic) userArgument (testAppAcd)
evErr_GCCC_Message (gEvtCli) GTFE (gTEM) rcTrgCoincidence (rcTrgFunctions) TrgPeriodicConditionDefinition (TrgPeriodic) userArgument (hTestEnv)
evErr_GTCC (gEvtCli) GTIC (gTEM) rcTrgEngines (rcTrgFunctions) TrgReadout (TrgEngines) userArgument (testSAppEvt)
evErr_GTCC_Message (gEvtCli) GTRC (gTEM) rcTrgGem (rcTrgGem) TrgRoi (TrgCoincidences) userArgument (testAppTkr)
evErr_Summary (gEvtCli) GTWR (gXBR) rcTrgMiniGLT (rcTrgMiniGLT) TrgRoiAsTiles (TrgRoiAsTiles) userArgument (testAppArchiver)
evGEM_Veto_List (gEvtCli) GUIbridge (guiBridges) rcTrgTileEnables (rcTrgFunctions) TrgRois (TrgCoincidences) userArgument (testAppAcdScalers)
evSummary (gEvtCli) GXBRD (gXBR) rcUser (rcUsers) TrgSequence (TrgSequence) userArgument (testAppEvtTO)
Evt (gEvtCli)
H
rcUsers (rcUsers) TrgSequenceAbstract (TrgSequence) userArgument (testAppAlarm)
EvtCli (gEvtCli) HAEM (gHSK) Receiver (Receiver) TrgSequenceDefinition (TrgSequence) userSuite (testSuite2)
EvtCliIO (gEvtCli) HARC (gHSK) Recorder (Recorder) TrgTileCounters (TrgTileCounters) userSuite (testSuite)
evTKR_Strip (gEvtCli) HCOM (gHSK) RegisterInterface (HskRegisters) TrgTileEnables (TrgInputEnables) userSuite (testSuiteLong)
evTKR_StripData (gEvtCli) HCPU (gHSK) Reloader (rcUtil) TrgTileStats (TrgTileCounters)
Z
evTKR_TOTdata (gEvtCli) HEBM (gHSK) ReverseTrendMap (TrendMaps) TrgTower (TrgTower) ZsupSolicitedEngine (test_evt_cal)
ExceptionFSM (FSM) HGEM (gHSK) RunControl (RunControl) TrgTowerEnables (TrgInputEnables) ZsupSolicitedEngine (test_evt_tkr)
F
HNUL (gHSK) RunControlCommon (RunControlCommon) TrgTowers (TrgTower) ZsupTrgInjectChargeReadout (test_evt_cal)
FSM (FSM) HPDU (gHSK) RunControlFileHandler (RunControlCommon) TrgTracker (TrgTower) ZsupTrgReadout (MiniGLTExample)
FullCondition (testAppAcdScalers) HskAlarmRecorder (HskRecorder) RunControlMain (RunControlMain) TrgTriggerCounters (TrgTriggerCounters) ZsupTrgReadout (SimpleGasuExample)
G
HskCli (HskCli)
S

_ | A | B | C | D | E | F | G | H | L | M | N | P | R | S | T | U | Z

Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
commandSynch() (defined in userApplication) | userApplication
getName() (defined in userApplication) | userApplication
pause() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgText Member List

This is the complete list of members for userArgText, including all inherited members.

__init__() (defined in userArgText) | userArgText
getValue(caption) (defined in userArgText) | userArgText

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgument Member List

This is the complete list of members for userArgument, including all inherited members.

__init__(parent=None, name=None, modal=0, fl=0) (defined in userArgument) | userArgument
CancelButtonClicked() (defined in userArgument) | userArgument
getValue(caption) (defined in userArgument) | userArgument
getValueExc(caption) (defined in userArgument) | userArgument
OKButtonClicked() (defined in userArgument) | userArgument

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ExceptionFSM Member List

This is the complete list of members for ExceptionFSM, including all inherited members.

__init__(value) (defined in ExceptionFSM) | ExceptionFSM
__str__() (defined in ExceptionFSM) | ExceptionFSM

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

FSM Member List

This is the complete list of members for FSM, including all inherited members.

__init__(initial_state, something) | FSM
add_transition(input_symbol, state, action, next_state) | FSM
add_transition_any(state, action, next_state) | FSM
add_transition_list(list_input_symbols, state, action, next_state) | FSM
get_transition(input_symbol, state) | FSM
process(input_symbol) | FSM
process_list(s) | FSM
reset() | FSM
set_default_transition(action, next_state) | FSM

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GAEM Member List

This is the complete list of members for GAEM, including all inherited members.

__init__(client, parent) | GAEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allARC() | GAEM
downAEQ() | GAEM
downARC(arcId) | GAEM
existsAEQ() | GAEM
existsARC(arcId) | GAEM
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GAEM) | GAEM
read(reg) (defined in GAEM) | GAEM
root() | Gdb
send(cmd) (defined in GAEM) | GAEM
up() | Gdb

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GAEQ Member List

This is the complete list of members for GAEQ, including all inherited members.

__init__(client, parent) | GAEQ
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GAEQ) | GAEQ
read(reg) (defined in GAEQ) | GAEQ
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GAFE Member List

This is the complete list of members for GAFE, including all inherited members.

__init__(client, parent, id) | GAFE
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GAFE) | GAFE
read(reg) (defined in GAFE) | GAFE
root() | Gdb
send(cmd) (defined in GAFE) | GAFE
up() | Gdb

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GARC Member List

This is the complete list of members for GARC, including all inherited members.

__init__(client, parent, id) | GARC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allAFE() | GARC
downAFE(afeId) | GARC
existsAFE(afeId) | GARC
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GARC) | GARC
read(reg) (defined in GARC) | GARC
root() | Gdb
send(cmd) (defined in GARC) | GARC
up() | Gdb

Generated on Fri Jan 21 18:00:59 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

_Attr Member List

This is the complete list of members for _Attr, including all inherited members.

__init__(node, attr) (defined in _Attr) | _Attr
flags() (defined in _Attr) | _Attr
getConstraint() | _Attr
getEGU() | _Attr
getName() (defined in _Attr) | _Attr
getNode() (defined in _Attr) | _Attr
getRule() | _Attr
getTimeStamp() | _Attr
id() (defined in _Attr) | _Attr
isCommand() (defined in _Attr) | _Attr
isNoDirectAccess() | _Attr
isReadOnly() | _Attr
isReadWrite() | _Attr
isWriteOnly() | _Attr
setConstraint(constraint) | _Attr
setEGU(egu) | _Attr
setRule(rule) | _Attr
setTimeStamp(value) (defined in _Attr) | _Attr
size() | _Attr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Gattr Member List

This is the complete list of members for Gattr, including all inherited members.

__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in Gattr) | Gattr
flags() (defined in Gattr) | Gattr
get(node, bypass=0) (defined in Gattr) | Gattr
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, value, bypass=0) (defined in Gattr) | Gattr
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GattrBF Member List

This is the complete list of members for GattrBF, including all inherited members.

__init__(name, regno, start, end, flags=ATTR_READ_WRITE) | GattrBF
gAttr::Gattr::__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in Gattr) | Gattr
flags() (defined in Gattr) | Gattr
get(node, bypass=0) | GattrBF
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, val, bypass=0) | GattrBF
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GattrDlc Member List

This is the complete list of members for GattrDlc, including all inherited members.

__init__(name, cmdNo, size=0, flags=ATTR_COMMAND) (defined in GattrDlc) | GattrDlc
gAttr::Gattr::__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in Gattr) | Gattr
flags() (defined in Gattr) | Gattr
get(node, bypass=0) (defined in Gattr) | Gattr
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, args) | GattrDlc
set(node, value, bypass=0) (defined in Gattr) | Gattr
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GattrRaw Member List

This is the complete list of members for GattrRaw, including all inherited members.

__init__(name, regno, size, flags=ATTR_READ_WRITE) | GattrRaw
gAttr::Gattr::__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in Gattr) | Gattr
flags() (defined in Gattr) | Gattr
get(node, bypass=0) | GattrRaw
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, val, bypass=0) | GattrRaw
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GattrReg Member List

This is the complete list of members for GattrReg, including all inherited members.

__init__(name, regno, size, flags=ATTR_READ_WRITE, rule=Gattr.defaultRule, constraint=Gattr.defaultConstraint, egu=Gattr.defaultEgu) | GattrReg
gAttr::Gattr::__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in Gattr) | Gattr
flags() (defined in Gattr) | Gattr
get(node, bypass=0) | GattrReg
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, val, bypass=0) | GattrReg
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Gconstraint Member List

This is the complete list of members for Gconstraint, including all inherited members.

__init__(name, subsystem, category, enabled, continuous=False) | Gconstraint
__init__() (defined in GconstraintBase) | GconstraintBase
_eval_(value) | Gconstraint
category() | Gconstraint
disable() | Gconstraint
enable() | Gconstraint
enabled() | Gconstraint
evaluate(value) | Gconstraint
name() | Gconstraint
reject(message) | Gconstraint
reset() | Gconstraint
subsystem() | Gconstraint

Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GconstraintBase Member List

This is the complete list of members for GconstraintBase, including all inherited members.

__init__() (defined in GconstraintBase) | GconstraintBase
evaluate(value) (defined in GconstraintBase) | GconstraintBase

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GconstraintLimit Member List

This is the complete list of members for GconstraintLimit, including all inherited members.

__init__(name, subsystem, category, enabled, continuous, low, high) (defined in GconstraintLimit) | GconstraintLimit
gConstraint::Gconstraint::__init__(name, subsystem, category, enabled, continuous=False) | Gconstraint
__init__() (defined in GconstraintBase) | GconstraintBase
_eval_(value) | GconstraintLimit
category() | Gconstraint
disable() | Gconstraint
enable() | Gconstraint
enabled() | Gconstraint
evaluate(value) | Gconstraint
name() | Gconstraint
reject(message) | Gconstraint
reset() | Gconstraint
subsystem() | Gconstraint

Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GconstraintLimitPegRE Member List

This is the complete list of members for GconstraintLimitPegRE, including all inherited members.

__init__(name, subsystem, category, enabled, continuous, low, high) (defined in GconstraintLimitPegRE) | GconstraintLimitPegRE
gConstraint::Gconstraint::__init__(name, subsystem, category, enabled, continuous=False) | Gconstraint
__init__() (defined in GconstraintBase) | GconstraintBase
_eval_(value) | GconstraintLimitPegRE
category() | Gconstraint
disable() | Gconstraint
enable() | Gconstraint
enabled() | Gconstraint
evaluate(value) | Gconstraint
name() | Gconstraint
reject(message) | Gconstraint
reset() | Gconstraint
subsystem() | Gconstraint

Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GconstraintLimitRE Member List

This is the complete list of members for GconstraintLimitRE, including all inherited members.

__init__(name, subsystem, category, enabled, continuous, low, high) (defined in GconstraintLimitRE) | GconstraintLimitRE
gConstraint::Gconstraint::__init__(name, subsystem, category, enabled, continuous=False) | Gconstraint
__init__() (defined in GconstraintBase) | GconstraintBase
_eval_(value) | GconstraintLimitRE
category() | Gconstraint
disable() | Gconstraint
enable() | Gconstraint
enabled() | Gconstraint
evaluate(value) | Gconstraint
name() | Gconstraint
reject(message) | Gconstraint
reset() | Gconstraint
subsystem() | Gconstraint

Generated on Fri Jan 21 18:01:01 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

gConstraintViolation Member List

This is the complete list of members for gConstraintViolation, including all inherited members.

__init__(args=None) (defined in gConstraintViolation) gConstraintViolation

Generated on Fri Jan 21 18:01:00 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GCRU Member List

This is the complete list of members for GCRU, including all inherited members.

__init__(client, parent) | GCRU
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GCRU) | GCRU
read(reg) (defined in GCRU) | GCRU
root() | Gdb
send(cmd) (defined in GCRU) | GCRU
up() | Gdb

Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Gdb Member List

This is the complete list of members for Gdb, including all inherited members.

__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEBM Member List

This is the complete list of members for GEBM, including all inherited members.

__init__(client, parent) | GEBM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
downEBMC() | GEBM
downEBMST() | GEBM
existsEBMC() | GEBM
existsEBMST() | GEBM
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEBMC Member List

This is the complete list of members for GEBMC, including all inherited members.

__init__(client, parent) | GEBMC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GEBMC) | GEBMC
read(reg) (defined in GEBMC) | GEBMC
root() | Gdb
send(cmd) (defined in GEBMC) | GEBMC
up() | Gdb

Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEBMST Member List

This is the complete list of members for GEBMST, including all inherited members.

__init__(client, parent) | GEBMST
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
read(reg) (defined in GEBMST) | GEBMST
root() | Gdb
send(cmd) (defined in GEBMST) | GEBMST
up() | Gdb

Generated on Fri Jan 21 18:01:02 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEGU Member List

This is the complete list of members for GEGU, including all inherited members.

__init__(units) (defined in GEGU) | GEGU
egu(value) | GEGU
raw(value) | GEGU
units() | GEGU

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEGU_linear Member List

This is the complete list of members for GEGU_linear, including all inherited members.

__init__(slope, intercept, units="") | GEGU_linear
__init__(units) (defined in GEGU) | GEGU
egu(rawValue) | GEGU_linear
gEGU::GEGU::egu(value) | GEGU
raw(eguValue) | GEGU_linear
gEGU::GEGU::raw(value) | GEGU
units() | GEGU

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEGU_poly3 Member List

This is the complete list of members for GEGU_poly3, including all inherited members.

__init__(coeff0, coeff1, coeff2, coeff3, offset, units="") | GEGU_poly3
__init__(units) (defined in GEGU) | GEGU
egu(rawValue) | GEGU_poly3
gEGU::GEGU::egu(value) | GEGU
raw(eguValue) | GEGU_poly3
gEGU::GEGU::raw(value) | GEGU
units() | GEGU

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

AEM Member List

This is the complete list of members for AEM, including all inherited members.

__init__() (defined in AEM) | AEM
addPHA(cbl, pha) | AEM
clearEvent() | AEM

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evAEM_PHA Member List

This is the complete list of members for evAEM_PHA, including all inherited members.

__init__(ui) (defined in evAEM_PHA) evAEM_PHA

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evCAL_LayerLogData Member List

This is the complete list of members for evCAL_LayerLogData, including all inherited members.

__init__(twr, layer, data) evCAL_LayerLogData

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evCAL_LogAccepts Member List

This is the complete list of members for evCAL_LogAccepts, including all inherited members.

__init__(twr, ui) (defined in evCAL_LogAccepts) evCAL_LogAccepts

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evCAL_LogData Member List

This is the complete list of members for evCAL_LogData, including all inherited members.

__init__(ui) (defined in evCAL_LogData) evCAL_LogData

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evCellHeader Member List

This is the complete list of members for evCellHeader, including all inherited members.

__init__(ui) (defined in evCellHeader) evCellHeader

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evContPacket Member List

This is the complete list of members for evContPacket, including all inherited members.

__init__(ui) (defined in evContPacket) evContPacket

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evDiag_CalLayer Member List

This is the complete list of members for evDiag_CalLayer, including all inherited members.

__init__() (defined in evDiag_CalLayer) evDiag_CalLayer

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evDiag_CalLayerEnd Member List

This is the complete list of members for evDiag_CalLayerEnd, including all inherited members.

__init__(ui) (defined in evDiag_CalLayerEnd) evDiag_CalLayerEnd

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evDiag_Data Member List

This is the complete list of members for evDiag_Data, including all inherited members.

__init__() (defined in evDiag_Data) evDiag_Data

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evDiag_TkrTrgReq Member List

This is the complete list of members for evDiag_TkrTrgReq, including all inherited members.

__init__(ui) (defined in evDiag_TkrTrgReq) evDiag_TkrTrgReq

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_CablePhase Member List

This is the complete list of members for evErr_CablePhase, including all inherited members.

__init__(ui) (defined in evErr_CablePhase) evErr_CablePhase

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_CableTimeOut Member List

This is the complete list of members for evErr_CableTimeOut, including all inherited members.

__init__(ui) (defined in evErr_CableTimeOut) evErr_CableTimeOut

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_GCCC Member List

This is the complete list of members for evErr_GCCC, including all inherited members.

__init__(ui) (defined in evErr_GCCC) evErr_GCCC

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_GCCC_Message Member List

This is the complete list of members for evErr_GCCC_Message, including all inherited members.

__init__(gccc, errGCCC) evErr_GCCC_Message

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_GTCC Member List

This is the complete list of members for evErr_GTCC, including all inherited members.

__init__(ui) (defined in evErr_GTCC) evErr_GTCC

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_GTCC_Message Member List

This is the complete list of members for evErr_GTCC_Message, including all inherited members.

__init__() (defined in evErr_GTCC_Message) evErr_GTCC_Message

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evErr_Summary Member List

This is the complete list of members for evErr_Summary, including all inherited members.

__init__(ui) (defined in evErr_Summary) evErr_Summary

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

evGEM_Veto_List Member List

This is the complete list of members for evGEM_Veto_List, including all inherited members.

__init__() (defined in evGEM_Veto_List) | evGEM_Veto_List
clear() (defined in evGEM_Veto_List) | evGEM_Veto_List

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evSummary Member List

This is the complete list of members for evSummary, including all inherited members.

__init__(ui) (defined in evSummary) evSummary

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Evt Member List

This is the complete list of members for Evt, including all inherited members.

__init__() | Evt
addCAL_LogAccept(accept) | Evt
addCAL_LogData(twr, layer, data) | Evt
addErrGCCCmsg(errGCCC) | Evt
addErrGTCCmsg(errGTCCmsg) | Evt
addTKRaccept(accept) | Evt
addTKRstrip(cc, rc, strip) | Evt
addTKRtot(cc, rc, tot) | Evt
clearEvent() | Evt

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

EvtCli Member List

This is the complete list of members for EvtCli, including all inherited members.

__init__(debug=0) | EvtCli
abort() | EvtCliIO
checkGGLTstatus(status, mask) | EvtCli
checkOnlineStatus(status, mask) | EvtCli
close() | EvtCliIO
connect(host) (defined in EvtCliIO) | EvtCliIO
dumpContributionData() | EvtCli
evBitCount(x) | EvtCli
evDumpAEM_Accepts() | EvtCli
evDumpAEM_PHA() | EvtCli
evDumpAEM_Vetos() | EvtCli
evDumpCAL_LogAccepts() | EvtCli
evDumpCAL_Logs() | EvtCli
evDumpDiagnostic() | EvtCli
evDumpEventAEM() | EvtCli
evDumpEventAEM_G2() | EvtCli
evDumpGEM() | EvtCli
evDumpGEM_Veto_List(offset) | EvtCli
evDumpSummary(minEvSize=24) | EvtCli
evDumpTEM_Error(forcePrint=0) | EvtCli
evDumpTKR() | EvtCli
evGetAEM_PHA(cbl) | EvtCli
evGetAEM_Vec(cbl, type) | EvtCli
evGetCAL_LogAccepts() | EvtCli
evGetCAL_Logs() | EvtCli
evGetCAL_NumAccepts() | EvtCli
evGetSummary() | EvtCli
evGetTEM_Diagnostic() | EvtCli
evGetTEM_Error() | EvtCli
evGetTimebase() | EvtCli
evGetTimestamp() | EvtCli
evGetTKR_Accepts(pAccept) | EvtCli
evGetTKR_NumAccepts() | EvtCli
evGetTKR_NumStrips() | EvtCli
evGetTKR_StripN(pAccepts, stripN, stripData=None) | EvtCli
evGetTKR_TOT() | EvtCli
getByte(byteOffset) | EvtCli
getContributionList() | EvtCli
getContributionStatus() | EvtCli
getContributionStatusStr() | EvtCli
getCurrentContribution() | EvtCli
getDWord(dWordOffset) | EvtCli
getEvtSize() | EvtCli
getEvtStatus() | EvtCli
getGGLTStatus() | EvtCli
getGGLTStatusStr() | EvtCli
getOnlineStatus() | EvtCli
getOnlineStatusStr() | EvtCli
getTimeout() | EvtCliIO
getUserId() | EvtCli
getWord(wordOffset) | EvtCli
isErrorEvent() | EvtCli
isGGLTStatus(status=None) | EvtCli
isSweepEvent() | EvtCli
isTimeoutEnabled() | EvtCliIO
open(filename) | EvtCliIO
print_EOE_Warning() | EvtCli
readEvent(dat=None) | EvtCli
readEventSocket() (defined in EvtCli) | EvtCli
readFile() | EvtCliIO
readSocket() | EvtCliIO
setCurrentContribution(contributionId) | EvtCli
setDebug(debug) | EvtCli
setEventMode(mode) (defined in EvtCliIO) | EvtCliIO
setSocket(sock) (defined in EvtCliIO) | EvtCliIO
setTimeout(timeout=1.0) | EvtCliIO
setTimeoutEnabled(flag) | EvtCliIO
setUserParm(parm) (defined in EvtCliIO) | EvtCliIO
unpack(fmt, str) | EvtCliIO

Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

EvtCliIO Member List

This is the complete list of members for EvtCliIO, including all inherited members.

__init__(debug) (defined in EvtCliIO) | EvtCliIO
abort() | EvtCliIO
close() | EvtCliIO
connect(host) (defined in EvtCliIO) | EvtCliIO
getTimeout() | EvtCliIO
isTimeoutEnabled() | EvtCliIO
open(filename) | EvtCliIO
readFile() | EvtCliIO
readSocket() | EvtCliIO
setEventMode(mode) (defined in EvtCliIO) | EvtCliIO
setSocket(sock) (defined in EvtCliIO) | EvtCliIO
setTimeout(timeout=1.0) | EvtCliIO
setTimeoutEnabled(flag) | EvtCliIO
setUserParm(parm) (defined in EvtCliIO) | EvtCliIO
unpack(fmt, str) | EvtCliIO

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evTKR_Strip Member List

This is the complete list of members for evTKR_Strip, including all inherited members.

__init__(ui) (defined in evTKR_Strip) evTKR_Strip

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evTKR_StripData Member List

This is the complete list of members for evTKR_StripData, including all inherited members.

__init__(cc, rc, strip) evTKR_StripData

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

evTKR_TOTdata Member List

This is the complete list of members for evTKR_TOTdata, including all inherited members.

__init__(cc, rc, tot) evTKR_TOTdata

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GEM Member List

This is the complete list of members for GEM, including all inherited members.

__init__() (defined in GEM) | GEM
clear() (defined in GEM) | GEM

Generated on Fri Jan 21 18:01:03 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEM Member List

This is the complete list of members for GGEM, including all inherited members.

__init__(client, parent) | GGEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
downGEMC() | GGEM
downGEMIE() | GGEM
downGEMMG() | GGEM
downGEMSC() | GGEM
downGEMST() | GGEM
downGEMVG() | GGEM
downGEMVG() | GGEM
downGEMW() | GGEM
existsGEMC() | GGEM
existsGEMIE() | GGEM
existsGEMMG() | GGEM
existsGEMSC() | GGEM
existsGEMST() | GGEM
existsGEMVG() | GGEM
existsGEMVG() | GGEM
existsGEMW() | GGEM
getEPUaddr() (defined in GGEM) | GGEM
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMC Member List

This is the complete list of members for GGEMC, including all inherited members.

__init__(client, parent) | GGEMC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMC) | GGEMC
read(reg) (defined in GGEMC) | GGEMC
root() | Gdb
send(cmd) (defined in GGEMC) | GGEMC
up() | Gdb

Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMIE Member List

This is the complete list of members for GGEMIE, including all inherited members.

__init__(client, parent) | GGEMIE
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMIE) | GGEMIE
read(reg) (defined in GGEMIE) | GGEMIE
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMMG Member List

This is the complete list of members for GGEMMG, including all inherited members.

__init__(client, parent) | GGEMMG
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMMG) | GGEMMG
read(reg) (defined in GGEMMG) | GGEMMG
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMSC Member List

This is the complete list of members for GGEMSC, including all inherited members.

__init__(client, parent) | GGEMSC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMSC) | GGEMSC
read(reg) (defined in GGEMSC) | GGEMSC
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMST Member List

This is the complete list of members for GGEMST, including all inherited members.

__init__(client, parent) | GGEMST
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMST) | GGEMST
read(reg) (defined in GGEMST) | GGEMST
root() | Gdb
send(cmd) (defined in GGEMST) | GGEMST
up() | Gdb

Generated on Fri Jan 21 18:01:04 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMVG Member List

This is the complete list of members for GGEMVG, including all inherited members.

__init__(client, parent) | GGEMVG
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMVG) | GGEMVG
read(reg) (defined in GGEMVG) | GGEMVG
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGEMW Member List

This is the complete list of members for GGEMW, including all inherited members.

__init__(client, parent) | GGEMW
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GGEMW) | GGEMW
read(reg) (defined in GGEMW) | GGEMW
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GGLT Member List

This is the complete list of members for GGLT, including all inherited members.

__init__(client, parent=None) | GGLT
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
disableMask() | GGLT
enableMask() | GGLT
getDisableTime() | GGLT
getEnableTime() | GGLT
getEPUaddr() (defined in GGLT) | GGLT
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
initialize() (defined in GGLT) | GGLT
isMaskDirty() | GGLT
load(reg, value) (defined in GGLT) | GGLT
read(reg) (defined in GGLT) | GGLT
refreshMask() | GGLT
root() | Gdb
send(cmd) (defined in GGLT) | GGLT
setDestinationOverride(override) | GGLT
triggersDisabled() | GGLT
up() | Gdb
waitForMaskEnable(tmo=None) | GGLT

Generated on Fri Jan 21 18:01:05 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GattrHsk Member List

This is the complete list of members for GattrHsk, including all inherited members.

__init__(node, attr) (defined in GattrHsk) | GattrHsk
__init__(name, id, rule=gAttr.Gattr.defaultRule, constraint=gAttr.Gattr.defaultConstraint, egu=gAttr.Gattr.defaultEgu) | GattrHsk
gAttr::Gattr::__init__(name, id, size, flags, rule=None, constraint=None, egu=None) | Gattr
create(node) (defined in GattrHsk) | GattrHsk
flags() (defined in Gattr) | Gattr
get(node, raw, bypass=False) | GattrHsk
get(node, bypass=0) (defined in Gattr) | Gattr
getConstraint() | Gattr
getEGU() | Gattr
getName() (defined in Gattr) | Gattr
getNode() (defined in GattrHsk) | GattrHsk
getRule() | Gattr
id() (defined in Gattr) | Gattr
isCommand() (defined in Gattr) | Gattr
isNoDirectAccess() | Gattr
isReadOnly() | Gattr
isReadWrite() | Gattr
isWriteOnly() | Gattr
set(node, val, bypass=True) | GattrHsk
setConstraint(constraint) | Gattr
setEGU(egu) | Gattr
setRule(rule) | Gattr
size() | Gattr

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GHSK Member List

This is the complete list of members for GHSK, including all inherited members.

__init__(client) | GHSK
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
applyConfig(seq) (defined in GHSK) | GHSK
downHAEM() | GHSK
downHCOM() | GHSK
downHCPU() | GHSK
downHEBM() | GHSK
downHGEM() | GHSK
downHNUL() | GHSK
downHPDU(childId) | GHSK
downHTEM(childId) | GHSK
existsHAEM() | GHSK
existsHCOM() | GHSK
existsHCPU() | GHSK
existsHEBM() | GHSK
existsHGEM() | GHSK
existsHPDU(hpduID) | GHSK
existsHTEM(temID) | GHSK
getConfigurations() | GHSK
getDeclarations() | GHSK
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name) | GHSK
getRules() | GHSK
getSerialNos(component=None) | Gdb
id() | Gdb
readConfig(cfgFileName) (defined in GHSK) | GHSK
readSchema(schema) (defined in GHSK) | GHSK
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HAEM Member List

This is the complete list of members for HAEM, including all inherited members.

__init__(client, parent) | HAEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
downHARC(arcID) | HAEM
existsHARC(arcID) | HAEM
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HARC Member List

This is the complete list of members for HARC, including all inherited members.

__init__(client, parent, arcID) | HARC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HCOM Member List

This is the complete list of members for HCOM, including all inherited members.

__init__(client, parent) | HCOM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HCPU Member List

This is the complete list of members for HCPU, including all inherited members.

__init__(client, parent) | HCPU
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HEBM Member List

This is the complete list of members for HEBM, including all inherited members.

__init__(client, parent) | HEBM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HGEM Member List

This is the complete list of members for HGEM, including all inherited members.

__init__(client, parent) | HGEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HNUL Member List

This is the complete list of members for HNUL, including all inherited members.

__init__(parent) | HNUL
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HPDU Member List

This is the complete list of members for HPDU, including all inherited members.

__init__(client, parent, pduID) | HPDU
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:07 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HTEM Member List

This is the complete list of members for HTEM, including all inherited members.

__init__(client, parent, temID) | HTEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:06 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GLAT Member List

This is the complete list of members for GLAT, including all inherited members.

__init__(client) | GLAT
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allTEM() (defined in GLAT) | GLAT
applyConfig(seq=None, gxbrd=None) (defined in GLAT) | GLAT
downAEM() | GLAT
downCRU() | GLAT
downEBM() | GLAT
downGEM() | GLAT
downLCB() | GLAT
downPDU(childId) | GLAT
downTEM(childId) | GLAT
existsAEM() | GLAT
existsCRU() | GLAT
existsEBM() | GLAT
existsGEM() | GLAT
existsLCB() | GLAT
existsPDU(pduId) | GLAT
existsTEM(temId) | GLAT
getAllOpaque() | GLAT
getAllSerialNos() | GLAT
getConfigurations() | GLAT
getDeclarations() | GLAT
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getRules() | GLAT
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GLAT) | GLAT
read(reg) (defined in GLAT) | GLAT
readConfig(cfgFileName) (defined in GLAT) | GLAT
readSchema(name) (defined in GLAT) | GLAT
root() | Gdb
takeSnapshot(stream, fileName, captureGTIC, captureGAEQ, trigger, configName, configVersion) (defined in GLAT) | GLAT
TEMcnt() | GLAT
up() | Gdb
writeConfig(fileName, seq=None) (defined in GLAT) | GLAT
writeSchema(fileName) (defined in GLAT) | GLAT

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GLCB Member List

This is the complete list of members for GLCB, including all inherited members.

__init__(client) | GLCB
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getLCBCSR() (defined in GLCB) | GLCB
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GLCB) | GLCB
read(reg) (defined in GLCB) | GLCB
root() | Gdb
setEvtEnable(parm) | GLCB
setLCBCSR(value) (defined in GLCB) | GLCB
up() | Gdb

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullStream Member List

This is the complete list of members for NullStream, including all inherited members.

close() (defined in NullStream) | NullStream
write(str) (defined in NullStream) | NullStream

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GMem Member List

This is the complete list of members for GMem, including all inherited members.

__init__(client) | GMem
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
gMEMbusToLocal(space, addr) | GMem
gMEMload(addr, val, size=4) | GMem
gMEMlocalToBus(space, addr) | GMem
gMEMread(addr, size=4) | GMem
id() | Gdb
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GNAT Member List

This is the complete list of members for GNAT, including all inherited members.

__init__(client) | GNAT
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addChannel(channelNo, itemList) | GNAT
addr() | Gdb
clearBuffer() | GNAT
flushPlaybackFIFO() | GNAT
flushRecordFIFO() | GNAT
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
initHandle(slot, physAddr) | GNAT
loadFIFO() | GNAT
root() | Gdb
setLATpMode(mode) | GNAT
startPlayback() | GNAT
up() | Gdb
writeFIFO(data) | GNAT
writeFIFO32(data) | GNAT

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GOCS Member List

This is the complete list of members for GOCS, including all inherited members.

__init__(client) (defined in GOCS) | GOCS
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
evtHandlerPrescaleExternal(prescale) | GOCS
evtHandlerSendAcdScalers(marker, prescale=0) | GOCS
evtHandlerSendAll() | GOCS
evtHandlerSendErrorsOnly() | GOCS
evtHandlerSendNothing() | GOCS
evtHandlerSendPrescaled(prescale) | GOCS
evtHandlerSetVerbosity(verbosity) | GOCS
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
getVersion() | GOCS
id() | Gdb
load(reg, value) (defined in GOCS) | GOCS
read(reg) (defined in GOCS) | GOCS
root() | Gdb
synchronize() | GOCS
up() | Gdb
verifyVersion() | GOCS

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

CALcontributionIterator2 Member List

This is the complete list of members for CALcontributionIterator2, including all inherited members.

__init__(event, contribution, gui, limits, lci) | CALcontributionIterator2
log(tower, layer, theLog) | CALcontributionIterator2
plot() | CALcontributionIterator2

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

myLATcomponentIterator Member List

This is the complete list of members for myLATcomponentIterator, including all inherited members.

__init__(gui) | myLATcomponentIterator
ACDcomponent(event, aemContribution) | myLATcomponentIterator
CALcomponent(event, calContribution) | myLATcomponentIterator
diagnostic(event, contribution) | myLATcomponentIterator
error(event, contribution) | myLATcomponentIterator
GEMcomponent(event, gemContribution) | myLATcomponentIterator
getAcdPeds() | myLATcomponentIterator
getCalPeds() | myLATcomponentIterator
GLTcomponent(event, contribution) | myLATcomponentIterator
OSWcomponent(event, contribution) | myLATcomponentIterator
readPedestals() | myLATcomponentIterator
TKRcomponent(event, tkrContribution) | myLATcomponentIterator
UDFcomponent(event, ebfContribution) (defined in myLATcomponentIterator) | myLATcomponentIterator

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TKRcontributionIterator Member List

This is the complete list of members for TKRcontributionIterator, including all inherited members.

__init__(event, contribution, gui) | TKRcontributionIterator
plot() | TKRcontributionIterator
strip(tower, layerEnd, hit) | TKRcontributionIterator
TOT(tower, layerEnd, tot) (defined in TKRcontributionIterator) | TKRcontributionIterator

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

singleEvtDisplayImpl Member List

This is the complete list of members for singleEvtDisplayImpl, including all inherited members.

__init__(filename=None, parent=None, name=None, fl=0) | singleEvtDisplayImpl
clearButtonGroups() | singleEvtDisplayImpl
clearViews() | singleEvtDisplayImpl
clickTWR(id) (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
createDockWindows() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDACD() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDCAL() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDCALTKR() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDData() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDTKR() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOSEDTWR() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
dockGOTED() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
fileClose() | singleEvtDisplayImpl
fileExit() | singleEvtDisplayImpl
fileOpen() | singleEvtDisplayImpl
goClicked() | singleEvtDisplayImpl
GOSEDPreferences() | singleEvtDisplayImpl
helpAbout() | singleEvtDisplayImpl
helpContents() | singleEvtDisplayImpl
helpOnline() | singleEvtDisplayImpl
mousePressEvent(e) (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
nextClicked() | singleEvtDisplayImpl
plot() | singleEvtDisplayImpl
previousClicked() | singleEvtDisplayImpl
replot() (defined in singleEvtDisplayImpl) | singleEvtDisplayImpl
selectChange() | singleEvtDisplayImpl
serverClose() | singleEvtDisplayImpl
serverOpen(state) | singleEvtDisplayImpl
ServerPreferences() | singleEvtDisplayImpl
stopClicked() | singleEvtDisplayImpl

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawHatACD Member List

This is the complete list of members for drawHatACD, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawHatACD
clear() (defined in drawHatACD) | drawHatACD
drawNames(pixmap) (defined in drawHatACD) | drawHatACD
paintEvent(pe) | drawHatACD
paintFace() (defined in drawHatACD) | drawHatACD
showEvent(se) (defined in drawHatACD) | drawHatACD

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawSide1ACD Member List

This is the complete list of members for drawSide1ACD, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawSide1ACD
clear() (defined in drawSide1ACD) | drawSide1ACD
drawNames(pixmap) (defined in drawSide1ACD) | drawSide1ACD
paintEvent(pe) | drawSide1ACD
paintFace() (defined in drawSide1ACD) | drawSide1ACD
showEvent(se) (defined in drawSide1ACD) | drawSide1ACD

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawSide2ACD Member List

This is the complete list of members for drawSide2ACD, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawSide2ACD
clear() (defined in drawSide2ACD) | drawSide2ACD
drawNames(pixmap) (defined in drawSide2ACD) | drawSide2ACD
paintEvent(pe) | drawSide2ACD
paintFace() (defined in drawSide2ACD) | drawSide2ACD
showEvent(se) (defined in drawSide2ACD) | drawSide2ACD

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawSide3ACD Member List

This is the complete list of members for drawSide3ACD, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawSide3ACD
clear() (defined in drawSide3ACD) | drawSide3ACD
drawNames(pixmap) (defined in drawSide3ACD) | drawSide3ACD
paintEvent(pe) | drawSide3ACD
paintFace() (defined in drawSide3ACD) | drawSide3ACD
showEvent(se) (defined in drawSide3ACD) | drawSide3ACD

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawSide4ACD Member List

This is the complete list of members for drawSide4ACD, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawSide4ACD
clear() (defined in drawSide4ACD) | drawSide4ACD
drawNames(pixmap) (defined in drawSide4ACD) | drawSide4ACD
paintEvent(pe) | drawSide4ACD
paintFace() (defined in drawSide4ACD) | drawSide4ACD
showEvent(se) (defined in drawSide4ACD) | drawSide4ACD

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawXZ_CAL Member List

This is the complete list of members for drawXZ_CAL, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawXZ_CAL
clear() (defined in drawXZ_CAL) | drawXZ_CAL
paintEvent(pe) | drawXZ_CAL
paintFace() (defined in drawXZ_CAL) | drawXZ_CAL
showEvent(se) (defined in drawXZ_CAL) | drawXZ_CAL

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawXZ_TKR Member List

This is the complete list of members for drawXZ_TKR, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawXZ_TKR
clear() (defined in drawXZ_TKR) | drawXZ_TKR
paintEvent(pe) | drawXZ_TKR
paintFace() (defined in drawXZ_TKR) | drawXZ_TKR
showEvent(se) (defined in drawXZ_TKR) | drawXZ_TKR

Generated on Fri Jan 21 18:01:08 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawYZ_CAL Member List

This is the complete list of members for drawYZ_CAL, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawYZ_CAL
clear() (defined in drawYZ_CAL) | drawYZ_CAL
paintEvent(pe) | drawYZ_CAL
paintFace() (defined in drawYZ_CAL) | drawYZ_CAL
showEvent(se) (defined in drawYZ_CAL) | drawYZ_CAL

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

drawYZ_TKR Member List

This is the complete list of members for drawYZ_TKR, including all inherited members.

__init__(gui, parent=None, name=None, fl=0) | drawYZ_TKR
clear() (defined in drawYZ_TKR) | drawYZ_TKR
paintEvent(pe) | drawYZ_TKR
paintFace() (defined in drawYZ_TKR) | drawYZ_TKR
showEvent(se) (defined in drawYZ_TKR) | drawYZ_TKR

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GPDU Member List

This is the complete list of members for GPDU, including all inherited members.

__init__(client, parent, id) | GPDU
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
downPEQ() | GPDU
existsPEQ() | GPDU
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GPDU) | GPDU
read(reg) (defined in GPDU) | GPDU
root() | Gdb
send(cmd) (defined in GPDU) | GPDU
up() | Gdb

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GPEQ Member List

This is the complete list of members for GPEQ, including all inherited members.

__init__(client, parent) | GPEQ
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GPEQ) | GPEQ
read(reg) (defined in GPEQ) | GPEQ
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Grule Member List

This is the complete list of members for Grule, including all inherited members.

__init__(name, subsystem, category, enabled, continuous=False) | Grule
__init__() (defined in GruleBase) | GruleBase
_eval_(value, attr, node) | Grule
category() | Grule
clearAllActions() | Grule
disable() | Grule
enable() | Grule
enabled() | Grule
evaluate(value, attr, node=None) | Grule
name() | Grule
registerAction(action, method, sender=dispatcher.Any) | Grule
reset() | Grule
sendAction(action, sender, arguments, named) | Grule
setActions(actions) | Grule
subsystem() | Grule
unregisterAction(action, method, sender=dispatcher.Any) | Grule

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GruleAlarms Member List

This is the complete list of members for GruleAlarms, including all inherited members.

__init__(name, subsystem, category, enabled, continuous, yellowUpperLimit, yellowLowerLimit, redUpperLimit, redLowerLimit, actions=[]) | GruleAlarms
gRule::Grule::__init__(name, subsystem, category, enabled, continuous=False) | Grule
__init__() (defined in GruleBase) | GruleBase
_eval_(value, attr, node) | GruleAlarms
category() | Grule
clearAllActions() | Grule
disable() | Grule
enable() | Grule
enabled() | Grule
evaluate(value, attr, node=None) | Grule
name() | Grule
registerAction(action, method, sender=dispatcher.Any) | Grule
reset() | Grule
sendAction(action, sender, arguments, named) | Grule
setActions(actions) | Grule
subsystem() | Grule
unregisterAction(action, method, sender=dispatcher.Any) | Grule

Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GruleBase Member List

This is the complete list of members for GruleBase, including all inherited members.

__init__() (defined in GruleBase) | GruleBase
evaluate(value, attr, node=None) (defined in GruleBase) | GruleBase

Generated on Fri Jan 21 18:01:09 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GruleLimit Member List

This is the complete list of members for GruleLimit, including all inherited members.

__init__(name, subsystem, category, enabled, continuous, low, high) | GruleLimit
gRule::Grule::__init__(name, subsystem, category, enabled, continuous=False) | Grule
__init__() (defined in GruleBase) | GruleBase
_eval_(value, attr, node) | GruleLimit
category() | Grule
clearAllActions() | Grule
disable() | Grule
enable() | Grule
enabled() | Grule
evaluate(value, attr, node=None) | Grule
name() | Grule
registerAction(action, method, sender=dispatcher.Any) | Grule
reset() | Grule
sendAction(action, sender, arguments, named) | Grule
setActions(actions) | Grule
subsystem() | Grule
unregisterAction(action, method, sender=dispatcher.Any) | Grule

Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GCCC Member List

This is the complete list of members for GCCC, including all inherited members.

__init__(client, parent, id) | GCCC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allCRC() | GCCC
downCRC(childId) | GCCC
existsCRC(crcId) | GCCC
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GCCC) | GCCC
read(reg) (defined in GCCC) | GCCC
root() | Gdb
send(cmd) (defined in GCCC) | GCCC
up() | Gdb

Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GCFE Member List

This is the complete list of members for GCFE, including all inherited members.

__init__(client, parent, id) | GCFE
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GCFE) | GCFE
read(reg) (defined in GCFE) | GCFE
root() | Gdb
send(cmd) (defined in GCFE) | GCFE
up() | Gdb

Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GCRC Member List

This is the complete list of members for GCRC, including all inherited members.

__init__(client, parent, id) | GCRC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allCFE() | GCRC
downCFE(childId) | GCRC
existsCFE(cfeId) | GCRC
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GCRC) | GCRC
read(reg) (defined in GCRC) | GCRC
root() | Gdb
send(cmd) (defined in GCRC) | GCRC
up() | Gdb

Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTCC Member List

This is the complete list of members for GTCC, including all inherited members.

__init__(client, parent, id) | GTCC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allTRC() | GTCC
downTRC(childId) | GTCC
existsTRC(trcId) | GTCC
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTCC) | GTCC
read(reg) (defined in GTCC) | GTCC
root() | Gdb
send(cmd) (defined in GTCC) | GTCC
up() | Gdb

Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTEM Member List

This is the complete list of members for GTEM, including all inherited members.

__init__(client, parent, id) | GTEM
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allCCC() | GTEM
allTCC() | GTEM
CCCcnt() | GTEM
downCCC(childId) | GTEM
downTCC(childId) | GTEM
downTIC() | GTEM
existsCCC(cccId) | GTEM
existsTCC(tccId) | GTEM
existsTIC() | GTEM
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTEM) | GTEM
read(reg) (defined in GTEM) | GTEM
root() | Gdb
send(cmd) (defined in GTEM) | GTEM
TCCcnt() | GTEM
up() | Gdb

Generated on Fri Jan 21 18:01:10 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTFE Member List

This is the complete list of members for GTFE, including all inherited members.

__init__(client, parent, id) | GTFE
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTFE) | GTFE
read(reg) (defined in GTFE) | GTFE
root() | Gdb
send(cmd) (defined in GTFE) | GTFE
up() | Gdb

Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTIC Member List

This is the complete list of members for GTIC, including all inherited members.

__init__(client, parent) | GTIC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTIC) | GTIC
read(reg) (defined in GTIC) | GTIC
root() | Gdb
satCtrDisable(reg) | GTIC
satCtrEnable(reg) | GTIC
satCtrLoopDisable() | GTIC
satCtrLoopEnable() | GTIC
satCtrSetLoopDelay(delay) | GTIC
send(cmd) (defined in GTIC) | GTIC
up() | Gdb

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTRC Member List

This is the complete list of members for GTRC, including all inherited members.

__init__(client, parent, id) | GTRC
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
allTFE() | GTRC
downTFE(childId) | GTRC
existsTFE(tfeId) | GTRC
getDeadChannels(feId=None) | GTRC
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getNoisyChannels(feId=None) | GTRC
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTRC) | GTRC
read(reg) (defined in GTRC) | GTRC
root() | Gdb
send(cmd) (defined in GTRC) | GTRC
up() | Gdb

Generated on Fri Jan 21 18:01:11 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GUIbridge Member List

This is the complete list of members for GUIbridge, including all inherited members.

__init__(guiThread) | GUIbridge
createGUI(qObject, obj, args, kwargs) | GUIbridge
execGUImethod(qObject, func, args, kwargs) | GUIbridge
execGUImethod2(qObject, func, args, kwargs) (defined in GUIbridge) | GUIbridge
execGUImethodNR(qObject, func, args, kwargs) | GUIbridge
handleCustomEvent(e) (defined in GUIbridge) | GUIbridge
isGUIthread() | GUIbridge
shutdown() | GUIbridge

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GTWR Member List

This is the complete list of members for GTWR, including all inherited members.

__init__(client, parent, id) | GTWR
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GTWR) | GTWR
read(reg) (defined in GTWR) | GTWR
root() | Gdb
up() | Gdb

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

GXBRD Member List

This is the complete list of members for GXBRD, including all inherited members.

__init__(client) | GXBRD
gDb::Gdb::__init__(client, parent, id, valid_attrs=[], addr=None) | Gdb
addr() | Gdb
applyConfig(seq=None) (defined in GXBRD) | GXBRD
downGLT() | GXBRD
downTWR(twrId) | GXBRD
existsGLT() | GXBRD
existsTWR(twrId) | GXBRD
getConfigurations() | GXBRD
getDeclarations() | GXBRD
getIdTuple() | Gdb
getName() (defined in Gdb) | Gdb
getOpaque(name=None) | Gdb
getSerialNos(component=None) | Gdb
id() | Gdb
load(reg, value) (defined in GXBRD) | GXBRD
read(reg) (defined in GXBRD) | GXBRD
readConfig(cfgFileName) (defined in GXBRD) | GXBRD
readSchema(name) (defined in GXBRD) | GXBRD
root() | Gdb
send(cmd) (defined in GXBRD) | GXBRD
up() | Gdb

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskCli Member List

This is the complete list of members for HskCli, including all inherited members.

__init__(handler=None) (defined in HskCli) | HskCli
connect(server) | HskCli
disconnect() | HskCli
handler(newhandler) (defined in HskCli) | HskCli

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskHandler Member List

This is the complete list of members for HskHandler, including all inherited members.

__init__(server, host) (defined in HskHandler) | HskHandler
connect() | HskHandler
disconnected() | HskHandler
timedout() | HskHandler

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskCollector Member List

This is the complete list of members for HskCollector, including all inherited members.

__init__(config) (defined in HskCollector) | HskCollector
latDB() (defined in HskCollector) | HskCollector

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

ccsdsHeader Member List

This is the complete list of members for ccsdsHeader, including all inherited members.

__init__(ui) (defined in ccsdsHeader) ccsdsHeader

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ccsdsPacket Member List

This is the complete list of members for ccsdsPacket, including all inherited members.

__init__(ui) (defined in ccsdsPacket) | ccsdsPacket
apid() (defined in ccsdsPacket) | ccsdsPacket
length() (defined in ccsdsPacket) | ccsdsPacket
seqCnt() (defined in ccsdsPacket) | ccsdsPacket
subSeconds() (defined in ccsdsPacket) | ccsdsPacket
type() (defined in ccsdsPacket) | ccsdsPacket

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskPacketRetriever Member List

This is the complete list of members for HskPacketRetriever, including all inherited members.

__init__(hskCli) (defined in HskPacketRetriever) | HskPacketRetriever
retrievePacket() (defined in HskPacketRetriever) | HskPacketRetriever

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskAlarmRecorder Member List

This is the complete list of members for HskAlarmRecorder, including all inherited members.

__init__(ghsk) (defined in HskAlarmRecorder) | HskAlarmRecorder
processTrends(trendables) (defined in HskAlarmRecorder) | HskAlarmRecorder

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

HskFileRecorder Member List

This is the complete list of members for HskFileRecorder, including all inherited members.

__init__(ghsk, flatFile) (defined in HskFileRecorder) HskFileRecorder

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

RegisterInterface Member List

This is the complete list of members for RegisterInterface, including all inherited members.

__init__(node, name) | RegisterInterface
name() (defined in RegisterInterface) | RegisterInterface
write(value) | RegisterInterface

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskLatRetriever Member List

This is the complete list of members for HskLatRetriever, including all inherited members.

__init__(glat) (defined in HskLatRetriever) | HskLatRetriever
retrievePacket() (defined in HskLatRetriever) | HskLatRetriever

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

HskTestRetriever Member List

This is the complete list of members for HskTestRetriever, including all inherited members.

__init__(glat) (defined in HskTestRetriever) | HskTestRetriever
aeqBuildDummy(timestamp) (defined in HskTestRetriever) | HskTestRetriever
retrievePacket() (defined in HskTestRetriever) | HskTestRetriever

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(gui, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgText Member List

This is the complete list of members for userArgText, including all inherited members.

__init__() (defined in userArgText) | userArgText
getValue(caption) (defined in userArgText) | userArgText

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgument Member List

This is the complete list of members for userArgument, including all inherited members.

__init__(parent=None, name=None, modal=0, fl=0) (defined in userArgument) | userArgument
getValue(caption) (defined in userArgument) | userArgument
OKButtonClicked() (defined in userArgument) | userArgument

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(gui, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgument Member List

This is the complete list of members for userArgument, including all inherited members.

__init__(parent=None, name=None, modal=0, fl=0) (defined in userArgument) | userArgument
CancelButtonClicked() (defined in userArgument) | userArgument
getValue(caption) (defined in userArgument) | userArgument
OKButtonClicked() (defined in userArgument) | userArgument

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(gui, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(gui, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

LATsweep Member List

This is the complete list of members for LATsweep, including all inherited members.

__init__(lat, trigger, shut) (defined in LATsweep) | LATsweep
shut(sweepEvent, progress=None) (defined in LATsweep) | LATsweep

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTExample Member List

This is the complete list of members for MiniGLTExample, including all inherited members.

__init__() | MiniGLTExample
conditions() | MiniGLTExample
engines() | MiniGLTExample

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTSolicitedCondition Member List

This is the complete list of members for MiniGLTSolicitedCondition, including all inherited members.

__init__() (defined in MiniGLTSolicitedCondition) | MiniGLTSolicitedCondition
solicited() (defined in MiniGLTSolicitedCondition) | MiniGLTSolicitedCondition

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTSolicitedEngine Member List

This is the complete list of members for MiniGLTSolicitedEngine, including all inherited members.

__init__() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
participate(conditionsValue) (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
prescale() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
request() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ZsupTrgReadout Member List

This is the complete list of members for ZsupTrgReadout, including all inherited members.

__init__() | ZsupTrgReadout
zeroSuppress() (defined in ZsupTrgReadout) | ZsupTrgReadout

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

LogRecordStreamHandler Member List

This is the complete list of members for LogRecordStreamHandler, including all inherited members.

handle() | LogRecordStreamHandler
handleLogRecord(record) (defined in LogRecordStreamHandler) | LogRecordStreamHandler
unPickle(data) (defined in LogRecordStreamHandler) | LogRecordStreamHandler

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:12 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NoCnoEnabled Member List

This is the complete list of members for NoCnoEnabled, including all inherited members.

__init__() | NoCnoEnabled
__setattr__(name, value) | TrgObject
LA1() | TrgCnoEnables
LA2() | TrgCnoEnables
LA3() | TrgCnoEnables
LA4() | TrgCnoEnables
LB2() | TrgCnoEnables
LB4() | TrgCnoEnables
RA2() | TrgCnoEnables
RA4() | TrgCnoEnables
RB1() | TrgCnoEnables
RB2() | TrgCnoEnables
RB3() | TrgCnoEnables
RB4() | TrgCnoEnables

Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NoInputsEnabled Member List

This is the complete list of members for NoInputsEnabled, including all inherited members.

__init__() | NoInputsEnabled
__setattr__(name, value) | TrgObject
cno() | NoInputsEnabled
tiles() | TrgInputEnables
towers() | NoInputsEnabled

Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NoTilesEnabled Member List

This is the complete list of members for NoTilesEnabled, including all inherited members.

__init__() | NoTilesEnabled
__setattr__(name, value) | TrgObject
tile(tileNumber) | NoTilesEnabled

Generated on Fri Jan 21 18:01:14 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullCal Member List

This is the complete list of members for NullCal, including all inherited members.

__init__() | NullCal
__setattr__(name, value) | TrgObject
useHighEnergy() | NullCal
useLowEnergy() | NullCal

Generated on Fri Jan 21 18:01:13 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullCoincidence Member List

This is the complete list of members for NullCoincidence, including all inherited members.

__init__() | NullCoincidence
__setattr__(name, value) | TrgObject
inCoincidence(tileNumber) | NullCoincidence

Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullEngine Member List

This is the complete list of members for NullEngine, including all inherited members.

__init__() | NullEngine
__setattr__(name, value) | TrgObject
participate(conditionsValue) | NullEngine
prescale() | NullEngine
request() | NullEngine

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullRequest Member List

This is the complete list of members for NullRequest, including all inherited members.

__init__() | NullRequest
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker(markerValue=0) | TrgEngineRequest
sequence() | NullRequest
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullRoi Member List

This is the complete list of members for NullRoi, including all inherited members.

__init__() | NullRoi
__setattr__(name, value) | TrgObject
tile(tileNumber) | NullRoi

Generated on Fri Jan 21 18:01:15 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullTkr Member List

This is the complete list of members for NullTkr, including all inherited members.

__init__() | NullTkr
__setattr__(name, value) | TrgObject
use() | NullTkr

Generated on Fri Jan 21 18:01:14 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

NullTower Member List

This is the complete list of members for NullTower, including all inherited members.

__init__() | NullTower
__setattr__(name, value) | TrgObject
calorimeter() | NullTower
tracker() | NullTower

Generated on Fri Jan 21 18:01:13 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcArchiver Member List

This is the complete list of members for rcArchiver, including all inherited members.

__init__(filePath=None, fileName=None, mode=MODE_CREATE, userId=123) (defined in rcArchiver) | rcArchiver |
close() (defined in rcArchiver) | rcArchiver |
getFileName() (defined in rcArchiver) | rcArchiver |
getFileNameFromTS(ts) (defined in rcArchiver) | rcArchiver | [static]
getFilePath() (defined in rcArchiver) | rcArchiver |
isClosed() (defined in rcArchiver) | rcArchiver |
read() (defined in rcArchiver) | rcArchiver |
write(rawEventData) (defined in rcArchiver) | rcArchiver |
writeTuple(tuple) (defined in rcArchiver) | rcArchiver |

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcCompletionStatus Member List

This is the complete list of members for rcCompletionStatus, including all inherited members.

addCompletionStatus(status, statusStr) | rcCompletionStatus |
getCompletionStatus(statStr) | rcCompletionStatus | [static]
getCompletionStatusStr(status) | rcCompletionStatus |
isCompletionStatus(status) | rcCompletionStatus |

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcGEMDefaultTrigger Member List

This is the complete list of members for rcGEMDefaultTrigger, including all inherited members.

__init__() | rcGEMDefaultTrigger
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGem
cnoEnableRegister() | TrgGemRegisters
coincidences() | rcGEMDefaultTrigger
commit(gem=None) | rcTrgGem
conditions() | rcGEMDefaultTrigger
configurationRegister() | TrgGemRegisters
disable() | rcTrgGem
enable(mask=None) | rcTrgGem
TrgGemRegisters::TrgGemRegisters::enable() | TrgAbstract
engines() | rcGEMDefaultTrigger
eventCounter() | TrgGem
eventDataParityEven() | TrgGemRegisters
eventHeaderParityEven() | TrgGemRegisters
GEM(glt=None) | TrgGem
getDisableTime() | rcTrgGem
getEnableTime() | rcTrgGem
getTimeStamp() | rcTrgGem
inhibitContribution() | TrgGemRegisters
inputEnables() | rcGEMDefaultTrigger
lookupTableRegister(registerNumber) | TrgGemRegisters
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgUsingTiles
periodicLimitRegister() | TrgGemRegisters
periodicModeRegister() | TrgGemRegisters
periodicRateRegister() | TrgGemRegisters
redundantPPS() | TrgGemRegisters
responseDataParityEven() | TrgGemRegisters
responseHeaderParityEven() | TrgGemRegisters
roi() | TrgUsingTiles
roiRegister(registerNumber) | TrgGemRegisters
sequence() | TrgUsingTiles
sequenceRegister() | TrgGemRegisters
shut(sweepEvent=None, progress=None) | rcGEMDefaultTrigger
TrgGem::TrgGem::shut(marker) | TrgGem
solicit() | TrgGem
sweepOnShut() | rcGEMDefaultTrigger
templateRegister(registerNumber) | TrgGemRegisters
tileCounters() | TrgGem
tileEnableRegister(registerNumber) | TrgGemRegisters
towerBusyEnableRegister() | TrgGemRegisters
towerEnableRegister(registerNumber) | TrgGemRegisters
triggerCounters() | TrgGem
triggerParityEven() | TrgGemRegisters
useAcdAsTrigger() | rcGEMDefaultTrigger
version() | TrgGem
waitForMaskEnable(tmo=None) | rcTrgGem
width() | TrgGemRegisters
widthRegister() | TrgGemRegisters

Generated on Fri Jan 21 18:01:16 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcGEMTrgEngines Member List

This is the complete list of members for rcGEMTrgEngines, including all inherited members.

__init__() | rcGEMTrgEngines
__setattr__(name, value) | TrgObject
engine(engineNumber) | rcTrgEngines
replaceEngine(engineNumber, engine) | rcTrgEngines

Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcMiniGLTDefaultTrigger Member List

This is the complete list of members for rcMiniGLTDefaultTrigger, including all inherited members.

__init__() | rcMiniGLTDefaultTrigger
__setattr__(name, value) | TrgObject
calStrobe() | TrgMiniGLTRegisters
commit() | rcTrgMiniGLT
conditions() | rcMiniGLTDefaultTrigger
destination() | TrgMiniGLTRegisters
disable() | rcTrgMiniGLT
enable(newMask=None) | rcTrgMiniGLT
enable(mask=None) (defined in TrgMiniGLT) | TrgMiniGLT
TrgMiniGLTRegisters::TrgMiniGLTRegisters::enable() | TrgAbstract
engines() | rcMiniGLTDefaultTrigger
eventNumber() | TrgMiniGLTRegisters
fourRangeReadout() | TrgMiniGLTRegisters
getDisableTime() | rcTrgMiniGLT
getEnableTime() | rcTrgMiniGLT
getTimeStamp() | rcTrgMiniGLT
GLT(glt=None) | TrgMiniGLT
inputEnables() | TrgAbstract
marker() | TrgMiniGLTRegisters
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
parity() | TrgMiniGLTRegisters
sequence() | TrgAbstract
shut(sweepEvent=None, progress=None) | rcMiniGLTDefaultTrigger
TrgMiniGLT::TrgMiniGLT::shut(marker) | TrgMiniGLT
solicit() | TrgMiniGLT
sweepOnShut() | rcMiniGLTDefaultTrigger
tack() | TrgMiniGLTRegisters
tag() | TrgMiniGLTRegisters
version() | TrgAbstract
waitForMaskEnable(tmo=None) | rcTrgMiniGLT
zeroSuppress() | TrgMiniGLTRegisters

Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcMiniGLTSolicitedCondition Member List

This is the complete list of members for rcMiniGLTSolicitedCondition, including all inherited members.

__init__() | rcMiniGLTSolicitedCondition
__setattr__(name, value) | TrgObject
calHigh() | TrgConditionsValue
calLow() | TrgConditionsValue
cno() | TrgConditionsValue
external() | MiniGLTTrgConditionsValue
periodic() | TrgConditionsValue
roi() | TrgConditionsValue
solicited() | rcMiniGLTSolicitedCondition
tkr() | TrgConditionsValue
value() | MiniGLTTrgConditionsValue

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcMiniGLTSolicitedEngine Member List

This is the complete list of members for rcMiniGLTSolicitedEngine, including all inherited members.

__init__() | rcMiniGLTSolicitedEngine
__setattr__(name, value) | TrgObject
participate(conditionsValue) | rcMiniGLTSolicitedEngine
prescale() | rcMiniGLTSolicitedEngine
request() | rcMiniGLTSolicitedEngine

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcSolicitedCondition Member List

This is the complete list of members for rcSolicitedCondition, including all inherited members.

__init__() | rcSolicitedCondition
__setattr__(name, value) | TrgObject
calHigh() | TrgConditionsValue
calLow() | TrgConditionsValue
cno() | TrgConditionsValue
external() | TrgConditionsValue
periodic() | TrgConditionsValue
roi() | TrgConditionsValue
solicited() | rcSolicitedCondition
tkr() | TrgConditionsValue
value() | TrgConditionsValue

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcSolicitedEngine Member List

This is the complete list of members for rcSolicitedEngine, including all inherited members.

__init__() | rcSolicitedEngine
__setattr__(name, value) | TrgObject
participate(conditionsValue) | rcSolicitedEngine
prescale() | rcSolicitedEngine
request() | rcSolicitedEngine

Generated on Fri Jan 21 18:01:17 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Preferences Member List

This is the complete list of members for Preferences, including all inherited members.

__getitem__(item) (defined in Preferences) | Preferences
__init__() (defined in Preferences) | Preferences
composePath(path) (defined in Preferences) | Preferences
expandVars(path) (defined in Preferences) | Preferences
isDir(item) (defined in Preferences) | Preferences
isNumber(item) (defined in Preferences) | Preferences

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcScmCfgSelector Member List

This is the complete list of members for rcScmCfgSelector, including all inherited members.

__init__(startwithDir, startwithFile, parent=None, name=None, fl=0) (defined in rcScmCfgSelector) | rcScmCfgSelector
getValue() (defined in rcScmCfgSelector) | rcScmCfgSelector

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcScmCfgSelText Member List

This is the complete list of members for rcScmCfgSelText, including all inherited members.

__init__(startwith) (defined in rcScmCfgSelText) | rcScmCfgSelText
getValue() (defined in rcScmCfgSelText) | rcScmCfgSelText

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcSecurityMan Member List

This is the complete list of members for rcSecurityMan, including all inherited members.

__init__(secureDir, users) (defined in rcSecurityMan) | rcSecurityMan
addPassword(loginId, password, userName) | rcSecurityMan
authenticateUser(loginId, password) | rcSecurityMan
changePassword(loginId, password, userName, oldPassword="") | rcSecurityMan
checkPassword(loginId) | rcSecurityMan
checkPermission(user, permission) | rcSecurityMan
deleteUser(loginId) | rcSecurityMan
getPermissionDescription(permission) | rcSecurityMan
getPermissions(role=None) | rcSecurityMan
getRoles() | rcSecurityMan
readPermissions() | rcSecurityMan
registerPermission(role, permission, permDesc) | rcSecurityMan
roleHasPermission(role, permission) | rcSecurityMan

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTestReport Member List

This is the complete list of members for rcTestReport, including all inherited members.

__init__() (defined in rcTestReport) | rcTestReport
addHeading(text) | rcTestReport
addHTML(htmlString, section=None) | rcTestReport
addSection(caption, insert=1) | rcTestReport
addSectionImage(sectionId, caption, url, width='', height='') | rcTestReport
addSectionItem(sectionId, label, text, url='') | rcTestReport
addSectionTable(sectionId, border='1', width='') | rcTestReport
addTableData(text, url='', align='', width='') | rcTestReport
addTableHeader(tableId, text, align='') | rcTestReport
beginTableRow(tableId) | rcTestReport
findTag(node, tagName) (defined in rcTestReport) | rcTestReport
getChildNodes(node) (defined in rcTestReport) | rcTestReport
getReports() (defined in rcTestReport) | rcTestReport
initReport(title) | rcTestReport
insertSection(sectionId, beforeSectionId=None) | rcTestReport
transformToFile(xslFileName, htmlFileName) | rcTestReport
xmlToString() (defined in rcTestReport) | rcTestReport

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTransitions Member List

This is the complete list of members for rcTransitions, including all inherited members.

__init__(rc, userId, debug) (defined in rcTransitions) | rcTransitions
addCustomReportData(key, value) | rcTransitions
addExportedFile(file=None, delete=False) | rcTransitions
adjustExcludeTime(dExcludeTime) | rcTransitions
applyConfig(seq=None, gxbrd=None) | rcTransitions
endExcludeTime() | rcTransitions
getAddlInputFiles() | rcTransitions
getArchiveFile() | rcTransitions
getArchiverInstance() | rcTransitions
getAvgDatagramSize() | rcTransitions
getAvgDeadTime() | rcTransitions
getBadEvents() | rcTransitions
getBadEventsFile() | rcTransitions
getCompletionStatus() | rcTransitions
getCompletionStatusStr() | rcTransitions
getDataDistributor() | rcTransitions
getDiscardedEvents() | rcTransitions
getElapsedTime() | rcTransitions
getEndTime() | rcTransitions
getErrorEvents() | rcTransitions
getErrorEventsFile() | rcTransitions
getEventCount() | rcTransitions
getEventRate() | rcTransitions
getEvtCli() | rcTransitions
getFailedEvents() | rcTransitions
getFailedEventSends() | rcTransitions
getFileTimeStamp() | rcTransitions
getFITSfile() | rcTransitions
getHSK() | rcTransitions
getHSKfile() | rcTransitions
getInstByteRate() | rcTransitions
getInstDatagramSize() | rcTransitions
getInstEventRate() | rcTransitions
getLengthMismatchedEvents() | rcTransitions
getName() (defined in rcTransitions) | rcTransitions
getParameterVerifier() | rcTransitions
getPauseCount() | rcTransitions
getPausedTime() | rcTransitions
getRawTimeStamp() | rcTransitions
getRunId() | rcTransitions
getSchemaConfigFile() | rcTransitions
getSessionVar(key) | rcTransitions
getStartTime() | rcTransitions
getSuite() | rcTransitions
getSuiteInstance() | rcTransitions
getUnsentEvents() | rcTransitions
getValidEvents() | rcTransitions
isLastSuiteScript() | rcTransitions
isRunFromSuite() | rcTransitions
pause() | rcTransitions
process(eventBuffer) | rcTransitions
rcPause() (defined in rcTransitions) | rcTransitions
rcResume() (defined in rcTransitions) | rcTransitions
rcSetup() | rcTransitions
rcStartRun() (defined in rcTransitions) | rcTransitions
rcStop() (defined in rcTransitions) | rcTransitions
rcStopRun() (defined in rcTransitions) | rcTransitions
rcTeardown() (defined in rcTransitions) | rcTransitions
readConfig(cfgFileName) | rcTransitions
resume() | rcTransitions
setArchiverClass(archiverClass) | rcTransitions
setCmdCli(cmdCli) | rcTransitions
setCompletionStatus(completionStatus, completionStatusStr=None) | rcTransitions
setEvtCli(evtCli) | rcTransitions
setLastSuiteScript() | rcTransitions
setPrefs(prefs) | rcTransitions
setSessionVar(key, value) | rcTransitions
setSuite(suite) | rcTransitions
setSuiteInstance(suiteInst) | rcTransitions
setup() | rcTransitions
startExcludeTime() | rcTransitions
startRun() | rcTransitions
stop() | rcTransitions
stopRun() | rcTransitions
takeSnapshot(stream=sys.stdout, fileName=None, captureGTIC=1, captureGAEQ=1, trigger=None, configName='', configVersion='') | rcTransitions
teardown() | rcTransitions
trigger(trg=None, replaceShut=True) | rcTransitions

Generated on Fri Jan 21 18:01:18 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTrgCoincidence Member List

This is the complete list of members for rcTrgCoincidence, including all inherited members.

__init__() | rcTrgCoincidence
__setattr__(name, value) | TrgObject
addPair(tile1, tile2) | rcTrgCoincidence
inCoincidence(tileNumber) | rcTrgCoincidence

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTrgEngines Member List

This is the complete list of members for rcTrgEngines, including all inherited members.

__init__() | rcTrgEngines
__setattr__(name, value) | TrgObject
engine(engineNumber) | rcTrgEngines
replaceEngine(engineNumber, engine) | rcTrgEngines

Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTrgTileEnables Member List

This is the complete list of members for rcTrgTileEnables, including all inherited members.

__init__() | rcTrgTileEnables
__setattr__(name, value) | TrgObject
addTile(tileNumber, side) (defined in rcTrgTileEnables) | rcTrgTileEnables
tile(tileNumber) | rcTrgTileEnables

Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

SweepMarkerEngine Member List

This is the complete list of members for SweepMarkerEngine, including all inherited members.

__init__() | SweepMarkerEngine
__setattr__(name, value) | TrgObject
participate(conditionsValue) | SweepMarkerEngine
prescale() | SweepMarkerEngine
request() | SweepMarkerEngine

Generated on Fri Jan 21 18:01:19 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTrgGem Member List

This is the complete list of members for rcTrgGem, including all inherited members.

__init__() | rcTrgGem
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGem
cnoEnableRegister() | TrgGemRegisters
commit(gem=None) | rcTrgGem
conditions() | TrgAbstract
configurationRegister() | TrgGemRegisters
disable() | rcTrgGem
enable(mask=None) | rcTrgGem
TrgGemRegisters::TrgGemRegisters::enable() | TrgAbstract
engines() | TrgAbstract
eventCounter() | TrgGem
eventDataParityEven() | TrgGemRegisters
eventHeaderParityEven() | TrgGemRegisters
GEM(glt=None) | TrgGem
getDisableTime() | rcTrgGem
getEnableTime() | rcTrgGem
getTimeStamp() | rcTrgGem
inhibitContribution() | TrgGemRegisters
inputEnables() | TrgAbstract
lookupTableRegister(registerNumber) | TrgGemRegisters
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgGemAbstract
periodicLimitRegister() | TrgGemRegisters
periodicModeRegister() | TrgGemRegisters
periodicRateRegister() | TrgGemRegisters
redundantPPS() | TrgGemRegisters
responseDataParityEven() | TrgGemRegisters
responseHeaderParityEven() | TrgGemRegisters
roi() | TrgGemAbstract
roiRegister(registerNumber) | TrgGemRegisters
sequence() | TrgAbstract
sequenceRegister() | TrgGemRegisters
shut(sweepEvent, progress=None) | rcTrgGem
TrgGem::TrgGem::shut(marker) | TrgGem
solicit() | TrgGem
sweepOnShut() | rcTrgGem
templateRegister(registerNumber) | TrgGemRegisters
tileCounters() | TrgGem
tileEnableRegister(registerNumber) | TrgGemRegisters
towerBusyEnableRegister() | TrgGemRegisters
towerEnableRegister(registerNumber) | TrgGemRegisters
triggerCounters() | TrgGem
triggerParityEven() | TrgGemRegisters
useAcdAsTrigger() | TrgGemAbstract
version() | TrgGem
waitForMaskEnable(tmo=None) | rcTrgGem
width() | TrgGemRegisters
widthRegister() | TrgGemRegisters

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcTrgMiniGLT Member List

This is the complete list of members for rcTrgMiniGLT, including all inherited members.

__init__() | rcTrgMiniGLT
__setattr__(name, value) | TrgObject
calStrobe() | TrgMiniGLTRegisters
commit() | rcTrgMiniGLT
conditions() | TrgAbstract
destination() | TrgMiniGLTRegisters
disable() | rcTrgMiniGLT
enable(newMask=None) | rcTrgMiniGLT
enable(mask=None) (defined in TrgMiniGLT) | TrgMiniGLT
TrgMiniGLTRegisters::TrgMiniGLTRegisters::enable() | TrgAbstract
engines() | TrgAbstract
eventNumber() | TrgMiniGLTRegisters
fourRangeReadout() | TrgMiniGLTRegisters
getDisableTime() | rcTrgMiniGLT
getEnableTime() | rcTrgMiniGLT
getTimeStamp() | rcTrgMiniGLT
GLT(glt=None) | TrgMiniGLT
inputEnables() | TrgAbstract
marker() | TrgMiniGLTRegisters
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
parity() | TrgMiniGLTRegisters
sequence() | TrgAbstract
shut(sweepEvent, progress=None) | rcTrgMiniGLT
TrgMiniGLT::TrgMiniGLT::shut(marker) | TrgMiniGLT
solicit() | TrgMiniGLT
sweepOnShut() | rcTrgMiniGLT
tack() | TrgMiniGLTRegisters
tag() | TrgMiniGLTRegisters
version() | TrgAbstract
waitForMaskEnable(tmo=None) | rcTrgMiniGLT
zeroSuppress() | TrgMiniGLTRegisters

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcUser Member List

This is the complete list of members for rcUser, including all inherited members.

__init__(userId, loginId, userName) (defined in rcUser) | rcUser
__str__() (defined in rcUser) | rcUser
addPermission(permission) | rcUser
addRole(role) | rcUser
getId() | rcUser
getLoginId() | rcUser
getName() | rcUser
getPermissions() | rcUser
getRoles() | rcUser
isAdministrator() | rcUser

Generated on Fri Jan 21 18:01:20 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

rcUsers Member List

This is the complete list of members for rcUsers, including all inherited members.

__init__() (defined in rcUsers) | rcUsers
addUser(user) | rcUsers
deleteUser(userId) | rcUsers
getIdNameDict() | rcUsers
getUser(userId) | rcUsers
getUserByLoginId(loginId) | rcUsers
getUserByName(name) | rcUsers
getUsers() | rcUsers

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Reloader Member List

This is the complete list of members for Reloader, including all inherited members.

__call__(args, namedargs) (defined in Reloader) | Reloader
__init__() (defined in Reloader) | Reloader

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Receiver Member List

This is the complete list of members for Receiver, including all inherited members.

__init__() (defined in Receiver) | Receiver
isReceiving() (defined in Receiver) | Receiver
process(trendables) (defined in Receiver) | Receiver
receive() (defined in Receiver) | Receiver
setReceiving(bool) (defined in Receiver) | Receiver
shutdown() (defined in Receiver) | Receiver

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

UDPReceiver Member List

This is the complete list of members for UDPReceiver, including all inherited members.

__init__() (defined in UDPReceiver) | UDPReceiver
isReceiving() (defined in Receiver) | Receiver
process(trendables) (defined in Receiver) | Receiver
receive() (defined in UDPReceiver) | UDPReceiver
setReceiving(bool) (defined in Receiver) | Receiver
setUDPClient(name, server) (defined in UDPReceiver) | UDPReceiver
shutdown() (defined in UDPReceiver) | UDPReceiver

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DummyRecorder Member List

This is the complete list of members for DummyRecorder, including all inherited members.

__init__() (defined in DummyRecorder) | DummyRecorder
processTrends(trendables) (defined in DummyRecorder) | DummyRecorder
shutdown() (defined in Recorder) | Recorder
updateTrends(trendables) (defined in Recorder) | Recorder

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Recorder Member List

This is the complete list of members for Recorder, including all inherited members.

__init__() (defined in Recorder) | Recorder
processTrends(trendables) (defined in Recorder) | Recorder
shutdown() (defined in Recorder) | Recorder
updateTrends(trendables) (defined in Recorder) | Recorder

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

UDPRecorder Member List

This is the complete list of members for UDPRecorder, including all inherited members.

__init__() (defined in UDPRecorder) | UDPRecorder
processTrends(trendables) (defined in UDPRecorder) | UDPRecorder
shutdown() (defined in UDPRecorder) | UDPRecorder
startUDPServer(name, server) (defined in UDPRecorder) | UDPRecorder
stopUDPServer() (defined in UDPRecorder) | UDPRecorder
updateTrends(trendables) (defined in Recorder) | Recorder

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DummyRetriever Member List

This is the complete list of members for DummyRetriever, including all inherited members.

__init__() (defined in DummyRetriever) | DummyRetriever
retrievePacket() (defined in DummyRetriever) | DummyRetriever

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

RunControl Member List

This is the complete list of members for RunControl, including all inherited members.

__init__(common, parent=None, name=None, fl=0) (defined in RunControl) | RunControl
clearHardwareVersionsCache() (defined in RunControl) | RunControl
connectClicked() (defined in RunControl) | RunControl
createGUI(obj, args, kwargs) | RunControl
customEvent(e) (defined in RunControl) | RunControl
disconnected() (defined in RunControl) | RunControl
doEmit(obj, signal=SIGNAL("clicked()"), args=()) | RunControl
doPause() | RunControl
doReset() | RunControl
doRun() | RunControl
doStop() | RunControl
doStopRun() | RunControl
execGUImethod(func, args, kwargs) | RunControl
execGUImethodNR(func, args, kwargs) | RunControl
ExitButtonClicked() (defined in RunControl) | RunControl
fileExit() (defined in RunControl) | RunControl
getFSM() (defined in RunControl) | RunControl
getHardwareVersions(lat=None) (defined in RunControl) | RunControl
initGUIbridges() (defined in RunControl) | RunControl
isGUIthread() (defined in RunControl) | RunControl
load() (defined in RunControl) | RunControl
normalCursor() (defined in RunControl) | RunControl
PauseClicked() (defined in RunControl) | RunControl
ResumeClicked() (defined in RunControl) | RunControl
setLAT(lat) (defined in RunControl) | RunControl
SetupClicked() (defined in RunControl) | RunControl
StartRunClicked() (defined in RunControl) | RunControl
StopClicked() (defined in RunControl) | RunControl
StopRunClicked() (defined in RunControl) | RunControl
TeardownClicked() (defined in RunControl) | RunControl
timedout() (defined in RunControl) | RunControl
userId() (defined in RunControl) | RunControl
waitCursor() (defined in RunControl) | RunControl

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

GDBN Member List

This is the complete list of members for GDBN, including all inherited members.

__init__() GDBN

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

RunControlCommon Member List

This is the complete list of members for RunControlCommon, including all inherited members.

__init__() (defined in RunControlCommon) | RunControlCommon
connect() (defined in RunControlCommon) | RunControlCommon
disconnect() (defined in RunControlCommon) | RunControlCommon
EBFdistribution() (defined in RunControlCommon) | RunControlCommon
elogWebsite() (defined in RunControlCommon) | RunControlCommon
getCmdCli() (defined in RunControlCommon) | RunControlCommon
getDBN() (defined in RunControlCommon) | RunControlCommon
getDDS() (defined in RunControlCommon) | RunControlCommon
getEvtCli() (defined in RunControlCommon) | RunControlCommon
getLAT() (defined in RunControlCommon) | RunControlCommon
getLoginId() | RunControlCommon
getMSGLogger() (defined in RunControlCommon) | RunControlCommon
getOCS() (defined in RunControlCommon) | RunControlCommon
getSecurityMan() (defined in RunControlCommon) | RunControlCommon
getXBRD() (defined in RunControlCommon) | RunControlCommon
initialize() (defined in RunControlCommon) | RunControlCommon
options() (defined in RunControlCommon) | RunControlCommon
prefGUI() (defined in RunControlCommon) | RunControlCommon
prefMan() (defined in RunControlCommon) | RunControlCommon
readSchema(filename) (defined in RunControlCommon) | RunControlCommon
setLoggingLevel(logLevel=None) (defined in RunControlCommon) | RunControlCommon
showLogin(parent) (defined in RunControlCommon) | RunControlCommon
startLogger() (defined in RunControlCommon) | RunControlCommon

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

RunControlFileHandler Member List

This is the complete list of members for RunControlFileHandler, including all inherited members.

__init__(filename, mode) (defined in RunControlFileHandler) | RunControlFileHandler
emit(record) (defined in RunControlFileHandler) | RunControlFileHandler

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

RunControlMain Member List

This is the complete list of members for RunControlMain, including all inherited members.

__init__(common, parent=None, name="RunControl", fl=0) (defined in RunControlMain) | RunControlMain
aboutRunControl() (defined in RunControlMain) | RunControlMain
applyPermissions(operator) (defined in RunControlMain) | RunControlMain
clearHardwareVersionsCache() (defined in RunControlMain) | RunControlMain
closeEvent(e) (defined in RunControlMain) | RunControlMain
connectClicked() (defined in RunControlMain) | RunControlMain
createGUI(obj, args, kwargs) | RunControlMain
customEvent(e) | RunControlMain
disconnected() (defined in RunControlMain) | RunControlMain
doEmit(obj, signal=SIGNAL("clicked()"), args=()) | RunControlMain
doPause() | RunControlMain
doReset() | RunControlMain
doRun() | RunControlMain
doStop() | RunControlMain
doStopRun() | RunControlMain
elogWebsite() (defined in RunControlMain) | RunControlMain
execGUImethod(func, args, kwargs) | RunControlMain
execGUImethodNR(func, args, kwargs) | RunControlMain
fileLogout() (defined in RunControlMain) | RunControlMain
getApp() (defined in RunControlMain) | RunControlMain
getFSM() (defined in RunControlMain) | RunControlMain
getHardwareVersions(lat=None, xbrd=None) (defined in RunControlMain) | RunControlMain
getName() (defined in RunControlMain) | RunControlMain
getSecurityMan() (defined in RunControlMain) | RunControlMain
handleComments(fromState, toState) (defined in RunControlMain) | RunControlMain
initApp() | RunControlMain
isGUIthread() | RunControlMain
loadApp(applName) | RunControlMain
login() (defined in RunControlMain) | RunControlMain
normalCursor() (defined in RunControlMain) | RunControlMain
PauseClicked() (defined in RunControlMain) | RunControlMain
ResetClicked() (defined in RunControlMain) | RunControlMain
RunClicked() (defined in RunControlMain) | RunControlMain
setEnabledTabPage(panelLabel, enable) | RunControlMain
setOperator(operator) (defined in RunControlMain) | RunControlMain
setOrientation(orientation) (defined in RunControlMain) | RunControlMain
setParticleType(particleType) (defined in RunControlMain) | RunControlMain
showHidePythonShell() (defined in RunControlMain) | RunControlMain
StopClicked() (defined in RunControlMain) | RunControlMain
timedout() (defined in RunControlMain) | RunControlMain
verifySoftware() (defined in RunControlMain) | RunControlMain
waitCursor() (defined in RunControlMain) | RunControlMain
warnFreeSpace(warn_level) (defined in RunControlMain) | RunControlMain

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

BoundMethodWeakref Member List

This is the complete list of members for BoundMethodWeakref, including all inherited members.

__call__() | BoundMethodWeakref |
__cmp__(other) | BoundMethodWeakref |
__init__(target, onDelete=None) | BoundMethodWeakref |
__new__(target, onDelete=None, arguments, named) | BoundMethodWeakref | [static]
__nonzero__() | BoundMethodWeakref |
__str__() | BoundMethodWeakref |
calculateKey(target) | BoundMethodWeakref | [static]

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

SGETrgEngines Member List

This is the complete list of members for SGETrgEngines, including all inherited members.

__init__() (defined in SGETrgEngines) SGETrgEngines

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

SGETrgInputEnables Member List

This is the complete list of members for SGETrgInputEnables, including all inherited members.

__init__() (defined in SGETrgInputEnables) SGETrgInputEnables

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

SimpleGasuExample Member List

This is the complete list of members for SimpleGasuExample, including all inherited members.

__init__() | SimpleGasuExample
coincidences() | SimpleGasuExample
conditions() (defined in SimpleGasuExample) | SimpleGasuExample
engines() | SimpleGasuExample
inputEnables() | SimpleGasuExample
useAcdAsTrigger() | SimpleGasuExample

Generated on Fri Jan 21 18:01:21 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

SolicitedCondition Member List

This is the complete list of members for SolicitedCondition, including all inherited members.

__init__() (defined in SolicitedCondition) | SolicitedCondition
solicited() (defined in SolicitedCondition) | SolicitedCondition

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

SolicitedEngine Member List

This is the complete list of members for SolicitedEngine, including all inherited members.

__init__() (defined in SolicitedEngine) | SolicitedEngine
participate(conditionsValue) (defined in SolicitedEngine) | SolicitedEngine
prescale() (defined in SolicitedEngine) | SolicitedEngine
request() (defined in SolicitedEngine) | SolicitedEngine

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ZsupTrgReadout Member List

This is the complete list of members for ZsupTrgReadout, including all inherited members.

__init__() | ZsupTrgReadout
zeroSuppress() (defined in ZsupTrgReadout) | ZsupTrgReadout

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

standardTestReport Member List

This is the complete list of members for standardTestReport, including all inherited members.

__init__() | standardTestReport
closeTestReport(FileName) | standardTestReport
getColorText(Text, Color='black', Bold=False) (defined in standardTestReport) | standardTestReport
statusString(status) | standardTestReport
writeTestInformation(runId, TestName=None, Operator=None, Site=None, Device=None, Phase=None, Status=None) | standardTestReport

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TaskEngine Member List

This is the complete list of members for TaskEngine, including all inherited members.

__init__(name=None) (defined in TaskEngine) | TaskEngine
name() | TaskEngine
run() | TaskEngine
shutdown(tmo=2.0) | TaskEngine
spawn(task, args, kwargs) | TaskEngine

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTExample Member List

This is the complete list of members for MiniGLTExample, including all inherited members.

__init__() | MiniGLTExample
conditions() | MiniGLTExample
engines() | MiniGLTExample

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTSolicitedCondition Member List

This is the complete list of members for MiniGLTSolicitedCondition, including all inherited members.

__init__() (defined in MiniGLTSolicitedCondition) | MiniGLTSolicitedCondition
solicited() (defined in MiniGLTSolicitedCondition) | MiniGLTSolicitedCondition

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTSolicitedEngine Member List

This is the complete list of members for MiniGLTSolicitedEngine, including all inherited members.

__init__() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
participate(conditionsValue) (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
prescale() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine
request() (defined in MiniGLTSolicitedEngine) | MiniGLTSolicitedEngine

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ZsupSolicitedEngine Member List

This is the complete list of members for ZsupSolicitedEngine, including all inherited members.

__init__() (defined in ZsupSolicitedEngine) | ZsupSolicitedEngine
participate(conditionsValue) (defined in ZsupSolicitedEngine) | ZsupSolicitedEngine
prescale() (defined in ZsupSolicitedEngine) | ZsupSolicitedEngine
request() (defined in ZsupSolicitedEngine) | ZsupSolicitedEngine

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ZsupTrgInjectChargeReadout Member List

This is the complete list of members for ZsupTrgInjectChargeReadout, including all inherited members.

__init__() | ZsupTrgInjectChargeReadout
zeroSuppress() (defined in ZsupTrgInjectChargeReadout) | ZsupTrgInjectChargeReadout

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgText Member List

This is the complete list of members for userArgText, including all inherited members.

__init__() (defined in userArgText) | userArgText
getValue(caption) (defined in userArgText) | userArgText

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgument Member List

This is the complete list of members for userArgument, including all inherited members.

__init__(parent=None, name=None, modal=0, fl=0) (defined in userArgument) | userArgument
CancelButtonClicked() (defined in userArgument) | userArgument
getValue(caption) (defined in userArgument) | userArgument
OKButtonClicked() (defined in userArgument) | userArgument

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

FullCondition Member List

This is the complete list of members for FullCondition, including all inherited members.

__init__() (defined in FullCondition) | FullCondition
calLow() (defined in FullCondition) | FullCondition
cno() (defined in FullCondition) | FullCondition
solicited() (defined in FullCondition) | FullCondition
tkr() (defined in FullCondition) | FullCondition

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

LDBI_LATcontributionIterator Member List

This is the complete list of members for LDBI_LATcontributionIterator, including all inherited members.

__init__(lci) (defined in LDBI_LATcontributionIterator) | LDBI_LATcontributionIterator
UDF(contrib, nextContrib) (defined in LDBI_LATcontributionIterator) | LDBI_LATcontributionIterator

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MarkerTrgReadout Member List

This is the complete list of members for MarkerTrgReadout, including all inherited members.

__init__() | MarkerTrgReadout
zeroSuppress() (defined in MarkerTrgReadout) | MarkerTrgReadout

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

SGETrgEngines Member List

This is the complete list of members for SGETrgEngines, including all inherited members.

__init__() (defined in SGETrgEngines) SGETrgEngines

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

SGETrgInputEnables Member List

This is the complete list of members for SGETrgInputEnables, including all inherited members.

__init__() (defined in SGETrgInputEnables) SGETrgInputEnables

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

SimpleGasuExample Member List

This is the complete list of members for SimpleGasuExample, including all inherited members.

__init__() | SimpleGasuExample
coincidences() | SimpleGasuExample
conditions() (defined in SimpleGasuExample) | SimpleGasuExample
engines() | SimpleGasuExample
inputEnables() | SimpleGasuExample
useAcdAsTrigger() | SimpleGasuExample

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
redAlarm(value, signal, sender) (defined in userApplication) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication
yellowAlarm1(value, signal, sender, sendNode) (defined in userApplication) | userApplication
yellowAlarm2(value, signal, sender, sendNode) (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(rc, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, latDatagram)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
teardown() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userApplication Member List

This is the complete list of members for userApplication, including all inherited members.

__init__(gui, userId, debug) (defined in userApplication) | userApplication
commandSynch() | userApplication
getName() (defined in userApplication) | userApplication
process((status, buffer)) | userApplication
resume() (defined in userApplication) | userApplication
setup() (defined in userApplication) | userApplication
startRun() (defined in userApplication) | userApplication
stop() (defined in userApplication) | userApplication
stopRun() (defined in userApplication) | userApplication
sync() (defined in userApplication) | userApplication
wait() (defined in userApplication) | userApplication

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userArgument Member List

This is the complete list of members for userArgument, including all inherited members.

__init__(parent=None, name=None, modal=0, fl=0) (defined in userArgument) | userArgument
getValue(caption) (defined in userArgument) | userArgument
OKButtonClicked() (defined in userArgument) | userArgument

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userSuite Member List

This is the complete list of members for userSuite, including all inherited members.

__init__(gui, userId, debug) (defined in userSuite) | userSuite
getName() (defined in userSuite) | userSuite
setupSuite() (defined in userSuite) | userSuite
startSuite() (defined in userSuite) | userSuite
stopSuite() (defined in userSuite) | userSuite

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

userSuite Member List

This is the complete list of members for userSuite, including all inherited members.

__init__(gui, userId, debug) (defined in userSuite) | userSuite
getName() (defined in userSuite) | userSuite
pauseSuite() (defined in userSuite) | userSuite
setupSuite() (defined in userSuite) | userSuite
startSuite() (defined in userSuite) | userSuite
stopSuite() (defined in userSuite) | userSuite

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ReverseTrendMap Member List

This is the complete list of members for ReverseTrendMap, including all inherited members.

__init__(startMap) (defined in ReverseTrendMap) | ReverseTrendMap
mapGet(key) (defined in ReverseTrendMap) | ReverseTrendMap
mapKeys() (defined in ReverseTrendMap) | ReverseTrendMap
mapSet(key, value) (defined in ReverseTrendMap) | ReverseTrendMap

Generated on Fri Jan 21 18:01:22 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgAbstract Member List

This is the complete list of members for TrgAbstract, including all inherited members.

__init__() | TrgAbstract
__setattr__(name, value) | TrgObject
conditions() | TrgAbstract
disable() | TrgAbstract
enable() | TrgAbstract
engines() | TrgAbstract
inputEnables() | TrgAbstract
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
sequence() | TrgAbstract
shut(marker) | TrgAbstract
solicit() | TrgAbstract
version() | TrgAbstract

Generated on Fri Jan 21 18:01:23 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCmdCounters Member List

This is the complete list of members for TrgCmdCounters, including all inherited members.

__init__() | TrgCmdCounters
__setattr__(name, value) | TrgObject
reset() | TrgCmdCounters
stats() | TrgCmdCounters

Generated on Fri Jan 21 18:01:24 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCmdStats Member List

This is the complete list of members for TrgCmdStats, including all inherited members.

__init__() | TrgCmdStats
__setattr__(name, value) | TrgObject
command() | TrgCmdStats
response() | TrgCmdStats

Generated on Fri Jan 21 18:01:24 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCoincidence Member List

This is the complete list of members for TrgCoincidence, including all inherited members.

__init__() | TrgCoincidence
__setattr__(name, value) | TrgObject
inCoincidence(tileNumber) | TrgCoincidence

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCoincidences Member List

This is the complete list of members for TrgCoincidences, including all inherited members.

__init__() | TrgCoincidences
__setattr__(name, value) | TrgObject
coincidence(coincidenceNumber) | TrgCoincidences
roi(regionNumber) | TrgRois

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgRoi Member List

This is the complete list of members for TrgRoi, including all inherited members.

__init__() | TrgRoi
__setattr__(name, value) | TrgObject
tile(tileNumber) | TrgRoi

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgRois Member List

This is the complete list of members for TrgRois, including all inherited members.

__init__() | TrgRois
__setattr__(name, value) | TrgObject
roi(regionNumber) | TrgRois

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgConditions Member List

This is the complete list of members for TrgConditions, including all inherited members.

__init__() | TrgConditions
__setattr__(name, value) | TrgObject
calHigh() | TrgConditions
calLow() | TrgConditions
cno() | TrgConditions
external() | TrgConditions
periodic() | TrgConditions
roi() | TrgConditions
solicited() | TrgConditions
tkr() | TrgConditions

Generated on Fri Jan 21 18:01:25 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgConditionsValue Member List

This is the complete list of members for TrgConditionsValue, including all inherited members.

__init__() | TrgConditionsValue
__setattr__(name, value) | TrgObject
calHigh() | TrgConditionsValue
calLow() | TrgConditionsValue
cno() | TrgConditionsValue
external() | TrgConditionsValue
periodic() | TrgConditionsValue
roi() | TrgConditionsValue
solicited() | TrgConditionsValue
tkr() | TrgConditionsValue
value() | TrgConditionsValue

Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgEngine Member List

This is the complete list of members for TrgEngine, including all inherited members.

__init__() | TrgEngine
__setattr__(name, value) | TrgObject
participate(conditionsValue) | TrgEngine
prescale() | TrgEngine
request() | TrgEngine

Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgEngineRequest Member List

This is the complete list of members for TrgEngineRequest, including all inherited members.

__init__() | TrgEngineRequest
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker(markerValue=0) | TrgEngineRequest
sequence() | TrgEngineRequest
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgEngines Member List

This is the complete list of members for TrgEngines, including all inherited members.

__init__() | TrgEngines
__setattr__(name, value) | TrgObject
engine(engineNumber) | TrgEngines

Generated on Fri Jan 21 18:01:26 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgInjectCharge Member List

This is the complete list of members for TrgInjectCharge, including all inherited members.

__init__() | TrgInjectCharge
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker(markerValue=0) | TrgEngineRequest
sequence() | TrgInjectCharge
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgInjectChargeReadout Member List

This is the complete list of members for TrgInjectChargeReadout, including all inherited members.

__init__() | TrgInjectChargeReadout
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker(markerValue=0) | TrgEngineRequest
sequence() | TrgInjectChargeReadout
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgInjectMarker Member List

This is the complete list of members for TrgInjectMarker, including all inherited members.

__init__(marker) | TrgInjectMarker
TrgEngines::TrgEngineRequest::__init__() | TrgEngineRequest
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker() | TrgInjectMarker
TrgEngines::TrgEngineRequest::marker(markerValue=0) | TrgEngineRequest
sequence() | TrgInjectMarker
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgReadout Member List

This is the complete list of members for TrgReadout, including all inherited members.

__init__() | TrgReadout
__setattr__(name, value) | TrgObject
destination() | TrgEngineRequest
fourRange() | TrgEngineRequest
marker(markerValue=0) | TrgEngineRequest
sequence() | TrgReadout
zeroSuppress() | TrgEngineRequest

Generated on Fri Jan 21 18:01:27 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgEventCounter Member List

This is the complete list of members for TrgEventCounter, including all inherited members.

__init__() | TrgEventCounter
__setattr__(name, value) | TrgObject
reset() | TrgEventCounter
stats() | TrgEventCounter

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGem Member List

This is the complete list of members for TrgGem, including all inherited members.

__init__() | TrgGem
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGem
cnoEnableRegister() | TrgGemRegisters
conditions() | TrgAbstract
configurationRegister() | TrgGemRegisters
disable() | TrgGem
enable(mask=None) (defined in TrgGem) | TrgGem
TrgGemRegisters::TrgGemRegisters::enable() | TrgAbstract
engines() | TrgAbstract
eventCounter() | TrgGem
eventDataParityEven() | TrgGemRegisters
eventHeaderParityEven() | TrgGemRegisters
GEM(glt=None) | TrgGem
inhibitContribution() | TrgGemRegisters
inputEnables() | TrgAbstract
lookupTableRegister(registerNumber) | TrgGemRegisters
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgGemAbstract
periodicLimitRegister() | TrgGemRegisters
periodicModeRegister() | TrgGemRegisters
periodicRateRegister() | TrgGemRegisters
redundantPPS() | TrgGemRegisters
responseDataParityEven() | TrgGemRegisters
responseHeaderParityEven() | TrgGemRegisters
roi() | TrgGemAbstract
roiRegister(registerNumber) | TrgGemRegisters
sequence() | TrgAbstract
sequenceRegister() | TrgGemRegisters
shut(marker) | TrgGem
solicit() | TrgGem
templateRegister(registerNumber) | TrgGemRegisters
tileCounters() | TrgGem
tileEnableRegister(registerNumber) | TrgGemRegisters
towerBusyEnableRegister() | TrgGemRegisters
towerEnableRegister(registerNumber) | TrgGemRegisters
triggerCounters() | TrgGem
triggerParityEven() | TrgGemRegisters
useAcdAsTrigger() | TrgGemAbstract
version() | TrgGem
width() | TrgGemRegisters
widthRegister() | TrgGemRegisters

Generated on Fri Jan 21 18:01:28 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemAbstract Member List

This is the complete list of members for TrgGemAbstract, including all inherited members.

__init__() | TrgGemAbstract
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGemAbstract
conditions() | TrgAbstract
disable() | TrgAbstract
enable() | TrgAbstract
engines() | TrgAbstract
eventCounter() | TrgGemAbstract
eventDataParityEven() | TrgGemAbstract
eventHeaderParityEven() | TrgGemAbstract
inhibitContribution() | TrgGemAbstract
inputEnables() | TrgAbstract
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgGemAbstract
redundantPPS() | TrgGemAbstract
responseDataParityEven() | TrgGemAbstract
responseHeaderParityEven() | TrgGemAbstract
roi() | TrgGemAbstract
sequence() | TrgAbstract
shut(marker) | TrgAbstract
solicit() | TrgAbstract
tileCounters() | TrgGemAbstract
triggerCounters() | TrgGemAbstract
triggerParityEven() | TrgGemAbstract
useAcdAsTrigger() | TrgGemAbstract
version() | TrgAbstract
width() | TrgGemAbstract

Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemCmdCounters Member List

This is the complete list of members for TrgGemCmdCounters, including all inherited members.

__init__(glt) | TrgGemCmdCounters
TrgCmdCounters::TrgCmdCounters::__init__() | TrgCmdCounters
__setattr__(name, value) | TrgObject
reset() | TrgGemCmdCounters
stats() | TrgGemCmdCounters

Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemCmdStats Member List

This is the complete list of members for TrgGemCmdStats, including all inherited members.

__init__(glt) | TrgGemCmdStats
TrgCmdCounters::TrgCmdStats::__init__() | TrgCmdStats
__setattr__(name, value) | TrgObject
command() | TrgGemCmdStats
response() | TrgGemCmdStats

Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemEventCounter Member List

This is the complete list of members for TrgGemEventCounter, including all inherited members.

__init__(glt) | TrgGemEventCounter
TrgEventCounter::TrgEventCounter::__init__() | TrgEventCounter
__setattr__(name, value) | TrgObject
reset() | TrgGemEventCounter
stats() | TrgGemEventCounter

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemTileCounters Member List

This is the complete list of members for TrgGemTileCounters, including all inherited members.

__init__(glt) | TrgGemTileCounters
__init__() (defined in TrgTileCounters) | TrgTileCounters
__setattr__(name, value) | TrgObject
assignA(tileNumber) | TrgGemTileCounters
TrgTileCounters::TrgTileCounters::assignA(a) | TrgTileCounters
assignAB(a, b) | TrgGemTileCounters
assignB(tileNumber) | TrgGemTileCounters
TrgTileCounters::TrgTileCounters::assignB(B) | TrgTileCounters
reset() | TrgGemTileCounters
stats() | TrgGemTileCounters

Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemTileStats Member List

This is the complete list of members for TrgGemTileStats, including all inherited members.

__init__(glt) | TrgGemTileStats
__init__() (defined in TrgTileStats) | TrgTileStats
__setattr__(name, value) | TrgObject
A() | TrgGemTileStats
B() | TrgGemTileStats

Generated on Fri Jan 21 18:01:30 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemTriggerCounters Member List

This is the complete list of members for TrgGemTriggerCounters, including all inherited members.

__init__(glt) | TrgGemTriggerCounters
TrgTriggerCounters::TrgTriggerCounters::__init__() | TrgTriggerCounters
__setattr__(name, value) | TrgObject
reset() | TrgGemTriggerCounters
stats() | TrgGemTriggerCounters

Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemTriggerStats Member List

This is the complete list of members for TrgGemTriggerStats, including all inherited members.

__init__(glt) | TrgGemTriggerStats
__init__() (defined in TrgTriggerStats) | TrgTriggerStats
__setattr__(name, value) | TrgObject
discarded() | TrgGemTriggerStats
livetime() | TrgGemTriggerStats
prescaled() | TrgGemTriggerStats
sent() | TrgGemTriggerStats

Generated on Fri Jan 21 18:01:29 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemPeriodicCondition Member List

This is the complete list of members for TrgGemPeriodicCondition, including all inherited members.

__init__() | TrgGemPeriodicCondition
__setattr__(name, value) | TrgObject
abort() | TrgGemPeriodicCondition
definition() | TrgPeriodicCondition
limit() | TrgGemPeriodicCondition
prescale() | TrgGemPeriodicCondition
remaining() | TrgGemPeriodicCondition
reset() | TrgGemPeriodicCondition
source() | TrgGemPeriodicCondition

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

ACDmap Member List

This is the complete list of members for ACDmap, including all inherited members.

__init__(gemVersion=None) (defined in ACDmap) | ACDmap
freeName(cable) (defined in ACDmap) | ACDmap
lookup(cable, channel) (defined in ACDmap) | ACDmap

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemRegisters Member List

This is the complete list of members for TrgGemRegisters, including all inherited members.

__init__() | TrgGemRegisters
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGemAbstract
cnoEnableRegister() | TrgGemRegisters
conditions() | TrgAbstract
configurationRegister() | TrgGemRegisters
disable() | TrgAbstract
enable() | TrgAbstract
engines() | TrgAbstract
eventCounter() | TrgGemAbstract
eventDataParityEven() | TrgGemRegisters
eventHeaderParityEven() | TrgGemRegisters
inhibitContribution() | TrgGemRegisters
inputEnables() | TrgAbstract
lookupTableRegister(registerNumber) | TrgGemRegisters
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgGemAbstract
periodicLimitRegister() | TrgGemRegisters
periodicModeRegister() | TrgGemRegisters
periodicRateRegister() | TrgGemRegisters
redundantPPS() | TrgGemRegisters
responseDataParityEven() | TrgGemRegisters
responseHeaderParityEven() | TrgGemRegisters
roi() | TrgGemAbstract
roiRegister(registerNumber) | TrgGemRegisters
sequence() | TrgAbstract
sequenceRegister() | TrgGemRegisters
shut(marker) | TrgAbstract
solicit() | TrgAbstract
templateRegister(registerNumber) | TrgGemRegisters
tileCounters() | TrgGemAbstract
tileEnableRegister(registerNumber) | TrgGemRegisters
towerBusyEnableRegister() | TrgGemRegisters
towerEnableRegister(registerNumber) | TrgGemRegisters
triggerCounters() | TrgGemAbstract
triggerParityEven() | TrgGemRegisters
useAcdAsTrigger() | TrgGemAbstract
version() | TrgAbstract
width() | TrgGemRegisters
widthRegister() | TrgGemRegisters

Generated on Fri Jan 21 18:01:31 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgGemSequence Member List

This is the complete list of members for TrgGemSequence, including all inherited members.

__init__() | TrgGemSequence
__setattr__(name, value) | TrgObject
definition() | TrgSequence
eventNumber() | TrgGemSequence
eventTag() | TrgGemSequence

Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCnoEnables Member List

This is the complete list of members for TrgCnoEnables, including all inherited members.

__init__() | TrgCnoEnables
__setattr__(name, value) | TrgObject
LA1() | TrgCnoEnables
LA2() | TrgCnoEnables
LA3() | TrgCnoEnables
LA4() | TrgCnoEnables
LB2() | TrgCnoEnables
LB4() | TrgCnoEnables
RA2() | TrgCnoEnables
RA4() | TrgCnoEnables
RB1() | TrgCnoEnables
RB2() | TrgCnoEnables
RB3() | TrgCnoEnables
RB4() | TrgCnoEnables

Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgInputEnables Member List

This is the complete list of members for TrgInputEnables, including all inherited members.

__init__() | TrgInputEnables
__setattr__(name, value) | TrgObject
cno() | TrgInputEnables
tiles() | TrgInputEnables
towers() | TrgInputEnables

Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTileEnables Member List

This is the complete list of members for TrgTileEnables, including all inherited members.

__init__() | TrgTileEnables
__setattr__(name, value) | TrgObject
tile(tileNumber) | TrgTileEnables

Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTowerEnables Member List

This is the complete list of members for TrgTowerEnables, including all inherited members.

__init__() | TrgTowerEnables
__setattr__(name, value) | TrgObject
towers() | TrgTowerEnables

Generated on Fri Jan 21 18:01:32 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

MiniGLTTrgConditionsValue Member List

This is the complete list of members for MiniGLTTrgConditionsValue, including all inherited members.

__init__() | MiniGLTTrgConditionsValue
__setattr__(name, value) | TrgObject
calHigh() | TrgConditionsValue
calLow() | TrgConditionsValue
cno() | TrgConditionsValue
external() | MiniGLTTrgConditionsValue
periodic() | TrgConditionsValue
roi() | TrgConditionsValue
solicited() | TrgConditionsValue
tkr() | TrgConditionsValue
value() | MiniGLTTrgConditionsValue

Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgMiniGLT Member List

This is the complete list of members for TrgMiniGLT, including all inherited members.

__init__() | TrgMiniGLT
__setattr__(name, value) | TrgObject
calStrobe() | TrgMiniGLTRegisters
conditions() | TrgAbstract
destination() | TrgMiniGLTRegisters
disable() | TrgMiniGLT
enable(mask=None) (defined in TrgMiniGLT) | TrgMiniGLT
TrgMiniGLTRegisters::TrgMiniGLTRegisters::enable() | TrgAbstract
engines() | TrgAbstract
eventNumber() | TrgMiniGLTRegisters
fourRangeReadout() | TrgMiniGLTRegisters
GLT(glt=None) | TrgMiniGLT
inputEnables() | TrgAbstract
marker() | TrgMiniGLTRegisters
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
parity() | TrgMiniGLTRegisters
sequence() | TrgAbstract
shut(marker) | TrgMiniGLT
solicit() | TrgMiniGLT
tack() | TrgMiniGLTRegisters
tag() | TrgMiniGLTRegisters
version() | TrgAbstract
zeroSuppress() | TrgMiniGLTRegisters

Generated on Fri Jan 21 18:01:33 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgMiniGLTAbstract Member List

This is the complete list of members for TrgMiniGLTAbstract, including all inherited members.

__init__() | TrgMiniGLTAbstract
__setattr__(name, value) | TrgObject
calStrobe() | TrgMiniGLTAbstract
conditions() | TrgAbstract
destination() | TrgMiniGLTAbstract
disable() | TrgAbstract
enable() | TrgAbstract
engines() | TrgAbstract
eventNumber() | TrgMiniGLTAbstract
fourRangeReadout() | TrgMiniGLTAbstract
inputEnables() | TrgAbstract
marker() | TrgMiniGLTAbstract
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
parity() | TrgMiniGLTAbstract
sequence() | TrgAbstract
shut(marker) | TrgAbstract
solicit() | TrgAbstract
tack() | TrgMiniGLTAbstract
tag() | TrgMiniGLTAbstract
version() | TrgAbstract
zeroSuppress() | TrgMiniGLTAbstract

Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgMiniGLTRegisters Member List

This is the complete list of members for TrgMiniGLTRegisters, including all inherited members.

__init__() | TrgMiniGLTRegisters
__setattr__(name, value) | TrgObject
calStrobe() | TrgMiniGLTRegisters
conditions() | TrgAbstract
destination() | TrgMiniGLTRegisters
disable() | TrgAbstract
enable() | TrgAbstract
engines() | TrgAbstract
eventNumber() | TrgMiniGLTRegisters
fourRangeReadout() | TrgMiniGLTRegisters
inputEnables() | TrgAbstract
marker() | TrgMiniGLTRegisters
maxConditions() | TrgAbstract
maxEngines() | TrgAbstract
parity() | TrgMiniGLTRegisters
sequence() | TrgAbstract
shut(marker) | TrgAbstract
solicit() | TrgAbstract
tack() | TrgMiniGLTRegisters
tag() | TrgMiniGLTRegisters
version() | TrgAbstract
zeroSuppress() | TrgMiniGLTRegisters

Generated on Fri Jan 21 18:01:34 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

TrgObject Member List

This is the complete list of members for TrgObject, including all inherited members.

__setattr__(name, value) TrgObject

Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgDefaultPeriodicCondition Member List

This is the complete list of members for TrgDefaultPeriodicCondition, including all inherited members.

__init__() | TrgDefaultPeriodicCondition
__setattr__(name, value) | TrgObject
limit() | TrgDefaultPeriodicCondition
prescale() | TrgDefaultPeriodicCondition
source() | TrgDefaultPeriodicCondition

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgPeriodicCondition Member List

This is the complete list of members for TrgPeriodicCondition, including all inherited members.

__init__() | TrgPeriodicCondition
__setattr__(name, value) | TrgObject
abort() | TrgPeriodicCondition
definition() | TrgPeriodicCondition
limit() | TrgPeriodicConditionAbstract
prescale() | TrgPeriodicConditionAbstract
remaining() | TrgPeriodicCondition
reset() | TrgPeriodicCondition
source() | TrgPeriodicConditionAbstract

Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgPeriodicConditionAbstract Member List

This is the complete list of members for TrgPeriodicConditionAbstract, including all inherited members.

__init__() | TrgPeriodicConditionAbstract
__setattr__(name, value) | TrgObject
limit() | TrgPeriodicConditionAbstract
prescale() | TrgPeriodicConditionAbstract
source() | TrgPeriodicConditionAbstract

Generated on Fri Jan 21 18:01:35 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgPeriodicConditionDefinition Member List

This is the complete list of members for TrgPeriodicConditionDefinition, including all inherited members.

__init__() | TrgPeriodicConditionDefinition
__setattr__(name, value) | TrgObject
limit() | TrgPeriodicConditionAbstract
prescale() | TrgPeriodicConditionAbstract
source() | TrgPeriodicConditionAbstract

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

AddableRoi Member List

This is the complete list of members for AddableRoi, including all inherited members.

__init__() | AddableRoi
__setattr__(name, value) | TrgObject
addTile(tile) (defined in AddableRoi) | AddableRoi
tile(tileNumber) | AddableRoi

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgRoiAsTiles Member List

This is the complete list of members for TrgRoiAsTiles, including all inherited members.

__init__() | TrgRoiAsTiles
__setattr__(name, value) | TrgObject
addCoincidence(cNumber, coinc) (defined in TrgRoiAsTiles) | TrgRoiAsTiles
coincidence(coincidenceNumber) | TrgRoiAsTiles
roi(roiNumber) (defined in TrgRoiAsTiles) | TrgRoiAsTiles
TrgCoincidences::TrgCoincidences::roi(regionNumber) | TrgRois

Generated on Fri Jan 21 18:01:36 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgDefaultSequence Member List

This is the complete list of members for TrgDefaultSequence, including all inherited members.

__init__() | TrgDefaultSequence
__setattr__(name, value) | TrgObject
eventNumber() | TrgDefaultSequence
eventTag() | TrgDefaultSequence

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgSequence Member List

This is the complete list of members for TrgSequence, including all inherited members.

__init__() | TrgSequence
__setattr__(name, value) | TrgObject
definition() | TrgSequence
eventNumber() | TrgSequenceAbstract
eventTag() | TrgSequenceAbstract

Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgSequenceAbstract Member List

This is the complete list of members for TrgSequenceAbstract, including all inherited members.

__init__() | TrgSequenceAbstract
__setattr__(name, value) | TrgObject
eventNumber() | TrgSequenceAbstract
eventTag() | TrgSequenceAbstract

Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgSequenceDefinition Member List

This is the complete list of members for TrgSequenceDefinition, including all inherited members.

__init__() | TrgSequenceDefinition
__setattr__(name, value) | TrgObject
eventNumber() | TrgSequenceAbstract
eventTag() | TrgSequenceAbstract

Generated on Fri Jan 21 18:01:37 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTileCounters Member List

This is the complete list of members for TrgTileCounters, including all inherited members.

__init__() (defined in TrgTileCounters) | TrgTileCounters
__setattr__(name, value) | TrgObject
assignA(a) | TrgTileCounters
assignAB(a, b) | TrgTileCounters
assignB(B) | TrgTileCounters
reset() | TrgTileCounters
stats() | TrgTileCounters

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTileStats Member List

This is the complete list of members for TrgTileStats, including all inherited members.

__init__() (defined in TrgTileStats) | TrgTileStats
__setattr__(name, value) | TrgObject
A() | TrgTileStats
B() | TrgTileStats

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgCalorimeter Member List

This is the complete list of members for TrgCalorimeter, including all inherited members.

__init__() | TrgCalorimeter
__setattr__(name, value) | TrgObject
useHighEnergy() | TrgCalorimeter
useLowEnergy() | TrgCalorimeter

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTower Member List

This is the complete list of members for TrgTower, including all inherited members.

__init__() | TrgTower
__setattr__(name, value) | TrgObject
calorimeter() | TrgTower
tracker() | TrgTower

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTowers Member List

This is the complete list of members for TrgTowers, including all inherited members.

__init__() | TrgTowers
__setattr__(name, value) | TrgObject
tower(towerNumber) | TrgTowers

Generated on Fri Jan 21 18:01:38 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTracker Member List

This is the complete list of members for TrgTracker, including all inherited members.

__init__() | TrgTracker
__setattr__(name, value) | TrgObject
use() | TrgTracker

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTriggerCounters Member List

This is the complete list of members for TrgTriggerCounters, including all inherited members.

__init__() | TrgTriggerCounters
__setattr__(name, value) | TrgObject
reset() | TrgTriggerCounters
stats() | TrgTriggerCounters

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgTriggerStats Member List

This is the complete list of members for TrgTriggerStats, including all inherited members.

__init__() (defined in TrgTriggerStats) | TrgTriggerStats
__setattr__(name, value) | TrgObject
discarded() | TrgTriggerStats
livetime() | TrgTriggerStats
prescaled() | TrgTriggerStats
sent() | TrgTriggerStats

Generated on Fri Jan 21 18:01:39 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

DefaultPeriodicCondition Member List

This is the complete list of members for DefaultPeriodicCondition, including all inherited members.

__init__() | DefaultPeriodicCondition
__setattr__(name, value) | TrgObject
abort() | TrgGemPeriodicCondition
definition() | DefaultPeriodicCondition
limit() | TrgGemPeriodicCondition
prescale() | TrgGemPeriodicCondition
remaining() | TrgGemPeriodicCondition
reset() | TrgGemPeriodicCondition
source() | TrgGemPeriodicCondition

Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Member List

TrgUsingTiles Member List

This is the complete list of members for TrgUsingTiles, including all inherited members.

__init__() | TrgUsingTiles
__setattr__(name, value) | TrgObject
cmdCounters() | TrgGem
cnoEnableRegister() | TrgGemRegisters
coincidences() | TrgUsingTiles
commit(gem=None) | rcTrgGem
conditions() | TrgAbstract
configurationRegister() | TrgGemRegisters
disable() | rcTrgGem
enable(mask=None) | rcTrgGem
TrgGemRegisters::TrgGemRegisters::enable() | TrgAbstract
engines() | TrgAbstract
eventCounter() | TrgGem
eventDataParityEven() | TrgGemRegisters
eventHeaderParityEven() | TrgGemRegisters
GEM(glt=None) | TrgGem
getDisableTime() | rcTrgGem
getEnableTime() | rcTrgGem
getTimeStamp() | rcTrgGem
inhibitContribution() | TrgGemRegisters
inputEnables() | TrgAbstract
lookupTableRegister(registerNumber) | TrgGemRegisters
maxConditions() | TrgGemAbstract
maxEngines() | TrgGemAbstract
periodicCondition() | TrgUsingTiles
periodicLimitRegister() | TrgGemRegisters
periodicModeRegister() | TrgGemRegisters
periodicRateRegister() | TrgGemRegisters
redundantPPS() | TrgGemRegisters
responseDataParityEven() | TrgGemRegisters
responseHeaderParityEven() | TrgGemRegisters
roi() | TrgUsingTiles
roiRegister(registerNumber) | TrgGemRegisters
sequence() | TrgUsingTiles
sequenceRegister() | TrgGemRegisters
shut(sweepEvent, progress=None) | rcTrgGem
TrgGem::TrgGem::shut(marker) | TrgGem
solicit() | TrgGem
sweepOnShut() | rcTrgGem
templateRegister(registerNumber) | TrgGemRegisters
tileCounters() | TrgGem
tileEnableRegister(registerNumber) | TrgGemRegisters
towerBusyEnableRegister() | TrgGemRegisters
towerEnableRegister(registerNumber) | TrgGemRegisters
triggerCounters() | TrgGem
triggerParityEven() | TrgGemRegisters
useAcdAsTrigger() | TrgUsingTiles
version() | TrgGem
waitForMaskEnable(tmo=None) | rcTrgGem
width() | TrgGemRegisters
widthRegister() | TrgGemRegisters

Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Collector.py Source File

monitoring

Collector.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import logging
00021 import threading
00022 import time
00023
00024 class Collector(object):
00025   def __init__(self, *args):
00026     self.__loopStop   = 0
00027     self.__monDelay   = 9
00028     self.__monThread  = None
00029     self.__retrievers = {}
00030     self.__recorders  = []
00031     self.__delayUnits = 0.01  # seconds
00032     self.__log        = logging.getLogger('collecting.Collector')
00033     self.setDelay(10)
00034
00035   def addRetriever(self,name,retriever):
00036     self.__retrievers[name]=retriever
00037     retriever.startup()
00038
00039   def delRetriever(self,name):
00040     if self.__retrievers.has_key(name):
00041       del self.__retrievers[name]
00042
00043   def addRecorder(self,recorder):
00044     self.__recorders.append(recorder)
00045
00046   def setDelay(self,delay):
00047     """Set the delay in units of seconds
00048     """
00049     if delay >= 1:
00050       acq = self.isAcquiring()
00051       self.setAcquiring(0)
00052       self.__monDelay = int(delay / self.__delayUnits)-1 # account for 1/10 second in thread
00053       self.setAcquiring(acq)
00054     else:
00055       self.__log.error("Delay must be an integer>1, delay unchanged")
00056
00057   def getDelay(self):
00058     return self.__monDelay * self.__delayUnits
00059
00060   def isAcquiring(self):
00061     if self.__monThread:
00062       return 1
00063     return 0
00064
00065   def setAcquiring(self,bool):
00066     if bool:
00067       self.__startLoop()
00068     else:
00069       self.__stopLoop()
00070
00071   def collectData(self):
00072     for r in self.__retrievers.values():
00073       data = r.retrievePacket()
00074       # Process the data
00075       for l in self.__recorders:
00076         l.updateTrends(data)
00077
00078   def shutdown(self):
00079     for r in self.__retrievers.values() + self.__recorders:
00080       r.shutdown()
00081     self.__stopLoop()
00082
00083   def __startLoop(self):
00084     if self.__monThread:
00085       self.__log.warning("There is already a Collector Loop")
00086     else:
00087       self.__monThread = threading.Thread(None,
00088                                           self.__monLoop,
00089                                           'Collector',
00090                                           (self.__monDelay,))
00091       self.__monThread.start()
00092
00093   def __stopLoop(self):
00094     if self.__monThread:
00095       self.__log.info("Shutting down Collector Loop")
00096       self.__loopStop  = 1
00097       self.__monThread.join()
00098       self.__monThread = None
00099       self.__loopStop  = 0
00100
00101   def __monLoop(self,delay):
00102     self.__log.info("Starting Collector Loop")
00103     while (not self.__loopStop):
00104       self.collectData()
00105       for i in xrange(delay):
00106         if (self.__loopStop):
00107           break;
00108         time.sleep(self.__delayUnits)
00109     self.__log.info("Collector Loop Stopped")
00110
00111 def testCollector():
00112   logging.basicConfig()
00113   logging.root.setLevel(logging.DEBUG)
00114
00115   udpServerName = 'testTrendingServer'
00116   udpServerAddr = '54320@239.255.1.14'
00117   from Retriever import DummyRetriever
00118   from Recorder  import UDPRecorder, DummyRecorder
00119
00120   c   = Collector()
00121   rec = UDPRecorder()
00122   rec.startUDPServer(udpServerName,udpServerAddr)
00123   c.addRetriever('dummy',DummyRetriever())
00124   c.addRecorder(rec)
00125   c.addRecorder(DummyRecorder())
00126   c.setAcquiring(True)
00127
00128   try:
00129     while 1:
00130       time.sleep(.01)
00131   except Exception, e:
00132     c.shutdown()
00133
00134 if __name__ == '__main__':
00135   testCollector()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: colorScale.py Source File

gosed

colorScale.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online Event Display color selector"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "10/14/04"
00014 __version__  = "$Revision: 1.2.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 def colorScale(value):
00022   """\brief Method for returning a color scale RGB tuple given a percentage.
00023
00024   Return a tuple giving the RGB values for a color chosen from a color scale:
00025     black       for value <  0.0
00026     blue (cold) for value >= 0.0
00027     .
00028     .
00029     .
00030     red (hot)   for value <= 1.0
00031     white       for value >  1.0
00032
00033   \param value - A number between 0.0 and 1.0
00034   \return A tuple containing the RGB values corresponding to the input value
00035   """
00036
00037   if value < 0.0:  return (0,     0,   0)
00038   if value > 1.0:  return (255, 255, 255)
00039
00040   r = 1.0
00041   g = 1.0
00042   b = 1.0
00043
00044   dv   = 1.0
00045   vmin = 0.0
00046   v    = value
00047
00048   if (v < (vmin + 0.25 * dv)):
00049     r = 0
00050     g = 4 * (v - vmin) / dv
00051   elif (v < (vmin + 0.5 * dv)):
00052     r = 0
00053     b = 1 + 4 * (vmin + 0.25 * dv - v) / dv
00054   elif (v < (vmin + 0.75 * dv)):
00055     r = 4 * (v - vmin - 0.5 * dv) / dv
00056     b = 0
00057   else:
00058     g = 1 + 4 * (vmin + 0.75 * dv - v) / dv
00059     b = 0
00060
00061   red   = int( r * 255. )
00062   green = int( g * 255. )
00063   blue  = int( b * 255. )
00064
00065   assert ( red < 256 and green < 256 and blue < 256 )
00066   return ( red, green, blue )
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: consumer.py Source File

consumer

consumer.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online consumer"
00012 __author__   = "Lester Miller"
00013 __date__     = "11/20/2003"
00014 __version__  = "$Revision: 1.5 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019 import LDF
00020 import LATTE.consumer.standardLDF as standardLDF
00021 import LATTE.tools.DataDistributorPoll as DDP
00022 import LATTE.runcontrol.rcArchiver as rcArchiver
00023 import struct
00024 import time
00025 import sys
00026 import getopt
00027 import array
00028 import logging as myLog
00029
00030 class Consumer(object):
00031   """\brief Consumer class to consume LDF data
00032   This class just handles file open/close or server
00033   open/close
00034   """
00035
00036   def __init__(self,argv):
00037     """consumer constructor
00038     """
00039     # subclasses should provide iterators in constructor
00040     self.lci       = standardLDF.LATcomponentIterator()
00041     self.eei       = standardLDF.EBFeventIterator(self.lci)
00042     self.lcti      = standardLDF.LATcontributionIterator(self.eei)
00043     self.ldbi      = LDF.LATdataBufferIterator(self.lcti)
00044
00045     self.__ds          = None
00046     self.__file        = None
00047     self.__archiver    = None
00048     self.__debug       = 0
00049     self.eventData     = None
00050     self.__archiveFile = "consumer.ldf"
00051     self.__inFileName  = None
00052     self.__nEvents     = 0
00053     self.__server      = "1"
00054     self.__runId       = ''
00055     self.sleepTime     = 0.1
00056     self.startRun      = False
00057     self.endRun        = False
00058     self.parseArgs(argv)
00059
00060   def parseEvent(self):
00061     """Analyse an event
00062     """
00063     # subclasses should provide a custom iterator to iterate in this method
00064     self.ldbi.iterate(self.eventData, len(self.eventData))
00065     self.checkUDF()
00066
00067   def checkUDF(self):
00068     udfDict = self.lcti.getUdfDict()
00069     self.startRun = False
00070     if 'startRun' in udfDict:
00071       self.setRunId(udfDict['startRun'])
00072       self.startRun = True
00073     self.endRun = False
00074     if 'endRun' in udfDict:
00075       self.endRun = True
00076     self.lcti.clearUdfDict()
00077
00078   def getRunId(self):
00079     return self.__runId
00080   def setRunId(self,runId):
00081     self.__runId = runId
00082
00083   def getNextEvent(self):
00084     """get Next Event into data buffer
00085     """
00086     if self.__file is not None:
00087       evtPtr = self.__file.tell()
00088       # get datagram
00089       self.eventData = self.__file.read(8)
00090       # check for file end
00091       if len(self.eventData) < 8:
00092         myLog.info("Consumer.getNextEvent: End of File")
00093         return 0
00094       # unpack pair of big-endian 4 byte words
00095       # this is presumably broken for Sun hardware
00096       (identity, length) = struct.unpack('!LL', self.eventData)
00097       self.eventData        += self.__file.read(length - 8)
00098       if self.__debug:
00099         myLog.info("got data %d length from file" % (length))
00100       return length
00101     if self.__ds is not None:
00102       self.eventData, sender = self.__ds.receive()
00103       if self.eventData is None:
00104         #print "No data from server"
00105         return 1
00106       if self.__debug:
00107         myLog.info("got data %d length from file" % len(self.eventData))
00108       return 1
00109     myLog.warn("Consumer.getNextEvent: No data source")
00110     return 0
00111
00112   def serverOpen(self, server="1"):
00113     """  Connect to network server
00114     """
00115     myLog.info("Consumer.serverOpen: Connecting to data server %s"%(server))
00116     # Close previous data sources
00117     if self.__file is not None:
00118       self.__fileClose()
00119     if self.__ds is not None:
00120       self.serverClose()
00121     dsName = 'LAT_EBFdata'
00122     self.__ds = DDP.DataDistributorPoll(dsName)
00123     if self.__ds is not None:
00124       self.__ds.connect(server)
00125       self.__ds.start()
00126     else:
00127       myLog.warn("Consumer.serverOpen: Unable to connect to Data Distribution server %s"%(server))
00128       sys.exit(2)
00129
00130   def serverClose(self):
00131     """  Close network server
00132     """
00133     if self.__ds is not None:
00134       self.__ds.stop()
00135       self.__ds.disconnect()
00136       self.__ds = None
00137
00138   def fileOpen(self,fn):
00139     """ Load input data from a file
00140     """
00141     # Close previous data sources
00142     if self.__ds is not None:
00143       self.serverClose()
00144     if self.__file is not None:
00145       self.__fileClose()
00146     try:
00147       self.__file = open(fn, 'rb')
00148     except:
00149       myLog.warn("Consumer.fileOpen: Fatal: failed to open file %s"%(fn))
00150       sys.exit(2)
00151     print myLog.info("Consumer.fileOpen: opening file %s"%(fn))
00152
00153   def fileClose(self):
00154     """ Close input data file
00155     """
00156     if self.__file is not None:
00157       self.__file.close()
00158       self.__file = None
00159     return
00160
00161   def archiveOpen(self,fn):
00162     """ Open data archive
00163     """
00164     # make a 'being written to' version of the file
00165     openfn = fn + '_locked'
00166     # Close previous archive file
00167     if self.__archiver is not None:
00168       self.archiveClose(fn)
00169     myLog.info("Consumer.archiveOpen: opening file %s"%(fn))
00170     try:
00171       self.__archiver = rcArchiver.rcArchiver(fileName=openfn)
00172     except:
00173       myLog.warn("Consumer.archiveOpen: failed to open archive file %s"%(fn))
00174       self.__archiver = None
00175
00176   def archiveClose(self,fn):
00177     """ Close data archive
00178     """
00179     if self.__archiver is not None:
00180       self.__archiver.close()
00181       self.__archiver = None
00182       myLog.info("Consumer.archiveClose: closing archive file %s"%(fn))
00183     # move it to the requested file name if it is closed
00184     openfn = fn + '_locked'
00185     import shutil
00186     shutil.move(openfn,fn)
00187     return
00188
00189   def dataSize(self):
00190     """Return current event data size
00191     """
00192     if self.eventData is not None:
00193       return len(self.eventData)
00194     else:
00195       return 0
00196
00197   def usage(self):
00198     print "\n%s Usage:" % (sys.argv[0])
00199     print "\t-h or --help for Help"
00200     print "\t-a or --archive to specify output to archive file (default consumer.ldf)"
00201     print "\t-n or --nevents to specify the number of events archived (default 0)"
00202     print "\t-i or --infile to specify an input from file instead of server"
00203     print "\t-s or --server to specify server to connect to (default 1)"
00204     print "\t-c or --config to specify configuration file (default None, used by Plotter)"
00205     print "\t-r or --rate to specify a rate limit in Hz (default 10)"
00206
00207
00208   def parseArgs(self,argv):
00209     try:
00210       opts, args = getopt.getopt(argv, "ha:n:i:s:c:r:",
00211                                  ["help", "archive=", "nevents=", "infile=", "server=","config=","rate="])
00212     except getopt.GetoptError:
00213       # print help information and exit:
00214       self.usage()
00215       sys.exit(2)
00216     for o, a in opts:
00217       if o in ("-h", "--help"):
00218         self.usage()
00219         sys.exit()
00220       if o in ("-a", "--archive"):
00221         self.__archiveFile = a
00222       if o in ("-n", "--nevents"):
00223         self.__nEvents = int(a)
00224       if o in ("-i", "--infile"):
00225         self.__inFileName = a
00226       if o in ("-s", "--server"):
00227         self.__server = a
00228       if o in ("-c", "--config"):
00229         self.configFile = a
00230       if o in ("-r", "--rate"):
00231         rate = float(a)
00232         if rate>0:
00233           self.sleepTime = 1./rate
00234
00235   def loop(self):
00236     if self.__inFileName is not None:
00237       self.fileOpen(self.__inFileName)
00238     else:
00239       self.serverOpen(self.__server)
00240     eventCount=0
00241     archivedEventCount=0
00242     sayWaiting = 0
00243     timeLastEvent = 0
00244     while (1):
00245       self.getNextEvent()
00246       if self.eventData is not None and self.dataSize()>0:
00247         timeLastEvent = time.time()
00248         eventCount+=1
00249         self.parseEvent()
00250         # archive
00251         if self.__archiver is not None and archivedEventCount<self.__nEvents:
00252           # don't know why, but needs byte swapping?
00253           outputData = array.array('L',self.eventData)
00254           outputData.byteswap()
00255           self.__archiver.write(outputData)
00256           #self.__archiver.write(self.eventData)
00257           archivedEventCount+=1
00258         # open archive if new run seen and none open
00259         if self.__nEvents>0 and self.startRun:
00260           self.archiveOpen(self.__archiveFile)
00261         # close archive if collected enough
00262         if (self.endRun or archivedEventCount>=self.__nEvents) and self.__archiver is not None:
00263           self.archiveClose(self.__archiveFile)
00264           archivedEventCount=0
00265         if sayWaiting==1:
00266           sayWaiting=0
00267           print "resumed acquisition... (eventCount is ",eventCount,")"
00268         time.sleep(self.sleepTime) # conserve cpu...
00269       else:
00270         deltaTime = time.time() - timeLastEvent
00271         if sayWaiting==0 and deltaTime>1:
00272           sayWaiting=1
00273           print "Waiting for data..."
00274       time.sleep(0.0005) # conserve cpu...
00275
00276     myLog.info("Consumer: Read in %d events" % (eventCount))
00277     self.serverClose()
00278     self.fileClose()
00279     sys.exit()
00280
00281
00282 if __name__ == '__main__':
00283   consumer = Consumer(sys.argv[1:])
00284   consumer.loop()
00285
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: consumerPlotter.py Source File

consumer

consumerPlotter.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Glast Online consumer plotter"
00012 __author__   = "Lester Miller"
00013 __date__     = "11/20/2003"
00014 __version__  = "$Revision: 1.10 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018 import LATTE.consumer.consumer as consumer
00019 import LATTE.consumer.standardPlotter as standardPlotter
00020 import threading
00021 import sys
00022 from qt import *
00023 import Numeric as numarray
00024 import os
00025 import sihippo
00026
00027 class consumerPlotter(consumer.Consumer,standardPlotter.standardPlotter,QMainWindow):
00028   """\brief Consumer class to consume LDF data
00029   This class just handles file open/close or server
00030   open/close
00031   """
00032
00033   def __init__(self,argv):
00034     """consumer constructor
00035     """
00036     QMainWindow.__init__(self,None,None,0)
00037     if 'ONLINE_ROOT' in os.environ:
00038       self.configFile = os.path.join(os.environ['ONLINE_ROOT'],'LATTE/consumer/consumerPlotter.cfg')
00039     else:
00040       self.configFile = ''
00041     consumer.Consumer.__init__(self,argv)
00042     standardPlotter.standardPlotter.__init__(self, self.lci)
00043     # used for status
00044     self.COMPL_STATUS_FAILED = 'FAILED'
00045     self.COMPL_STATUS_PASSED = 'PASSED'
00046     self.COMPL_STATUS_UNDEFINED = 'PASSED'
00047     self.COMPL_STATUS_ABORTED = 'ABORTED'
00048     self.COMPL_STATUS_PASSED_CONDITIONALLY = 'PASSED_CONDITIONALLY'
00049     self.__status = self.COMPL_STATUS_UNDEFINED
00050     self.__exportedFileList = []
00051     self.initializePlotter()
00052     self.guiThread = threading.Thread(None,self.loop,'consumerloop',())
00053     self.guiThread.start()
00054
00055   def getName(self):
00056     return 'consumerPlotter'
00057
00058   def parseEvent(self):
00059     """Analyse an event
00060     """
00061     self.ldbi.iterate(self.eventData, len(self.eventData))
00062     self.checkUDF()
00063     if self.endRun:
00064       self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00065       self.reportResults()
00066       self.exportFiles()
00067     if self.startRun:
00068       self.setCompletionStatus(self.COMPL_STATUS_UNDEFINED)
00069       self.clearPlots()
00070       self.readPedestals()
00071     self.updatePlots()
00072     if self.lci.nEvtSeen>0 and self.lci.nEvtSeen%self.checkInterval==0:
00073       self.checkLimits()
00074
00075   def checkUDF(self):
00076     udfDict = self.lcti.getUdfDict()
00077     self.startRun = False
00078     if 'startRun' in udfDict:
00079       self.setRunId(udfDict['startRun'])
00080       self.startRun = True
00081     self.endRun = False
00082     if 'endRun' in udfDict:
00083       self.endRun = True
00084     if 'configFile' in udfDict:
00085       self.setConfigFile(udfDict['configFile'])
00086     if 'dataType' in udfDict:
00087       self.setDataType(udfDict['dataType'])
00088     self.lcti.clearUdfDict()
00089
00090   def checkLimits(self):
00091     print 'checking limits...'
00092     for plot in self.limits.keys():
00093       cLimit = self.limits[plot]
00094       # check ringBuffer for completion
00095       if self.ntRequests[self.getPlotNtuple(plot)]<=0 or self.lci.ntDict[self.getPlotNtuple(plot)].rows()>=self.ntRequests[self.getPlotNtuple(plot)]:
00096         (limitName,limitLabelList,limitFailList,errorLabelList,errorFailList)  = self.checkLimit(plot,cLimit)
00097         if len(limitFailList)>0 or len(errorFailList)>0:
00098           #self.histDict[plot].getDataRep(0).setRepColor(sihippo.Color.orange)
00099           print 'Plot ',plot,' is out of limits!!'
00100
00101   # these methods are needed for reporting, they pretend to be rcTransitions
00102   def setCompletionStatus(self,status):
00103     self.__status = status
00104   def getCompletionStatusStr(self):
00105     return self.__status
00106   def getCompletionStatus(self):
00107     return self.__status
00108
00109   def addExportedFile(self,file,delete=False):
00110     self.__exportedFileList.append((file,delete))
00111
00112   def exportFiles(self):
00113     if self.reportPath is not None and os.path.exists(self.reportPath) and len(self.__exportedFileList)>0:
00114       exportDirName = self.getName()+'_'+self.getRunId()
00115       exportDir = os.path.join(self.reportPath,exportDirName)
00116       if os.access(self.reportPath,os.W_OK):             # can we write?
00117         os.mkdir(exportDir)
00118         for (file,delete) in self.__exportedFileList:
00119           import shutil
00120           fileName = os.path.basename(file)
00121           outFile = os.path.join(exportDir,fileName)
00122           # avoid copying to itself
00123           if os.path.exists(file) and not os.path.exists(outFile):
00124             if delete:
00125               shutil.move(file,outFile)
00126             else:
00127               shutil.copy(file,outFile)
00128
00129 if __name__ == '__main__':
00130   a = QApplication(sys.argv)
00131   consumer = consumerPlotter(sys.argv[1:])
00132   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00133   a.setMainWidget(consumer)
00134   a.exec_loop()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: copyright_SLAC.py Source File

copyright_SLAC.py

00001 #
00002 #                               Copyright 2003
00003 #                                     by
00004 #                        The Board of Trustees of the
00005 #                     Leland Stanford Junior University.
00006 #                            All rights reserved.
00007 #
00008 #          Work supported by the U.S. Department of Energy under contract
00009 #        DE-AC03-76SF00515.
00010 #
00011 #                                Disclaimer Notice
00012 #
00013 #         The items furnished herewith were developed under the sponsorship
00014 #    of the U.S. Government.  Neither the U.S., nor the U.S. D.O.E., nor the
00015 #    Leland Stanford Junior University, nor their employees, makes any war-
00016 #    ranty, express or implied, or assumes any liability or responsibility
00017 #    for accuracy, completeness or usefulness of any information, apparatus,
00018 #    product or process disclosed, or represents that its use will not in-
00019 #    fringe privately-owned rights.  Mention of any product, its manufactur-
00020 #    er, or suppliers shall not, nor is it intended to, imply approval, dis-
00021 #    approval, or fitness for any particular use.  The U.S. and the Univer-
00022 #    sity at all times retain the right to use and disseminate the furnished
00023 #    items for any purpose whatsoever.                       Notice 91 02 01
00024 #
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: createDigestData.py Source File

createDigestData.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Create Digest Data module"
00013 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:19:44 $").split(' ')[1]
00015 __version__  = "$Revision: 1.4 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.database.gVersions import Gversions
00022 import sys
00023 import marshal
00024
00025 if __name__ == '__main__':
00026   release  = sys.argv[1]
00027   basedir  = sys.argv[2]
00028   filename = sys.argv[3]
00029   if release == 'unspecified':
00030     release = __release__
00031   digests = Gversions.collectDigests(basedir)
00032   src  = 'class _digestData(object):'+'_release ="'+release+'";_digests = '+repr(digests)
00033   c = compile(src,'','exec')
00034   f = file(filename,'wb')
00035   marshal.dump(c, f)
00036   f.close()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributor.py Source File

tools

DataDistributor.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT data distribution wrapper classes"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/01 21:39:39 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 import socket
00022 import struct
00023
00024
00025 class DataDistributorServer(object):
00026   """\brief Data Distributor Server
00027   """
00028   def __init__(self, name = None):
00029     """Data Distributor server constructor.
00030
00031     \param name The name of the type of data to be served.
00032                 See the DataDistributorAddress class.
00033     """
00034     self.__socket = None
00035     self.__group  = None
00036     self.__port   = DataDistributorAddress.port(name)
00037
00038   def connect(self, server):
00039     """Method to set up a socket and connect to it.
00040
00041     \param server The address of a socket on which to serve the data.  This
00042                   address must be the same for both server and client.  The
00043                   value can be in one of the following forms:
00044                   - A number of which only the two lower decimal digits are
00045                     used, i.e., in the range 0-99
00046                   - <port>@<multicast address>, where <port> is a value that
00047                     will override what is found from the data type name
00048                     translation, and <multicast address> is some valid multicast
00049                     IP address starting with the value 239.  A name may be used
00050                     for the <multicast address> value as well, as long as it can
00051                     be found in the name server and translates to a valid
00052                     multicast IP address.
00053                   - <multicast address>, as discussed in the previous bullet.
00054                     The port value is taken to be the one found from looking up
00055                     the data type name in the port table.
00056     """
00057     if self.__socket is None:
00058       self.__port, self.__group = DataDistributorAddress.lookup(self.__port,
00059                                                                 server)
00060
00061       # Look up multicast group address in name server
00062       # (doesn't hurt if it is already in ddd.ddd.ddd.ddd format)
00063       group = socket.gethostbyname(self.__group)
00064
00065       # Any chance this sort of looks like a valid multicast group?
00066       firstByte = int(group.split(".", 1)[0])
00067       if firstByte != 224 and firstByte != 239:
00068         raise RuntimeError, \
00069           "Group %s does not resolve to a multicast address" % self.__group
00070
00071       s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
00072       ttl = struct.pack('b', 1)     # Time-to-live
00073       s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl)
00074       self.__socket = s
00075     else:
00076       raise RuntimeError, "Socket already in use"
00077
00078   def disconnect(self):
00079     """Gracefully shut down the socket."""
00080     if self.__socket is not None:
00081       self.__socket.shutdown(1)
00082       self.__socket.close()
00083       self.__socket = None
00084       self.__group  = None
00085       self.__port   = None
00086     else:
00087       raise RuntimeError, "No socket found"
00088
00089   def publish(self, data):
00090     """Publish the data on the multicast socket.
00091
00092     \param data The data to be sent out on the multicast socket.
00093
00094     """
00095     if self.__socket is not None:
00096       self.__socket.sendto(data, (self.__group, self.__port))
00097     else:
00098       raise RuntimeError, "No socket found"
00099
00100
00101 class DataDistributorClient(object):
00102   """\brief Data distributor client class.
00103   """
00104   __timeout = 1
00105
00106   def __init__(self, name = None, length = 4096):
00107     """Data Distributor client constructor.
00108
00109     \param name   The name of the type of data that the client wants to receive.
00110                   See the DataDistributorAddress class.
00111     \param length The size in bytes of the buffer to allocate for receiving the
00112                   data
00113     """
00114     self.__socket     = None
00115     self.__group      = None
00116     self.__port       = DataDistributorAddress.port(name)
00117     self.__length     = length
00118     self.__returnNone = None
00119
00120   # Open a UDP socket, bind it to a port and select a multicast group
00121   def connect(self, server):
00122     """Open a UDP socket, bind it to a port and select a multicast group.
00123
00124     \param server The address the server is multicasting on.  This
00125                   address must be the same for both server and client.  The
00126                   value can be in one of the following forms:
00127                   - A number of which only the two lower decimal digits are
00128                     used, i.e., in the range 0-99
00129                   - <port>@<multicast address>, where <port> is a value that
00130                     will override what is found from the data type name
00131                     translation, and <multicast address> is some valid multicast
00132                     IP address starting with the value 239.  A name may be used
00133                     for the <multicast address> value as well, as long as it can
00134                     be found in the name server and translates to a valid
00135                     multicast IP address.
00136                   - <multicast address>, as discussed in the previous bullet.
00137                     The port value is taken to be the one found from looking up
00138                     the data type name in the port table.
00139
00140     """
00141     if self.__socket is None:
00142       self.__port, self.__group = DataDistributorAddress.lookup(self.__port,
00143                                                                 server)
00144       #print "port@group =", str(self.__port) + '@' + self.__group
00145       # Import modules used only here
00146       import string
00147       import struct
00148       #
00149       # Create a socket
00150       s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
00151       #
00152       # Allow multiple copies of this program on one machine
00153       # (not strictly needed)
00154       s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
00155       #
00156       # Bind it to the port
00157       s.bind(('', self.__port))
00158       #
00159       # Look up multicast group address in name server
00160       # (doesn't hurt if it is already in ddd.ddd.ddd.ddd format)
00161       group = socket.gethostbyname(self.__group)
00162       #
00163       # Construct binary group address
00164       bytes = map(int, group.split("."))
00165       if bytes[0] != 224 and bytes[0] != 239: # Any chance this sort of looks like a valid multicast group?
00166         raise RuntimeError, \
00167           "Group %s does not resolve to a multicast address" % self.__group
00168       grpaddr = 0
00169       for byte in bytes: grpaddr = (grpaddr << 8L) | byte
00170       #
00171       # Construct interface address
00172       # Use gethostbyname and gethostname to force the connection onto the
00173       # primary network interface.
00174       host   = socket.gethostbyname(socket.gethostname())
00175       bytes  = map(int, host.split("."))
00176       ifaddr = 0
00177       for byte in bytes: ifaddr = (ifaddr << 8L) | byte
00178       #
00179       # Construct struct mreq from grpaddr and ifaddr
00180       mreq = struct.pack('ll', socket.htonl(grpaddr), socket.htonl(ifaddr))
00181       #
00182       # Add group membership
00183       s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
00184       #
00185       self.__socket = s
00186     else:
00187       raise RuntimeError, "Socket already in use"
00188
00189   def disconnect(self):
00190     """Gracefully shut down the socket."""
00191     if self.__socket is not None:
00192       self.__socket.shutdown(0)
00193       self.__socket.close()
00194       self.__socket = None
00195       self.__group  = None
00196       self.__port   = None
00197     else:
00198       raise RuntimeError, "No socket found"
00199
00200   def returnNone(self):
00201     """Method to signal the receive loop to exit."""
00202     self.__returnNone = 1
00203
00204   def receive(self):
00205     """Receive multicast data and the sender's identification.
00206
00207     \return A list of the data and the sender's identification string.
00208     """
00209     if self.__socket is not None:
00210       import select
00211       while self.__returnNone is None:
00212         rd, wr, ex = select.select([self.__socket], [], [], self.__timeout)
00213         if rd:
00214           data, sender = self.__socket.recvfrom(self.__length)
00215           return data, sender
00216         elif ex:
00217           return None, None
00218     else:
00219       raise RuntimeError, "No socket found"
00220     return None, None
00221
00222 class DataDistributorAddress(object):
00223   """\brief Data distributor address class containing static methods that
00224   govern the picking of multicast ports and addresses.
00225   """
00226   # See http://www.iana.org/assignments/port-numbers on how to pick a port
00227   # I randomly chose the following from the dynamic ports section:
00228   __PORT_TEMPLATE = 54321
00229   # See http://www.iana.org/assignments/multicast-addresses on how to pick a
00230   # group BaBar uses 239.255.0.2- 239.255.0.130, so I chose the following:
00231   __GROUP_TEMPLATE = '239.255.1.%u'
00232
00233   __ports = {"LAT_EBFdata" : __PORT_TEMPLATE + 0,
00234              "LAT_CMDdata" : __PORT_TEMPLATE + 1,
00235              "LAT_HSKdata" : __PORT_TEMPLATE + 2,
00236              "LAT_MsgLog"  : __PORT_TEMPLATE + 3}
00237
00238   def port(name):
00239     """Static method to select a physical multicast port to use based on the
00240        type of data that is desired.
00241
00242     \param name The name of the type of data that is desired.  Choose from
00243                 'LAT_EBFdata', 'LAT_CMDdata', 'LAT_HSKdata' and 'LAT_MsgLog'.
00244     """
00245     if name in DataDistributorAddress.__ports:
00246       return DataDistributorAddress.__ports[name]
00247     return None
00248
00249   def lookup(port, server):
00250     """Static method for resolving the multicast port and group values.
00251
00252     \param port   An integer containing the multicast port to use, e.g. from
00253                   the port() method above, or None to indicate that the value
00254                   will come from the supplied server string.
00255     \param server A string that contains either the machine ID (test stand
00256                   instance number), or <port>@<group IP or name>, or <group IP
00257                   or name> when a port number is also supplied.  These last two
00258                   can be used to override the values chosen by this class.  The
00259                   machine ID is a number from 0 - 999, where the hundreds
00260                   digit represents the site ID and remainder (0-99) is the
00261                   machine ID at the site.  This latter portion is what's used.
00262     \return A list made up of the resolved port and group values.
00263     """
00264     # Do a DNS like action to get the machine ID of the server
00265     # Until we get that built, let's do the following:
00266
00267     # The 'server' argument is either a machine ID or a string of the form
00268     # port@<multicast group> (multicast group could be an IP address or a name)
00269     try:
00270       # Site machine IDs run from 0 to 99.  Remove the site ID to prevent > 255
00271       group = DataDistributorAddress.__GROUP_TEMPLATE % (int(server) % 100)
00272     except ValueError:                  # Can only be <port>@<group> or <group>
00273       try:
00274         port, group = server.split('@', 1)
00275         port = int(port)
00276       except ValueError:                # Must be <group>
00277         group = server
00278     return port, group
00279
00280   port   = staticmethod(port)
00281   lookup = staticmethod(lookup)
00282
00283
00284 if __name__ == "__main__":
00285   """Testing routine.
00286
00287   Usage: Run DataDistributor (this file) in one session to start up the client
00288          and DataDistributor -s in another session to start up the server.
00289   """
00290   import time
00291
00292   def sender():
00293     dds = DataDistributorServer('test')
00294     dds.connect('54320@239.255.1.0')
00295
00296     i = 5
00297     while i > 0:  #1:
00298       i -= 1
00299       data = `time.time()`
00300 ##      data = data + (1400 - len(data)) * '\0'
00301       dds.publish(data)
00302       time.sleep(1)
00303     dds.disconnect()
00304
00305   def receiver():
00306     dds = DataDistributorClient('test')
00307     dds.connect('54320@239.255.1.0')
00308
00309     # Loop, printing any data we receive
00310     while 1:
00311       data, sender = dds.receive()
00312       while data[-1:] == '\0': data = data[:-1] # Strip trailing \0's
00313       print sender, ':', `data`
00314
00315   #---
00316   import sys
00317
00318   flags = sys.argv[1:]
00319
00320   if flags:
00321     sender()
00322   else:
00323     receiver()
00324
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataDistributorPoll.py Source File

tools

DataDistributorPoll.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT data distribution polling class"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/24 23:21:24 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 import DataDistributor as DD
00022 import threading
00023 import copy
00024 import time
00025
00026 TRUE  = (0 < 1)
00027 FALSE = (not TRUE)
00028
00029
00030 class DataDistributorPoll(DD.DataDistributorClient):
00031   """\brief Data distributor client that polls for samples of data.
00032
00033   Use of this class involves the starting of a thread that constantly receives
00034   the data arriving in the base class's socket.  Keeping the socket drained of
00035   data allows the user of this class to get the most recent data received, thus
00036   avoiding getting data with a bursty time structure.  Whenever the application
00037   calls the receive() method, it gets the most recent data sample.  Because of
00038   the reference counting method used by Python objects, no copy of the data
00039   needs to be made to avoid the data changing from underneath the application.
00040   The application can hold onto the data reference as long as it likes.
00041   Whenever new data appears a new reference is created, and is possibly deleted
00042   before the application gets access to it, leaving any existing reference
00043   alone.  When the application tries to get access to the latest data, it gets
00044   a copy of the most recent reference, and the previous reference is deleted,
00045   if it has gone out of scope.
00046   """
00047   def __init__(self, name):
00048     """DataDistributorPoll constructor.
00049
00050     \param name The name of the type of data that the client wants to receive.
00051                 See the DataDistributorAddress class.
00052     """
00053     DD.DataDistributorClient.__init__(self, name)
00054     self.__pollTaskQuit = FALSE
00055     self.__pollTask     = None
00056     self.__data         = None
00057     self.__dataCopy     = None
00058     self.__sender       = None
00059
00060   def start(self):
00061     """Start the polling thread."""
00062     self.__pollTask = threading.Thread(None, self.__poll, 'DataDistributorPoll')
00063     if self.__pollTask is not None:
00064       self.__pollTask.start()
00065
00066   def stop(self):
00067     """Stop the polling thread."""
00068     self.returnNone()   # Force the base class receiver loop to break out
00069     self.__pollTaskQuit = TRUE
00070     self.__pollTask.join()
00071
00072   def __poll(self):
00073     """Internal routine to drain the data distributor client socket."""
00074     while not self.__pollTaskQuit:
00075       self.__data, self.__sender = DD.DataDistributorClient.receive(self)
00076       time.sleep(.001)  # Let another thread have some CPU time
00077
00078   def receive(self):
00079     """Receive a sampled value of the data and sender information.
00080
00081     \return A list of the sampled data and sender's identification string."""
00082     if self.__data is not self.__dataCopy:
00083       self.__dataCopy = self.__data
00084       return self.__dataCopy, self.__sender
00085     else:
00086       return None, None
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: DataExport.py Source File

tools

DataExport.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT data export routines"
00012 __author__   = "J. Panetta <panetta@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/09/01 04:29:05 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import exceptions
00021 import md5
00022 import os
00023 import shutil
00024 import stat
00025 import sys
00026 import logging as log
00027 from   LATTE.tools.FreeSpace        import FreeSpace
00028 from   LATTE.client.gOptions        import Options
00029
00030 class GExportException(exceptions.Exception):
00031   """Define an exception from the Export system
00032   """
00033   def __init__(self, status):
00034     self.status = status
00035
00036   def __str__(self):
00037     return repr(self.status)
00038
00039
00040 class DataExport:
00041   """Class to synch a file or set of files between one location and another
00042   """
00043   # Error codes
00044   NO_ERROR                      = 0x0
00045   DIR_NOT_WRITABLE              = 0x1
00046   NOT_EXTANT                    = 0x2
00047
00048   DISK_FULL                     = 0x10
00049
00050   DISK_FULL_LEVEL               = 100*1024*1024  # 100 Megabytes
00051
00052   def __init__(self):
00053     self.__purgeFiles   = False
00054     pass
00055
00056   def setPurge(self, purge):
00057     """
00058     """
00059     if purge == True:
00060       self.__purgeFiles = True
00061     else:
00062       self.__purgeFiles = False
00063
00064   def synch(self, source, dest):
00065     """Synch up two directory structures.
00066        Synch only goes in one direction:  source --> destination.
00067     """
00068
00069     sourceStatus = self.__checkDir(source)
00070     destStatus   = self.__checkDir(dest)
00071
00072     # do something with statuses
00073
00074     # get a list of directories under source.  Do this only once, as it can take time
00075     dirList = []
00076     for file in os.listdir(source):
00077       file = os.path.join(source,file)
00078       if os.path.isdir(file):
00079         dirList.append(file)
00080
00081     for sourceDir in dirList:
00082       destDir = os.path.join(dest, os.path.basename(sourceDir))
00083       try:
00084         log.info( "Exporting from %s to %s" % ( sourceDir, destDir ) )
00085         self.exportDir(sourceDir, destDir)
00086       except Exception, e:
00087         log.error( "Failed exporting from %s to %s" % ( sourceDir, destDir ) )
00088         log.error( "  Exception: %s" % e )
00089         pass
00090
00091   def export(self, source, dest):
00092     """Copy from source to dest.
00093        This routine will determine whether source is a file or a directory
00094     """
00095     if os.path.isdir(source):
00096       self.exportDir(source, dest)
00097     else:
00098       self.exportFile(source, dest)
00099
00100   def exportDir(self, sourceDir, destDir):
00101     """
00102     Copy a source directory to a destination.
00103     Destination must not be extant.
00104     """
00105
00106     # check statuses
00107     sourceStatus = self.__checkStat(sourceDir)
00108     destStatus   = self.__checkStat(destDir)
00109
00110     # don't care if source dir is on a full disk
00111     if ( sourceStatus & ~DataExport.DISK_FULL ):
00112       msg = "Source directory %s contains errors:  0x%x" % (sourceDir, sourceStatus)
00113       msg += self.__statusParse(sourceStatus)
00114       raise GExportException, msg
00115     # Destination must not be extant.
00116     if not ( destStatus & DataExport.NOT_EXTANT ) :
00117       msg = "Destination directory %s already exists" % (destDir)
00118       raise GExportException, msg
00119     if ( destStatus & ~DataExport.NOT_EXTANT ) :
00120       msg = "Destination directory %s contains errors:  0x%x" % (destDir, destStatus)
00121       msg += self.__statusParse(destStatus)
00122
00123       raise GExportException, msg
00124     # source and dest can't be the same
00125     if os.path.abspath(sourceDir) == os.path.abspath(destDir):
00126       msg = "Source and destination directories are the same file.  Export aborted"
00127       raise GExportException, msg
00128
00129     shutil.copytree( sourceDir, destDir )    # copy the directory tree
00130     self.__compareTree( sourceDir, destDir )
00131
00132     if self.__purgeFiles:
00133       for root, dirs, files in os.walk(sourceDir, topdown=False):
00134         for name in files:
00135             f = os.path.join(root, name)
00136             os.chmod(f, stat.S_IWRITE) # Just in case it is read-only
00137             os.remove(f)
00138         for name in dirs:
00139             os.rmdir(os.path.joinjoin(root, name))
00140       os.rmdir(root)
00141
00142   def exportFile(self, sourceFile, destFile):
00143     """
00144     Copy a source file to a destination file.
00145     Destination must not be extant.
00146     """
00147
00148     # check statuses
00149     sourceStatus = self.__checkStat(sourceFile)
00150     destStatus   = self.__checkStat(destFile)
00151
00152     # don't care if source dir is on a full disk
00153     if ( sourceStatus & ~DataExport.DISK_FULL ):
00154       msg = "Source directory %s contains errors:  0x%x" % (sourceFile, sourceStatus)
00155       msg += self.__statusParse(sourceStatus)
00156       raise GExportException, msg
00157     # Destination must not be extant.
00158     if not ( destStatus & DataExport.NOT_EXTANT ):
00159       msg = "Destination file %s already exists" % (destFile)
00160       msg += self.__statusParse(destStatus)
00161       raise GExportException, msg
00162     if ( destStatus & ~DataExport.NOT_EXTANT ) :
00163       msg = "Destination directory %s contains errors:  0x%x" % (destFile, destStatus)
00164       msg += self.__statusParse(destStatus)
00165
00166       raise GExportException, msg
00167     # source and dest can't be the same
00168     if os.path.abspath(sourceFile) == os.path.abspath(destFile):
00169       msg = "Source and destination directories are the same file.  Export aborted"
00170       raise GExportException, msg
00171
00172     shutil.copy( sourceFile, destFile )    # copy the directory tree
00173
00174     # Check MD5 sums
00175     sourceMD5 = self.md5sum(sourceFile)
00176     destMD5   = self.md5sum(destFile)
00177     if sourceMD5 != destMD5:
00178       msg = "md5 sums don't match for %s :" % (sourceFile)
00179       msg += "\n   source: %s, dest: %s" % ( sourceMD5, destMD5 )
00180       raise GExportException, msg
00181
00182     # Purge
00183     if self.__purgeFiles:
00184       os.remove(sourceFile)
00185
00186   def md5sum(self, fname):
00187     '''Returns an md5 hash for file fname.'''
00188     # md5hash from ActiveState cookbook
00189     # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/266486
00190     #
00191     # 2004-01-30
00192     #
00193     # Nick Vargish
00194     #
00195     # Simple md5 hash utility for generating md5 checksums of files.
00196     # Modified slightly by Jim Panetta
00197     try:
00198       if os.path.isdir(fname):
00199         return "Directory"
00200       f = file(fname, 'rb')
00201     except:
00202       return 'Failed to open file'
00203     ret = self.__sumfile(f)
00204     f.close()
00205     return ret
00206
00207   def __compareTree(self, sourceDir, destDir):
00208     """Compare all files under sourceDir and destDir with md5
00209     """
00210     # scan the source/dest directories
00211     # chdir so that the source/dest keys are the same
00212     os.chdir(sourceDir)
00213     sourceWalk = os.walk(".")
00214     sourceMD5 = self.__treeWalk( sourceWalk, self.md5sum )
00215
00216     os.chdir(destDir)
00217     destWalk   = os.walk(".")
00218     destMD5   = self.__treeWalk( destWalk,   self.md5sum )
00219
00220     # compare the checksums
00221     for file in sourceMD5.keys():
00222       if destMD5.has_key(file):
00223         if sourceMD5[file] != destMD5[file]:
00224           msg = "md5 sums don't match for %s :" % (file)
00225           msg += "\n   source: %s, dest: %s" % ( sourceMD5[file], destMD5[file])
00226           raise GExportException, msg
00227         else:
00228           destMD5.pop(file)
00229       else:
00230         msg = "Destination directory %s does not contain file %s from source directory %s" % \
00231               ( destDir, file, sourceDir )
00232         raise GExportException, msg
00233
00234     if destMD5 != {}:
00235       msg = "Destination directory %s contains files not in source directory:" % ( destDir )
00236       for file in destMD5.keys():
00237         msg += "\n    %s" % ( file )
00238       raise GExportException, msg
00239
00240   def __treeWalk(self, tree, function):
00241     """Walk a tree, executing function() on every
00242     """
00243     returnDict = {}
00244     for root, dirs, files in tree:
00245       for name in dirs + files:
00246         try:
00247           retVal = function(os.path.join(root, name))
00248         except:
00249           retVal = -1
00250         returnDict[os.path.join(root, name)] = retVal
00251     return returnDict
00252
00253   def __checkStat(self, obj):
00254     """
00255     Check if source and directories exist, are writable,
00256     and the disks aren't full.
00257     """
00258     status = 0L
00259
00260     if not os.path.exists(obj):
00261       status |= DataExport.NOT_EXTANT
00262     elif FreeSpace(os.path.dirname(obj)) < DataExport.DISK_FULL_LEVEL:
00263       status |= DataExport.DISK_FULL
00264     if not os.access(os.path.dirname(obj),os.W_OK):
00265       status |= DataExport.DIR_NOT_WRITABLE
00266
00267     return status
00268
00269   def __makeReadOnly(self, file):
00270     status = 0
00271     try:
00272       os.chmod(file, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
00273     except:
00274       status = -1
00275     return status
00276
00277   def __statusParse(self, status):
00278     msg = ""
00279     if status & DataExport.DIR_NOT_WRITABLE:
00280       msg += "\n  Directory not writable"
00281     if status & DataExport.NOT_EXTANT:
00282       msg += "\n  Directory does not exist"
00283     if status & DataExport.DISK_FULL:
00284       msg += "\n  Disk is full"
00285     return msg
00286
00287   def __sumfile(self, fobj):
00288     '''Returns an md5 hash for an object with read() method.'''
00289     m = md5.new()
00290     while True:
00291       d = fobj.read(8096)
00292       if not d:
00293         break
00294       m.update(d)
00295     return m.hexdigest()
00296
00297
00298
00299 def usage():
00300   return """
00301 DataExport:  Securely copy files from one directory to another.
00302
00303 Mandatory options:
00304 --source        Source directory
00305 --destination   Destination directory
00306
00307 Flags:
00308 --purge         Set if source files are to be deleted after copy.
00309 """
00310
00311 if __name__ == "__main__":
00312   """Command line interface for the Data Export system.
00313      Can be called by the user or by an automated process.
00314
00315   """
00316
00317   # Options, first list mandatory, second list optional
00318   options = Options(['source', 'destination'], [], ['purge'])
00319   try:
00320     options.parse()
00321   except Exception, msg:
00322     options.usage(usage())
00323     raise Exception, msg
00324
00325   source         = options.source
00326   destination    = options.destination
00327   print "source=%s, dest=%s" % ( source, destination)
00328
00329   exporter = DataExport()
00330
00331   # Do we want file deletion?
00332   if options.purge is not None:
00333     exporter.setPurge(True)
00334
00335   exporter.export(source, destination)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: dispatcher.py Source File

dispatch

dispatcher.py

00001 """Multiple-producer-multiple-consumer signal-dispatching
00002
00003 dispatcher is the core of the PyDispatcher system,
00004 providing the primary API and the core logic for the
00005 system.
00006
00007 Module attributes of note:
00008
00009   Any -- Singleton used to signal either "Any Sender" or
00010     "Any Signal".  See documentation of the _Any class.
00011   Anonymous -- Singleton used to signal "Anonymous Sender"
00012     See documentation of the _Anonymous class.
00013
00014 Internal attributes:
00015   WEAKREF_TYPES -- tuple of types/classes which represent
00016     weak references to receivers, and thus must be de-
00017     referenced on retrieval to retrieve the callable
00018     object
00019   connections -- { senderkey (id) : { signal : [receivers...]}}
00020   senders -- { senderkey (id) : weakref(sender) }
00021     used for cleaning up sender references on sender
00022     deletion
00023   sendersBack -- { receiverkey (id) : [senderkey (id)...] }
00024     used for cleaning up receiver references on receiver
00025     deletion, (considerably speeds up the cleanup process
00026     vs. the original code.)
00027 """
00028 from __future__ import generators
00029 import types, weakref
00030 import saferef, robustapply, errors
00031
00032 __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
00033 __cvsid__ = "$Id: dispatcher.py,v 2.0 2004/07/28 11:37:18 perazzo Exp $"
00034 __version__ = "$Revision: 2.0 $"[11:-2]
00035
00036 try:
00037     True
00038 except NameError:
00039     True = 1==1
00040     False = 1==0
00041
00042 class _Parameter:
00043   """Used to represent default parameter values."""
00044   def __repr__(self):
00045     return self.__class__.__name__
00046
00047 class _Any(_Parameter):
00048   """Singleton used to signal either "Any Sender" or "Any Signal"
00049
00050   The Any object can be used with connect, disconnect,
00051   send, or sendExact to signal that the parameter given
00052   Any should react to all senders/signals, not just
00053   a particular sender/signal.
00054   """
00055 Any = _Any()
00056
00057 class _Anonymous(_Parameter):
00058   """Singleton used to signal "Anonymous Sender"
00059
00060   The Anonymous object is used to signal that the sender
00061   of a message is not specified (as distinct from being
00062   "any sender").  Registering callbacks for Anonymous
00063   will only receive messages sent without senders.  Sending
00064   with anonymous will only send messages to those receivers
00065   registered for Any or Anonymous.
00066
00067   Note:
00068     The default sender for connect is Any, while the
00069     default sender for send is Anonymous.  This has
00070     the effect that if you do not specify any senders
00071     in either function then all messages are routed
00072     as though there was a single sender (Anonymous)
00073     being used everywhere.
00074   """
00075 Anonymous = _Anonymous()
00076
00077 WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
00078
00079 connections = {}
00080 senders = {}
00081 sendersBack = {}
00082
00083
00084 def connect(receiver, signal=Any, sender=Any, weak=True):
00085   """Connect receiver to sender for signal
00086
00087   receiver -- a callable Python object which is to receive
00088     messages/signals/events.  Receivers must be hashable
00089     objects.
00090
00091     if weak is True, then receiver must be weak-referencable
00092     (more precisely saferef.safeRef() must be able to create
00093     a reference to the receiver).
00094
00095     Receivers are fairly flexible in their specification,
00096     as the machinery in the robustApply module takes care
00097     of most of the details regarding figuring out appropriate
00098     subsets of the sent arguments to apply to a given
00099     receiver.
00100
00101     Note:
00102       if receiver is itself a weak reference (a callable),
00103       it will be de-referenced by the system's machinery,
00104       so *generally* weak references are not suitable as
00105       receivers, though some use might be found for the
00106       facility whereby a higher-level library passes in
00107       pre-weakrefed receiver references.
00108
00109   signal -- the signal to which the receiver should respond
00110
00111     if Any, receiver will receive any signal from the
00112     indicated sender (which might also be Any, but is not
00113     necessarily Any).
00114
00115     Otherwise must be a hashable Python object other than
00116     None (DispatcherError raised on None).
00117
00118   sender -- the sender to which the receiver should respond
00119
00120     if Any, receiver will receive the indicated signals
00121     from any sender.
00122
00123     if Anonymous, receiver will only receive indicated
00124     signals from send/sendExact which do not specify a
00125     sender, or specify Anonymous explicitly as the sender.
00126
00127     Otherwise can be any python object.
00128
00129   weak -- whether to use weak references to the receiver
00130     By default, the module will attempt to use weak
00131     references to the receiver objects.  If this parameter
00132     is false, then strong references will be used.
00133
00134   returns None, may raise DispatcherTypeError
00135   """
00136   if signal is None:
00137     raise errors.DispatcherTypeError(
00138       'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
00139     )
00140   receiverID = id( receiver )
00141   if weak: receiver = saferef.safeRef(receiver, onDelete=_removeReceiver)
00142   senderkey = id(sender)
00143   signals = {}
00144   if connections.has_key(senderkey):
00145     signals = connections[senderkey]
00146   else:
00147     connections[senderkey] = signals
00148     # Keep track of senders for cleanup.
00149     # Is Anonymous something we want to clean up?
00150     if sender not in (None, Anonymous, Any):
00151       def remove(object, senderkey=senderkey):
00152         _removeSender(senderkey=senderkey)
00153       # Skip objects that can not be weakly referenced, which means
00154       # they won't be automatically cleaned up, but that's too bad.
00155       try:
00156         weakSender = weakref.ref(sender, remove)
00157         senders[senderkey] = weakSender
00158         sendersBack.setdefault(receiverID,[]).append(senderkey)
00159       except:
00160         pass
00161   receivers = []
00162   if signals.has_key(signal):
00163     receivers = signals[signal]
00164   else:
00165     signals[signal] = receivers
00166   try: receivers.remove(receiver)
00167   except ValueError: pass
00168   receivers.append(receiver)
00169
00170 def disconnect(receiver, signal=Any, sender=Any, weak=True):
00171   """Disconnect receiver from sender for signal
00172
00173   receiver -- the registered receiver to disconnect
00174   signal -- the registered signal to disconnect
00175   sender -- the registered sender to disconnect
00176   weak -- the weakref state to disconnect
00177
00178   disconnect reverses the process of connect,
00179   the semantics for the individual elements are
00180   logically equivalent to a tuple of
00181   (receiver, signal, sender, weak) used as a key
00182   to be deleted from the internal routing tables.
00183   (The actual process is slightly more complex
00184   but the semantics are basically the same).
00185
00186   Note:
00187     Using disconnect is not required to cleanup
00188     routing when an object is deleted, the framework
00189     will remove routes for deleted objects
00190     automatically.  It's only necessary to disconnect
00191     if you want to stop routing to a live object.
00192
00193   returns None, may raise DispatcherTypeError or
00194     DispatcherKeyError
00195   """
00196   if signal is None:
00197     raise errors.DispatcherTypeError(
00198       'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
00199     )
00200   if weak: receiver = saferef.safeRef(receiver)
00201   senderkey = id(sender)
00202   try:
00203     receivers = connections[senderkey][signal]
00204   except KeyError:
00205     raise errors.DispatcherKeyError(
00206       """No receivers found for signal %r from sender %r""" %(
00207         signal,
00208         sender
00209       )
00210     )
00211   try:
00212     receivers.remove(receiver)
00213   except ValueError:
00214     raise errors.DispatcherKeyError(
00215       """No connection to receiver %s for signal %s from sender %s""" %(
00216         receiver,
00217         signal,
00218         sender
00219       )
00220     )
00221   _cleanupConnections(senderkey, signal)
00222
00223 def getReceivers( sender = Any, signal = Any ):
00224   """Get list of receivers from global tables
00225
00226   This utility function allows you to retrieve the
00227   raw list of receivers from the connections table
00228   for the given sender and signal pair.
00229
00230   Note:
00231     there is no guarantee that this is the actual list
00232     stored in the connections table, so the value
00233     should be treated as a simple iterable/truth value
00234     rather than, for instance a list to which you
00235     might append new records.
00236
00237   Normally you would use liveReceivers( getReceivers( ...))
00238   to retrieve the actual receiver objects as an iterable
00239   object.
00240   """
00241   try:
00242     return connections[id(sender)][signal]
00243   except KeyError:
00244     return []
00245
00246 def liveReceivers(receivers):
00247   """Filter sequence of receivers to get resolved, live receivers
00248
00249   This is a generator which will iterate over
00250   the passed sequence, checking for weak references
00251   and resolving them, then returning all live
00252   receivers.
00253   """
00254   for receiver in receivers:
00255     if isinstance( receiver, WEAKREF_TYPES):
00256       # Dereference the weak reference.
00257       receiver = receiver()
00258       if receiver is not None:
00259         yield receiver
00260     else:
00261       yield receiver
00262
00263 def getAllReceivers( sender = Any, signal = Any ):
00264   """Get list of all receivers from global tables
00265
00266   This gets all receivers which should receive
00267   the given signal from sender, each receiver should
00268   be produced only once by the resulting generator
00269   """
00270   receivers = {}
00271   for set in (
00272     # Get receivers that receive *this* signal from *this* sender.
00273     getReceivers( sender, signal ),
00274     # Add receivers that receive *any* signal from *this* sender.
00275     getReceivers( sender, Any ),
00276     # Add receivers that receive *this* signal from *any* sender.
00277     getReceivers( Any, signal ),
00278     # Add receivers that receive *any* signal from *any* sender.
00279     getReceivers( Any, Any ),
00280   ):
00281     for receiver in set:
00282       if receiver: # filter out dead instance-method weakrefs
00283         try:
00284           if not receivers.has_key( receiver ):
00285             receivers[receiver] = 1
00286             yield receiver
00287         except TypeError:
00288           # dead weakrefs raise TypeError on hash...
00289           pass
00290
00291 def send(signal=Any, sender=Anonymous, *arguments, **named):
00292   """Send signal from sender to all connected receivers.
00293
00294   signal -- (hashable) signal value, see connect for details
00295
00296   sender -- the sender of the signal
00297
00298     if Any, only receivers registered for Any will receive
00299     the message.
00300
00301     if Anonymous, only receivers registered to receive
00302     messages from Anonymous or Any will receive the message
00303
00304     Otherwise can be any python object (normally one
00305     registered with a connect if you actually want
00306     something to occur).
00307
00308   arguments -- positional arguments which will be passed to
00309     *all* receivers. Note that this may raise TypeErrors
00310     if the receivers do not allow the particular arguments.
00311     Note also that arguments are applied before named
00312     arguments, so they should be used with care.
00313
00314   named -- named arguments which will be filtered according
00315     to the parameters of the receivers to only provide those
00316     acceptable to the receiver.
00317
00318   Return a list of tuple pairs [(receiver, response), ... ]
00319
00320   if any receiver raises an error, the error propagates back
00321   through send, terminating the dispatch loop, so it is quite
00322   possible to not have all receivers called if a raises an
00323   error.
00324   """
00325   # Call each receiver with whatever arguments it can accept.
00326   # Return a list of tuple pairs [(receiver, response), ... ].
00327   responses = []
00328   for receiver in liveReceivers(getAllReceivers(sender, signal)):
00329     response = robustapply.robustApply(
00330       receiver,
00331       signal=signal,
00332       sender=sender,
00333       *arguments,
00334       **named
00335     )
00336     responses.append((receiver, response))
00337   return responses
00338 def sendExact( signal=Any, sender=Anonymous, *arguments, **named ):
00339   """Send signal only to those receivers registered for exact message
00340
00341   sendExact allows for avoiding Any/Anonymous registered
00342   handlers, sending only to those receivers explicitly
00343   registered for a particular signal on a particular
00344   sender.
00345   """
00346   responses = []
00347   for receiver in liveReceivers(getReceivers(sender, signal)):
00348     response = robustapply.robustApply(
00349       receiver,
00350       signal=signal,
00351       sender=sender,
00352       *arguments,
00353       **named
00354     )
00355     responses.append((receiver, response))
00356   return responses
00357
00358
00359 def _removeReceiver(receiver):
00360   """Remove receiver from connections."""
00361   backKey = id(receiver)
00362   for senderkey in sendersBack.get(backKey,()):
00363     try:
00364       for signal in connections[senderkey].keys():
00365         try:
00366           receivers = connections[senderkey][signal]
00367         except KeyError:
00368           pass
00369         else:
00370           try: receivers.remove(receiver)
00371           except: pass
00372         _cleanupConnections(senderkey, signal)
00373     except KeyError:
00374       pass
00375
00376 def _cleanupConnections(senderkey, signal):
00377   """Delete any empty signals for senderkey. Delete senderkey if empty."""
00378   try:
00379     receivers = connections[senderkey][signal]
00380   except:
00381     pass
00382   else:
00383     if not receivers:
00384       # No more connected receivers. Therefore, remove the signal.
00385       try:
00386         signals = connections[senderkey]
00387       except KeyError:
00388         pass
00389       else:
00390         del signals[signal]
00391         if not signals:
00392           # No more signal connections. Therefore, remove the sender.
00393           _removeSender(senderkey)
00394
00395 def _removeSender(senderkey):
00396   """Remove senderkey from connections."""
00397   try:
00398     del connections[senderkey]
00399   except KeyError:
00400     pass
00401   # Senderkey will only be in senders dictionary if sender
00402   # could be weakly referenced.
00403   try: del senders[senderkey]
00404   except: pass
00405
00406
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: EnvMonImpl.py Source File

runcontrol

EnvMonImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #7
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Environmental Monitoring implementation GUI class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/12/14 18:03:27 $").split(' ')[1]
00014 __version__  = "$Revision: 2.16.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                     sys
00021 import                     os
00022 import                     threading
00023 import                     time
00024 from qt             import *
00025 from sihippo        import *
00026 import                     atexit
00027 import                     copy
00028
00029 from EnvMon                        import EnvMon
00030 from EnvMonSetRange                import EnvMonSetRange
00031 from LATTE.database.gSchemaConfig  import *
00032 from LATTE.database.gLAT           import GLAT
00033 from LATTE.database.gXBR           import GXBRD
00034 from LATTE.tools.taskEngine        import TaskEngine
00035 from LATTE.tools.guiBridges        import GUIbridge
00036
00037
00038 class EnvMonImpl(EnvMon):
00039
00040   DEADTIME_RATE_IN_MHZ = 20.0
00041   TIMEBASE_RATE_IN_MHZ = 16.6666667
00042
00043   def __init__(self, common, parent = None, name = None, fl = 0):
00044     EnvMon.__init__(self, None, name, fl)
00045     if not name:
00046       self.setName("EnvMon")
00047     self.fontPsize= QApplication.font().pointSize()
00048
00049     self.splitEnvMon.setOpaqueResize(1)
00050     self.DBN = common.getDBN()
00051     #self.__lat = common.getLAT()
00052     self.scrPlotView = ScrollablePlotView(self.DBN, self.frameOuterPlots,"PlotScrollView")
00053     if self.DBN != {}:
00054       self.scrPlotView.initEventPlot()
00055     self.__rate = 50
00056     self.sldRate.setValue(self.__rate)
00057     self.oldVal = None
00058     self.initDisplays()
00059     self.inShutdown = False
00060     atexit.register(self.quitApp)
00061     QObject.connect(self.bgDataTakingPlot,  SIGNAL('clicked(int)'),      self.toggleDataTakingPlot)
00062     QObject.connect(self.bgDataTakingMon,   SIGNAL('clicked(int)'),      self.toggleDataTakingMon)
00063     QObject.connect(self.bgChan0Plot,       SIGNAL('clicked(int)'),      self.toggleChan0Plot)
00064     QObject.connect(self.bgChan0Mon,        SIGNAL('clicked(int)'),      self.toggleChan0Mon)
00065     QObject.connect(self.bgChan1Plot,       SIGNAL('clicked(int)'),      self.toggleChan1Plot)
00066     QObject.connect(self.bgChan1Mon,        SIGNAL('clicked(int)'),      self.toggleChan1Mon)
00067     QObject.connect(self.bgChan2Plot,       SIGNAL('clicked(int)'),      self.toggleChan2Plot)
00068     QObject.connect(self.bgChan2Mon,        SIGNAL('clicked(int)'),      self.toggleChan2Mon)
00069     QObject.connect(self.bgChan3Plot,       SIGNAL('clicked(int)'),      self.toggleChan3Plot)
00070     QObject.connect(self.bgChan3Mon,        SIGNAL('clicked(int)'),      self.toggleChan3Mon)
00071     QObject.connect(self.bgChan4Plot,       SIGNAL('clicked(int)'),      self.toggleChan4Plot)
00072     QObject.connect(self.bgChan4Mon,        SIGNAL('clicked(int)'),      self.toggleChan4Mon)
00073     QObject.connect(self.bgAcdEnv1Plot,     SIGNAL('clicked(int)'),      self.toggleAcdEnv1Plot)
00074     QObject.connect(self.bgAcdEnv1Mon,      SIGNAL('clicked(int)'),      self.toggleAcdEnv1Mon)
00075     QObject.connect(self.bgPDUPlot,         SIGNAL('clicked(int)'),      self.togglePDUPlot)
00076     QObject.connect(self.bgPDUMon,          SIGNAL('clicked(int)'),      self.togglePDUMon)
00077     QObject.connect(self.cmbBlock,          SIGNAL("activated(int)"),    self.changeBlock)
00078     QObject.connect(self.cmbFreeBoard,      SIGNAL("activated(int)"),    self.changeFreeBoard)
00079     QObject.connect(self.sldRate,           SIGNAL("valueChanged(int)"), self.changeRate)
00080     QObject.connect(self.btnClear,          SIGNAL("clicked()"),         self.clearPlots)
00081     QObject.connect(self.btnRaw,            SIGNAL("toggled(bool)"),     self.toggleRaw)
00082
00083     cmd = common.getCmdCli()
00084     self.__lat = GLAT(cmd)
00085     envMonFile = os.path.join(os.environ['ONLINE_ROOT'],
00086                             'LATTE/repos/envMonSchema.xml')
00087
00088     self.__xbrd = GXBRD(cmd)
00089     self.__xbrd.readSchema(envMonFile)
00090     self.__lat.readSchema(envMonFile)
00091
00092
00093     self.DataTakingRegList = [
00094                           'event_size',
00095                           'sat_deadtime_lrs_ctr',
00096                           'sat_cal_lrs_ctr_0',
00097                           'sat_cal_lrs_ctr_1',
00098                           'sat_tkr_lrs_ctr_0',
00099                           'sat_tkr_lrs_ctr_1',
00100                           'sat_tkr_lrs_ctr_2',
00101                           'sat_tkr_lrs_ctr_3'
00102                         ]
00103
00104     self.chan2RegList = [
00105                           'adc_afee0_t0',
00106                           'adc_afee0_t1',
00107                           'adc_afee1_t0',
00108                           'adc_afee1_t1',
00109                           'adc_afee2_t0',
00110                           'adc_afee2_t1',
00111                           'adc_afee3_t0',
00112                           'adc_afee3_t1'
00113                         ]
00114
00115     self.chan3RegList = [
00116                           'adc_tkr_c0_t0',
00117                           'adc_tkr_c0_t1',
00118                           'adc_tkr_c1_t0',
00119                           'adc_tkr_c1_t1',
00120                           'adc_tkr_c2_t0',
00121                           'adc_tkr_c2_t1',
00122                           'adc_tkr_c3_t0',
00123                           'adc_tkr_c3_t1'
00124                         ]
00125
00126     self.chan4RegList = [
00127                           'adc_tkr_c4_t0',
00128                           'adc_tkr_c4_t1',
00129                           'adc_tkr_c5_t0',
00130                           'adc_tkr_c5_t1',
00131                           'adc_tkr_c6_t0',
00132                           'adc_tkr_c6_t1',
00133                           'adc_tkr_c7_t0',
00134                           'adc_tkr_c7_t1'
00135                         ]
00136
00137     self.acdEnv1RegList = [
00138                           'env_vdd_',
00139                           'env_temp_',
00140                           'env_hv1_',
00141                           'env_hv2_',
00142                           'env_dac_digital_3_3i',
00143                           'env_dac_temp',
00144                           'env_dac_hv_i',
00145                           'env_dac_v',
00146                         ]
00147
00148     self.acdEnv2RegList = [
00149                           'env_free_4LA',
00150                           'env_free_4LB',
00151                           'env_free_4RA',
00152                           'env_free_4RB',
00153                           'env_daq',
00154                         ]
00155
00156     self.pduRegList = [
00157                         'adc_ps_temp_0',
00158                         'adc_ps_temp_1',
00159                         'adc_tem_temp_0',
00160                         'adc_tem_temp_1',
00161                         'adc_tem_voltage_0',
00162                         'adc_tem_voltage_1',
00163                       ]
00164
00165     self.acdPlotCheckList = {}
00166     self.acdMonitorCheckList = {}
00167     for i in range(12):
00168       self.acdPlotCheckList[i] = [0] * 8
00169       self.acdMonitorCheckList[i] = [0] * 8
00170
00171     self.monitorList = {}
00172     #self.vArrayList = {}
00173     self.__block = 'TEM 0'
00174     self.changeFreeBoard(0)
00175     self.cmbBlock.setCurrentText(self.__block)
00176     self.changeBlock(-1) # First time caller
00177     self.__threadQuit = 0
00178     self.__bypass = 0
00179     #self.__dictSem = threading.Semaphore(1) # used for controlling dictionary access
00180
00181     self.__guiThread    = threading.currentThread()
00182     self.__guiBridge    = GUIbridge(self.__guiThread)
00183
00184     #self.threadReadEnv = threading.Thread(target=self.readEnvValues, name='EnvMon', args=())
00185     #self.threadReadEnv.start()
00186     self.threadReadEnv = TaskEngine('EnvMon')
00187     self.threadReadEnv.start()
00188     self.threadReadEnv.spawn(self.readEnvValues)
00189
00190   def setupLabels(self, newTem):
00191     if newTem:
00192                # (channel, adc)
00193       labels = {  (0,1): 'TKR Bias (I)',
00194                   (0,3): 'CAL Bias (I)',
00195                   (0,5): 'TEM (I)',
00196                   (0,6): 'TKR Bias V0',
00197                   (0,7): '',
00198                   (1,1): 'TKR Bias V1',
00199                   (1,3): 'CAL Bias V1',
00200                   (1,4): 'CAL Bias V0',
00201                   (1,5): '28 V0',
00202                   (1,7): '28 V1'
00203                 }
00204
00205       self.disableEntries = ['TKRBiasI']
00206
00207       self.chan0RegList = [
00208                             'adc_tkr_digital_2_5v',
00209                             'psd_tkr_bias_i',
00210                             'adc_tkr_analog_a_1_5v',
00211                             'psd_cal_bias_i',
00212                             'adc_tkr_analog_b_2_5v',
00213                             'psd_tem_i',
00214                             'adc_tkr_bias_v0',
00215                             ''
00216                           ]
00217
00218       self.chan1RegList = [
00219                             'adc_cal_digital_3_3v',
00220                             'adc_tkr_bias_v1',
00221                             'adc_cal_analog_3_3v',
00222                             'adc_cal_bias_v1',
00223                             'adc_cal_bias_v0',
00224                             'adc_28_v0',
00225                             'adc_tem_digital_3_3v',
00226                             'adc_28_v1'
00227                           ]
00228
00229     else:
00230                # (channel, adc)
00231       labels = {  (0,1): 'TKR Digital (2.5I)',
00232                   (0,3): 'TKR Analog A (1.5I)',
00233                   (0,5): 'TKR Analog B (2.5I)',
00234                   (0,6): 'TKR Bias (V)',
00235                   (0,7): 'TKR Bias (I)',
00236                   (1,1): 'CAL Digital (3.3I)',
00237                   (1,3): 'CAL Analog (3.3I)',
00238                   (1,4): 'CAL Bias (V)',
00239                   (1,5): 'CAL Bias (I)',
00240                   (1,7): 'TEM Digital (3.3I)'
00241                 }
00242       self.disableEntries = []
00243
00244       self.chan0RegList = [
00245                             'adc_tkr_digital_2_5v',
00246                             'adc_tkr_digital_2_5i',
00247                             'adc_tkr_analog_a_1_5v',
00248                             'adc_tkr_analog_a_1_5i',
00249                             'adc_tkr_analog_b_2_5v',
00250                             'adc_tkr_analog_b_2_5i',
00251                             'adc_tkr_bias_v',
00252                             'adc_tkr_bias_i'
00253                           ]
00254
00255       self.chan1RegList = [
00256                             'adc_cal_digital_3_3v',
00257                             'adc_cal_digital_3_3i',
00258                             'adc_cal_analog_3_3v',
00259                             'adc_cal_analog_3_3i',
00260                             'adc_cal_bias_v',
00261                             'adc_cal_bias_i',
00262                             'adc_tem_digital_3_3v',
00263                             'adc_tem_digital_3_3i'
00264                           ]
00265
00266     for ((ch,adc), label) in labels.items():
00267       txtLabel = eval("self.textLabelCh%dAdc%d" % (ch,adc))
00268       if label != "": label += ":"
00269       txtLabel.setText(label)
00270     for suffix in self.disableEntries:
00271       eval("self.txt"+suffix).setEnabled(0)
00272       eval("self.chkPlot"+suffix).setEnabled(0)
00273       eval("self.chkMon"+suffix).setEnabled(0)
00274
00275
00276   def setFont(self, font):
00277     self.fontPsize= font.pointSize()
00278     EnvMon.setFont(self, font)
00279     for regName in self.monitorList:
00280       self.adjustMonitorTextFont(self.monitorList[regName])
00281
00282   def adjustMonitorTextFont(self, monTxt):
00283     font = monTxt.font()
00284     font.setPointSize(self.fontPsize)
00285     monTxt.setFont(font)
00286
00287   def toggleRaw(self, raw):
00288     self.__bypass = raw
00289
00290   def changeBlock(self, block):
00291     if block == -1:
00292       block = 0
00293       suppressError = 1
00294     else:
00295       suppressError = 0
00296     blockText = str(self.cmbBlock.text(block))
00297     if blockText.startswith('TEM'):
00298       try:
00299         self.selectTEM(blockText)
00300       except:
00301         # Either the TEM doesn't exist or running with a G2 or G3 setup
00302         if not suppressError:
00303           QMessageBox.critical(self, "Environmental Quantity Monitor",
00304                               "Invalid block " + blockText +
00305                               ", doesn't exist in this hardware configuration.")
00306         else:
00307           self.selectAEM()
00308       else:
00309         self.envMonStack.raiseWidget(0)
00310       self.cmbBlock.setCurrentText(self.__block)
00311     else:
00312       self.selectAEM()
00313
00314   def selectAEM(self):
00315     self.__block = "AEM"
00316     self.__lat.applyConfig(2)
00317     self.__gaeq = self.__lat.AEM.AEQ
00318     self.envMonStack.raiseWidget(1)
00319
00320   def selectTEM(self, blockText):
00321     temId = int(blockText.split()[1])
00322     tem = self.__lat.TEM[temId]
00323     temVer = int((tem.status >> 16) & 0x3F)
00324     self.__block = blockText
00325     self.__gtic = tem.TIC
00326     self.__gtwr = self.__xbrd.TWR[temId]
00327     if temVer < 8:
00328       self.__lat.applyConfig(0, self.__xbrd)
00329       self.setupLabels(0)
00330     else:
00331       self.__lat.applyConfig(1, self.__xbrd)
00332       self.setupLabels(1)
00333
00334   def changeFreeBoard(self, boardId):
00335     self.__board = boardId
00336     self.__freeBoard = str(self.cmbFreeBoard.currentText())
00337     self.populateACDchecks(boardId)
00338
00339   def populateACDchecks(self, boardId):
00340     checkList = self.acdMonitorCheckList[boardId]
00341     for i in range(8):
00342       chkState = checkList[i]
00343       chkBox = self.bgAcdEnv1Mon.find(i)
00344       if chkState:
00345         chkBox.setChecked(1)
00346       else:
00347         chkBox.setChecked(0)
00348         eval("self.txt" + chkBox.name()[6:]).setText("")
00349     checkList = self.acdPlotCheckList[boardId]
00350     for i in range(8):
00351       chkState = checkList[i]
00352       chkBox = self.bgAcdEnv1Plot.find(i)
00353       if chkState:
00354         chkBox.setChecked(1)
00355       else:
00356         chkBox.setChecked(0)
00357
00358
00359   def toggleDataTakingPlot(self, id):
00360     chk = self.bgDataTakingPlot.find(id)
00361     if chk.isChecked():
00362       if not self.DataTakingRegList[id] in self.scrPlotView.getPlotList():
00363         if self.DataTakingRegList[id] == "event_size":
00364           self.scrPlotView.addEventPlot(self.DataTakingRegList[id])
00365         else:
00366           columns = ['Time', 'Counter']
00367           self.scrPlotView.addPlot(name=self.DataTakingRegList[id],
00368                                           title=self.DataTakingRegList[id],
00369                                           sizeX=250,
00370                                           sizeY=300,
00371                                           labels=columns)
00372     else:
00373       self.scrPlotView.removePlot(self.DataTakingRegList[id])
00374
00375   def toggleDataTakingMon(self, id):
00376     chk = self.bgDataTakingMon.find(id)
00377     if chk.isChecked():
00378       if not self.DataTakingRegList[id] in self.monitorList:
00379         #self.__dictSem.acquire()
00380         self.monitorList[self.DataTakingRegList[id]] = eval("self.txt" + chk.name()[6:])
00381         self.adjustMonitorTextFont(self.monitorList[self.DataTakingRegList[id]])
00382         #self.__dictSem.release()
00383     else:
00384       if self.DataTakingRegList[id] in self.monitorList:
00385         self.monitorList[self.DataTakingRegList[id]].setText('')
00386         #self.__dictSem.acquire()
00387         self.monitorList.__delitem__(self.DataTakingRegList[id])
00388         #self.__dictSem.release()
00389
00390
00391   def toggleChan0Plot(self, id):
00392     chk = self.bgChan0Plot.find(id)
00393     if chk.isChecked():
00394       if not self.chan0RegList[id] in self.scrPlotView.getPlotList():
00395         reg = self.__gtic.regs[self.chan0RegList[id]]
00396         if reg.getEGU().units() == '':
00397           strUnits = ""
00398         else:
00399           strUnits = " (" + reg.getEGU().units() + ")"
00400         if chk.name()[-1] == 'V':
00401           columns = ['Time', 'Voltage' + strUnits]
00402         else:
00403           columns = ['Time', 'Current' + strUnits]
00404         #self.vArrayList[self.chan0RegList[id]] = [0.0] * 100
00405         self.scrPlotView.addPlot(name=self.chan0RegList[id],
00406                                         title=self.chan0RegList[id],
00407                                         sizeX=250,
00408                                         sizeY=300,
00409                                         labels=columns)
00410     else:
00411       self.scrPlotView.removePlot(self.chan0RegList[id])
00412
00413
00414   def toggleChan0Mon(self, id):
00415     chk = self.bgChan0Mon.find(id)
00416     if chk.isChecked():
00417       if not self.chan0RegList[id] in self.monitorList:
00418         #self.__dictSem.acquire()
00419         self.monitorList[self.chan0RegList[id]] = eval("self.txt" + chk.name()[6:])
00420         self.adjustMonitorTextFont(self.monitorList[self.chan0RegList[id]])
00421         #self.__dictSem.release()
00422     else:
00423       if self.chan0RegList[id] in self.monitorList:
00424         self.monitorList[self.chan0RegList[id]].setText('')
00425         #self.__dictSem.acquire()
00426         self.monitorList.__delitem__(self.chan0RegList[id])
00427         #self.__dictSem.release()
00428
00429   def toggleChan1Plot(self, id):
00430     chk = self.bgChan1Plot.find(id)
00431     if chk.isChecked():
00432       if not self.chan1RegList[id] in self.scrPlotView.getPlotList():
00433         reg = self.__gtic.regs[self.chan1RegList[id]]
00434         if reg.getEGU().units() == '':
00435           strUnits = ""
00436         else:
00437           strUnits = " (" + reg.getEGU().units() + ")"
00438         if chk.name()[-1] == 'V':
00439           columns = ['Time', 'Voltage' + strUnits]
00440         else:
00441           columns = ['Time', 'Current' + strUnits]
00442         #self.vArrayList[self.chan1RegList[id]] = [0.0] * 100
00443         self.scrPlotView.addPlot(name=self.chan1RegList[id],
00444                                         title=self.chan1RegList[id],
00445                                         sizeX=250,
00446                                         sizeY=300,
00447                                         labels=columns)
00448     else:
00449       self.scrPlotView.removePlot(self.chan1RegList[id])
00450
00451
00452   def toggleChan1Mon(self, id):
00453     chk = self.bgChan1Mon.find(id)
00454     if chk.isChecked():
00455       if not self.chan1RegList[id] in self.monitorList:
00456         #self.__dictSem.acquire()
00457         self.monitorList[self.chan1RegList[id]] = eval("self.txt" + chk.name()[6:])
00458         self.adjustMonitorTextFont(self.monitorList[self.chan1RegList[id]])
00459         #self.__dictSem.release()
00460     else:
00461       if self.chan1RegList[id] in self.monitorList:
00462         self.monitorList[self.chan1RegList[id]].setText('')
00463         #self.__dictSem.acquire()
00464         self.monitorList.__delitem__(self.chan1RegList[id])
00465         #self.__dictSem.release()
00466
00467   def toggleChan2Plot(self, id):
00468     chk = self.bgChan2Plot.find(id)
00469     if chk.isChecked():
00470       if not self.chan2RegList[id] in self.scrPlotView.getPlotList():
00471         reg = self.__gtic.regs[self.chan2RegList[id]]
00472         if reg.getEGU().units() == '':
00473           strUnits = ""
00474         else:
00475           strUnits = " (" + reg.getEGU().units() + ")"
00476         columns = ['Time', 'Temperature' + strUnits]
00477         #self.vArrayList[self.chan2RegList[id]] = [0.0] * 100
00478         self.scrPlotView.addPlot(name=self.chan2RegList[id],
00479                                         title=self.chan2RegList[id],
00480                                         sizeX=250,
00481                                         sizeY=300,
00482                                         labels=columns)
00483     else:
00484       self.scrPlotView.removePlot(self.chan2RegList[id])
00485
00486
00487   def toggleChan2Mon(self, id):
00488     chk = self.bgChan2Mon.find(id)
00489     if chk.isChecked():
00490       if not self.chan2RegList[id] in self.monitorList:
00491         #self.__dictSem.acquire()
00492         self.monitorList[self.chan2RegList[id]] = eval("self.txt" + chk.name()[6:])
00493         self.adjustMonitorTextFont(self.monitorList[self.chan2RegList[id]])
00494         #self.__dictSem.release()
00495     else:
00496       if self.chan2RegList[id] in self.monitorList:
00497         self.monitorList[self.chan2RegList[id]].setText('')
00498         #self.__dictSem.acquire()
00499         self.monitorList.__delitem__(self.chan2RegList[id])
00500         #self.__dictSem.release()
00501
00502   def toggleChan3Plot(self, id):
00503     chk = self.bgChan3Plot.find(id)
00504     if chk.isChecked():
00505       if not self.chan3RegList[id] in self.scrPlotView.getPlotList():
00506         reg = self.__gtic.regs[self.chan3RegList[id]]
00507         if reg.getEGU().units() == '':
00508           strUnits = ""
00509         else:
00510           strUnits = " (" + reg.getEGU().units() + ")"
00511         columns = ['Time', 'Temperature' + strUnits]
00512         #self.vArrayList[self.chan3RegList[id]] = [0.0] * 100
00513         self.scrPlotView.addPlot(name=self.chan3RegList[id],
00514                                         title=self.chan3RegList[id],
00515                                         sizeX=250,
00516                                         sizeY=300,
00517                                         labels=columns)
00518     else:
00519       self.scrPlotView.removePlot(self.chan3RegList[id])
00520
00521
00522   def toggleChan3Mon(self, id):
00523     chk = self.bgChan3Mon.find(id)
00524     if chk.isChecked():
00525       if not self.chan3RegList[id] in self.monitorList:
00526         #self.__dictSem.acquire()
00527         self.monitorList[self.chan3RegList[id]] = eval("self.txt" + chk.name()[6:])
00528         self.adjustMonitorTextFont(self.monitorList[self.chan3RegList[id]])
00529         #self.__dictSem.release()
00530     else:
00531       if self.chan3RegList[id] in self.monitorList:
00532         self.monitorList[self.chan3RegList[id]].setText('')
00533         #self.__dictSem.acquire()
00534         self.monitorList.__delitem__(self.chan3RegList[id])
00535         #self.__dictSem.release()
00536
00537   def toggleChan4Plot(self, id):
00538     chk = self.bgChan4Plot.find(id)
00539     if chk.isChecked():
00540       if not self.chan4RegList[id] in self.scrPlotView.getPlotList():
00541         reg = self.__gtic.regs[self.chan4RegList[id]]
00542         if reg.getEGU().units() == '':
00543           strUnits = ""
00544         else:
00545           strUnits = " (" + reg.getEGU().units() + ")"
00546         columns = ['Time', 'Temperature' + strUnits]
00547         #self.vArrayList[self.chan4RegList[id]] = [0.0] * 100
00548         self.scrPlotView.addPlot(name=self.chan4RegList[id],
00549                                         title=self.chan4RegList[id],
00550                                         sizeX=250,
00551                                         sizeY=300,
00552                                         labels=columns)
00553     else:
00554       self.scrPlotView.removePlot(self.chan4RegList[id])
00555
00556
00557   def toggleChan4Mon(self, id):
00558     chk = self.bgChan4Mon.find(id)
00559     if chk.isChecked():
00560       if not self.chan4RegList[id] in self.monitorList:
00561         #self.__dictSem.acquire()
00562         self.monitorList[self.chan4RegList[id]] = eval("self.txt" + chk.name()[6:])
00563         self.adjustMonitorTextFont(self.monitorList[self.chan4RegList[id]])
00564         #self.__dictSem.release()
00565     else:
00566       if self.chan4RegList[id] in self.monitorList:
00567         self.monitorList[self.chan4RegList[id]].setText('')
00568         #self.__dictSem.acquire()
00569         self.monitorList.__delitem__(self.chan4RegList[id])
00570         #self.__dictSem.release()
00571
00572   def toggleAcdEnv1Plot(self, id):
00573     chk = self.bgAcdEnv1Plot.find(id)
00574     if chk.isChecked():
00575       reg = self.acdEnv1RegList[id]
00576       if reg.startswith('env_dac'):
00577         for i in range(12):
00578           self.acdPlotCheckList[i][id] = 1
00579       else:
00580         self.acdPlotCheckList[self.__board][id] = 1
00581       if reg.endswith('_'):
00582         reg += str(self.cmbFreeBoard.currentText())
00583       if not reg in self.scrPlotView.getPlotList():
00584         regAttr = self.__gaeq.regs[reg]
00585         if regAttr.getEGU().units() == '':
00586           strUnits = ""
00587         else:
00588           strUnits = " (" + regAttr.getEGU().units() + ")"
00589         columns = ['Time', strUnits]
00590         #self.vArrayList[self.acdEnv1RegList[id]] = [0.0] * 100
00591         self.scrPlotView.addPlot(name=reg,
00592                                         title=reg,
00593                                         sizeX=250,
00594                                         sizeY=300,
00595                                         labels=columns)
00596     else:
00597       reg = self.acdEnv1RegList[id]
00598       if reg.startswith('env_dac'):
00599         for i in range(12):
00600           self.acdPlotCheckList[i][id] = 0
00601       else:
00602         self.acdPlotCheckList[self.__board][id] = 0
00603       if reg.endswith('_'):
00604         reg += str(self.cmbFreeBoard.currentText())
00605       self.scrPlotView.removePlot(reg)
00606
00607   def toggleAcdEnv1Mon(self, id):
00608     chk = self.bgAcdEnv1Mon.find(id)
00609     if chk.isChecked():
00610       reg = self.acdEnv1RegList[id]
00611       if reg.startswith('env_dac'):
00612         for i in range(12):
00613           self.acdMonitorCheckList[i][id] = 1
00614       else:
00615         self.acdMonitorCheckList[self.__board][id] = 1
00616       if reg.endswith('_'):
00617         reg += str(self.cmbFreeBoard.currentText())
00618       if not reg in self.monitorList:
00619         #self.__dictSem.acquire()
00620         self.monitorList[reg] = eval("self.txt" + chk.name()[6:])
00621         self.adjustMonitorTextFont(self.monitorList[reg])
00622         #self.__dictSem.release()
00623     else:
00624       reg = self.acdEnv1RegList[id]
00625       if reg.startswith('env_dac'):
00626         for i in range(12):
00627           self.acdMonitorCheckList[i][id] = 0
00628       else:
00629         self.acdMonitorCheckList[self.__board][id] = 0
00630       if reg.endswith('_'):
00631         reg += str(self.cmbFreeBoard.currentText())
00632       if reg in self.monitorList:
00633         self.monitorList[reg].setText('')
00634         #self.__dictSem.acquire()
00635         self.monitorList.__delitem__(reg)
00636         #self.__dictSem.release()
00637
00638   def togglePDUPlot(self, id):
00639     chk = self.bgPDUPlot.find(id)
00640     if chk.isChecked():
00641       if not self.pduRegList[id] in self.scrPlotView.getPlotList():
00642         reg = self.__gtwr.regs[self.pduRegList[id]]
00643         if reg.getEGU().units() == '':
00644           strUnits = ""
00645         else:
00646           strUnits = " (" + reg.getEGU().units() + ")"
00647         if chk.name()[-1] == 'V':
00648           columns = ['Time', 'Voltage' + strUnits]
00649         else:
00650           columns = ['Time', 'Temperature' + strUnits]
00651         self.scrPlotView.addPlot(name=self.pduRegList[id],
00652                                         title=self.pduRegList[id],
00653                                         sizeX=250,
00654                                         sizeY=300,
00655                                         labels=columns)
00656     else:
00657       self.scrPlotView.removePlot(self.acdEnv2RegList[id])
00658
00659   def togglePDUMon(self, id):
00660     chk = self.bgPDUMon.find(id)
00661     if chk.isChecked():
00662       if not self.pduRegList[id] in self.monitorList:
00663         #self.__dictSem.acquire()
00664         self.monitorList[self.pduRegList[id]] = eval("self.txt" + chk.name()[6:])
00665         self.adjustMonitorTextFont(self.monitorList[self.pduRegList[id]])
00666         #self.__dictSem.release()
00667     else:
00668       if self.pduRegList[id] in self.monitorList:
00669         self.monitorList[self.pduRegList[id]].setText('')
00670         #self.__dictSem.acquire()
00671         self.monitorList.__delitem__(self.pduRegList[id])
00672         #self.__dictSem.release()
00673
00674
00675   def clearPlots(self):
00676     #self.__dictSem.acquire()
00677     for txt in self.monitorList.values():
00678       txt.setText('')
00679     self.monitorList.clear()
00680     for chkId in self.scrPlotView.getPlotList().keys():
00681       self.scrPlotView.removePlot(chkId)
00682     for chkId in range(self.bgDataTakingMon.count()):
00683       self.bgDataTakingMon.find(chkId).setChecked(0)
00684       self.bgDataTakingPlot.find(chkId).setChecked(0)
00685     for chkId in range(self.bgChan0Mon.count()):
00686       self.bgChan0Mon.find(chkId).setChecked(0)
00687       self.bgChan0Plot.find(chkId).setChecked(0)
00688     for chkId in range(self.bgChan1Mon.count()):
00689       self.bgChan1Mon.find(chkId).setChecked(0)
00690       self.bgChan1Plot.find(chkId).setChecked(0)
00691     for chkId in range(self.bgChan2Mon.count()):
00692       self.bgChan2Mon.find(chkId).setChecked(0)
00693       self.bgChan2Plot.find(chkId).setChecked(0)
00694     for chkId in range(self.bgChan3Mon.count()):
00695       self.bgChan3Mon.find(chkId).setChecked(0)
00696       self.bgChan3Plot.find(chkId).setChecked(0)
00697     for chkId in range(self.bgChan4Mon.count()):
00698       self.bgChan4Mon.find(chkId).setChecked(0)
00699       self.bgChan4Plot.find(chkId).setChecked(0)
00700     for chkId in range(self.bgAcdEnv1Mon.count()):
00701       self.bgAcdEnv1Mon.find(chkId).setChecked(0)
00702       self.bgAcdEnv1Plot.find(chkId).setChecked(0)
00703     for chkId in range(self.bgPDUMon.count()):
00704       self.bgPDUMon.find(chkId).setChecked(0)
00705       self.bgPDUPlot.find(chkId).setChecked(0)
00706     #self.__dictSem.release()
00707
00708   def initDisplays(self):
00709     #self.scrPlotView.setVScrollBarMode(QScrollView.AlwaysOn)
00710     self.frameOuterPlotsLayout = QGridLayout(self.frameOuterPlots,1,1,11,6,"frameOuterPlotsLayout")
00711     self.frameOuterPlotsLayout.addWidget(self.scrPlotView, 0, 0)
00712
00713   def changeRate(self, val):
00714     self.__rate = val
00715
00716   def calcDeadTime(self, regName):
00717     reg = self.__gtic.regs[regName]
00718     regNo = reg.id()
00719     resp = self.__gtic.read(regNo)
00720     status = resp.status()
00721     newVal = resp.value()
00722     newTS = resp.payloads()[1]
00723     if status == 0:
00724       if self.oldVal is None:
00725         self.oldVal = newVal
00726         self.oldTS = newTS
00727         return None
00728       else:
00729         dTime = newVal - self.oldVal
00730         dTS = newTS - self.oldTS
00731         self.oldVal = newVal
00732         self.oldTS = newTS
00733         if dTime < 0:
00734           dTime += (1L << 32)
00735         if dTS < 0:
00736           dTS += (1L << 64)
00737         if dTS != 0:                    # Make sure denominator isn't zero
00738           return (float(dTime)/float(dTS)) * (EnvMonImpl.TIMEBASE_RATE_IN_MHZ / EnvMonImpl.DEADTIME_RATE_IN_MHZ) * 100.0
00739         else:
00740           #print "dTimebase = 0"
00741           return None
00742     else:
00743       #print "Deadtime counter saturated"
00744       self.oldVal = None
00745       self.oldTS = None
00746       return None
00747
00748   def readEnvValues(self):
00749     def updateGui(regs):
00750       for (tWidget, val) in regs.items():
00751         if self.__threadQuit != 0: break
00752         tWidget.setText(val)
00753     cnt = 0
00754     while(self.__threadQuit == 0):
00755       cnt = cnt + 1
00756       #self.__dictSem.acquire()
00757
00758       #Make a copy of the list so that we don't have concurrency issues
00759       #with the main thread
00760       regList = copy.copy(self.monitorList)
00761       updateGuiRegs = {}
00762       #self.__dictSem.release()
00763       for regName in regList:
00764         if self.__threadQuit != 0:
00765           break
00766         if regName == "event_size" and self.DBN != {}:
00767           val = self.DBN['_event_size']
00768           strVal = "%8d" % val
00769           if not self.__bypass:
00770             strVal = strVal + "   "
00771         elif regName == "sat_deadtime_lrs_ctr":
00772           val = self.calcDeadTime(regName)
00773           if val is not None:
00774             strVal = "%3.2f%%" % val
00775           else:
00776             val    = 0
00777             strVal = "N/A"
00778           if not self.__bypass:
00779             strVal = strVal + "   "
00780         else:
00781           try:
00782             if regName.startswith('env'):
00783               reg = self.__gaeq.regs[regName]
00784               val = reg.get(bypass=self.__bypass, node=self.__gaeq)
00785             elif regName in self.pduRegList:
00786               reg = self.__gtwr.regs[regName]
00787               reg.set(0, self.__gtwr)
00788               val = reg.get(bypass=1, node=self.__gtwr) & 0xFFFF
00789               if not self.__bypass:
00790                 val = reg.getEGU().egu(val)
00791             else:
00792               reg = self.__gtic.regs[regName]
00793               val = reg.get(bypass=self.__bypass, node=self.__gtic)
00794             if not self.__bypass:
00795               if regName in self.DataTakingRegList:
00796                 strVal = "%8d" % val
00797               else:
00798                 strVal = "%8.4f" % val
00799               strVal = strVal + " %2s" % reg.getEGU().units()
00800             else:
00801               strVal = "%8d" % val
00802           except:
00803             val    = 0
00804             strVal = "N/A"
00805         if not regName.startswith('env') or regName.startswith('env_dac'):
00806           #regList[regName].setText(strVal)
00807           #self.execGUImethodNR(regList[regName].setText, strVal)
00808           updateGuiRegs[regList[regName]] = strVal
00809         elif regName[-3:] == self.__freeBoard:
00810           #regList[regName].setText(strVal)
00811           #self.execGUImethodNR(regList[regName].setText, strVal)
00812           updateGuiRegs[regList[regName]] = strVal
00813         if regName in self.scrPlotView.getPlotList():
00814           plot = self.scrPlotView.getPlot(regName)
00815           if regName == "event_size" and self.DBN != {}:
00816             self.DBN['_EventSizeNTuple'].setIntervalEnabled(0)
00817             #plot.update()
00818             self.DBN['_EventSizeNTuple'].setIntervalEnabled(1)
00819           else:
00820             nt = plot.getNTuple()
00821             nt.addRow([cnt, val])
00822       #self.__dictSem.release()
00823       if updateGuiRegs != {}:
00824          self.execGUImethodNR(updateGui, updateGuiRegs)
00825
00826       t0 = time.time()
00827       while (time.time() - t0 < 2.1 - self.__rate*0.02):
00828         time.sleep(.1)
00829         if self.__threadQuit != 0:
00830           break
00831     # Make sure all the previous calls to GUI bridge
00832     # get processed before shutdown
00833     if self.__threadQuit == 1:
00834       self.execGUImethodNR(self.shutdown)
00835
00836   def shutdown(self):
00837     self.__threadQuit = 1
00838     self.threadReadEnv.shutdown()
00839     self.inShutdown = True
00840     self.__guiBridge.shutdown()
00841     time.sleep(.1)
00842     self.unregisterExitHandler()
00843     self.close()
00844     #self.deleteLater()
00845
00846   def quitApp(self):
00847     self.__threadQuit = 2
00848     self.inShutdown = True
00849     self.threadReadEnv.shutdown()
00850     self.__guiBridge.shutdown()
00851     time.sleep(.1)
00852     self.unregisterExitHandler()
00853
00854   def unregisterExitHandler(self):
00855     for i in range(len(atexit._exithandlers)):
00856       if atexit._exithandlers[i][0] == self.quitApp:
00857         del atexit._exithandlers[i]
00858         break
00859
00860   def closeEvent(self, e):
00861     if self.__threadQuit == 0:
00862       # Before the user closes the app we want to
00863       # shutdown, so ignore the close request and
00864       # let the thread finish to its completion
00865       # which will call shutdown where the actual
00866       # close happens.
00867       self.__threadQuit = 1
00868       #self.shutdown()
00869       #e.accept()
00870       e.ignore()
00871     else:
00872       e.accept()
00873
00874   def customEvent(self, e):
00875     """This method overrides the QObject base class's.  There is generally
00876     no reason to call this method directly.  It is called by the Qt
00877     infrastructure whenever the custom event is posted, e.g. by the following
00878     three methods of this class: createGUI, execGUImethodNR and execGUImethod.
00879     """
00880     self.__guiBridge.handleCustomEvent(e)
00881
00882   def execGUImethodNR(self, func, *args, **kwargs):
00883     """Method used for executing a GUI function from a non-GUI thread.
00884     Use this method when no (useful) response is expected or
00885     when waiting for one could cause a deadlock.  Any response from the
00886     function is lost."""
00887     if self.inShutdown:  return # Don't try to update the GUI during shutdown
00888
00889     return self.__guiBridge.execGUImethodNR(self, func, *args, **kwargs)
00890
00891   def execGUImethod(self, func, *args, **kwargs):
00892     """Method used for executing a GUI function from a non-GUI thread.
00893     Use this method when a response is expected from the function and
00894     when it is appropriate to wait for it (no deadlock arises)"""
00895     if self.inShutdown:  return # Don't try to update the GUI during shutdown
00896
00897     return self.__guiBridge.execGUImethod(self, func, *args, **kwargs)
00898
00899
00900
00901 class PlotWidget(QtViewWidget):
00902
00903   class EnvMonSetRangeImpl(EnvMonSetRange):
00904     def __init__(self, parent = None,name = None,fl = 1):
00905       EnvMonSetRange.__init__(self,parent,name,fl)
00906       QObject.connect(self.btnOK,     SIGNAL("clicked()"), self.OKButtonClicked)
00907       QObject.connect(self.btnCancel, SIGNAL("clicked()"), self.CancelButtonClicked)
00908       self.__cancel = 1
00909
00910     def OKButtonClicked(self):
00911       self.__cancel = 0
00912       self.close()
00913
00914     def CancelButtonClicked(self):
00915       self.close()
00916
00917     def getMinMax(self):
00918       rect = self.parentWidget().geometry()
00919       self.move (rect.center().x() - self.rect().center().x(),
00920                  rect.center().y() - self.rect().center().y())
00921       self.txtMinVal.setFocus()
00922       self.show()
00923       self.exec_loop()
00924       if self.__cancel:
00925         return None
00926       else:
00927         return (str(self.txtMinVal.text()), str(self.txtMaxVal.text()))
00928
00929   def __init__(self, envMonDlg, parent, title, sizeX, sizeY, labels):
00930     QtViewWidget.__init__(self, parent, "", Qt.WStaticContents | Qt.WRepaintNoErase)
00931     #QtViewWidget.__init__(self, parent, "")
00932     self.printer=QPrinter()
00933     self.__setRangeDlg = self.EnvMonSetRangeImpl(envMonDlg)
00934     ntc = NTupleController.instance()
00935     self.__nt = ntc.createCircularBuffer(2)
00936     self.__nt.setLabels(labels)
00937     self.__nt.setTitle(title)
00938     self.__nt.reserve(100)
00939     dc = DisplayController.instance()
00940     self.__plot = dc.createDisplay('Strip Chart', self.__nt, labels)
00941     self.setPlotter (self.__plot)
00942     self.setDoubleBuffering(1)
00943     self.resize(sizeX, sizeY)
00944     self.show()
00945
00946   def getNTuple(self):
00947     return self.__nt
00948
00949   def contextMenuEvent(self, cmev):
00950     contextMenu = QPopupMenu( self )
00951     caption = QLabel( self )
00952     caption.setAlignment( Qt.AlignCenter )
00953     caption.setText("<font color=darkblue><u><b>Context Menu</b></u></font>")
00954     contextMenu.insertItem(caption)
00955     contextMenu.insertItem( "&Print to printer", self.printPlot, Qt.CTRL+Qt.Key_P)
00956     contextMenu.insertItem( "&Save to &file", self.saveToFile, Qt.CTRL+Qt.Key_S)
00957     contextMenu.insertSeparator()
00958     contextMenu.insertItem( "&Set Range", self.setRange, Qt.CTRL+Qt.Key_R)
00959     contextMenu.exec_loop(QCursor.pos())
00960
00961   def printPlot(self):
00962     if not self.printer:
00963       self.printer = QPrinter()
00964     if self.printer.setup(self):
00965       pp=QPainter(self.printer)
00966       self.draw(pp)
00967
00968   def saveToFile(self):
00969     imgFormatList = []
00970     ifQList = QImage.outputFormatList()
00971     fileSpec = "Images ("
00972     for imgFormat in ifQList:
00973       imgFormat = str(imgFormat)
00974       if imgFormat == 'JPEG': imgFormat = 'JPG'
00975       imgFormatList = imgFormatList + [imgFormat]
00976       fileSpec = fileSpec + " *." + imgFormat.lower()
00977     fileSpec = fileSpec + " )"
00978     fileName = QFileDialog.getSaveFileName(QString.null, fileSpec,
00979                          self, "file save as bitmap",
00980                          "Plot -- File Save As Bitmap")
00981     fileName = str(fileName)
00982     if fileName != '':
00983       sep = fileName.rfind('.')
00984       if not sep:
00985         QMessageBox.critical(self, "Environmental Quantity Monitor",
00986                               "Can not determine the output image format without an extension")
00987       else:
00988         imgFormat = fileName[sep+1:].upper()
00989         if imgFormat not in imgFormatList:
00990           QMessageBox.critical(self, "Environmental Quantity Monitor",
00991                               "Unsupported image format:%s" % fileName[fileName.rfind('.')+1:].upper())
00992         else:
00993           if imgFormat == 'JPG': imgFormat = 'JPEG'
00994           plotPixmap = QPixmap.grabWidget(self)
00995           plotPixmap.save(fileName, imgFormat)
00996
00997
00998   def setRange(self):
00999     minMax = self.__setRangeDlg.getMinMax()
01000     if minMax is not None:
01001       self.__plot.setRange('y', float(minMax[0]), float(minMax[1]))
01002
01003 class ScrollablePlotView(QScrollView):
01004   def __init__(self, dbn, parent = None,name = None,fl = 0):
01005     QScrollView.__init__(self, parent, name, fl)
01006     self.__parent = parent
01007     self.__dbn = dbn
01008     self._plots = []
01009     self.setVScrollBarMode(QScrollView.AlwaysOn)
01010     self.box = QVBox(self.viewport())
01011     self.addChild(self.box)
01012     self.__nTupleList = {}
01013     self.__plotList = {}
01014     self.viewport().setFocusProxy( self );
01015     self.viewport().setFocusPolicy( QWidget.WheelFocus );
01016
01017   def addPlot(self, name, title, sizeX, sizeY, labels):
01018     plot = PlotWidget(self.__parent, self.box, title, sizeX, sizeY, labels)
01019     self.__nTupleList[name] = plot.getNTuple()
01020     self.__plotList[name] = plot
01021     return plot
01022
01023   def initEventPlot(self): # revisit
01024     dc = DisplayController.instance()
01025     self.eventPlotter = dc.createDisplay('Histogram', self.__dbn['_EventSizeNTuple'], ['Event Size'])
01026     self.eventWidget = QtViewWidget(self.box, '', Qt.WStaticContents | Qt.WRepaintNoErase)
01027     self.eventWidget.setDoubleBuffering(1)
01028     self.eventWidget.setPlotter (self.eventPlotter)
01029     self.eventWidget.resize(250, 300)
01030     self.eventWidget.hide()
01031
01032   def addEventPlot(self, name):
01033     self.__plotList[name] = self.eventWidget
01034     self.eventWidget.show()
01035     return self.eventWidget
01036
01037
01038   def removePlot(self, name):
01039     if name == "event_size":
01040       self.eventWidget.hide()
01041       self.__plotList.__delitem__(name)
01042     else:
01043       self.box.removeChild(self.getPlot(name))
01044       self.__nTupleList.__delitem__(name)
01045       self.__plotList.__delitem__(name)
01046
01047   def getPlot(self, name):
01048     return self.__plotList[name]
01049
01050   def getNTupleList(self):
01051     return self.__nTupleList
01052
01053   def getPlotList(self):
01054     return self.__plotList
01055
01056
01057
01058 if __name__ == "__main__":
01059   from LATTE.runcontrol.RunControlCommon import RunControlCommon
01060
01061   rcCommon = RunControlCommon()
01062   rcCommon.initialize()
01063   rcCommon.setLoggingLevel("INFO")
01064   rcCommon.connect()
01065
01066   a = QApplication(sys.argv)
01067   em = EnvMonImpl(rcCommon)
01068   QObject.connect(a,SIGNAL("lastWindowClosed()"), a, SLOT("quit()"))
01069   a.setMainWidget(em)
01070   em.show()
01071   a.exec_loop()
01072
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: errors.py Source File

dispatch

errors.py

00001 """Error types for dispatcher mechanism
00002 """
00003
00004 class DispatcherError(Exception):
00005     """Base class for all Dispatcher errors"""
00006 class DispatcherKeyError(KeyError, DispatcherError):
00007     """Error raised when unknown (sender,signal) set specified"""
00008 class DispatcherTypeError(TypeError, DispatcherError):
00009     """Error raised when inappropriate signal-type specified (None)"""
00010
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: evtDataImpl.py Source File

runcontrol

evtDataImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Event Data displayer module"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:15:11 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import sys
00022 from qt import *
00023 from evtData import evtData
00024 import Numeric
00025
00026 class evtDataImpl(evtData):
00027
00028   def __init__(self,parent = None,name = None,fl = 0):
00029     evtData.__init__(self,parent,name,fl)
00030   # public slot
00031
00032   def load(self):
00033     f = file( str(self.__filename), 'rb' )
00034
00035     #~ if not f.open( IO_ReadOnly ):
00036         #~ return
00037
00038     dataString = []
00039     #~ while 1:
00040     data = f.read()
00041     dataArray = Numeric.fromstring(data,'b')
00042
00043     #~ self.evtDataList.setPointSize(16)
00044     #~ self.evtDataList.setFamily('Courier')
00045
00046     v = ""
00047     for i in xrange(len(dataArray)):
00048       v += "%02x " % dataArray[i]
00049
00050     self.evtDataList.setText(v)
00051
00052     #~ font = self.evtDataList.font()
00053
00054     f.close()
00055
00056   def fileNew(self):
00057     print "evtDataImpl.fileNew(): Not implemented yet"
00058   # public slot
00059
00060   def fileOpen(self):
00061     fn = QFileDialog.getOpenFileName( QString.null, "(*.*)", self, "Event Data file dialog",
00062                                             "Choose an Event Data File" )
00063     if not fn.isEmpty():
00064       self.__filename = fn
00065       self.load( )
00066
00067   def fileSave(self):
00068     print "evtDataImpl.fileSave(): Not implemented yet"
00069   # public slot
00070
00071   def fileSaveAs(self):
00072     print "evtDataImpl.fileSaveAs(): Not implemented yet"
00073   # public slot
00074
00075   def filePrint(self):
00076     Margin = 50
00077     pageNo = 1
00078     column = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150] # Magic numbers
00079
00080     # If there are no items, don't try to print
00081     if not self.Logger.firstChild():
00082       return
00083
00084     if self.printer.setup(self):
00085       self.statusBar().message('Printing...')
00086
00087       p = QPainter()
00088       p.begin(self.printer)
00089       p.setFont(self.Logger.font())
00090       yPos = 0
00091       fm = p.fontMetrics()
00092       metrics = QPaintDeviceMetrics(self.printer)
00093
00094       header = "Evend Data Source: " + str(self.__filename)
00095
00096       page = "Page: 1"
00097       p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, header)
00098       yPos = yPos + fm.lineSpacing()
00099       p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, page)
00100       yPos = yPos + 2*fm.lineSpacing()
00101
00102       #~ columnHeader = ['','Severity','Date','Time','Source','Message']
00103
00104       for i in len(self.__data):
00105         p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00106                     Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00107       yPos = yPos + fm.lineSpacing()
00108
00109       item = self.Logger.firstChild()
00110       for j in range(self.Logger.childCount()):
00111         if Margin + yPos > metrics.height() - Margin:
00112           pageNo = pageNo + 1
00113           page = "Page: " + str(pageNo)
00114           self.statusBar().message('Printing (page %d)...' % (pageNo))
00115           self.printer.newPage()
00116           yPos = 0
00117           p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, header)
00118           yPos = yPos + fm.lineSpacing()
00119           p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, page)
00120           yPos = yPos + 2*fm.lineSpacing()
00121
00122           for i in range (0,6):
00123             p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00124                       Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00125           yPos = yPos + fm.lineSpacing()
00126
00127         for i in range (0,6):
00128           p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00129                     Qt.ExpandTabs | Qt.DontClip,item.text(i))
00130         yPos = yPos + fm.lineSpacing()
00131         item = item.nextSibling()
00132
00133       p.end()
00134       self.statusBar().message('Printing completed',2000)
00135     else:
00136       self.statusBar().message('Printing aborted',2000)
00137
00138
00139   def fileExit(self):
00140     print "evtDataImpl.fileExit(): Not implemented yet"
00141   # public slot
00142
00143   def helpIndex(self):
00144     print "evtDataImpl.helpIndex(): Not implemented yet"
00145   # public slot
00146
00147   def helpContents(self):
00148     print "evtDataImpl.helpContents(): Not implemented yet"
00149   # public slot
00150
00151   def helpAbout(self):
00152     print "evtDataImpl.helpAbout(): Not implemented yet"
00153
00154
00155
00156 if __name__ == "__main__":
00157   a = QApplication(sys.argv)
00158   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00159   w = evtDataImpl()
00160   a.setMainWidget(w)
00161   w.show()
00162   a.exec_loop()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: excApp.py Source File

tests / apps

excApp.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Application for testing handling of exceptions"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "August 20, 2004"        # Created
00014 __version__  = "$Revision: 1.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from qt import qApp
00021
00022 import            threading
00023 import logging as log
00024
00025 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00026 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00027
00028 from support.SimpleGasuExample   import *
00029 from support.MiniGLTExample      import *
00030
00031
00032 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00033 #  the userApplication example to get the number of self triggers to take.
00034 class userArgument(ArgumentImpl):
00035   "GUI for getting the user to input some sort of value."
00036   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00037     ArgumentImpl.__init__(self, parent, name, modal, fl)
00038     self.__value = 0
00039
00040   def OKButtonClicked(self):
00041     self.__value = int(self.ArgumentList.text().latin1())
00042     self.close()
00043
00044   def CancelButtonClicked(self):
00045     self.__value = None
00046     self.close()
00047
00048   def getValue(self, caption):
00049     #self.setCaption(caption)
00050     self.ArgLabel.setText(qApp.translate("Argument", caption, None))
00051     self.show()
00052     self.exec_loop()
00053     return self.__value
00054
00055   def getValueExc(self, caption):
00056     raise Exception, "Exception taken during a GUI operation"
00057
00058 class userArgText(object):
00059   "Text user interface for getting the user to input some sort of value"
00060   def __init__(self):
00061     pass
00062
00063   def getValue(self, caption):
00064     return int(raw_input("%s: " % (caption)))
00065
00066
00067 #  Null application implementation.
00068 class userApplication(rcTransitions):
00069   "Implmentation class for Null application"
00070   def __init__(self, rc, userId, debug):
00071     rcTransitions.__init__(self, rc, userId, debug)
00072     self.__eventSem    = threading.Semaphore(0)
00073     self.__cmdSynchSem = threading.Semaphore(0)
00074
00075   def getName(self):
00076     return __name__
00077
00078   def setup(self):
00079     log.debug("userApplication.setup()")
00080
00081     if self.rc is None:
00082       self.__arg = userArgText()
00083     else:
00084       self.__arg = self.rc.createGUI(userArgument, self.rc, self.getName(), 1)
00085
00086     caption = "Select when to take an exception:\n  0 = GUI\n  1 = Setup\n  2 = StartRun\n  3 = StopRun\n  4 = Stop\n  5 = Teardown\n  6 = Pause\n  7 = Resume\n  8 = CmdSynch\n  9 = Process"
00087     if self.rc is None:
00088       self.__state = self.__arg.getValue(caption)
00089     else:
00090       self.__state = self.rc.execGUImethod(self.__arg.getValue, caption)
00091
00092     if self.__state == 0:
00093       crud = self.rc.execGUImethod(self.__arg.getValueExc, "Exception test")
00094       return False                      # To reject the transition
00095
00096     if self.__state == 1:
00097       raise Exception, "Exception taken during SETUP transition"
00098
00099     # Two choices for the trigger, GEM and MiniGLT
00100     if self.lat.existsGEM():
00101       self.trigger( SimpleGasuExample() )
00102     else:
00103       self.trigger( MiniGLTExample() )
00104
00105     # A state transition can be rejected by not returning None
00106     return None
00107
00108   def startRun(self):
00109     log.debug("userApplication.startRun()")
00110
00111     if self.__state == 2:
00112       raise Exception, "Exception taken during STARTRUN transition"
00113
00114     self.__cmdSynchQuit = False
00115
00116     # A state transition can be rejected by not returning None
00117     return None
00118
00119   def stopRun(self):
00120     log.debug("userApplication.stopRun()")
00121
00122     self.__cmdSynchQuit = True
00123     self.__eventSem.release()
00124
00125     # Set the test completion status value
00126     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00127
00128     if self.__state == 3:
00129       raise Exception, "Exception taken during STOPRUN transition"
00130
00131     # The STOP_RUN transition can not be rejected
00132
00133   def stop(self):
00134     log.debug("userApplication.stop()")
00135
00136     if self.__state == 4:
00137       raise Exception, "Exception taken during STOP transition"
00138
00139     return self.stopRun()
00140
00141   def teardown(self):
00142     log.debug("userApplication.teardown()")
00143
00144     if self.__state == 5:
00145       raise Exception, "Exception taken during TEARDOWN transition"
00146
00147   def pause(self):
00148     log.debug("userApplication.pause()")
00149
00150     if self.__state == 6:
00151       raise Exception, "Exception taken during PAUSE transition"
00152
00153   def resume(self):
00154     log.debug("userApplication.resume()")
00155
00156     if self.__state == 7:
00157       raise Exception, "Exception taken during RESUME transition"
00158
00159     # Issue self trigger to make up for the one that was lost during PAUSE
00160     self.trigger().solicit()
00161
00162   def process(self, (status, buffer)):
00163     "Method called back for each data event taken"
00164
00165     if self.__state == 8:  log.debug("userApplication.process()")
00166
00167     if self.__state == 9:
00168       raise Exception, "Exception taken during process()"
00169
00170     # Get next event triggered
00171     self.__eventSem.release()
00172
00173   def commandSynch(self):
00174     log.debug("userApplication.commandSynch()")
00175
00176     trigger  = self.trigger()
00177     eventSem = self.__eventSem
00178
00179     # Drain the semaphore release count
00180     # Handles the case when the stop run release collided with a trigger release
00181     while eventSem.acquire(0):  pass
00182
00183     # Wait for START_RUN to enable triggers
00184     trigger.waitForMaskEnable()
00185
00186     cnt = 0
00187     while not self.__cmdSynchQuit:
00188       if cnt == 5 and self.__state == 8:
00189         raise Exception, "Exception taken during commandSynch()"
00190       trigger.solicit()                 # Issue an internal trigger
00191       eventSem.acquire()                # Wait for the event to be processed
00192       cnt += 1
00193
00194     # Indicate we're done
00195     self.sync()
00196
00197   def wait(self):
00198     self.__cmdSynchSem.acquire()
00199
00200   def sync(self):
00201     if __name__ == "__main__" or self.isRunFromSuite():
00202       self.__cmdSynchSem.release()
00203
00204
00205 # Standalone mode:
00206 if __name__ == "__main__":
00207   import os
00208   import logging as log
00209   log.basicConfig()
00210   log.getLogger("").setLevel(log.DEBUG)
00211   ua = userApplication(None, 321, 0)
00212   prefs = {'datasave': 1, 'datadir':os.path.join(os.environ['ONLINE_ROOT'],'temp')}
00213   ua.setPrefs(prefs)
00214   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00215   ua.rcStartRun()
00216   ua.wait()
00217   ua.rcStopRun()
00218   ua.rcTeardown()
00219
00220 # History:
00221 #     $Log: excApp.py,v $
00222 #     Revision 1.1  2004/08/23 21:04:24  claus
00223 #     Test exception handling.
00224 #
00225 #
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FEpowerUp.py Source File

runcontrol

FEpowerUp.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Front End power up / power down routines"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/21 23:56:36 $").split(' ')[1]
00014 __version__  = "$Revision: 2.12.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 from time import sleep
00020 import           sys
00021 import           logging as log
00022
00023 from LATTE.client.gException import LATInterfaceException
00024
00025 class FEpowerUp(object):
00026   def __init__(self, acdPowerUp=None, temPowerUp=None):
00027     self.acdPowerUp = acdPowerUp
00028     self.temPowerUp = temPowerUp
00029     self.__nominal  = 0x800
00030
00031   def initialize(self, lat, xbrd):
00032     self.lat        = lat
00033     self.xbrd       = xbrd
00034
00035   def setAcdPowerUp(self, acdPowerUp):
00036     self.acdPowerUp = acdPowerUp
00037
00038   def setTemPowerUp(self, temPowerUp):
00039     self.temPowerUp = temPowerUp
00040
00041   def up(self):
00042     # Power up TEM(s)
00043     activeTEMs = self.getActiveTEMs(self.lat)
00044     #for (temId, tem) in activeTEMs.items():
00045     #  if self.temPowerUp is None or temId in self.temPowerUp:
00046     #    # turn off front ends
00047     #    tic = tem.TIC
00048     #    if self.temPowerUp is None:
00049     #      tic.POWER_SUPPLY = 0x0
00050     #    else:
00051     #      powerSupply = tic.POWER_SUPPLY
00052     #      if powerSupply & self.temPowerUp[temId] != 0:
00053     #        powerSupply &= ~self.temPowerUp[temId]
00054     #        tic.POWER_SUPPLY = powerSupply
00055
00056     xbrd = self.xbrd
00057     if xbrd is not None:
00058       # set all margin DACs to "middle" values
00059       # ggDACload() take the following values:
00060       #   0x000 - maximum voltage
00061       #   0x800 - nominal
00062       #   0xFFF - minimum voltage
00063
00064       # Adjust TKR Analog 2.5v
00065       margin = 0x800
00066       if margin != self.__nominal:
00067         log.warn("dac_tkr_analog_2_5 is being set to 0x%03x" % margin)
00068       xbrd.dac_tkr_analog_2_5 = margin
00069
00070       # Adjust TKR Digital 2.5v
00071       margin = 0x800
00072       if margin != self.__nominal:
00073         log.warn("dac_tkr_digital_2_5 is being set to 0x%03x" % margin)
00074       xbrd.dac_tkr_digital_2_5 = margin
00075
00076       # Adjust TKR Analog 1.5v _and_ CAL Analog 3.3v
00077       margin = 0x800
00078       if margin != self.__nominal:
00079         log.warn("dac_tkr_cal_analog is being set to 0x%03x" % margin)
00080       xbrd.dac_tkr_cal_analog = margin
00081
00082       # Adjust CAL Digital 3.3v
00083       margin = 0x800
00084       if margin != self.__nominal:
00085         log.warn("dac_cal_digital_3_3 is being set to 0x%03x" % margin)
00086       xbrd.dac_cal_digital_3_3 = margin
00087
00088       # Adjust TEM Digital 3.3v
00089       margin = 0x800
00090       if margin != self.__nominal:
00091         log.warn("dac_tem_voltage is being set to 0x%03x" % margin)
00092       xbrd.dac_tem_voltage = margin
00093
00094       ##
00095       ##  HIGH VOLTAGES for TKR and CAL
00096       ##  Disable by default
00097       ##
00098       ##  Note:  These take different values then ggDACload()
00099       ##
00100       ##    0x4000 - 0 V
00101       ##    0x5000 - plus half scale
00102       ##    0x5FFE - plus full scale
00103       ##
00104
00105       # Adjust TKR High Voltage
00106       #tic.tkr_biasdac = 0x4000
00107
00108       # Adjust CAL High Voltage
00109       #tic.cal_biasdac = 0x5000
00110
00111     for (temId, tem) in activeTEMs.items():
00112       # turn on TKR and/or CAL front ends
00113       if self.temPowerUp is None or temId in self.temPowerUp:
00114         tic = tem.TIC
00115         if self.temPowerUp is None:
00116           tic.POWER_SUPPLY = 0x3
00117         elif tic.POWER_SUPPLY != self.temPowerUp[temId]:
00118           tic.POWER_SUPPLY |= self.temPowerUp[temId]
00119         # We don't want to reset the TEM since it causes events
00120         # to be triggered
00121         #tem.CMD_RESET = 1
00122
00123     # Power up AEM
00124     aem = self.lat.AEM
00125     if not self.isAEMactive(aem):
00126       aem = None
00127     else:
00128       for (arcId, arc) in aem.ARC.items():
00129         if self.acdPowerUp is None or arcId in self.acdPowerUp:
00130           aem.power_down = arcId
00131           aem.power_up = arcId
00132           sleep(1.5)  # Gotta wait 1.5 seconds before *any* read can work.
00133           arc.look_at_me = 0xeb90
00134     return self.checkPower(aem, activeTEMs)
00135
00136   def down(self):
00137     # Power down TEM
00138     activeTEMs = self.getActiveTEMs(self.lat)
00139     for (temId, tem) in activeTEMs.items():
00140       if self.temPowerUp is None or temId in self.temPowerUp:
00141         # turn off CAL and/or TKR front ends
00142         tic = tem.TIC
00143         if self.temPowerUp is None:
00144           tic.POWER_SUPPLY = 0x0
00145         else:
00146           tic.POWER_SUPPLY &= ~self.temPowerUp[temId]
00147
00148     xbrd = self.xbrd
00149
00150     if xbrd is not None:
00151       # set all margin DACs to "middle" values (as per Leonid's request)
00152
00153       # Adjust TKR Analog 2.5v
00154       xbrd.dac_tkr_analog_2_5 = self.__nominal
00155
00156       # Adjust TKR Digital 2.5v
00157       xbrd.dac_tkr_digital_2_5 = self.__nominal
00158
00159       # Adjust TKR Analog 1.5v _and_ CAL Analog 3.3v
00160       xbrd.dac_tkr_cal_analog = self.__nominal
00161
00162       # Adjust CAL Digital 3.3v
00163       xbrd.dac_cal_digital_3_3 = self.__nominal
00164
00165       # Adjust TEM Digital 3.3v
00166       xbrd.dac_tem_voltage = self.__nominal
00167
00168     # Power down AEM
00169     aem = self.lat.AEM
00170     if not self.isAEMactive(aem):
00171       aem = None
00172     else:
00173       for arcId in aem.ARC:
00174         if self.acdPowerUp is None or arcId in self.acdPowerUp:
00175           try:
00176             arc = aem.ARC[arcId]
00177             for mode in (0xF8F, 0xFF1): # Enable HVBS 1 and then HVBS 2
00178               arc.mode &= mode
00179               hvbs = arc.hvbs
00180               while hvbs > 0:
00181                 hvbs -= 200 # Ramp-down in 200 DAC step decrements
00182                 if hvbs >= 0:
00183                   arc.hvbs = hvbs
00184                 else:
00185                   arc.hvbs = 0
00186                 arc.cmd_set_hvbs = 1
00187                 sleep(1)
00188           except LATInterfaceException:
00189             if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
00190                 and self.lat.getDeclarations()['options']['ignorehardwaretimeouts']:
00191               pass
00192             else:
00193               raise LATInterfaceException(sys.exc_info()[1].status)
00194           aem.power_down = arcId
00195     return self.checkPower(aem, activeTEMs)
00196
00197   def getActiveTEMs(self, lat):
00198     activeTEMs = {}
00199     if lat.TEMcnt() > 0:
00200       for (temId, tem) in lat.TEM.items():
00201         try:
00202           tem.configuration # Check to see if this TEM really exists
00203           activeTEMs[temId] = tem
00204         except LATInterfaceException:
00205           if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
00206               and lat.getDeclarations()['options']['ignorehardwaretimeouts']:
00207             continue
00208           else:
00209             raise LATInterfaceException(sys.exc_info()[1].status)
00210     return activeTEMs
00211
00212   def isAEMactive(self, aem):
00213     if aem is None:
00214       return False
00215     else:
00216       try:
00217         aem.configuration # Check to see if the AEM really exists
00218       except LATInterfaceException:
00219         if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
00220             and aem.up().getDeclarations()['options']['ignorehardwaretimeouts']:
00221           return False
00222         else:
00223           raise LATInterfaceException(sys.exc_info()[1].status)
00224     return True
00225
00226   def refreshPowerStatus(self):
00227     activeTEMs = self.getActiveTEMs(self.lat)
00228     aem = self.lat.AEM
00229     if not self.isAEMactive(aem):
00230       aem = None
00231     return self.checkPower(aem, activeTEMs)
00232
00233   def checkPower(self, aem, activeTEMs):
00234     aemPowerCheck = []
00235     calPowerCheck = []
00236     tkrPowerCheck = []
00237
00238     # Prepare feedback as to which CAL & TKR front ends were really turned on
00239     for (temId, tem) in activeTEMs.items():
00240       tic = tem.TIC
00241       powerSupply = tic.POWER_SUPPLY
00242       if powerSupply & 1:
00243         tkrPowerCheck.append(temId)
00244       if powerSupply & 2:
00245         calPowerCheck.append(temId)
00246
00247     if aem is not None:
00248       # Prepare feedback as to which free-boards were really turned on
00249       powerStatus = aem.power_status
00250       for i in range(12):
00251         if powerStatus & (1 << i):
00252           aemPowerCheck.append(i)
00253     return (aemPowerCheck, calPowerCheck, tkrPowerCheck)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: fits2ldf.py Source File

runcontrol

fits2ldf.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "FITS to Archive converter"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/24 23:15:11 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import sys
00020 import getopt
00021
00022 def __usage():
00023   print "\n%s Usage:" % (sys.argv[0])
00024   print "\t-h or --help for Help"
00025   print "\t-f or --fits to specify the input FITS file"
00026   print "\t-a or --archive to specify to output archive file"
00027   print "\t-r or --runreport to specify an output run report filename (eg. rcReport.out)"
00028   print "\t-v or --verbose to specify progress messages during the conversion"
00029
00030
00031 if __name__ == '__main__':
00032   archiveFile=''
00033   fitsFile=''
00034   verbose=0
00035   try:
00036     opts, args = getopt.getopt(sys.argv[1:], "ha:f:vr:",
00037                                ["help", "archive=", "fits=", "verbose", "runreport="])
00038   except getopt.GetoptError:
00039     # print help information and exit:
00040     __usage()
00041     sys.exit(2)
00042   for o, a in opts:
00043     if o in ("-h", "--help"):
00044       __usage()
00045       sys.exit()
00046     if o in ("-a", "--archive"):
00047       archiveFile = a
00048     if o in ("-f", "--fits"):
00049       fitsFile = a
00050     if o in ("-v", "--verbose"):
00051       verbose = 1
00052     if o in ("-r", "--runreport"):
00053       runReportFile = a
00054
00055   if archiveFile == '':
00056     print "\nERROR: Missing archive file parameter"
00057     __usage()
00058     sys.exit(2)
00059
00060   if fitsFile == '':
00061     print "\nERROR: Missing FITS file parameter"
00062     __usage()
00063     sys.exit(2)
00064
00065   import rcArchiver
00066   arch = rcArchiver.rcArchiver(fileName=archiveFile, mode=rcArchiver.MODE_CREATE)
00067
00068   import rcReportGen
00069   reportGen = rcReportGen.rcReportGen(fileName=runReportFile)
00070   reportGen.initialize()
00071
00072   import rcFitsWriter
00073   fits = rcFitsWriter.rcFitsWriter(fileName=fitsFile, mode=rcFitsWriter.MODE_READONLY,
00074                                    format=rcFitsWriter.FORMAT_BYTE, reportGen=reportGen)
00075
00076   cnt=0
00077   while(1):
00078     dat = fits.read()
00079     if dat == None: break
00080     cnt+=1
00081     if verbose and (cnt % 100) == 0: print "Progress line:", cnt
00082     arch.write(dat)
00083   if verbose and (cnt % 100) != 0: print "Progress line:", cnt
00084
00085   arch.close()
00086   fits.close()
00087
00088   reportGen.writeReportXML()
00089
00090   if verbose: print "Conversion completed successfully!"
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FreeSpace.py Source File

tools

FreeSpace.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT free disk space utility functions"
00012 __author__   = "Jim Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "10/20/2003"
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020 import os
00021
00022 def FreeSpace(filePath=None):
00023   """ freespace(path) -> long
00024   Return the number of bytes available to the user on the file system
00025   pointed to by path."""
00026   try:
00027     os.statvfs          # doesn't fail if we're on unix
00028   except AttributeError:
00029     # Win32 implementation
00030     try:
00031       if filePath is None: filePath = 'C:/'  # Root level directory
00032       import win32file
00033       return win32file.GetDiskFreeSpaceEx(filePath)[0]
00034     except Exception, e:
00035       print 'FreeSpace() exception: ', e, ' path ', filePath
00036       return long(-1)
00037   else:
00038     # Unix implementation
00039     try:
00040       if filePath is None: filePath = '.'    # Current working directory
00041       import statvfs
00042       s = os.statvfs(filePath)
00043       return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
00044     except Exception, e:
00045       print 'FreeSpace() exception: ', e
00046       return long(-1)
00047
00048   # should never get here
00049   return long(-1)
00050
00051
00052
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: FSM.py Source File

runcontrol

FSM.py

00001 #!/usr/local/bin python
00002 # This was found at http://www.noah.org/python/FSM/ on November 12, 2002.
00003 # RiC slightly modified it 11/13/02.
00004 # __author__ below means responsible party, not author in the usual sense.
00005
00006 __facility__ = "Online"
00007 __abstract__ = "Finite State Machine class"
00008 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00009 __date__     = "11/12/2002"
00010 __version__  = "$Revision: 2.0 $"
00011 __credits__  = "SLAC"
00012
00013
00014
00015 '''This module implements a Finite State Machine (FSM).
00016 In addition to state this FSM also maintains a user defined "something".
00017 This "something" is effectively memory, so this FSM could be considered
00018 a Push-down Automata (PDA) since a PDA is a FSM + memory.
00019
00020 The following describes how the FSM works, but you will probably also need
00021 to see the example function to understand how the FSM is used in practice.
00022
00023 You define an FSM by building tables of transitions.
00024 For a given input symbol the process() method uses these tables
00025 to decide what action to call and what the next state will be.
00026 The FSM has a table of transitions that associate:
00027         (input_symbol, current_state) --> (action, next_state)
00028 where "action" is a function you define. The symbols and states
00029 can be any objects. You use the add_transition() and add_transition_list()
00030 methods to add to the transition table. The FSM also has a table
00031 of transitions that associate:
00032         (current_state) --> (action, next_state)
00033 You use the add_transition_any() method to add to this transition table.
00034 The FSM also has one default transition that is not associated
00035 with any specific input_symbol or state. You use the
00036 set_default_transition() method to set the default transition.
00037
00038 When an action function is called it is passed a reference to the FSM.
00039 The action function may then access attributes of the FSM such as
00040 input_symbol, current_state, or "something". The "something" attribute
00041 can be any object that you want to pass along to the action functions.
00042 It is not used by the FSM. For parsing you would typically pass a list
00043 to be used as a stack.
00044
00045 The processing sequence is as follows.
00046 The process() method is given an input_symbol to process.
00047 The FSM will search the table of transitions that associate:
00048         (input_symbol, current_state) --> (action, next_state)
00049 If the pair (input_symbol, current_state) is found then
00050 process() will call the associated action function and then set the
00051 current state to the next_state.
00052
00053 If the FSM cannot find a match for (input_symbol, current_state)
00054 it will then search the table of transitions that associate:
00055         (current_state) --> (action, next_state)
00056 If the current_state is found then the process() method will call
00057 the associated action function and then set the current state to
00058 the next_state. Notice that this table lacks an input_symbol.
00059 It lets you define transitions for a current_state and ANY input_symbol.
00060 Hence, it is called the "any" table. Remember, it is always checked
00061 after first searching the table for a specific (input_symbol, current_state).
00062
00063 For the case where the FSM did not match either of the previous two cases
00064 the FSM will try to use the default transition. If the default transition
00065 is defined then the process() method will call the associated action function
00066 and then set the current state to the next_state. This lets you define
00067 a default transition as a catch-all case. You can think of it as an
00068 exception handler. There can be only one default transition.
00069
00070 Finally, if none of the previous cases are defined for an input_symbol
00071 and current_state then the FSM will raise an exception.
00072 This may be desirable, but you can always prevent this just by
00073 defining a default transition.
00074
00075 Noah Spurrier 20020822
00076 '''
00077
00078 import exceptions
00079
00080
00081 class ExceptionFSM(exceptions.Exception):
00082     '''This is the FSM Exception class.'''
00083     def __init__(self, value):
00084         self.value = value
00085     def __str__(self):
00086         return `self.value`
00087
00088 class FSM(object):
00089     '''This is a Finite State Machine (FSM).
00090     '''
00091
00092     def __init__(self, initial_state, something):
00093         '''This creates the FSM.
00094         You set the initial state here. The "something" attribute is any
00095         object that you want to pass along to the action functions.
00096         It is not used by the FSM. For parsing you would typically pass
00097         a list to be used as a stack.
00098         '''
00099         # Map (input_symbol, current_state) --> (action, next_state).
00100         self.state_transitions = {}
00101         # Map (current_state) --> (action, next_state).
00102         self.state_transitions_any = {}
00103         self.default_transition = None
00104
00105         self.input_symbol = None
00106         self.initial_state = initial_state
00107         self.current_state = self.initial_state
00108         self.something = something
00109
00110     def reset (self):
00111         '''This sets the current_state to the initial_state and
00112         sets input_symbol to None.
00113         The initial state was set by the constructor __init__().
00114         '''
00115         self.current_state = self.initial_state
00116         self.input_symbol = None
00117
00118     def add_transition (self, input_symbol, state, action, next_state):
00119         '''This adds a transition that associates
00120                 (input_symbol, current_state) --> (action, next_state)
00121         The action may be set to None in which case the process() method
00122         will ignore the action and only set the next_state.
00123
00124         You can also set transitions for a list of symbols by using
00125         add_transition_list().
00126         '''
00127         self.state_transitions[(input_symbol, state)] = (action, next_state)
00128
00129     def add_transition_list (self, list_input_symbols, state, action, next_state):
00130         '''This adds the same transition for lots of different input symbols.
00131         You can pass a list or a string. Note that it is handy to use
00132         string.digits, string.whitespace, string.letters, etc. to add
00133         transitions that match character classes.
00134         '''
00135         for input_symbol in list_input_symbols:
00136             self.add_transition (input_symbol, state, action, next_state)
00137
00138     def add_transition_any (self, state, action, next_state):
00139         '''This adds a transition that associates
00140                 (current_state) --> (action, next_state)
00141         The process() method checks these associations if it cannot
00142         first find a match of an (input_symbol, current_state).
00143         '''
00144         self.state_transitions_any [state] = (action, next_state)
00145
00146     def set_default_transition (self, action, next_state):
00147         '''This sets the default transition.
00148         This defines an action and next_state if the FSM cannot find the
00149         input symbol and the current state in the transition list and
00150         if the FSM cannot find the current_state in the transition_any list.
00151         This is useful for catching errors and undefined states.
00152
00153         The default transition can be removed by setting the attribute
00154         default_transition to None.
00155         '''
00156         self.default_transition = (action, next_state)
00157
00158     def get_transition (self, input_symbol, state):
00159         '''This returns (action, next state) given an input_symbol and state.
00160         This leaves the FSM unchanged. This does not update the current state
00161         nor does it trigger the output action. Normally you do not call
00162         this method. It is called by process().
00163
00164         The sequence of steps to check for a defined transition goes from
00165         the most specific to the least specific.
00166         1. Check state_transitions[] that match (input_symbol, state)
00167         2. Check state_transitions_any[] that match (state)
00168            In other words, match a specific state and ANY input_symbol.
00169         3. Check if the default_transition is defined.
00170            This catches any input_symbol and any state.
00171            This is a handler for errors, undefined states, or defaults.
00172         4. No transition was defined. If we get here then raise an exception.
00173         '''
00174         if self.state_transitions.has_key((input_symbol, self.current_state)):
00175             return self.state_transitions[(input_symbol, self.current_state)]
00176         elif self.state_transitions_any.has_key (self.current_state):
00177             return self.state_transitions_any[self.current_state]
00178         elif self.default_transition != None:
00179             return self.default_transition
00180         else:
00181             raise ExceptionFSM ('Transition is undefined: (%s, %s).' %
00182                 (str(input_symbol), str(self.current_state)) )
00183
00184     def process (self, input_symbol):
00185         '''This is the main method that you call to process input.
00186         This may cause the FSM to change state and call an action.
00187         This method calls get_transition() to find the action and next_state
00188         associated with the input_symbol and current_state.
00189         If the action is None then the action is not called and
00190         only the current state is changed.
00191         This method processes one input symbol. You can process a list of
00192         symbols (or a string) by calling process_list().
00193         This method returns an uninterpreted status value used to indicate
00194         whether the state transition completed successfully.
00195         '''
00196         self.input_symbol = input_symbol
00197         (action, next_state) = self.get_transition (self.input_symbol, self.current_state)
00198         if action != None:
00199             status = action ()
00200         if status is None and next_state is not None:
00201             self.current_state = next_state
00202         return status
00203
00204     def process_list (self, s):
00205         '''This takes a list and sends each element to process().
00206         The list may be a string.
00207         '''
00208         for c in s:
00209             self.process (c)
00210
00211 ##########################################################################
00212 # The following example demonstrates the use of the FSM class in
00213 # processing RPN expressions. Run this module from the command line.
00214 # You will get a prompt > for input.
00215 # Enter an RPN Expression.
00216 # Numbers may be integers. Operators are * / + -
00217 # Use the = sign to evaluate and print the expression.
00218 # For example:
00219 #    167 3 2 2 * * * 1 - =
00220 # will print:
00221 #    2003
00222 ##########################################################################
00223
00224 import string
00225
00226 #
00227 # These define the actions.
00228 # Note that "something" is a list being used as a stack.
00229 #
00230 def BeginBuildNumber (fsm):
00231     fsm.something.append (fsm.input_symbol)
00232 def BuildNumber (fsm):
00233     s = fsm.something.pop ()
00234     s = s + fsm.input_symbol
00235     fsm.something.append (s)
00236 def EndBuildNumber (fsm):
00237     s = fsm.something.pop ()
00238     fsm.something.append (int(s))
00239 def DoOperator (fsm):
00240     ar = fsm.something.pop()
00241     al = fsm.something.pop()
00242     if fsm.input_symbol == '+':
00243         fsm.something.append (al + ar)
00244     elif fsm.input_symbol == '-':
00245         fsm.something.append (al - ar)
00246     elif fsm.input_symbol == '*':
00247         fsm.something.append (al * ar)
00248     elif fsm.input_symbol == '/':
00249         fsm.something.append (al / ar)
00250 def DoEqual (fsm):
00251     print str(fsm.something.pop())
00252 def Error (fsm):
00253     print 'That does not compute.'
00254     print str(fsm.input_symbol)
00255
00256 #
00257 # This is where the example starts and the FSM state transitions are defined.
00258 # Note that states (such as 'INIT') are strings. This is not necessary, but
00259 # it makes the example easier to read.
00260 #
00261 def example ():
00262     f = FSM ('INIT', []) # "something" will be used as a stack.
00263     f.set_default_transition (Error, 'INIT')
00264     f.add_transition_any  ('INIT', None, 'INIT')
00265     f.add_transition      ('=',               'INIT',            DoEqual,          'INIT')
00266     f.add_transition_list (string.digits,     'INIT',            BeginBuildNumber, 'BUILDING_NUMBER')
00267     f.add_transition_list (string.digits,     'BUILDING_NUMBER', BuildNumber,      'BUILDING_NUMBER')
00268     f.add_transition_list (string.whitespace, 'BUILDING_NUMBER', EndBuildNumber,   'INIT')
00269     f.add_transition_list ('+-*/',            'INIT',            DoOperator,       'INIT')
00270
00271     print
00272     print 'Enter an RPN Expression.'
00273     print 'Numbers may be integers. Operators are * / + -'
00274     print 'Use the = sign to evaluate and print the expression.'
00275     print 'For example: '
00276     print '    167 3 2 2 * * * 1 - ='
00277     inputs = raw_input ('>')
00278     for s in inputs:
00279         f.process (s)
00280
00281 if __name__ == '__main__':
00282     example ()
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Class Members - Functions

All | Functions
_ | a | b | c | d | e | f | g | h | i | l | m | n | o | p | r | s | t | u | v | w | z

- _ -

  • __call__() : BoundMethodWeakref
  • __cmp__() : BoundMethodWeakref
  • __init__() : DefaultPeriodicCondition, TrgUsingTiles, TrgTriggerCounters, TrgTracker, TrgCalorimeter, TrgTower, TrgTowers, TrgDefaultSequence, TrgSequence, TrgSequenceDefinition, TrgSequenceAbstract, AddableRoi, TrgRoiAsTiles, TrgDefaultPeriodicCondition, TrgPeriodicConditionDefinition, TrgPeriodicCondition, TrgPeriodicConditionAbstract, TrgMiniGLTRegisters, TrgMiniGLTAbstract, MiniGLTTrgConditionsValue, TrgMiniGLT, TrgTileEnables, TrgCnoEnables, TrgTowerEnables, TrgInputEnables, TrgGemSequence, TrgGemRegisters, TrgGemPeriodicCondition, TrgGemEventCounter, TrgGemCmdStats, TrgGemCmdCounters, TrgGemTileStats, TrgGemTileCounters, TrgGemTriggerStats, TrgGemTriggerCounters, TrgGemAbstract, TrgGem, TrgEventCounter, TrgInjectMarker, TrgInjectChargeReadout, TrgReadout, TrgInjectCharge, TrgEngineRequest, TrgEngine, TrgEngines, TrgConditionsValue, TrgConditions, TrgCoincidence, TrgCoincidences, TrgRoi, TrgRois, TrgCmdStats, TrgCmdCounters, TrgAbstract, rcTrgMiniGLT, rcTrgGem, rcTrgCoincidence, rcTrgTileEnables, SweepMarkerEngine, rcTrgEngines, rcMiniGLTSolicitedCondition, rcMiniGLTSolicitedEngine, rcSolicitedCondition, rcSolicitedEngine, rcGEMTrgEngines, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, NullRequest, NullEngine, NullCoincidence, NullRoi, NoInputsEnabled, NoCnoEnabled, NoTilesEnabled, NullTkr, NullCal, NullTower, GUIbridge, DataDistributorPoll, DataDistributorClient, DataDistributorServer, AcdHWMultiplexer, ZsupTrgInjectChargeReadout, MiniGLTExample, SimpleGasuExample, MarkerTrgReadout, MiniGLTExample, ZsupTrgReadout, SimpleGasuExample, ZsupTrgReadout, MiniGLTExample, GDBN, FSM, RegisterInterface, drawYZ_CAL, drawXZ_CAL, drawYZ_TKR, drawXZ_TKR, drawHatACD, drawSide4ACD, drawSide3ACD, drawSide2ACD, drawSide1ACD, singleEvtDisplayImpl, myLATcomponentIterator, TKRcontributionIterator, CALcontributionIterator2, BoundMethodWeakref, GTWR, GXBRD, GTIC, GTFE, GTRC, GTCC, GCFE, GCRC, GCCC, GTEM, GruleAlarms, GruleLimit, Grule, GPEQ, GPDU, GNAT, GMem, GLCB, GLAT, HNUL, HCPU, HCOM, HPDU, HEBM, HGEM, HARC, HAEM, HTEM, GHSK, GattrHsk, GGLT, GGEMW, GGEMIE, GGEMVG, GGEMSC, GGEMST, GGEMMG, GGEMC, GGEM, GEGU_poly3, GEGU_linear, GEBMST, GEBMC, GEBM, Gdb, GCRU, Gconstraint, GattrBF, GattrReg, GattrRaw, Gattr, GAFE, GARC, GAEQ, GAEM, standardTestReport, consumerPlotter, Consumer, EvtCli, evErr_GCCC_Message, evCAL_LayerLogData, evTKR_StripData, evTKR_TOTdata, Evt
  • __new__() : BoundMethodWeakref
  • __nonzero__() : BoundMethodWeakref
  • __setattr__() : TrgObject
  • __str__() : BoundMethodWeakref
  • _eval_() : GruleAlarms, GruleLimit, Grule, GconstraintLimitPegRE, GconstraintLimit, GconstraintLimitRE, Gconstraint

- a -

  • A() : TrgTileStats, TrgGemTileStats
  • abort() : TrgPeriodicCondition, TrgGemPeriodicCondition, AcdHWMultiplexer, EvtCliIO
  • ACDcomponent() : myLATcomponentIterator
  • add_transition() : FSM
  • add_transition_any() : FSM
  • add_transition_list() : FSM
  • addCAL_LogAccept() : Evt
  • addCAL_LogData() : Evt
  • addChannel() : GNAT
  • addCompletionStatus() : rcCompletionStatus
  • addCustomReportData() : rcTransitions
  • addErrGCCCmsg() : Evt
  • addErrGTCCmsg() : Evt
  • addExportedFile() : rcTransitions
  • addHeading() : rcTestReport
  • addHTML() : rcTestReport
  • addPair() : rcTrgCoincidence
  • addPassword() : rcSecurityMan
  • addPermission() : rcUser
  • addPHA() : AEM
  • addr() : Gdb
  • addRole() : rcUser
  • addSection() : rcTestReport
  • addSectionImage() : rcTestReport
  • addSectionItem() : rcTestReport
  • addSectionTable() : rcTestReport
  • addTableData() : rcTestReport
  • addTableHeader() : rcTestReport
  • addTKRaccept() : Evt
  • addTKRstrip() : Evt
  • addTKRtot() : Evt
  • addUser() : rcUsers
  • adjustExcludeTime() : rcTransitions
  • allAFE() : GARC
  • allARC() : GAEM
  • allCCC() : GTEM
  • allCFE() : GCRC
  • allCRC() : GCCC
  • allTCC() : GTEM
  • allTFE() : GTRC
  • allTRC() : GTCC
  • applyConfig() : rcTransitions
  • archiveClose() : Consumer
  • archiveOpen() : Consumer
  • assignA() : TrgTileCounters, TrgGemTileCounters
  • assignAB() : TrgTileCounters, TrgGemTileCounters
  • assignB() : TrgTileCounters, TrgGemTileCounters
  • authenticateUser() : rcSecurityMan

- b -

  • B() : TrgTileStats, TrgGemTileStats
  • beginTableRow() : rcTestReport

- c -

  • CALcomponent() : myLATcomponentIterator
  • calculateKey() : BoundMethodWeakref
  • calHigh() : TrgConditionsValue, TrgConditions
  • calLow() : TrgConditionsValue, TrgConditions
  • calorimeter() : TrgTower, NullTower
  • calStrobe() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • category() : Grule, Gconstraint
  • CCCcnt() : GTEM
  • changePassword() : rcSecurityMan
  • checkGGLTstatus() : EvtCli
  • checkOnlineStatus() : EvtCli
  • checkPassword() : rcSecurityMan
  • checkPermission() : rcSecurityMan
  • clearAllActions() : Grule
  • clearBuffer() : GNAT
  • clearButtonGroups() : singleEvtDisplayImpl
  • clearEvent() : Evt, AEM
  • clearViews() : singleEvtDisplayImpl
  • close() : EvtCliIO
  • closeTestReport() : standardTestReport
  • cmdCounters() : TrgGemAbstract, TrgGem
  • cno() : TrgInputEnables, TrgConditionsValue, TrgConditions, NoInputsEnabled
  • cnoEnableRegister() : TrgGemRegisters
  • coincidence() : TrgRoiAsTiles, TrgCoincidences
  • coincidences() : TrgUsingTiles, rcGEMDefaultTrigger, SimpleGasuExample
  • command() : TrgGemCmdStats, TrgCmdStats
  • commandSynch() : userApplication
  • commit() : rcTrgMiniGLT, rcTrgGem
  • conditions() : TrgAbstract, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, MiniGLTExample
  • configurationRegister() : TrgGemRegisters
  • connect() : DataDistributorClient, DataDistributorServer, HskHandler, HskCli
  • createGUI() : GUIbridge, RunControlMain, RunControl
  • customEvent() : RunControlMain

- d -

  • dataSize() : Consumer
  • definition() : DefaultPeriodicCondition, TrgSequence, TrgPeriodicCondition
  • deleteUser() : rcUsers, rcSecurityMan
  • destination() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgEngineRequest
  • diagnostic() : myLATcomponentIterator
  • disable() : TrgMiniGLT, TrgGem, TrgAbstract, rcTrgMiniGLT, rcTrgGem, Grule, Gconstraint
  • disableMask() : GGLT
  • discarded() : TrgTriggerStats, TrgGemTriggerStats
  • disconnect() : DataDistributorClient, DataDistributorServer, HskCli
  • disconnected() : HskHandler
  • doEmit() : RunControlMain, RunControl
  • doPause() : RunControlMain, RunControl
  • doReset() : RunControlMain, RunControl
  • doRun() : RunControlMain, RunControl
  • doStop() : RunControlMain, RunControl
  • doStopRun() : RunControlMain, RunControl
  • downAEM() : GLAT
  • downAEQ() : GAEM
  • downAFE() : GARC
  • downARC() : GAEM
  • downCCC() : GTEM
  • downCFE() : GCRC
  • downCRC() : GCCC
  • downCRU() : GLAT
  • downEBM() : GLAT
  • downEBMC() : GEBM
  • downEBMST() : GEBM
  • downGEM() : GLAT
  • downGEMC() : GGEM
  • downGEMIE() : GGEM
  • downGEMMG() : GGEM
  • downGEMSC() : GGEM
  • downGEMST() : GGEM
  • downGEMVG() : GGEM
  • downGEMW() : GGEM
  • downGLT() : GXBRD
  • downHAEM() : GHSK
  • downHARC() : HAEM
  • downHCOM() : GHSK
  • downHCPU() : GHSK
  • downHEBM() : GHSK
  • downHGEM() : GHSK
  • downHNUL() : GHSK
  • downHPDU() : GHSK
  • downHTEM() : GHSK
  • downLCB() : GLAT
  • downPDU() : GLAT
  • downPEQ() : GPDU
  • downTCC() : GTEM
  • downTEM() : GLAT
  • downTFE() : GTRC
  • downTIC() : GTEM
  • downTRC() : GTCC
  • downTWR() : GXBRD
  • dumpContributionData() : EvtCli
  • dwell() : AcdHWMultiplexer

- e -

  • egu() : GEGU_poly3, GEGU_linear, GEGU
  • enable() : TrgAbstract, rcTrgMiniGLT, rcTrgGem, Grule, Gconstraint
  • enabled() : Grule, Gconstraint
  • enableMask() : GGLT
  • endExcludeTime() : rcTransitions
  • engine() : TrgEngines, rcTrgEngines
  • engines() : TrgAbstract, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger, MiniGLTExample, SimpleGasuExample, MiniGLTExample, SimpleGasuExample, MiniGLTExample
  • error() : myLATcomponentIterator
  • evaluate() : Grule, Gconstraint
  • evBitCount() : EvtCli
  • evDumpAEM_Accepts() : EvtCli
  • evDumpAEM_PHA() : EvtCli
  • evDumpAEM_Vetos() : EvtCli
  • evDumpCAL_LogAccepts() : EvtCli
  • evDumpCAL_Logs() : EvtCli
  • evDumpDiagnostic() : EvtCli
  • evDumpEventAEM() : EvtCli
  • evDumpEventAEM_G2() : EvtCli
  • evDumpGEM() : EvtCli
  • evDumpGEM_Veto_List() : EvtCli
  • evDumpSummary() : EvtCli
  • evDumpTEM_Error() : EvtCli
  • evDumpTKR() : EvtCli
  • eventCounter() : TrgGemAbstract, TrgGem
  • eventDataParityEven() : TrgGemRegisters, TrgGemAbstract
  • eventHeaderParityEven() : TrgGemRegisters, TrgGemAbstract
  • eventNumber() : TrgDefaultSequence, TrgSequenceAbstract, TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgGemSequence
  • eventTag() : TrgDefaultSequence, TrgSequenceAbstract, TrgGemSequence
  • evGetAEM_PHA() : EvtCli
  • evGetAEM_Vec() : EvtCli
  • evGetCAL_LogAccepts() : EvtCli
  • evGetCAL_Logs() : EvtCli
  • evGetCAL_NumAccepts() : EvtCli
  • evGetSummary() : EvtCli
  • evGetTEM_Diagnostic() : EvtCli
  • evGetTEM_Error() : EvtCli
  • evGetTimebase() : EvtCli
  • evGetTimestamp() : EvtCli
  • evGetTKR_Accepts() : EvtCli
  • evGetTKR_NumAccepts() : EvtCli
  • evGetTKR_NumStrips() : EvtCli
  • evGetTKR_StripN() : EvtCli
  • evGetTKR_TOT() : EvtCli
  • evtHandlerPrescaleExternal() : GOCS
  • evtHandlerSendAcdScalers() : GOCS
  • evtHandlerSendAll() : GOCS
  • evtHandlerSendErrorsOnly() : GOCS
  • evtHandlerSendNothing() : GOCS
  • evtHandlerSendPrescaled() : GOCS
  • evtHandlerSetVerbosity() : GOCS
  • execGUImethod() : GUIbridge, RunControlMain, RunControl
  • execGUImethodNR() : GUIbridge, RunControlMain, RunControl
  • existsAEM() : GLAT
  • existsAEQ() : GAEM
  • existsAFE() : GARC
  • existsARC() : GAEM
  • existsCCC() : GTEM
  • existsCFE() : GCRC
  • existsCRC() : GCCC
  • existsCRU() : GLAT
  • existsEBM() : GLAT
  • existsEBMC() : GEBM
  • existsEBMST() : GEBM
  • existsGEM() : GLAT
  • existsGEMC() : GGEM
  • existsGEMIE() : GGEM
  • existsGEMMG() : GGEM
  • existsGEMSC() : GGEM
  • existsGEMST() : GGEM
  • existsGEMVG() : GGEM
  • existsGEMW() : GGEM
  • existsGLT() : GXBRD
  • existsHAEM() : GHSK
  • existsHARC() : HAEM
  • existsHCOM() : GHSK
  • existsHCPU() : GHSK
  • existsHEBM() : GHSK
  • existsHGEM() : GHSK
  • existsHPDU() : GHSK
  • existsHTEM() : GHSK
  • existsLCB() : GLAT
  • existsPDU() : GLAT
  • existsPEQ() : GPDU
  • existsTCC() : GTEM
  • existsTEM() : GLAT
  • existsTFE() : GTRC
  • existsTIC() : GTEM
  • existsTRC() : GTCC
  • existsTWR() : GXBRD
  • export() : DataExport
  • exportDir() : DataExport
  • exportFile() : DataExport
  • external() : MiniGLTTrgConditionsValue, TrgConditionsValue, TrgConditions

- f -

  • fileClose() : singleEvtDisplayImpl, Consumer
  • fileExit() : singleEvtDisplayImpl
  • fileOpen() : singleEvtDisplayImpl, Consumer
  • flushPlaybackFIFO() : GNAT
  • flushRecordFIFO() : GNAT
  • fourRange() : TrgEngineRequest
  • fourRangeReadout() : TrgMiniGLTRegisters, TrgMiniGLTAbstract

- g -

  • GEM() : TrgGem
  • GEMcomponent() : myLATcomponentIterator
  • get() : GattrHsk, GattrBF, GattrReg, GattrRaw
  • get_transition() : FSM
  • getAcdPeds() : myLATcomponentIterator
  • getAddlInputFiles() : rcTransitions
  • getAllOpaque() : GLAT
  • getAllSerialNos() : GLAT
  • getArchiveFile() : rcTransitions
  • getArchiverInstance() : rcTransitions
  • getAvgDatagramSize() : rcTransitions
  • getAvgDeadTime() : rcTransitions
  • getBadEvents() : rcTransitions
  • getBadEventsFile() : rcTransitions
  • getByte() : EvtCli
  • getCalPeds() : myLATcomponentIterator
  • getCompletionStatus() : rcTransitions, rcCompletionStatus
  • getCompletionStatusStr() : rcTransitions, rcCompletionStatus
  • getConfigurations() : GXBRD, GLAT, GHSK
  • getConstraint() : _Attr, Gattr
  • getContributionList() : EvtCli
  • getContributionStatus() : EvtCli
  • getContributionStatusStr() : EvtCli
  • getCurrentContribution() : EvtCli
  • getDataDistributor() : rcTransitions
  • getDeadChannels() : GTRC
  • getDeclarations() : GXBRD, GLAT, GHSK
  • getDisableTime() : rcTrgMiniGLT, rcTrgGem, GGLT
  • getDiscardedEvents() : rcTransitions
  • getDWord() : EvtCli
  • getEGU() : _Attr, Gattr
  • getElapsedTime() : rcTransitions
  • getEnableTime() : rcTrgMiniGLT, rcTrgGem, GGLT
  • getEndTime() : rcTransitions
  • getErrorEvents() : rcTransitions
  • getErrorEventsFile() : rcTransitions
  • getEventCount() : rcTransitions
  • getEventRate() : rcTransitions
  • getEvtCli() : rcTransitions
  • getEvtSize() : EvtCli
  • getEvtStatus() : EvtCli
  • getFailedEvents() : rcTransitions
  • getFailedEventSends() : rcTransitions
  • getFileTimeStamp() : rcTransitions
  • getFITSfile() : rcTransitions
  • getGGLTStatus() : EvtCli
  • getGGLTStatusStr() : EvtCli
  • getHSK() : rcTransitions
  • getHSKfile() : rcTransitions
  • getId() : rcUser
  • getIdNameDict() : rcUsers
  • getIdTuple() : Gdb
  • getInstByteRate() : rcTransitions
  • getInstDatagramSize() : rcTransitions
  • getInstEventRate() : rcTransitions
  • getLengthMismatchedEvents() : rcTransitions
  • getLoginId() : RunControlCommon, rcUser
  • getName() : rcUser
  • getNextEvent() : Consumer
  • getNoisyChannels() : GTRC
  • getOnlineStatus() : EvtCli
  • getOnlineStatusStr() : EvtCli
  • getOpaque() : GHSK, Gdb
  • getParameterVerifier() : rcTransitions
  • getPauseCount() : rcTransitions
  • getPausedTime() : rcTransitions
  • getPermissionDescription() : rcSecurityMan
  • getPermissions() : rcUser, rcSecurityMan
  • getRawTimeStamp() : rcTransitions
  • getRoles() : rcUser, rcSecurityMan
  • getRule() : _Attr, Gattr
  • getRules() : GLAT, GHSK
  • getRunId() : rcTransitions
  • getSchemaConfigFile() : rcTransitions
  • getSerialNos() : Gdb
  • getSessionVar() : rcTransitions
  • getStartTime() : rcTransitions
  • getSuite() : rcTransitions
  • getSuiteInstance() : rcTransitions
  • getTimeout() : EvtCliIO
  • getTimeStamp() : rcTrgMiniGLT, rcTrgGem, _Attr
  • getUnsentEvents() : rcTransitions
  • getUser() : rcUsers
  • getUserByLoginId() : rcUsers
  • getUserByName() : rcUsers
  • getUserId() : EvtCli
  • getUsers() : rcUsers
  • getValidEvents() : rcTransitions
  • getVersion() : GOCS
  • getWord() : EvtCli
  • GLT() : TrgMiniGLT
  • GLTcomponent() : myLATcomponentIterator
  • gMEMbusToLocal() : GMem
  • gMEMload() : GMem
  • gMEMlocalToBus() : GMem
  • gMEMread() : GMem
  • goClicked() : singleEvtDisplayImpl
  • GOSEDPreferences() : singleEvtDisplayImpl

- h -

  • handle() : LogRecordStreamHandler
  • helpAbout() : singleEvtDisplayImpl
  • helpContents() : singleEvtDisplayImpl
  • helpOnline() : singleEvtDisplayImpl

- i -

  • id() : Gdb
  • inCoincidence() : TrgCoincidence, rcTrgCoincidence, NullCoincidence
  • inhibitContribution() : TrgGemRegisters, TrgGemAbstract
  • initApp() : RunControlMain
  • initHandle() : GNAT
  • initReport() : rcTestReport
  • inputEnables() : TrgAbstract, rcGEMDefaultTrigger, SimpleGasuExample
  • insertSection() : rcTestReport
  • isAdministrator() : rcUser
  • isCompletionStatus() : rcCompletionStatus
  • isErrorEvent() : EvtCli
  • isGGLTStatus() : EvtCli
  • isGUIthread() : GUIbridge, RunControlMain
  • isLastSuiteScript() : rcTransitions
  • isMaskDirty() : GGLT
  • isNoDirectAccess() : _Attr, Gattr
  • isReadOnly() : _Attr, Gattr
  • isReadWrite() : _Attr, Gattr
  • isRunFromSuite() : rcTransitions
  • isSweepEvent() : EvtCli
  • isTimeoutEnabled() : EvtCliIO
  • isWriteOnly() : _Attr, Gattr

- l -

  • LA1() : TrgCnoEnables
  • LA2() : TrgCnoEnables
  • LA3() : TrgCnoEnables
  • LA4() : TrgCnoEnables
  • LB2() : TrgCnoEnables
  • LB4() : TrgCnoEnables
  • limit() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition
  • livetime() : TrgTriggerStats, TrgGemTriggerStats
  • loadApp() : RunControlMain
  • loadFIFO() : GNAT
  • log() : CALcontributionIterator2
  • lookup() : DataDistributorAddress
  • lookupTableRegister() : TrgGemRegisters

- m -

  • marker() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgInjectMarker, TrgEngineRequest
  • maxConditions() : TrgGemAbstract, TrgAbstract
  • maxEngines() : TrgGemAbstract, TrgAbstract
  • md5sum() : DataExport

- n -

  • name() : TaskEngine, Grule, Gconstraint
  • nextClicked() : singleEvtDisplayImpl

- o -

  • open() : EvtCliIO
  • OSWcomponent() : myLATcomponentIterator

- p -

  • paintEvent() : drawYZ_CAL, drawXZ_CAL, drawYZ_TKR, drawXZ_TKR, drawHatACD, drawSide4ACD, drawSide3ACD, drawSide2ACD, drawSide1ACD
  • parity() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • parseEvent() : consumerPlotter, Consumer
  • participate() : TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • pause() : rcTransitions
  • periodic() : TrgConditionsValue, TrgConditions
  • periodicCondition() : TrgUsingTiles, TrgGemAbstract
  • periodicLimitRegister() : TrgGemRegisters
  • periodicModeRegister() : TrgGemRegisters
  • periodicRateRegister() : TrgGemRegisters
  • plot() : singleEvtDisplayImpl, TKRcontributionIterator, CALcontributionIterator2
  • port() : DataDistributorAddress
  • prescale() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition, TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • prescaled() : TrgTriggerStats, TrgGemTriggerStats
  • previousClicked() : singleEvtDisplayImpl
  • print_EOE_Warning() : EvtCli
  • process() : userApplication, rcTransitions, FSM
  • process_list() : FSM
  • publish() : DataDistributorServer

- r -

  • RA2() : TrgCnoEnables
  • RA4() : TrgCnoEnables
  • raw() : GEGU_poly3, GEGU_linear, GEGU
  • RB1() : TrgCnoEnables
  • RB2() : TrgCnoEnables
  • RB3() : TrgCnoEnables
  • RB4() : TrgCnoEnables
  • rcSetup() : rcTransitions
  • readConfig() : rcTransitions
  • readEvent() : EvtCli
  • readFile() : EvtCliIO
  • readPedestals() : myLATcomponentIterator
  • readPermissions() : rcSecurityMan
  • readSocket() : EvtCliIO
  • receive() : DataDistributorPoll, DataDistributorClient
  • redundantPPS() : TrgGemRegisters, TrgGemAbstract
  • refreshMask() : GGLT
  • registerAction() : Grule
  • registerPermission() : rcSecurityMan
  • reject() : Gconstraint
  • remaining() : TrgPeriodicCondition, TrgGemPeriodicCondition
  • replaceEngine() : rcTrgEngines
  • request() : TrgEngine, SweepMarkerEngine, rcMiniGLTSolicitedEngine, rcSolicitedEngine, NullEngine
  • reset() : TrgTriggerCounters, TrgTileCounters, TrgPeriodicCondition, TrgGemPeriodicCondition, TrgGemEventCounter, TrgGemCmdCounters, TrgGemTileCounters, TrgGemTriggerCounters, TrgEventCounter, TrgCmdCounters, FSM, Grule, Gconstraint
  • response() : TrgGemCmdStats, TrgCmdStats
  • responseDataParityEven() : TrgGemRegisters, TrgGemAbstract
  • responseHeaderParityEven() : TrgGemRegisters, TrgGemAbstract
  • resume() : AcdHWMultiplexer, rcTransitions
  • returnNone() : DataDistributorClient
  • roi() : TrgUsingTiles, TrgGemAbstract, TrgConditionsValue, TrgConditions, TrgRois
  • roiRegister() : TrgGemRegisters
  • roleHasPermission() : rcSecurityMan
  • root() : Gdb
  • run() : TaskEngine

- s -

  • satCtrDisable() : GTIC
  • satCtrEnable() : GTIC
  • satCtrLoopDisable() : GTIC
  • satCtrLoopEnable() : GTIC
  • satCtrSetLoopDelay() : GTIC
  • selectChange() : singleEvtDisplayImpl
  • sendAction() : Grule
  • sent() : TrgTriggerStats, TrgGemTriggerStats
  • sequence() : TrgUsingTiles, TrgInjectMarker, TrgInjectChargeReadout, TrgReadout, TrgInjectCharge, TrgEngineRequest, TrgAbstract, NullRequest
  • sequenceRegister() : TrgGemRegisters
  • serverClose() : singleEvtDisplayImpl, Consumer
  • serverOpen() : singleEvtDisplayImpl, Consumer
  • ServerPreferences() : singleEvtDisplayImpl
  • set() : GattrHsk, GattrBF, GattrDlc, GattrReg, GattrRaw
  • set_default_transition() : FSM
  • setActions() : Grule
  • setArchiverClass() : rcTransitions
  • setCmdCli() : rcTransitions
  • setCompletionStatus() : rcTransitions
  • setConstraint() : _Attr, Gattr
  • setCurrentContribution() : EvtCli
  • setDebug() : EvtCli
  • setDestinationOverride() : GGLT
  • setEGU() : _Attr, Gattr
  • setEnabledTabPage() : RunControlMain
  • setEvtCli() : rcTransitions
  • setEvtEnable() : GLCB
  • setLastSuiteScript() : rcTransitions
  • setLATpMode() : GNAT
  • setPrefs() : rcTransitions
  • setRule() : _Attr, Gattr
  • setSessionVar() : rcTransitions
  • setSuite() : rcTransitions
  • setSuiteInstance() : rcTransitions
  • setTimeout() : EvtCliIO
  • setTimeoutEnabled() : EvtCliIO
  • setup() : rcTransitions
  • shut() : TrgMiniGLT, TrgGem, TrgAbstract, rcTrgMiniGLT, rcTrgGem, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger
  • shutdown() : TaskEngine, GUIbridge, AcdHWMultiplexer
  • size() : _Attr, Gattr
  • solicit() : TrgMiniGLT, TrgGem, TrgAbstract
  • solicited() : TrgConditionsValue, TrgConditions, rcMiniGLTSolicitedCondition, rcSolicitedCondition
  • source() : TrgDefaultPeriodicCondition, TrgPeriodicConditionAbstract, TrgGemPeriodicCondition
  • spawn() : TaskEngine
  • start() : DataDistributorPoll, AcdHWMultiplexer
  • startExcludeTime() : rcTransitions
  • startPlayback() : GNAT
  • startRun() : rcTransitions
  • stats() : TrgTriggerCounters, TrgTileCounters, TrgGemEventCounter, TrgGemCmdCounters, TrgGemTileCounters, TrgGemTriggerCounters, TrgEventCounter, TrgCmdCounters, AcdHWMultiplexer
  • statusString() : standardTestReport
  • stop() : DataDistributorPoll, AcdHWMultiplexer, rcTransitions
  • stopClicked() : singleEvtDisplayImpl
  • stopRun() : rcTransitions
  • strip() : TKRcontributionIterator
  • subsystem() : Grule, Gconstraint
  • sweepOnShut() : rcTrgMiniGLT, rcTrgGem, rcMiniGLTDefaultTrigger, rcGEMDefaultTrigger
  • synch() : DataExport
  • synchronize() : GOCS

- t -

  • tack() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • tag() : TrgMiniGLTRegisters, TrgMiniGLTAbstract
  • takeSnapshot() : rcTransitions
  • TCCcnt() : GTEM
  • teardown() : rcTransitions
  • TEMcnt() : GLAT
  • templateRegister() : TrgGemRegisters
  • tile() : AddableRoi, TrgTileEnables, TrgRoi, rcTrgTileEnables, NullRoi, NoTilesEnabled
  • tileCounters() : TrgGemAbstract, TrgGem
  • tileEnableRegister() : TrgGemRegisters
  • tileList() : AcdHWMultiplexer
  • tiles() : TrgInputEnables
  • timedout() : HskHandler
  • tkr() : TrgConditionsValue, TrgConditions
  • TKRcomponent() : myLATcomponentIterator
  • tower() : TrgTowers
  • towerBusyEnableRegister() : TrgGemRegisters
  • towerEnableRegister() : TrgGemRegisters
  • towers() : TrgTowerEnables, TrgInputEnables, NoInputsEnabled
  • tracker() : TrgTower, NullTower
  • transformToFile() : rcTestReport
  • trigger() : rcTransitions
  • triggerCounters() : TrgGemAbstract, TrgGem
  • triggerParityEven() : TrgGemRegisters, TrgGemAbstract
  • triggersDisabled() : GGLT

- u -

  • units() : GEGU
  • unpack() : EvtCliIO
  • unregisterAction() : Grule
  • up() : Gdb
  • use() : TrgTracker, NullTkr
  • useAcdAsTrigger() : TrgUsingTiles, TrgGemAbstract, rcGEMDefaultTrigger, SimpleGasuExample
  • useHighEnergy() : TrgCalorimeter, NullCal
  • useLowEnergy() : TrgCalorimeter, NullCal

- v -

  • value() : MiniGLTTrgConditionsValue, TrgConditionsValue
  • verifyVersion() : GOCS
  • version() : TrgGem, TrgAbstract

- w -

  • waitForMaskEnable() : rcTrgMiniGLT, rcTrgGem, GGLT
  • width() : TrgGemRegisters, TrgGemAbstract
  • widthRegister() : TrgGemRegisters
  • write() : RegisterInterface
  • writeFIFO() : GNAT
  • writeFIFO32() : GNAT
  • writeTestInformation() : standardTestReport

- z -

  • zeroSuppress() : TrgMiniGLTRegisters, TrgMiniGLTAbstract, TrgEngineRequest
Generated on Fri Jan 21 18:00:54 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gAEM.py Source File

database

gAEM.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST ACD functional block hierarchy"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/08/25 04:18:27 $").split(' ')[1]
00015 __version__ = "$Revision: 2.9 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import time
00022 import gDb
00023 import gAttr
00024 import LATTE.client.gRegister as gRegister
00025
00026 class GAEM(gDb.Gdb):
00027   """\brief ACD Common Controller.
00028
00029   Has GAEM specific registers and dataless commands.
00030
00031   Valid Registers:
00032   - \c configuration
00033   - \c common_status
00034   - \c freeboard_status
00035   - \c command_response
00036   - \c trgseq
00037   - \c power_status
00038   - \c address
00039   - \c timeout
00040   - \c relocation
00041   - \c response_timeout
00042   - \c power_up
00043   - \c power_down
00044
00045   Dataless Commands:
00046   - \c cmd_reset
00047
00048   """
00049   __attrs = [
00050     gAttr.GattrReg('configuration',     0, 4),
00051     gAttr.GattrReg('common_status',     1, 4),
00052     gAttr.GattrReg('freeboard_status',  2, 4),
00053     gAttr.GattrReg('command_response',  3, 4),
00054     gAttr.GattrReg('trgseq',            4, 4),
00055     gAttr.GattrReg('power_status',      5, 4),
00056     gAttr.GattrReg('address',           6, 4),
00057     gAttr.GattrReg('timeout',           7, 4),
00058     gAttr.GattrReg('relocation',        8, 4),
00059     gAttr.GattrReg('response_timeout',  9, 4),
00060     gAttr.GattrReg('power_up',         10, 4),
00061     gAttr.GattrReg('power_down',       11, 4),
00062     gAttr.GattrDlc('cmd_reset',         1, 0),
00063     ]
00064
00065   def __init__(self, client, parent):
00066     """\brief Initialize valid registers as Gattrs.
00067
00068     Assign default values to members
00069     """
00070     self.ARC = gDb.Children(self, GARC)
00071     self.AEQ = None
00072     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00073
00074   def read(self, reg):
00075     return self.cmdrsp('AEM_CC_read_sync', 'slh', 'LADR_AEM', reg, '!I')
00076
00077   def load(self, reg, value):
00078     return self.cmdrsp('AEM_CC_load_sync', 'slh', 'LADR_AEM', reg, value)
00079
00080   def send(self, cmd):
00081     return self.cmdrsp('AEM_CC_cmd_sync', 'slh', 'LADR_AEM', cmd)
00082
00083   def downARC(self, arcId):
00084     """\brief Navigate to the GARC indicated by \a childId
00085
00086     \param  childId The id of the child GARC
00087
00088     \return         A GARC object instance
00089     """
00090     return self.ARC.down(arcId)
00091
00092   def allARC(self):
00093     """\brief Navigate to the broadcast GARC
00094
00095     \return The broadcast GARC object instance
00096     """
00097     return self.ARC.all()
00098
00099   def existsARC(self, arcId):
00100     """\brief Check if the GARC instance with the id
00101     \a arcId exists in the schema.
00102
00103     \param  arcId ACD readout controller id
00104
00105     \return       1 if it exists, 0 if it doesn't.
00106     """
00107     return self.ARC.exists(arcId)
00108
00109   def downAEQ(self):
00110     """\brief Navigate to the GAEQ
00111
00112     \return The GAEQ object instance
00113     """
00114     return self.AEQ
00115
00116   def existsAEQ(self):
00117     """\brief Check if the GAEQ instance exists in the schema.
00118
00119     \return  1 if it exists, 0 if it doesn't.
00120     """
00121     return self.AEQ != None
00122
00123 ## private:
00124   def __removeARC(self, arcId):
00125     self.ARC.remove(arcId)
00126
00127   def __addARC(self, arcId):
00128     return self.ARC.add(arcId)
00129
00130   def __removeAEQ(self):
00131     self.AEQ = None
00132
00133   def __addAEQ(self):
00134     self.AEQ = GAEQ(self.client(), self)
00135     return self.AEQ
00136
00137 class GAEQ(gDb.Gdb):
00138   """\brief ACD Environmental Monitors.
00139
00140   Has GAEQ specific registers and dataless commands.
00141
00142   Valid Registers:
00143   - \c env_free_1la
00144   - \c env_free_1rb
00145   - \c env_free_2la
00146   - \c env_free_2lb
00147   - \c env_free_2ra
00148   - \c env_free_2rb
00149   - \c env_free_3la
00150   - \c env_free_3rb
00151   - \c env_free_4la
00152   - \c env_free_4lb
00153   - \c env_free_4ra
00154   - \c env_free_4rb
00155   - \c env_daq
00156
00157     Pseudo registers:
00158   - \c env_vdd_xxx
00159   - \c env_temp_xxx
00160   - \c env_hv1_xxx
00161   - \c env_hv2_xxx
00162   - \c env_dac_digital_3_3i
00163   - \c env_dac_temp
00164   - \c env_dac_hv_i
00165   - \c env_dac_v
00166
00167   """
00168   __attrs = [
00169     # Registers
00170     gAttr.GattrReg('env_free_1la',       0, 8),
00171     gAttr.GattrReg('env_free_1rb',       1, 8),
00172     gAttr.GattrReg('env_free_2la',       2, 8),
00173     gAttr.GattrReg('env_free_2lb',       3, 8),
00174     gAttr.GattrReg('env_free_2ra',       4, 8),
00175     gAttr.GattrReg('env_free_2rb',       5, 8),
00176     gAttr.GattrReg('env_free_3la',       6, 8),
00177     gAttr.GattrReg('env_free_3rb',       7, 8),
00178     gAttr.GattrReg('env_free_4la',       8, 8),
00179     gAttr.GattrReg('env_free_4lb',       9, 8),
00180     gAttr.GattrReg('env_free_4ra',      10, 8),
00181     gAttr.GattrReg('env_free_4rb',      11, 8),
00182     gAttr.GattrReg('env_daq',           12, 8),
00183     ]
00184   __STALE_TMO = 1.0     # Timeout in seconds before considering adcs value stale
00185   __GAEQ_ENV_VDD_1LA = 20
00186   __ADCS_BASE = 20
00187
00188   i = __ADCS_BASE
00189   for env in ('1la','1rb','2la','2lb','2ra','2rb',
00190               '3la','3rb','4la','4lb','4ra','4rb'):
00191     __attrs.append(gAttr.GattrReg('env_vdd_'+env, i, 2))
00192     i+=1
00193     __attrs.append(gAttr.GattrReg('env_temp_'+env, i, 2))
00194     i+=1
00195     __attrs.append(gAttr.GattrReg('env_hv1_'+env, i, 2))
00196     i+=1
00197     __attrs.append(gAttr.GattrReg('env_hv2_'+env, i, 2))
00198     i+=1
00199   __attrs.append(gAttr.GattrReg('env_dac_digital_3_3i', 68, 2))
00200   __attrs.append(gAttr.GattrReg('env_dac_temp', 69, 2))
00201   __attrs.append(gAttr.GattrReg('env_dac_hv_i', 70, 2))
00202   __attrs.append(gAttr.GattrReg('env_dac_v', 71, 2))
00203
00204   def __init__(self, client, parent):
00205     """\brief Initialize valid registers as Gattrs.
00206
00207     Assign default values to members
00208     """
00209     self.__envs = 13*[(None, 0)]      # [gRegister.Register, time.time()]
00210     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00211
00212   def read(self, reg):
00213     if reg < GAEQ.__ADCS_BASE:
00214       return self.cmdrsp('AEM_AENV_read_sync', 'slh', 'LADR_AEM', reg, '!Q')
00215     else:
00216       return self.__fetchReg(reg)
00217
00218   def load(self, reg, value):
00219     return self.cmdrsp('AEM_AENV_load_sync', 'slh', 'LADR_AEM', reg, value)
00220
00221   def __fetchReg(self, reg):
00222     mux   = (reg - GAEQ.__ADCS_BASE) / 4
00223     which = (reg - GAEQ.__ADCS_BASE) % 4
00224     now = time.time()
00225     (rsp, rt) = self.__envs[mux]
00226     if ((rsp is None) or (now - rt) > GAEQ.__STALE_TMO):
00227       # Set the mux and cause the ADCs to convert
00228       self.cmdrsp('AEM_AENV_load_sync', 'slh', 'LADR_AEM', mux, 0)
00229       # Read the values and timeout information
00230       rsp = self.cmdrsp('AEM_AENV_read_sync', 'slh', 'LADR_AEM', mux, '!Q')
00231       self.__envs[mux] = (rsp, now)
00232     timestamp = rsp.timestamp()
00233     status    = rsp.status()
00234     payloads  = [(rsp.value() >> (16 * which)) & 0x0fff]
00235     return gRegister.Register(timestamp, status, payloads, 'H')
00236
00237 class GARC(gDb.Gdb):
00238   """\brief ACD Readout Controller.
00239
00240   Has GARC specific registers and dataless commands.
00241
00242   Valid Registers:
00243   - function block 0
00244     - \c veto_delay
00245     - \c hvbs
00246     - \c saa
00247     - \c use_hv_normal
00248     - \c use_hv_saa
00249     - \c hold_delay
00250     - \c veto_width
00251     - \c hitmap_width
00252     - \c hitmap_deadtime
00253   - function block 1
00254     - \c look_at_me
00255     - \c hitmap_delay
00256     - \c pha_en_0
00257     - \c veto_en_0
00258     - \c hld_en_0
00259     - \c pha_en_1
00260     - \c veto_en_1
00261     - \c hld_en_1
00262     - \c max_pha
00263   - function block 2
00264     - \c mode
00265     - \c status
00266     - \c last_cmd
00267     - \c diagnostic
00268     - \c cmd_reject
00269     - \c free_id
00270     - \c garc_version
00271   - function block 3
00272     - \c pha_threshold_0
00273     - \c pha_threshold_1
00274     - \c pha_threshold_2
00275     - \c pha_threshold_3
00276     - \c pha_threshold_4
00277     - \c pha_threshold_5
00278     - \c pha_threshold_6
00279   - function block 4
00280     - \c pha_threshold_7
00281     - \c pha_threshold_8
00282     - \c pha_threshold_9
00283     - \c pha_threshold_10
00284     - \c pha_threshold_11
00285     - \c pha_threshold_12
00286     - \c pha_threshold_13
00287   - function block 5
00288     - \c pha_threshold_14
00289     - \c pha_threshold_15
00290     - \c pha_threshold_16
00291     - \c pha_threshold_17
00292     - \c adc_tacq
00293
00294   \deprecated
00295   - \c \b rqst_hvbs Use 'hvbs' instead
00296   - \c \b rqst_hvsaa Use 'saa' instead
00297   - \c \b hvbs Use 'use_hv_normal' instead
00298   - \c \b hvsaa Use 'use_hv_saa' instead
00299   </table>
00300
00301   Dataless Commands
00302   - \c cmd_reset
00303   - \c cmd_calstrobe
00304   - \c cmd_set_hvbs
00305   - \c cmd_set_hvsaa
00306
00307   """
00308   __attrs = [
00309     # Registers
00310     # function block 0
00311     gAttr.GattrReg('veto_delay',         2, 2),
00312     gAttr.GattrReg('hvbs',               8, 2),
00313     gAttr.GattrReg('saa',                9, 2),
00314     gAttr.GattrReg('use_hv_normal',     10, 2),
00315     gAttr.GattrReg('use_hv_saa',        11, 2),
00316     gAttr.GattrReg('hold_delay',        12, 2),
00317     gAttr.GattrReg('veto_width',        13, 2),
00318     gAttr.GattrReg('hitmap_width',      14, 2),
00319     gAttr.GattrReg('hitmap_deadtime',   15, 2),
00320     # function block 1
00321     gAttr.GattrReg('look_at_me',        20, 2),
00322     gAttr.GattrReg('hitmap_delay',      24, 2),
00323     gAttr.GattrReg('pha_en_0',          25, 2),
00324     gAttr.GattrReg('veto_en_0',         26, 2),
00325     gAttr.GattrReg('pha_en_1',          28, 2),
00326     gAttr.GattrReg('veto_en_1',         29, 2),
00327     gAttr.GattrReg('max_pha',           31, 2),
00328     # function block 2
00329     gAttr.GattrReg('mode',              40, 2),
00330     gAttr.GattrReg('status',            41, 2),
00331     gAttr.GattrReg('last_cmd',          42, 2),
00332     gAttr.GattrReg('diagnostic',        43, 2),
00333     gAttr.GattrReg('cmd_reject',        44, 2),
00334     gAttr.GattrReg('free_id',           45, 2),
00335     gAttr.GattrReg('garc_version',      46, 2),
00336     # function block 3
00337     gAttr.GattrReg('pha_threshold_0',   56, 2),
00338     gAttr.GattrReg('pha_threshold_1',   57, 2),
00339     gAttr.GattrReg('pha_threshold_2',   58, 2),
00340     gAttr.GattrReg('pha_threshold_3',   59, 2),
00341     gAttr.GattrReg('pha_threshold_4',   60, 2),
00342     gAttr.GattrReg('pha_threshold_5',   61, 2),
00343     gAttr.GattrReg('pha_threshold_6',   62, 2),
00344     # function block 4
00345     gAttr.GattrReg('pha_threshold_7',   72, 2),
00346     gAttr.GattrReg('pha_threshold_8',   73, 2),
00347     gAttr.GattrReg('pha_threshold_9',   74, 2),
00348     gAttr.GattrReg('pha_threshold_10',  75, 2),
00349     gAttr.GattrReg('pha_threshold_11',  76, 2),
00350     gAttr.GattrReg('pha_threshold_12',  77, 2),
00351     gAttr.GattrReg('pha_threshold_13',  78, 2),
00352     # function block 5
00353     gAttr.GattrReg('pha_threshold_14',  88, 2),
00354     gAttr.GattrReg('pha_threshold_15',  89, 2),
00355     gAttr.GattrReg('pha_threshold_16',  90, 2),
00356     gAttr.GattrReg('pha_threshold_17',  91, 2),
00357     gAttr.GattrReg('adc_tacq',          92, 2),
00358     # Dataless Commands
00359     gAttr.GattrReg('cmd_reset',          1, 0),
00360     gAttr.GattrReg('cmd_calstrobe',      3, 0),
00361     gAttr.GattrReg('cmd_set_hvbs',      10, 0),
00362     gAttr.GattrReg('cmd_set_hvsaa',     11, 0)
00363     ]
00364
00365   BCASTADDR = 0x1f
00366   NARCS = 12
00367
00368   def __init__(self, client, parent, id):
00369     """\brief Initialize valid registers as Gattrs.
00370
00371     Assign default values to members
00372     """
00373     if id < GARC.NARCS:
00374       addr = id
00375     elif id == gDb.Children.BCASTID:
00376       addr = GARC.BCASTADDR
00377     else:
00378       raise KeyError("*** gAEM: GARC id %d is invalid" %(id))
00379     self.AFE = gDb.Children(self, GAFE)
00380     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00381
00382   def read(self, reg):
00383     return self.cmdrsp('AEM_GARC_read_sync', 'slh', 'LADR_AEM', self.addr(), reg, '!I')
00384
00385   def load(self, reg, value):
00386     return self.cmdrsp('AEM_GARC_load_sync', 'slh', 'LADR_AEM', self.addr(), reg, value)
00387
00388   def send(self, cmd):
00389     return self.cmdrsp('AEM_GARC_cmd_sync', 'slh', 'LADR_AEM', self.addr(), cmd)
00390   def downAFE(self, afeId):
00391     """\brief Navigate to the GAFE indicated by \a childId
00392
00393     \param  childId The id of the child GAFE
00394
00395     \return         A GAFE object instance
00396     """
00397     return self.AFE.down(afeId)
00398
00399   def allAFE(self):
00400     """\brief Navigate to the broadcast GAFE
00401
00402     \return The broadcast GAFE object instance
00403     """
00404     return self.AFE.all()
00405
00406   def existsAFE(self, afeId):
00407     """\brief Check if the GAFE instance with the id
00408     \a afeId exists in the schema.
00409
00410     \param  afeId ACD readout controller id
00411
00412     \return       1 if it exists, 0 if it doesn't.
00413     """
00414     return self.AFE.exists(afeId)
00415
00416 ## private:
00417   def __removeAFE(self, afeId):
00418     self.AFE.remove(afeId)
00419
00420   def __addAFE(self, afeId):
00421     return self.AFE.add(afeId)
00422
00423
00424 class GAFE(gDb.Gdb):
00425   """\brief ACD Front-End Controller.
00426
00427   Has GAFE specific registers and dataless commands.
00428
00429   Valid Registers:
00430   - \c configuration
00431   - \c veto_dac
00432   - \c hld_dac
00433   - \c veto_vernier
00434   - \c bias_dac
00435   - \c tci_dac
00436   - \c vers_addr
00437   - \c write_ctr
00438   - \c reject_ctr
00439   - \c loop_ctr
00440   - \c chip_addr
00441
00442   \deprecated
00443   - \c \b lld_dac Use 'veto_vernier' instead
00444
00445   """
00446   __attrs = [
00447     # Registers
00448     gAttr.GattrReg('configuration',  0, 2),
00449     gAttr.GattrReg('veto_dac',       1, 2),
00450     gAttr.GattrReg('veto_vernier',   2, 2),
00451     gAttr.GattrReg('hld_dac',        3, 2),
00452     gAttr.GattrReg('bias_dac',       4, 2),
00453     gAttr.GattrReg('tci_dac',        5, 2),
00454     gAttr.GattrReg('vers_addr',      6, 2),
00455     gAttr.GattrReg('write_ctr',      7, 2),
00456     gAttr.GattrReg('reject_ctr',     8, 2),
00457     gAttr.GattrReg('loop_ctr',       9, 2),
00458     gAttr.GattrReg('chip_addr',     10, 2)
00459     ]
00460
00461   BCASTADDR = 0x1f
00462   NAFES = 18
00463
00464   def __init__(self, client, parent, id):
00465     """\brief Initialize valid registers as Gattrs.
00466
00467     """
00468     if id < GAFE.NAFES:
00469       addr = id
00470     elif id == gDb.Children.BCASTID:
00471       addr = GAFE.BCASTADDR
00472     else:
00473       raise KeyError("*** gAEM: GAFE id %d is invalid" %(id))
00474     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00475
00476   def read(self, reg):
00477     return self.cmdrsp('AEM_GAFE_read_sync', 'slh', 'LADR_AEM', self.up().addr(), self.addr(), reg, '!I')
00478
00479   def load(self, reg, value):
00480     return self.cmdrsp('AEM_GAFE_load_sync', 'slh', 'LADR_AEM', self.up().addr(), self.addr(), reg, value)
00481
00482   def send(self, cmd):
00483     return self.cmdrsp('AEM_GAFE_cmd_sync', 'slh', 'LADR_AEM', self.up().addr(), self.addr(), cmd)
00484
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gAttr.py Source File

database

gAttr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 ## \namespace gAttr
00012 ##
00013 ## \brief GLAST LAT record attribute definitions.
00014 ##
00015 ## \b Contents:
00016 ##
00017 ## GLAST LAT functional block hierarchy representation in Python
00018 ## See <a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/TEM.pdf">
00019 ## The Tower Electronics Module (TEM) - Programming ICD specification (LAT-TD-00605-D1)</a>
00020 ## for more info
00021
00022 __facility__ = "Online"
00023 __abstract__ = "GLAST LAT record attribute definitions"
00024 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00025 __date__     = ("$Date: 2004/09/25 01:50:42 $").split(' ')[1]
00026
00027 __version__  = "$Revision: 2.14 $"
00028 __release__ = "$Name: P04-06-05 $"
00029 __credits__  = "SLAC"
00030
00031 import LATTE.copyright_SLAC
00032
00033 from LATTE.client.gException import LATInterfaceException
00034
00035 from gRule       import GruleBase
00036 from gConstraint import GconstraintBase
00037 from gEGU        import GEGU
00038
00039 ATTR_READ             = 0x1
00040 ATTR_WRITE            = 0x2
00041 ATTR_READ_ONLY        = ATTR_READ
00042 ATTR_WRITE_ONLY       = ATTR_WRITE
00043 ATTR_READ_WRITE       = ATTR_READ | ATTR_WRITE
00044 ATTR_NO_DIRECT_ACCESS = 0x4
00045 ATTR_COMMAND          = 0x8 | ATTR_WRITE
00046
00047 # The following is for backward compatibility only
00048 REG_READ_ONLY        = ATTR_READ_ONLY
00049 REG_WRITE_ONLY       = ATTR_WRITE_ONLY
00050 REG_READ_WRITE       = ATTR_READ_WRITE
00051 REG_NO_DIRECT_ACCESS = ATTR_NO_DIRECT_ACCESS
00052
00053
00054
00055 class Gattr(object):
00056   """\brief Base class which is instantiated once for each attribute kind.
00057   """
00058   # Set up a single instance of the defaults rather than one per Gattr
00059   defaultRule       = GruleBase()
00060   defaultConstraint = GconstraintBase()
00061   defaultEgu        = GEGU("")
00062
00063
00064   def __init__(self, name, id, size, flags, rule=None, constraint=None, egu=None):
00065     """Gattr constructor.
00066
00067     \param name        The name of the attribute.
00068     \param size        Attribute size in bytes.
00069     \param rule        Optional. Attribute rule.
00070     \param constraint  Optional. Attribute constraint.
00071     \param egu         Optional. Attribute EGU
00072     """
00073     self.__name       = name.lower()
00074     self.__id         = id
00075     self.__size       = size
00076     self.__flags      = flags
00077
00078     self.__rule       = rule
00079     self.__constraint = constraint
00080     self.__egu        = egu
00081
00082   def create(self, node):
00083     return _Attr(node, self)
00084
00085   def set(self, node, value, bypass=0):
00086     raise Exception, "Missing set() implementation"      # Revisit status
00087
00088   def get(self, node, bypass=0):
00089     raise Exception, "Missing get() implementation"      # Revisit status
00090
00091   def getName(self):
00092     return self.__name
00093
00094   def size(self):
00095     """Method for returning the size of the attribute
00096
00097     \return Attribute size in bytes
00098     """
00099     return self.__size
00100
00101   def id(self):
00102     return self.__id
00103
00104   def setRule(self, rule):
00105     """Method to attach a rule to a gAttr after the gAttr has been constructed.
00106
00107     \param rule A Grule object instance
00108     """
00109     self.__rule = rule
00110
00111   def getRule(self):
00112     """Retrieve the rule associated with the gAttr.
00113     """
00114     return self.__rule
00115
00116   def setConstraint(self, constraint):
00117     """
00118     Method to attach a constraint to a gAttr after the gAttr has been constructed.
00119     This method will go away once constraints are loaded from a configuration file.
00120
00121     \param constraint A Gconstraint object instance
00122     """
00123     self.__constraint = constraint
00124
00125   def setEGU(self, egu):
00126     """
00127     Method to attach a EGU to a gAttr after the gAttr has been constructed.
00128
00129     \param egu A Gegu object instance
00130     """
00131     self.__egu = egu
00132
00133   def getEGU(self):
00134     """
00135     Method that returns the gEGU.GEGU class for this gAttr
00136
00137     \return A Gegu object instance
00138     """
00139     return self.__egu
00140
00141   def getConstraint(self):
00142     """
00143     Method that returns the gConstraint.Gconstraint class for this gAttr
00144
00145     \return A Gconstraint object instance
00146     """
00147     return self.__constraint
00148
00149   def flags(self):
00150     return self.__flags
00151
00152   def isReadOnly(self):
00153     """ Returns a boolean value indicating if the attribute is read only or not
00154
00155     \return 1=Read Only, 0=Not Read Only.
00156     """
00157     return self.__flags == ATTR_READ
00158
00159   def isWriteOnly(self):
00160     """ Returns a boolean value indicating if the attribute is write only or not
00161
00162     \return 1=Write Only, 0=Not Write Only.
00163     """
00164     return self.__flags == ATTR_WRITE
00165
00166   def isReadWrite(self):
00167     """ Returns a boolean value indicating if the attribute is read write or not
00168
00169     \return 1=Read Write, 0=Not Read Write.
00170     """
00171     return self.__flags == ATTR_READ_WRITE
00172
00173   def isNoDirectAccess(self):
00174     """ Returns a boolean value indicating if the attribute is no direct access or not
00175
00176     \return 1=No Direct Access, 0=Not No Direct Access.
00177     """
00178     return self.__flags == ATTR_NO_DIRECT_ACCESS
00179
00180   def isCommand(self):
00181     """
00182     """
00183     return self.__flags & ATTR_COMMAND == ATTR_COMMAND
00184
00185
00186
00187
00188 class GattrRaw(Gattr):
00189   """\brief Class which is instantiated for each raw register kind
00190   """
00191   def __init__(self, name, regno, size, flags=ATTR_READ_WRITE):
00192     """GattrRaw constructor
00193
00194     \param name        The name of the register
00195     \param regno       Register no.
00196     \param size        Register size in bytes.
00197
00198     """
00199     Gattr.__init__(self, name, regno, size, flags)
00200
00201   def set(self, node, val, bypass=0):
00202     """
00203     Method for setting the value of a register attribute.
00204     Calls the functions in the base class for setting values.
00205
00206     \param val    Register value to be set
00207     \param bypass Optional. Flag for bypassing EGU conversion
00208
00209     """
00210     response = node.load(self.id(), val)
00211     status = response.status()
00212     if status & 0x3:  raise LATInterfaceException(status)
00213     return None, response.timestamp()
00214
00215   def get(self, node, bypass=0):
00216     """
00217     Method for getting the value of a register attribute.
00218     Calls the functions in the node class for getting values.
00219     If bypass=0 (the default), the value will be returned in EU.
00220     If bypass=1, the raw value will be returned.
00221     """
00222     response = node.read(self.id())
00223     status = response.status()
00224     if status & 0x3:  raise LATInterfaceException(status)
00225
00226     return response.value(), response.timestamp()
00227
00228
00229 class GattrReg(Gattr):
00230   """\brief Class which is instantiated for each register
00231   """
00232   def __init__(self, name, regno, size, flags=ATTR_READ_WRITE,
00233                rule=Gattr.defaultRule, constraint=Gattr.defaultConstraint, egu=Gattr.defaultEgu):
00234     """GattrReg constructor
00235
00236     \param name        The name of the register
00237     \param regno       Register no.
00238     \param size        Register size in bytes.
00239     \param rule        Optional. Register rule.
00240     \param constraint  Optional. Register constraint.
00241     \param egu         Optional. Register EGU
00242
00243     """
00244     Gattr.__init__(self, name, regno, size, flags, rule, constraint, egu)
00245
00246   def set(self, node, val, bypass=0):
00247     """
00248     Method for setting the value of a register attribute.
00249     Calls the functions in the base class for setting values.
00250
00251     \param val    Register value to be set
00252     \param bypass Optional. Flag for bypassing EGU conversion
00253
00254     """
00255     if bypass:
00256       raw = val
00257     else:
00258       (val, rejected) = self._Gattr__constraint.evaluate(val)
00259       if rejected:
00260         return None, None
00261       raw = self._Gattr__egu.raw(val)
00262
00263     response = node.load(self.id(), raw)
00264     status = response.status()
00265     if status & 0x3:  raise LATInterfaceException(status)
00266     return None, response.timestamp()
00267
00268   def get(self, node, bypass=0):
00269     """
00270     Method for getting the value of a register attribute.
00271     Calls the functions in the node class for getting values.
00272     If bypass=0 (the default), the value will be returned in EU.
00273     If bypass=1, the raw value will be returned.
00274     """
00275     response = node.read(self.id())
00276     status = response.status()
00277     if status & 0x3:  raise LATInterfaceException(status)
00278
00279     raw = response.value()
00280     if bypass:
00281       return raw, response.timestamp()
00282     else:
00283       egu = self._Gattr__egu.egu(raw)
00284       self._Gattr__rule.evaluate(egu, self, node)
00285       return egu, response.timestamp()
00286
00287
00288 class GattrDlc(Gattr):
00289   """Attribute class for implementing dataless commands"""
00290   def __init__(self, name, cmdNo, size=0, flags=ATTR_COMMAND):
00291     Gattr.__init__(self, name, cmdNo, 0, flags)
00292     self.get = self.set
00293
00294   def set(self, node, *args):
00295     """
00296     Method for invoking a dataless command.
00297     The value parameter is meaningless for this method and is only supplied to
00298     satisfy the function signature.
00299     """
00300     response = node.send(self.id())
00301     status = response.status()
00302     if status & 0x3:  raise LATInterfaceException(status)
00303     return None, response.timestamp()
00304
00305 class GattrBF(Gattr):
00306   """\brief Bit field class which is instantiated for each bit field kind
00307
00308   This class allows operation on bit fields of the form (end, start]
00309   in a register specified by the register number (regno).
00310
00311   N.B. This attribute operates on the raw value of the associated register
00312   """
00313   def __init__(self, name, regno, start, end, flags=ATTR_READ_WRITE):
00314     """GattrBF constructor
00315
00316     \param name        The name of the bit field
00317     \param regno       Register no. containing the bit field
00318     \param start       Bit offset to start (inclusive) of the bit field
00319     \param end         Bit offset to the end (exclusive) of the bit field
00320     \param flags       Optional flags to govern access to the bit field
00321
00322     """
00323     Gattr.__init__(self, name, regno, 0, flags)
00324
00325     if end <= start:
00326       raise Exception, "Invalid bit field specification: start %d, end %d" % (start, end) # Revisit
00327     self.__offset = start
00328     self.__mask   = long(2**(end - start) - 1) << start
00329
00330   def set(self, node, val, bypass=0):
00331     """
00332     Method for setting the value of a bit field.
00333     Calls the functions in the base class for setting values.
00334
00335     \param val    bit field value to be set
00336     \param bypass ignored
00337
00338     """
00339
00340     response = node.read(self.id())
00341     status = response.status()
00342     if status & 0x3:  raise LATInterfaceException(status)
00343
00344     value = ((response.value() & ~self.__mask) |
00345              ((long(val) << self.__offset) & self.__mask))
00346
00347     response = node.load(self.id(), value)
00348     status = response.status()
00349     if status & 0x3:  raise LATInterfaceException(status)
00350     return None, response.timestamp()
00351
00352   def get(self, node, bypass=0):
00353     """
00354     Method for getting the value of a bit field.
00355
00356     \param val    bit field value to be set
00357     \param bypass ignored
00358     """
00359     response = node.read(self.id())
00360     status = response.status()
00361     if status & 0x3:  raise LATInterfaceException(status)
00362
00363     value = (response.value() & self.__mask) >> self.__offset
00364
00365     return value, response.timestamp()
00366
00367 class _Attr(object):
00368   """Helper class for private use in this file only.
00369   """
00370
00371
00372   def __init__(self, node, attr):
00373     #print node.getName(), attr
00374     self.__node = node
00375     self.__attr = attr
00376
00377     self.__timestamp = -1L
00378
00379     #print id(self), id(attr), node.getName(), attr.getName(), attr.flags()
00380     if attr.flags() == (ATTR_READ | ATTR_NO_DIRECT_ACCESS):
00381       self.set = self.__badSet
00382       self.get = self.__badGet
00383     else:
00384       self.set = self.__set
00385       self.get = self.__get
00386
00387     # Callthroughs to 'parent' class
00388 #    setRule          = Gattr.setRule
00389 #    setConstraint    = Gattr.setConstraint
00390 #    getEGU           = Gattr.getEGU
00391 #    getRule          = Gattr.getRule
00392 #    getConstraint    = Gattr.getConstraint
00393 #    getName          = Gattr.getName
00394
00395 #    id               = Gattr.id
00396 #    size             = Gattr.size
00397 #    isReadOnly       = Gattr.isReadOnly
00398 #    isWriteOnly      = Gattr.isWriteOnly
00399 #    isReadWrite      = Gattr.isReadWrite
00400 #    isNoDirectAccess = Gattr.isNoDirectAccess
00401 #    isCommand        = Gattr.isCommand
00402
00403
00404   def getName(self):
00405     return self.__attr.getName()
00406
00407   def size(self):
00408     """Method for returning the size of the attribute
00409
00410     \return Attribute size in bytes
00411     """
00412     return self.__attr.size()
00413
00414   def id(self):
00415     return self.__attr.id()
00416
00417   def setRule(self, rule):
00418     """Method to attach a rule to a gAttr after the gAttr has been constructed.
00419
00420     \param rule A Grule object instance
00421     """
00422     return self.__attr.setRule(rule)
00423
00424   def getRule(self):
00425     """Retrieve the rule associated with the gAttr.
00426     """
00427     return self.__attr.getRule()
00428
00429   def setConstraint(self, constraint):
00430     """
00431     Method to attach a constraint to a gAttr after the gAttr has been constructed.
00432     This method will go away once constraints are loaded from a configuration file.
00433
00434     \param constraint A Gconstraint object instance
00435     """
00436     return self.__attr.setConstraint(constraint)
00437
00438   def setEGU(self, egu):
00439     """
00440     Method to attach a EGU to a gAttr after the gAttr has been constructed.
00441
00442     \param egu A Gegu object instance
00443     """
00444     return self.__attr.setEGU(egu)
00445
00446   def getEGU(self):
00447     """
00448     Method that returns the gEGU.GEGU class for this gAttr
00449
00450     \return A Gegu object instance
00451     """
00452     return self.__attr.getEGU()
00453
00454   def getConstraint(self):
00455     """
00456     Method that returns the gConstraint.Gconstraint class for this gAttr
00457
00458     \return A Gconstraint object instance
00459     """
00460     return self.__attr.getConstraint()
00461
00462   def flags(self):
00463     return self.__attr.flags()
00464
00465   def isReadOnly(self):
00466     """ Returns a boolean value indicating if the attribute is read only or not
00467
00468     \return 1=Read Only, 0=Not Read Only.
00469     """
00470     return self.__attr.isReadOnly()
00471
00472   def isWriteOnly(self):
00473     """ Returns a boolean value indicating if the attribute is write only or not
00474
00475     \return 1=Write Only, 0=Not Write Only.
00476     """
00477     return self.__attr.isWriteOnly()
00478
00479   def isReadWrite(self):
00480     """ Returns a boolean value indicating if the attribute is read write or not
00481
00482     \return 1=Read Write, 0=Not Read Write.
00483     """
00484     return self.__attr.isReadWrite()
00485
00486   def isNoDirectAccess(self):
00487     """ Returns a boolean value indicating if the attribute is no direct access or not
00488
00489     \return 1=No Direct Access, 0=Not No Direct Access.
00490     """
00491     return self.__attr.isNoDirectAccess()
00492
00493   def isCommand(self):
00494     """
00495     """
00496     return self.__attr.isCommand()
00497
00498
00499   def __set(self, val, bypass=0, node=None):
00500     if node is not None:
00501       junk, self.__timestamp = self.__attr.set(node, val, bypass)
00502     else:                             # For backward compatibility
00503       junk, self.__timestamp = self.__attr.set(self.__node, val, bypass)
00504
00505   def __get(self, bypass=0, node=None):
00506     if node is not None:
00507       val, self.__timestamp = self.__attr.get(node, bypass)
00508     else:                             # For backward compatibility
00509       val, self.__timestamp = self.__attr.get(self.__node, bypass)
00510     return val
00511
00512   def __badSet(self, node, val, bypass=0):
00513     return -1                         # revisit
00514     #raise LATInterfaceException(1)
00515
00516   def __badGet(self, node, val, bypass=0):
00517     return -1                         # revisit
00518     #raise LATInterfaceException(1)
00519
00520   def getNode(self):
00521     return self.__node
00522
00523   def setTimeStamp(self, value):
00524     self.__timestamp = value
00525
00526   def getTimeStamp(self):
00527     """
00528     Method that returns the timestamp at the moment when the register was accessed.
00529
00530     \return Timestamp in seconds as a floating point value
00531     """
00532     if self.__timestamp == -1:
00533       return self.__timestamp
00534     else:
00535       return ((self.__timestamp >> 32) +
00536               (self.__timestamp & 0xffffffffL) / 1000000000.0)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gBits.py Source File

client

gBits.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Bit field utility methods"
00013 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/10/29 01:59:35 $").split(' ')[1]
00015 __version__  = "$Revision: 2.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import sys
00022 import string
00023 import inspect
00024
00025 class bf(object):
00026   def __init__(self,value=0L):
00027     self._d = long(value)
00028
00029   def set(self, value):
00030     self._d = long(value)
00031
00032   def __getitem__(self, index):
00033     return (self._d >> index) & 1
00034
00035   def __setitem__(self,index,value):
00036     value    = (value&1L)<<index
00037     mask     = 1L<<index
00038     self._d  = (self._d & ~mask) | value
00039
00040   def __getslice__(self, start, end):
00041     mask = 2**(end - start) -1
00042     return (self._d >> start) & mask
00043
00044   def __setslice__(self, start, end, value):
00045     mask = 2**(end - start) -1
00046     value = (long(value) & mask) << start
00047     mask = mask << start
00048     self._d = (self._d & ~mask) | value
00049     return (self._d >> start) & mask
00050
00051   def getOnBits(self):
00052     value = self._d
00053     i = 0
00054     bits = []
00055     while value != 0:
00056       bit = value & 1L
00057       if bit: bits.append(i)
00058       value = value >> 1
00059       i+=1
00060     return bits
00061
00062   def __int__(self):
00063     return self._d
00064
00065   def __str__(self):
00066     return str(self._d)
00067
00068 class BitField(object):
00069   def __init__(self, ui, bf_def):
00070     self.bf_ui = bf(ui)
00071     self.bf_def = bf_def
00072
00073   def set(self, ui):
00074     self.bf_ui.set(ui)
00075
00076   def __setattr__(self, attribute, val):
00077     if attribute == 'ui':
00078       self.__dict__['bf_ui'] = bf(val)
00079       return
00080     elif attribute in ('bf_ui', 'bf_def'):
00081       self.__dict__[attribute] = val
00082       return
00083     else:
00084       for (bitField, fromBit, toBit) in self.bf_def:
00085         if attribute.lower() == bitField:
00086           self.bf_ui[fromBit:toBit] = val
00087           return
00088     self.__dict__[attribute] = val
00089
00090   def __getattr__(self, attribute):
00091     if attribute == 'ui':
00092       return int(self.__dict__['bf_ui'])
00093     elif attribute in ('bf_ui', 'bf_def'):
00094       return self.__dict__[attribute]
00095     else:
00096       for (bitField, fromBit, toBit) in self.bf_def:
00097         if attribute == bitField:
00098           return self.bf_ui[fromBit:toBit]
00099     return self.__dict__[attribute]
00100
00101   def __int__(self):
00102     return int(self.__dict__['bf_ui'])
00103
00104   def __str__(self):
00105     return str(self.__dict__['bf_ui'])
00106
00107
00108 def hexConvert(s, size=1, outPutStyle="0x%s "):
00109   """
00110   Convert binary string s
00111   to a hex format
00112
00113   Keyword arguments:
00114
00115   'size'        -- How large should each hex value be
00116
00117   'outPutStyle' -- How should each value be formatted
00118   """
00119   res=[]
00120   while s:
00121       temp=s[:size]
00122       s=s[size:]
00123       l=[]
00124       for i in temp:
00125           l.append("%02x"%ord(i))
00126       val=string.join(l,'')
00127       res.append(outPutStyle%val)
00128   return string.join(res,'')
00129
00130 def lhex(x, size=8):
00131   xs = string.lower(hex(x))
00132   l = len(xs)
00133   if xs[l-1] == "l":
00134     xs = xs[2:l-1]
00135   else:
00136     xs = xs[2:l]
00137   l = len(xs)
00138   xs = '0'*(size-l) + xs
00139   return xs
00140
00141 def q(cond,on_true,on_false):
00142   if cond:
00143     if not inspect.isfunction(on_true):
00144       return on_true
00145     else:
00146       return apply(on_true)
00147   else:
00148     if not inspect.isfunction(on_false):
00149       return on_false
00150     else:
00151       return apply(on_false)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCmdCli.py Source File

client

gCmdCli.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Command handler client"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:57:24 $").split(' ')[1]
00015 __version__  = "$Revision: 2.5 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020 import logging as log
00021
00022 import gCommand
00023 import gResponse
00024 import gSocket
00025 import gException
00026
00027 class CmdCli(gSocket.Socket):
00028   PortNumber = 2000
00029
00030   def __init__(self, handler=None, debug=0):
00031     gSocket.Socket.__init__(self, CmdCli.PortNumber)
00032     self.__handler = handler
00033     self.cmdrsp = None
00034     self.setDebug(debug)
00035
00036   def setDebug(self, debug):
00037     if debug == 0:
00038       self.cmdrsp = self.__cmdrsp
00039     else:
00040       self.cmdrsp = self.__cmdrsp_debug
00041
00042   def getDebug(self):
00043     return self.cmdrsp == self.__cmdrsp_debug
00044
00045   def handler(self, newhandler):
00046     self.__handler = newhandler
00047
00048   def __command_response(self, command):
00049     self.lock()
00050     try:
00051       self.send(command)
00052       result = self.recv(1024)
00053       self.release()
00054     except:
00055       self.release()
00056       if self.__handler is not None:
00057         self.__handler.timedout()
00058       status = gException.LATInterfaceStatus.status('OCS_TMO')
00059       raise gException.LATInterfaceException(status)
00060     if len(result) == 0:
00061       if self.__handler is not None:
00062         self.__handler.disconnected()
00063       status = gException.LATInterfaceStatus.status('OCS_NOSRV')
00064       raise gException.LATInterfaceException(status)
00065     return result
00066
00067   def __cmdrsp(self, functionname, *arguments):
00068     command = gCommand.Command(functionname, *arguments)
00069     result = self.__command_response(command.packet())
00070     response = gResponse.Response(command, result)
00071     return response
00072
00073   def __cmdrsp_debug(self, functionname, *arguments):
00074     log.debug('%s calling: %s(%s)' %(__name__, functionname, arguments))
00075     command = gCommand.Command(functionname, *arguments)
00076     result = self.__command_response(command.packet())
00077     response = gResponse.Response(command, result)
00078     statusmsg = gException.LATInterfaceStatus(response.status())
00079     log.debug('%s returns: status: %s, value(s): %s' \
00080               %(__name__, statusmsg, response.payloads()))
00081     return response
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCommand.py Source File

client

gCommand.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Commanding"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/09/11 00:52:01 $").split(' ')[1]
00015 __version__  = "$Revision: 2.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import struct
00022
00023 def packstring(arg, type):
00024   strlen = len(arg)
00025   strpad = 4-(strlen&0x3)
00026   fmt = '!HH%ds%dx' %(strlen, strpad)
00027   return struct.pack(fmt, strlen+strpad, type, arg)
00028
00029 class Command:
00030   __Function = 0
00031   __Handler  = 1
00032   __Payload  = 2
00033   __Value    = 3
00034   __Input    = 4
00035
00036   def __init__(self, functionname, *arguments):
00037     self.__packet = None
00038     self.__payloadfmts = []
00039
00040     cmd = packstring(functionname, Command.__Function)
00041     for arg in arguments:
00042       if isinstance(arg, str):
00043         if arg[0] == '!':
00044           cmd += packstring(arg[1:], Command.__Payload)
00045           self.__payloadfmts.append(arg[1:])
00046         elif arg[0] == '>':
00047           cmd += packstring(arg[1:], Command.__Input)
00048         else:
00049           cmd += packstring(arg, Command.__Handler)
00050       elif isinstance(arg, int) or isinstance(arg, long):
00051         cmd += struct.pack('!HHI', 4, Command.__Value, arg)
00052       else:
00053         raise Exception, "*** gCommand: cannot handle type %s" \
00054                         %(arg.__class__.__name__)
00055     self.__packet = struct.pack('!I', len(cmd)) + cmd
00056
00057   def packet(self):
00058     return self.__packet
00059
00060   def payloadfmts(self):
00061     return self.__payloadfmts
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gConstraint.py Source File

database

gConstraint.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Classes for defining constraints"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/11 03:10:09 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import exceptions
00020 import gGroup
00021
00022 True  = (0 < 1)
00023 False = not True
00024
00025 class gConstraintViolation(exceptions.Exception):
00026   """\brief Constraint Violation Class
00027
00028   Exception class used in constraint classes
00029   """
00030   def __init__(self, args=None):
00031     self.args = args
00032
00033
00034 class GconstraintBase(object):
00035   """\brief Base constraint class for use when no constraint is appropriate.
00036   """
00037   def __init__(self):
00038     pass
00039
00040   def evaluate(self, value):
00041     return (value, False)
00042
00043 class Gconstraint(GconstraintBase):
00044   """\brief Base class for describing constraints
00045   """
00046   def __init__(self, name, subsystem, category, enabled, continuous = False):
00047     """ Constructor.
00048       \param name       Constraint name
00049       \param subsystem  Subsystem gGroup to which the constraint belongs
00050       \param category   Category gGroup to which the constraint belongs
00051       \param enabled    Flag indicating whether constraint is enabled
00052       \param continuous Flag indicating whether constraint can fire repeatedly
00053     """
00054     self.__name       = name
00055     self.__subsystem  = subsystem
00056     self.__category   = category
00057     self.__enabled    = enabled
00058     self.__continuous = continuous
00059     self.__fired      = False
00060
00061   def _eval_(self, value):
00062     """Dummy evaluation method to be overridden through inheritance to implement
00063     the application specific constraint evaluation"""
00064     return (value, False)
00065
00066   def evaluate(self, value):
00067     """This method is called to evaluate the constraint on 'value'"""
00068     if self.__subsystem.enabled() and \
00069        self.__category.enabled()  and \
00070        self.__enabled:
00071       return self._eval_(value)
00072     else:
00073       return (value, False)
00074
00075   def name(self):
00076     """Method to retrieve the constraint's name"""
00077     return self.__name
00078
00079   def subsystem(self):
00080     """Method for discovering this constraint's subsystem"""
00081     return self.__subsystem
00082
00083   def category(self):
00084     """Method for discovering this constraint's category"""
00085     return self.__category
00086
00087   def enabled(self):
00088     """Method for discovering whether this constraint is enabled"""
00089     return self.__enabled
00090
00091   def enable(self):
00092     """Method used to enable evaluation of this constraint"""
00093     self.__enabled = True
00094
00095   def disable(self):
00096     """Method used to disable evaluation of this constraint"""
00097     self.__enabled = False
00098
00099   def reset(self):
00100     """Method used to reenable evaluation of this constraint in the case of
00101     noncontinuous mode after it has been violated"""
00102     self.__fired = False
00103
00104   def reject(self, message):
00105     """Method optionally used by the constraint evaluation implementation to
00106     signal a constraint violation"""
00107     if self.__continuous or not self.__fired:
00108       self.__fired = True
00109       raise gConstraintViolation, message
00110
00111
00112 class GconstraintLimitRE(Gconstraint):
00113   """\brief On Constraint Limit Raise Exception
00114
00115   Constraint class that determines whether to raise an exception
00116   based on the passed in value being within given limits.
00117   """
00118   def __init__(self, name, subsystem, category, enabled, continuous,
00119                low, high):
00120     Gconstraint.__init__(self, name, subsystem, category, enabled, continuous)
00121     self.__low  = low
00122     self.__high = high
00123
00124   def _eval_(self, value):
00125     if value < self.__low or value > self.__high:
00126       self.reject()
00127       return (value, True)
00128     return (value, False)
00129
00130
00131 class GconstraintLimit(Gconstraint):
00132   """\brief Limit Constraint
00133
00134   Constraint class that limits a passed in value to given limits.  If the
00135   value is outside of the constraint limits, it is pegged to the nearest limit.
00136   """
00137   def __init__(self, name, subsystem, category, enabled, continuous,
00138                low, high):
00139     Gconstraint.__init__(self, name, subsystem, category, enabled, continuous)
00140     self.__low  = low
00141     self.__high = high
00142
00143   def _eval_(self, value):
00144     if   value < self.__low:
00145       print "%s constraint: value is driven to the low constraint"  % self.name()
00146       return    (self.__low,  False)
00147     elif value > self.__high:
00148       print "%s constraint: value is driven to the high constraint" % self.name()
00149       return    (self.__high, False)
00150     else:
00151       return    (value,       False)
00152
00153 class GconstraintLimitPegRE(Gconstraint):
00154   """\brief Pegged Limit Constraint
00155
00156   Constraint class that limits a passed in value to given limits.  If the
00157   value is outside of the constraint limits, it raises an exception AND the
00158   value is pegged to the nearest limit.
00159   """
00160   def __init__(self, name, subsystem, category, enabled, continuous,
00161                low, high):
00162     Gconstraint.__init__(self, name, subsystem, category, enabled, continuous)
00163     self.__low  = low
00164     self.__high = high
00165
00166   def _eval_(self, value):
00167     if   value < self.__low:
00168       violMsg =  "Driven to low constraint"
00169       self.reject(violMsg)
00170       return    (self.__low,  True)
00171     elif value > self.__high:
00172       violMsg =  "Driven to high constraint"
00173       self.reject(violMsg)
00174       return    (self.__high, True)
00175     else:
00176       return    (value,       False)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gCRU.py Source File

database

gCRU.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST CRU functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/08/11 03:10:09 $").split(' ')[1]
00015 __version__ = "$Revision: 2.4 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022 import gAttr
00023
00024 class GCRU(gDb.Gdb):
00025   """\brief CRU node.
00026
00027   Has GCRU specific registers and dataless commands.
00028
00029   Valid Registers:
00030   - \c configuration
00031   - \c command_enable
00032   - \c response_enable
00033   - \c cr_statistics
00034   - \c acd_startup_clock
00035   - \c test_io
00036
00037   Dataless Commands:
00038   - \c cmd_nop
00039   - \c cmd_reset
00040
00041   """
00042   __attrs = [
00043     # Registers
00044     gAttr.GattrRaw('configuration',        0, 4),
00045     gAttr.GattrRaw('command_enable',       1, 4),
00046     gAttr.GattrRaw('response_enable',      2, 4),
00047     gAttr.GattrRaw('cr_statistics',        3, 4),
00048     gAttr.GattrRaw('acd_startup_clock',    4, 4),
00049     gAttr.GattrRaw('test_io',              5, 4),
00050     # Dataless Commands
00051     gAttr.GattrDlc('cmd_nop',              0, 0),
00052     gAttr.GattrDlc('cmd_reset',            1, 0),
00053     ]
00054
00055   def __init__(self, client, parent):
00056     """\brief Initialize valid registers as Gattrs.
00057     """
00058     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00059
00060   def read(self, reg):
00061     return self.cmdrsp('CRUconReadSync', 'slh', 'LADR_CRU', reg, '!I')
00062
00063   def load(self, reg, value):
00064     return self.cmdrsp('CRUconLoadSync', 'slh', 'LADR_CRU', reg, value)
00065
00066   def send(self, cmd):
00067     return self.cmdrsp('CRUconCmdSync', 'slh', 'LADR_CRU', cmd)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gDb.py Source File

database

gDb.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST functional block base class"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/09/07 21:00:29 $").split(' ')[1]
00015 __version__ = "$Revision: 2.13 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gAttr
00022 from LATTE.client.gNode import Node
00023
00024 class Gdb(Node):
00025   """\brief Base class for all GLAST LAT functional blocks.
00026
00027      Uses __getattr__ and __setattr__ methods to feature an SCL like syntax
00028      for referencing attributes
00029   """
00030   def __init__(self, client, parent, id, valid_attrs=[], addr=None):
00031     """gNode constructor.
00032
00033     \param valid_regs A list of valid attribute names.
00034     """
00035     Node.__init__(self, client)
00036     self.__parent = parent
00037     self.__id = id
00038     if addr is None:
00039       self.__addr = id
00040     else:
00041       self.__addr = addr
00042
00043     attrDict = _regList()
00044     self.__dict__['regs'] = attrDict
00045
00046     #Instantiate all attributes
00047     for attr in valid_attrs:
00048       attrDict[attr.getName()] = attr.create(self)
00049
00050   def up(self):
00051     """Return the parent of this component
00052     """
00053     return self.__parent
00054
00055   def id(self):
00056     """Return the hardware id of this component
00057     """
00058     return self.__id
00059
00060   def addr(self):
00061     """Return the hardware address of this component
00062     """
00063     return self.__addr
00064
00065   def root(self):
00066     """Return the root node in this node's hierarchy
00067
00068     \return The root node
00069     """
00070     root = self
00071     while root.up() is not None:
00072       root = root.up()
00073     return root
00074
00075   def getIdTuple(self):
00076     """Return the node id(s) in this node's hierarchy
00077
00078     \return The root node
00079     """
00080     idtuple = []
00081     root = self
00082     while root.up() is not None:
00083       idtuple.append(root.id())
00084       root = root.up()
00085     idtuple.reverse()
00086     return tuple(idtuple)
00087
00088   def getName(self):
00089     return self.__class__.__name__
00090
00091   def getOpaque(self, name=None):
00092     """\brief Retrieves the named opaque data included in the schema
00093     The opaque data needs to be associated with a node therefore this
00094     method only returns the opaque data that is associated with that
00095     node.
00096
00097     \param  name Name of the opaque XML data (optional)
00098
00099     \return      A list of XML DOM objects matching \a name
00100                  or if \a name is None a dictionary of a list
00101                  of XML DOM objects
00102     """
00103     root = self.root()
00104     rname = root.__class__.__name__
00105     rdict = root.__dict__
00106     opaque = rdict["_" + rname + '__opaque']
00107     if self in opaque:
00108       if name is None:
00109         return opaque[self]
00110       elif name in opaque[self]:
00111         return opaque[self][name]
00112
00113   def getSerialNos(self, component=None):
00114     """\brief Retrieves the serial numbers associated with the node
00115
00116     \param  component Hardware component identifier (optional)
00117
00118     \return           A dictionary matching \a component
00119                       or if \a component is None a dictionary of all
00120                       components and their serial numbers
00121     """
00122     root = self.root()
00123     rname = root.__class__.__name__
00124     rdict = root.__dict__
00125     serialnos = rdict["_" + rname + '__serialnos']
00126     if self in serialnos:
00127       if component is None:
00128         return serialnos[self]
00129       elif component in serialnos[self]:
00130         return {component: serialnos[self][component]}
00131
00132 ## private:
00133 #
00134 #  The following was an attempt to optimize access for mixed case attribute
00135 #  names.  Unfortunately we run into trouble with the tem.regs['configuration']
00136 #  type notation, and with constructs like 'for reg in regs' which returns
00137 #  the attribute in each casing.  We punt on it for now (Thu Aug 19 2004)
00138 #
00139 #   def __setattr__(self, attribute, value):
00140 #     attrDict = self.__dict__
00141 #     if attribute in attrDict:
00142 #       attrDict[attribute] = value
00143 #       return
00144 #     try:
00145 #       regs = attrDict['regs']
00146 #     except KeyError:
00147 #       attrDict[attribute] = value
00148 #       return
00149 #     try:
00150 #       regs[attribute].set(value, 0, self)
00151 #     except KeyError:
00152 #       try:
00153 #         attr = regs[attribute.lower()]
00154 #       except KeyError:
00155 #         raise AttributeError("Attribute " + attribute + " not found")
00156 #       regs[attribute] = attr
00157 #       attr.set(value, 0, self)
00158
00159 #   def __getattr__(self, attribute):
00160 #     attrDict = self.__dict__
00161 #     if attribute in attrDict:
00162 #       return attrDict[attribute]
00163 #     try:
00164 #       regs = attrDict['regs']
00165 #       return regs[attribute].get(0, self)
00166 #     except KeyError:
00167 #       try:
00168 #         attr = regs[attribute.lower()]
00169 #       except KeyError:
00170 #         raise AttributeError("Attribute " + attribute + " not found")
00171 #       regs[attribute] = attr
00172 #       return attr.get(0, self)
00173
00174   def __setattr__(self, attribute, value):
00175     """Gets called when a syntax like 'gtem.configuration = 5' is used"""
00176     attrDict = self.__dict__
00177     try:
00178       regs = attrDict['regs']
00179       if attribute in regs:
00180         regs[attribute].set(value, 0, self)
00181       elif attribute in attrDict:
00182         attrDict[attribute] = value
00183       else:
00184         raise AttributeError("Attribute " + attribute + " not found")
00185     except KeyError:
00186       if 'regs' not in attrDict:
00187         attrDict[attribute] = value
00188       else:
00189         raise AttributeError("Attribute " + attribute + " not found")
00190
00191   def __getattr__(self, attribute):
00192     """Gets called when a syntax like 'print gtem.configuration' is used"""
00193     try:
00194       return self.__dict__['regs'][attribute].get(0, self)
00195     except KeyError:
00196       raise AttributeError("Attribute " + attribute + " not found")
00197
00198 class _regList(dict):
00199   def __init__(self):
00200     dict.__init__(self)
00201
00202   def __getitem__(self, attribute):
00203     return dict.__getitem__(self, attribute.lower())
00204
00205   def __setitem__ (self, attribute, value):
00206     dict.__setitem__(self, attribute.lower(), value)
00207
00208   def get (self, attribute, default=None):
00209     return dict.get(self, attribute.lower(), default)
00210
00211   def has_key(self, attribute):
00212     return dict.has_key(self, attribute.lower())
00213
00214   def __contains__(self, attribute):
00215     return dict.__contains__(self, attribute.lower())
00216
00217
00218 class Children(dict):
00219   BCASTID = 0xff
00220
00221   def __init__(self, parent, type):
00222     dict.__init__(self)
00223     self.__parent = parent
00224     self.__type = type
00225     self.__bcast = None
00226
00227   def remove(self, id):
00228     if id in self:
00229       self.__delitem__(id)
00230     elif id == Children.BCASTID:
00231       self.__bcast = None
00232     else:
00233       print "*** gDb: id %d not found for %s %d" %(id, self.__parent.getName(), self.__parent.id())
00234
00235   def add(self, id):
00236     if id == Children.BCASTID:
00237       if self.__bcast is not None:
00238         print "*** gDb: bcast %s already exists for %s %d" \
00239               %(self.__bcast.getName(),
00240                 self.__parent.getName(), self.__parent.id())
00241       else:
00242         self.__bcast = self.__type(self.__parent.client(), self.__parent, id)
00243         return self.__bcast
00244     elif id in self:
00245       print "*** gDb: child %s %d already exists for %s %d" \
00246             %(self[id].getName(), id,
00247               self.__parent.getName(), self.__parent.id())
00248     else:
00249       self[id] = self.__type(self.__parent.client(), self.__parent, id)
00250       return self[id]
00251
00252   def down(self, id):
00253     if id in self:
00254       return self[id]
00255     elif id == Children.BCASTID:
00256       return self.__bcast
00257     else:
00258       return None
00259
00260   def exists(self, id):
00261     if id in self:
00262       return True
00263     elif id == Children.BCASTID and self.__bcast is not None:
00264       return True
00265     return False
00266
00267   def all(self):
00268     return self.__bcast
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEBM.py Source File

database

gEBM.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST EBM functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/10/21 21:38:29 $").split(' ')[1]
00015 __version__ = "$Revision: 2.6 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022 import gAttr
00023
00024 class GEBM(gDb.Gdb):
00025   """\brief GEBM node.
00026
00027   """
00028   __attrs = []
00029
00030   def __init__(self, client, parent):
00031     """\brief Initialize child objects.
00032
00033     """
00034     self.EBMC = None
00035     self.EBMST = None
00036     gDb.Gdb.__init__(self, client, parent, 0)
00037
00038   def downEBMC(self):
00039     """\brief Navigate to the GEBMC node.
00040
00041     \return         The GEBMC object instance
00042     """
00043     return self.EBMC
00044
00045   def existsEBMC(self):
00046     """\brief Check if the GEBMC instance exists in the schema.
00047
00048     \return       1 if it exists, 0 if it doesn't.
00049     """
00050     return self.EBMC != None
00051
00052   def downEBMST(self):
00053     """\brief Navigate to the GEBMST node.
00054
00055     \return         The GEBMST object instance
00056     """
00057     return self.EBMST
00058
00059   def existsEBMST(self):
00060     """\brief Check if the GEBMS instance exists in the schema.
00061
00062     \return       1 if it exists, 0 if it doesn't.
00063     """
00064     return self.EBMST != None
00065
00066 ## private:
00067
00068   def __removeEBMC(self):
00069     self.EBMC = None
00070
00071   def __addEBMC(self):
00072     gebmc = GEBMC(self.client(), self)
00073     self.EBMC = gebmc
00074     return gebmc
00075
00076   def __removeEBMST(self):
00077     self.EBMST = None
00078
00079   def __addEBMST(self):
00080     gebmst = GEBMST(self.client(), self)
00081     self.EBMST = gebmst
00082     return gebmst
00083
00084
00085 class GEBMC(gDb.Gdb):
00086   """\brief EBM Controller node.
00087
00088   Has GEBMC specific registers.
00089
00090   Valid Registers:
00091   - \c back_end_config
00092   - \c front_end_a_config
00093   - \c front_end_b_config
00094   - \c address
00095   - \c sources
00096   - \c input_enables
00097   - \c output_enables
00098   - \c timeout
00099   - \c tem_statistics
00100   - \c cr_statistics
00101
00102   Dataless Commands:
00103   - \c cmd_nop
00104   - \c cmd_reset
00105
00106   """
00107   __attrs = [
00108     # Registers
00109     gAttr.GattrRaw('back_end_config',     0, 4),
00110     gAttr.GattrRaw('front_end_a_config',  1, 4),
00111     gAttr.GattrRaw('front_end_b_config',  2, 4),
00112     gAttr.GattrRaw('address',             3, 4),
00113     gAttr.GattrRaw('sources',             4, 4),
00114     gAttr.GattrRaw('input_enables',       5, 4),
00115     gAttr.GattrRaw('output_enables',      6, 4),
00116     gAttr.GattrRaw('timeout',             7, 4),
00117     gAttr.GattrRaw('tem_statistics',      8, 4),
00118     gAttr.GattrRaw('cr_statistics',       9, 4),
00119     # Dataless Commands
00120     gAttr.GattrDlc('cmd_nop',             0, 0),
00121     gAttr.GattrDlc('cmd_reset',           1, 0),
00122     ]
00123
00124   def __init__(self, client, parent):
00125     """\brief Initialize valid registers as Gattrs
00126     """
00127     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00128
00129   def read(self, reg):
00130     return self.cmdrsp('EBMconReadSync', 'slh', 'LADR_EBM', reg, '!I')
00131
00132   def load(self, reg, value):
00133     return self.cmdrsp('EBMconLoadSync', 'slh', 'LADR_EBM', reg, value)
00134
00135   def send(self, cmd):
00136     return self.cmdrsp('EBMconCmdSync', 'slh', 'LADR_EBM', cmd)
00137
00138
00139 class GEBMST(gDb.Gdb):
00140   """\brief EBM Event Statistics node.
00141
00142   Has GEBMST specific registers.
00143
00144   Valid Registers:
00145   - \c receive_gem
00146   - \c receive_aem
00147   - \c receive_siu0
00148   - \c receive_siu1
00149   - \c receive_epu0
00150   - \c receive_epu1
00151   - \c receive_epu2
00152   - \c receive_siu2
00153   - \c receive_tem_mux0
00154   - \c receive_tem_mux1
00155   - \c transmit_siu0
00156   - \c transmit_siu1
00157   - \c transmit_epu0
00158   - \c transmit_epu1
00159   - \c transmit_epu2
00160   - \c transmit_siu2
00161   - \c transmit_ssr
00162
00163   Dataless Commands:
00164   - \c cmd_reset
00165
00166   """
00167   __attrs = [
00168     # Registers
00169     gAttr.GattrRaw('receive_gem',          0, 4),
00170     gAttr.GattrRaw('receive_aem',          1, 4),
00171     gAttr.GattrRaw('receive_siu0',         2, 4),
00172     gAttr.GattrRaw('receive_siu1',         3, 4),
00173     gAttr.GattrRaw('receive_epu0',         4, 4),
00174     gAttr.GattrRaw('receive_epu1',         5, 4),
00175     gAttr.GattrRaw('receive_epu2',         6, 4),
00176     gAttr.GattrRaw('receive_siu2',         7, 4),
00177     gAttr.GattrRaw('receive_tem_mux0',    16, 4),
00178     gAttr.GattrRaw('receive_tem_mux1',    17, 4),
00179     gAttr.GattrRaw('transmit_siu0',       32, 4),
00180     gAttr.GattrRaw('transmit_siu1',       33, 4),
00181     gAttr.GattrRaw('transmit_epu0',       34, 4),
00182     gAttr.GattrRaw('transmit_epu1',       35, 4),
00183     gAttr.GattrRaw('transmit_epu2',       36, 4),
00184     gAttr.GattrRaw('transmit_siu2',       37, 4),
00185     gAttr.GattrRaw('transmit_ssr',        38, 4),
00186     gAttr.GattrRaw('cr_statistics',        9, 4),
00187     # Dataless Commands
00188     gAttr.GattrDlc('cmd_reset',            0, 0),
00189     ]
00190
00191   def __init__(self, client, parent):
00192     """\brief Initialize valid registers as Gattrs.
00193
00194     """
00195     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00196
00197   def read(self, reg):
00198     return self.cmdrsp('EBMstatReadSync', 'slh', 'LADR_EBM', reg, '!I')
00199
00200   def send(self, cmd):
00201     return self.cmdrsp('EBMstatCmdSync', 'slh', 'LADR_EBM', cmd)
00202
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEGU.py Source File

database

gEGU.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Classes for handling raw/engineering unit (EGU) oconversions"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/11 03:10:09 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021
00022 class GEGU(object):
00023   """\brief Base class for raw/engineering unit conversions.
00024
00025   """
00026   def __init__(self, units):
00027     self.__units  = units
00028
00029   def egu(self, value):
00030     """Overloadable method for converting raw units to engineering units
00031
00032     \param value Value in raw units.
00033
00034     \return Engineering units value after the conversion.
00035
00036     """
00037     return value
00038
00039   def raw(self, value):
00040     """Overloadable method for converting engineering units to raw units
00041
00042     \param value Value in engineering units.
00043
00044     \return Raw value after the conversion.
00045
00046     """
00047     return value
00048
00049   def units(self):
00050     """Method for returning the units string
00051
00052     \return Units string value.
00053
00054     """
00055     return self.__units
00056
00057
00058 class GEGU_linear(GEGU):
00059   """\brief EGU class for performing linear conversions.
00060
00061   """
00062   def __init__(self, slope, intercept, units=""):
00063     """Initialize a raw/EGU linear conversion object.
00064
00065       \param slope     Number of engineering unit counts per raw value tick
00066       \param intercept Offset in units of the engineering unit
00067       \param units     The engineering units name, e.g. 'cm'
00068
00069     """
00070     assert slope, "GEGU_linear.__init__: slope argument cannot be zero"
00071     GEGU.__init__(self, units)
00072     self.__slope     = slope
00073     self.__intercept = intercept
00074
00075   def egu(self, rawValue):
00076     """Convert a value in raw units to engineering units
00077
00078     \param rawValue Value in raw units.
00079
00080     \return Engineering units value after the conversion.
00081
00082     """
00083
00084     # Compensate for some pseudo quantities (like PSD_TEM_0)
00085     # where the rawValue may be received as a large positive
00086     # value although it is negative.
00087     if rawValue >= (1 << 31L):
00088       rawValue = rawValue - (1 << 32L)
00089
00090     return rawValue * self.__slope + self.__intercept
00091
00092   def raw(self, eguValue):
00093     """Convert a value in engineering units to raw units
00094
00095     \param eguValue Value in engineering units.
00096
00097     \return Raw value after the conversion.
00098
00099     """
00100     return int(round((eguValue - self.__intercept) / self.__slope))
00101
00102 class GEGU_poly3(GEGU):
00103   """\brief EGU class for performing 3rd degree polynominal conversions.
00104
00105   """
00106   def __init__(self, coeff0, coeff1, coeff2, coeff3, offset, units=""):
00107     """Initialize a raw/EGU linear conversion object.
00108
00109     \param slope     Number of engineering unit counts per raw value tick
00110     \param intercept Offset in units of the engineering unit
00111     \param units     The engineering units name, e.g. 'cm'
00112
00113     """
00114 #    assert slope, "GEGU_linear.__init__: slope argument cannot be zero"
00115     GEGU.__init__(self, units)
00116     self.__coeff0 = coeff0
00117     self.__coeff1 = coeff1
00118     self.__coeff2 = coeff2
00119     self.__coeff3 = coeff3
00120     self.__offset = offset
00121
00122   def egu(self, rawValue):
00123     """Convert a value in raw units to engineering units
00124
00125     \param rawValue Value in raw units
00126
00127     \return Engineering units value after the conversion.
00128
00129     """
00130     return self.__coeff0 + self.__coeff1*(rawValue-self.__offset) + self.__coeff2*(rawValue-self.__offset)**2 + self.__coeff3*(rawValue-self.__offset)**3
00131
00132   def raw(self, eguValue):
00133     """Convert a value in engineering units to raw units
00134
00135     \param eguValue Value in engineering units.
00136
00137     \return Raw value after the conversion.
00138
00139     """
00140     return 0
00141
00142
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gEvtCli.py Source File

client

gEvtCli.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 ## \namespace evtCli
00011 ##
00012 ## \brief Event handler classes
00013 ##
00014 ##  Event objects:
00015 ##
00016 ##    The following list contains the objects populated during parsing.
00017 ##    Please refer to the individual classes to find out how to access
00018 ##    event data stored in these objects:
00019 ##
00020 ##    - CAL_LogAccepts   -- List of evCAL_LogAccepts
00021 ##
00022 ##    - CAL_LogData      -- List of evCAL_LayerLogData
00023 ##
00024 ##    - TKRstrips        -- List of evTKR_StripData
00025 ##
00026 ##    - TKRaccepts       -- List of int
00027 ##
00028 ##    - TKRtots          -- List of evTKR_TOTdata
00029 ##
00030 ##    - diag             -- evDiag_Data
00031 ##
00032 ##    - errSummary       -- evErr_Summary
00033 ##
00034 ##    - errGCCCmsg       -- List of evErr_GCCC_Message
00035 ##
00036 ##    - errGTCCmsg       -- List of evErr_GTCC_Message
00037 ##
00038 ##    - errCablePhase    -- evErr_CablePhase
00039 ##
00040 ##    - errCableTimeOut  -- evErr_CableTimeOut
00041 ##
00042 ##    - aem              -- AEM
00043 ##
00044 ##    - aem.PHA          -- Dictionary of evAEM_PHA indexed by cable number
00045 ##
00046 ##    - gem              -- GEM
00047 ##
00048 ##    - gem.vetoList     -- evGEM_Veto_List
00049
00050 __facility__ = "Online"
00051 __abstract__ = "Event handler client"
00052 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00053 __date__     = ("$Date: 2005/01/14 01:12:57 $").split(' ')[1]
00054 __version__  = "$Revision: 2.28.2.1 $"
00055 __release__  = "$Name: P04-06-05 $"
00056 __credits__  = "SLAC"
00057
00058 import LATTE.copyright_SLAC
00059
00060 import          sys
00061 import          struct
00062 import          select
00063 import          traceback
00064 import logging  as     log
00065 from string     import *
00066 from os         import *
00067 from time       import sleep, time, gmtime, asctime
00068 from operator   import isNumberType
00069 from math       import modf
00070
00071 from gLog import logStack, logException
00072 from gException import LATInterfaceStatus
00073 from gBits import BitField, q, hexConvert
00074 from gSocket import Socket
00075
00076 N_GCCC =  4
00077 N_GCRC =  4
00078 N_GCFE = 12
00079
00080 N_GTCC =  8
00081 N_GTRC =  9
00082 N_GTFE = 24
00083
00084 N_GARC = 12
00085 N_GAFE = 18
00086
00087 GTCC_MAP     = [6, 3, 7, 2, 5, 0, 4, 1]
00088 GTCC_ERR_MAP = [3, 6, 2, 7, 0, 5, 1, 4]
00089
00090 GCCC_MAP = [0, 2, 3, 1]
00091
00092 # AEM class
00093 class AEM(object):
00094   """\brief AEM event object
00095
00096   Members:
00097   - \c vetoHitVectors
00098   - \c acceptHitVectors
00099   - \c PHA
00100
00101   """
00102   EV_AEM_VETO = 1
00103   EV_AEM_ZEROSUP = 2
00104
00105   def __init__(self):
00106     self.clearEvent()
00107
00108   def clearEvent(self):
00109     """\brief Initialize accept and veto hit vectors
00110
00111     """
00112     self.vetoHitVectors = [0]*N_GARC
00113     self.acceptHitVectors = [0]*N_GARC
00114     self.PHA = {}
00115     for cbl in range(N_GARC):
00116       self.PHA[cbl] = []
00117
00118   def addPHA(self, cbl, pha):
00119     """\brief Adds a PHA value.
00120
00121     Called from evDumpAEM_PHA
00122
00123     \param cbl Cable number
00124     \param pha 16 bit PHA value
00125     """
00126     self.PHA[cbl].append(pha)
00127
00128 class evAEM_PHA(BitField):
00129   """\brief PHA object
00130
00131   Bit Fields:
00132   - \c more
00133   - \c range
00134   - \c ADC
00135   - \c parityErr
00136
00137   """
00138   evAEM_PHA_BF =  [
00139                     ('more',         14, 15),
00140                     ('range',        13, 14),
00141                     ('ADC',           1, 13),
00142                     ('parityErr',     0,  1)
00143                   ]
00144   def __init__(self, ui):
00145     BitField.__init__(self, ui, self.evAEM_PHA_BF)
00146
00147 class GEM(object):
00148   """\brief GEM event object.
00149
00150   Members:
00151   - \c ROI_Vector
00152   - \c TKR_Vector
00153   - \c CAL_HE_Vector
00154   - \c CAL_LE_Vector
00155   - \c triggerSummary
00156   - \c CNO_Vector
00157   - \c vetoList
00158   - \c liveTime
00159   - \c busy
00160   - \c prescaled
00161   - \c sent
00162   - \c triggerTime
00163   - \c onePPSTime
00164
00165   """
00166   def __init__(self):
00167     self.vetoList = evGEM_Veto_List()
00168     self.clear()
00169
00170   def clear(self):
00171     self.ROI_Vector = 0
00172     self.TKR_Vector = 0
00173     self.CAL_HE_Vector = 0
00174     self.CAL_LE_Vector = 0
00175     self.triggerSummary = 0
00176     self.CNO_Vector = 0
00177     self.vetoList.clear()
00178     self.liveTime = 0
00179     self.busy = 0
00180     self.prescaled = 0
00181     self.sent = 0
00182     self.triggerTime = 0
00183     self.onePPSTime = 0
00184
00185 class evGEM_Veto_List(object):
00186   """\brief GEM Veto List object.
00187
00188   Members:
00189   - \c XZP
00190   - \c XZM
00191   - \c YZP
00192   - \c YZM
00193   - \c XY
00194   - \c NA
00195   - \c RBN
00196
00197   """
00198   def __init__(self):
00199     self.clear()
00200
00201   def clear(self):
00202     self.XZP = 0
00203     self.XZM = 0
00204     self.YZP = 0
00205     self.YZM = 0
00206     self.XY  = 0
00207     self.NA  = 0
00208     self.RBN = 0
00209
00210
00211 class Evt(object):
00212   """\brief Event object
00213
00214   Members:
00215   - \c aem
00216   - \c gem
00217   - \c contributor
00218   - \c summary
00219   - \c TKRstrips
00220   - \c TKRaccepts
00221   - \c TKRtots
00222   - \c CAL_LogAccepts
00223   - \c CAL_LogData
00224   - \c diag
00225   - \c errSummary
00226   - \c errGCCCmsg
00227   - \c errGTCCmsg
00228   - \c errCablePhase
00229   - \c errCableTimeOut
00230
00231   """
00232   def __init__(self):
00233     """\brief Event object constructor.
00234
00235     Instantiate the AEM object and clear the event.
00236     """
00237     self.aem = AEM()
00238 ## New Event Format
00239     self.gem = GEM()
00240 ##
00241     self.clearEvent()
00242
00243   def clearEvent(self):
00244     """\brief Clear the event data
00245
00246     """
00247     self.contributor = None
00248     self.summary = None
00249     self.TKRstrips = []
00250     self.TKRaccepts = []
00251     self.TKRtots = []
00252     self.CAL_LogAccepts = []
00253     self.CAL_LogData = []
00254     self.diag = None
00255     self.errSummary = None
00256     self.errGCCCmsg = []
00257     self.errGTCCmsg = []
00258     self.errCablePhase = None
00259     self.errCableTimeOut = None
00260
00261   def addTKRstrip(self, cc, rc, strip):
00262     """\brief Add a stripData to the tracker strip hit list of evTKR_StripData objects.
00263
00264     \param cc    Cable controller id
00265     \param rc    Readout controller id
00266     \param strip evTKR_Strip object instance
00267     """
00268     self.TKRstrips.append(evTKR_StripData(cc, rc, strip))
00269
00270   def addTKRaccept(self, accept):
00271     """\brief Add a TKR accept to the list
00272
00273     \param 9-bit TKR accept value
00274     """
00275     self.TKRaccepts.append(accept)
00276
00277   def addTKRtot(self, cc, rc, tot):
00278     """\brief Add a TKR tot to the list of evTKR_TOTdata objects.
00279
00280     \param cc    Cable controller id
00281     \param rc    Readout controller id
00282     \param tot   8-bit tot value
00283     """
00284     self.TKRtots.append(evTKR_TOTdata(cc, rc, tot))
00285
00286   def addCAL_LogAccept(self, accept):
00287     """\brief Add a log accept to the list
00288
00289     \param accept An evCAL_LogAccepts object instance
00290     """
00291     self.CAL_LogAccepts.append(accept)
00292
00293   def addCAL_LogData(self, twr, layer, data):
00294     """\brief Add a log data to the list
00295
00296     \param layer A layer id in the form of 'x1', 'y1', etc.
00297     \param data  An evCAL_LogData object instance
00298     """
00299     self.CAL_LogData.append(evCAL_LayerLogData(twr, layer, data))
00300
00301   def addErrGCCCmsg(self, errGCCC):
00302     """\brief Add a GCCC error contribution to the event object
00303
00304     \param errGCCC An evErr_GCCC object instance
00305     """
00306     self.errGCCCmsg.append(errGCCC)
00307
00308   def addErrGTCCmsg(self, errGTCCmsg):
00309     """\brief Add a GTCC error message to the event object
00310
00311     \param errGTCCmsg An evErr_GTCC_Message object instance
00312     """
00313     self.errGTCCmsg.append(errGTCCmsg)
00314
00315 class evErr_Summary(BitField):
00316   """\brief Error summary bitfields
00317
00318   Bit Fields:
00319   - \c cblTimeOut
00320   - \c cblPhsErr
00321   - \c gtccErr
00322   - \c gcccErr
00323
00324   """
00325   evErr_Summary_BF =  [
00326                         ('cblTimeOut',  13, 14),
00327                         ('cblPhsErr',   12, 13),
00328                         ('gtccErr',      4, 12),
00329                         ('gcccErr',      0,  4)
00330                       ]
00331   def __init__(self, ui):
00332     BitField.__init__(self, ui, self.evErr_Summary_BF)
00333
00334 class evSummary(BitField):
00335   """\brief Event summary bitfields
00336
00337   Bit Fields:
00338   - \c startbit
00339   - \c calStrobe
00340   - \c tag
00341   - \c TACK
00342   - \c readout4
00343   - \c zeroSuppress
00344   - \c marker
00345   - \c error
00346   - \c diag
00347   - \c evNumber
00348   - \c trgParityErr
00349
00350   """
00351   evSummary_BF =  [
00352                     ('startbit ',     31, 32),
00353                     ('calStrobe',     30, 31),
00354                     ('tag',           28, 30),
00355                     ('TACK',          27, 28),
00356                     ('readout4',      26, 27),
00357                     ('zeroSuppress',  25, 26),
00358                     ('marker',        22, 25),
00359                     ('error',         21, 22),
00360                     ('diag',          20, 21),
00361                     ('evNumber',       1, 16),
00362                     ('trgParityErr',   0,  1)
00363                   ]
00364   def __init__(self, ui):
00365     BitField.__init__(self, ui, self.evSummary_BF)
00366
00367 class evSummary_Singleton(evSummary):
00368   def __init__(self, ui):
00369     evSummary.__init__(self, ui)
00370
00371   def __call__(self, ui):
00372     self.set(ui)
00373     return self
00374
00375 class evContPacket(BitField):
00376   """\brief Contribution Packet bitfields
00377
00378   Bit Fields:
00379   - \c error
00380   - \c sequence
00381   - \c length
00382
00383   """
00384   evContPacket_BF = [
00385                     ('error',     13, 16),
00386                     ('sequence',   8, 13),
00387                     ('length',     0,  8),
00388                   ]
00389   def __init__(self, ui):
00390     BitField.__init__(self, ui, self.evContPacket_BF)
00391
00392 class evContPacket_Singleton(evContPacket):
00393   def __init__(self, ui):
00394     evContPacket.__init__(self, ui)
00395
00396   def __call__(self, ui):
00397     self.set(ui)
00398     return self
00399
00400 class evTKR_TOTdata(object):
00401   """\brief TKR TOT data class
00402
00403   Members:
00404   - \c tot
00405   - \c cc
00406   - \c rc
00407
00408   """
00409   def __init__(self, cc, rc, tot):
00410     """\brief evTKR_TOTdata constructor
00411
00412     \param cc  Cable controller id
00413     \param rc  Readout controller id
00414     \param tot 8-bit TOT value
00415
00416     """
00417     self.tot = tot
00418     self.cc = cc
00419     self.rc = rc
00420
00421 class evTKR_Strip(BitField):
00422   """\brief TKR strip bitfields
00423
00424   Bit Fields:
00425   - \c done
00426   - \c gtfe
00427   - \c strip
00428
00429   """
00430   evTKR_Strip_BF =  [
00431                       ('done',    11, 12),
00432                       ('gtfe',     6, 11),
00433                       ('strip',    0,  6)
00434                     ]
00435   def __init__(self, ui):
00436     BitField.__init__(self, ui, self.evTKR_Strip_BF)
00437
00438 class evTKR_StripData(object):
00439   """\brief TKR StripData class
00440
00441   Members:
00442   - \c cc
00443   - \c rc
00444   - \c strip
00445
00446   """
00447   def __init__(self, cc, rc, strip):
00448     """\brief evTKR_StripData constructor
00449
00450     \param cc    Cable controller id
00451     \param rc    Readout controller id
00452     \param strip An evTKR_Strip object instance
00453     """
00454     self.strip = strip
00455     self.cc = cc
00456     self.rc = rc
00457
00458 class evCAL_LogAccepts(BitField):
00459   """\brief Log Accepts bitfields
00460
00461   Bit Fields:
00462   - \c y3
00463   - \c y2
00464   - \c y1
00465   - \c y0
00466   - \c x3
00467   - \c x2
00468   - \c x1
00469   - \c x0
00470
00471   """
00472   evCAL_LogAccepts_BF = [
00473                           ('y3',    28, 32),
00474                           ('y2',    24, 28),
00475                           ('y1',    20, 24),
00476                           ('y0',    16, 20),
00477                           ('x3',    12, 16),
00478                           ('x2',     8, 12),
00479                           ('x1',     4,  8),
00480                           ('x0',     0,  4)
00481                         ]
00482   def __init__(self, twr, ui):
00483     BitField.__init__(self, ui, self.evCAL_LogAccepts_BF)
00484     self.twr = twr
00485
00486 class evCAL_LayerLogData(object):
00487   """\brief Class that associates a layer with the log data
00488
00489   """
00490   def __init__(self, twr, layer, data):
00491     """\brief evCAL_LayerLogData constructor
00492
00493     \param layer CAL layer (such as 'x1', 'y1', etc)
00494     \param data  evCAL_LogData bitfield
00495     """
00496     self.twr   = twr
00497     self.layer = layer
00498     self.data  = data
00499
00500 class evCAL_LogData(BitField):
00501   """\brief Log Data bitfields
00502
00503   Bit Fields:
00504   - \c column
00505   - \c rangeADC_neg
00506   - \c valADC_neg
00507   - \c rangeADC_pos
00508   - \c valADC_pos
00509
00510   """
00511   evCAL_LogData_BF =  [
00512                         ('column',       28, 32),
00513                         ('rangeADC_neg', 26, 28),
00514                         ('valADC_neg',   14, 26),
00515                         ('rangeADC_pos', 12, 14),
00516                         ('valADC_pos',    0, 12)
00517                       ]
00518   def __init__(self, ui):
00519     BitField.__init__(self, ui, self.evCAL_LogData_BF)
00520
00521 class evDiag_CalLayerEnd(BitField):
00522   """\brief Calorimeter Layer End bitfields
00523
00524   Bit Fields:
00525   - \c trgRequestHigh
00526   - \c trgRequestLow
00527   - \c logAccepts
00528
00529   """
00530   evDiag_CalLayerEnd_BF =   [
00531                               ('trgRequestHigh',  13, 14),
00532                               ('trgRequestLow',   12, 13),
00533                               ('logAccepts',       0, 12)
00534                             ]
00535   def __init__(self, ui):
00536     BitField.__init__(self, ui, self.evDiag_CalLayerEnd_BF)
00537
00538 class evDiag_CalLayer:
00539   """\brief Calorimeter Layer class
00540
00541   Members:
00542   - \c gccc
00543   - \c layer
00544   - \c negLayerEnd
00545   - \c posLayerEnd
00546
00547   """
00548   def __init__(self):
00549     self.gccc        = None
00550     self.layer       = None
00551     self.negLayerEnd = evDiag_CalLayerEnd(0)
00552     self.posLayerEnd = evDiag_CalLayerEnd(0)
00553
00554
00555 class evDiag_TkrTrgReq(BitField):
00556   """\brief TKR Trigger Request bitfields
00557
00558   Members:
00559   - \c gtcc
00560
00561   Bit Fields:
00562   - \c trgRequests
00563
00564   """
00565   evDiag_TkrTrgReq_BF =   [
00566                             ('trgRequests',  0, 9)
00567                           ]
00568   def __init__(self, ui):
00569     BitField.__init__(self, ui, self.evDiag_TkrTrgReq_BF)
00570     self.gtcc = None
00571
00572 class evErr_GCCC(BitField):
00573   """\brief GCCC Error bitfields
00574
00575   Bit Fields:
00576
00577   - \c errParm
00578   - \c sweepNum
00579   - \c errType
00580
00581   """
00582   evErr_GCCC_BF =   [
00583                       ('errParm',   8, 16),
00584                       ('sweepNum',  6,  8),
00585                       ('errType',   0,  4)
00586                     ]
00587   def __init__(self, ui):
00588     BitField.__init__(self, ui, self.evErr_GCCC_BF)
00589
00590 class evErr_GCCC_Message(object):
00591   """\brief GCCC Error Message object
00592
00593   Members:
00594   - \c gccc
00595   - \c errGCCC
00596
00597   """
00598   def __init__(self, gccc, errGCCC):
00599     """\brief evErr_GCCC_Message constructor
00600
00601     \param gccc    GCCC id
00602     \param errGCCC evErr_GCCC object instance
00603     """
00604     self.gccc       = gccc
00605     self.errGCCC    = errGCCC
00606
00607 class evErr_CablePhase(BitField):
00608   """\brief Cable Controller Phasing Error bitfields
00609
00610   Bit Fields:
00611   - \c tag7
00612   - \c tag6
00613   - \c tag5
00614   - \c tag4
00615   - \c tag3
00616   - \c tag2
00617   - \c tag1
00618   - \c tag0
00619
00620   """
00621   evErr_CablePhase_BF = [
00622                           ('tag7', 14, 16),
00623                           ('tag6', 12, 14),
00624                           ('tag5', 10, 12),
00625                           ('tag4',  8, 10),
00626                           ('tag3',  6,  8),
00627                           ('tag2',  4,  6),
00628                           ('tag1',  2,  4),
00629                           ('tag0',  0,  2)
00630                         ]
00631   def __init__(self, ui):
00632     BitField.__init__(self, ui, self.evErr_CablePhase_BF)
00633
00634 class evErr_GTCC(BitField):
00635   """\brief GTCC Error bitfields
00636
00637   Bit Fields:
00638   - \c dataParity
00639   - \c GTRCsum
00640   - \c wrdCntParity
00641   - \c hdrParity
00642   - \c cblTimeOut
00643   - \c fifoFull
00644   - \c phsGTFE
00645   - \c phsGTRC
00646   - \c nGTRC
00647
00648   """
00649   evErr_GTCC_BF =   [
00650                       ('dataParity',    15, 16),
00651                       ('GTRCsum',       14, 15),
00652                       ('wrdCntParity',  13, 14),
00653                       ('hdrParity',     12, 13),
00654                       ('cblTimeOut',    11, 12),
00655                       ('fifoFull',      10, 11),
00656                       ('phsGTFE',        9, 10),
00657                       ('phsGTRC',        8,  9),
00658                       ('nGTRC',          0,  8)
00659                     ]
00660   def __init__(self, ui):
00661     BitField.__init__(self, ui, self.evErr_GTCC_BF)
00662
00663 class evErr_GTCC_Message(object):
00664   """\brief GTCC Error Message object
00665
00666   Members:
00667   - \c gtcc
00668   - \c errGTCC
00669   - \c parameters
00670
00671   """
00672   def __init__(self):
00673     self.gtcc       = None
00674     self.errGTCC    = None
00675     self.parameters = {}
00676
00677
00678 class evErr_CableTimeOut(BitField):
00679   """\brief Cable Timeout Error bitfields
00680
00681   Bit Fields:
00682   - \c tkr
00683   - \c cal
00684
00685   """
00686   evErr_CableTimeOut_BF = [
00687                             ('tkr',  4, 12),
00688                             ('cal',  0,  4)
00689                           ]
00690   def __init__(self, ui):
00691     BitField.__init__(self, ui, self.evErr_CableTimeOut_BF)
00692
00693
00694 class evDiag_Data(object):
00695   """\brief Diagnostic Data class
00696
00697   Members:
00698   - \c cal
00699   - \c tkr
00700
00701   """
00702   size = 48 # 8*(4 + 2)
00703   def __init__(self):
00704     self.cal = []
00705     self.tkr = []
00706     for i in range(8):
00707       inst = evDiag_CalLayer()
00708       self.cal.append(inst)
00709       inst = evDiag_TkrTrgReq(0)
00710       self.tkr.append(inst)
00711
00712 class evCellHeader(BitField):
00713   """\brief Cell Header bitfields
00714
00715   Bit Fields:
00716   - \c respond
00717   - \c destination
00718   - \c protocol
00719   - \c source
00720   - \c parity
00721
00722   """
00723   evCellHeader_BF = [
00724                       ('respond',    15, 16),
00725                       ('destination', 9, 15),
00726                       ('protocol',    7,  9),
00727                       ('source',      1,  7),
00728                       ('parity',      0,  1),
00729                     ]
00730   def __init__(self, ui):
00731     BitField.__init__(self, ui, self.evCellHeader_BF)
00732
00733 class evCellHeader_Singleton(evCellHeader):
00734   def __init__(self, ui):
00735     evCellHeader.__init__(self, ui)
00736
00737   def __call__(self, ui):
00738     self.set(ui)
00739     return self
00740
00741
00742 class EvtCliIO(Socket):
00743   """\brief Event client input/output class
00744
00745 \b Contents:
00746
00747   This base class contains all the input/output handling routines for the event client (EvtCli) class.
00748
00749   """
00750
00751   EVENT_SRC_SOCK = 0
00752   EVENT_SRC_FILE = 1
00753   PortNumber = 2001
00754
00755   def __init__(self, debug):
00756     Socket.__init__(self, EvtCliIO.PortNumber)
00757     self.read                = None
00758     self.__abort             = 0
00759     self.__timeout           = 1        # !!!!
00760     self.__timeoutEnabled    = 0
00761     self.__debugErrorOutput  = debug & (EvtCli.DEBUG_ALL | EvtCli.DEBUG_ERROR_OUTPUT)
00762
00763   def connect(self, host):
00764     Socket.connect(self, host)
00765     self.read = self.readSocket
00766
00767   def setSocket(self, sock):
00768     Socket.setSocket(self, sock)
00769     self.read = self.readSocket
00770
00771   def readSocket(self):
00772     """\brief The 'lightweight' event read routine.
00773
00774     This routine does the minimal work of reading the raw
00775     event data from a file or a socket.
00776
00777     \return Event buffer read
00778     """
00779     self.__abort = 0
00780     while not self.__abort:
00781       rd, wr, ex = select.select([self.socket()], [], [], self.__timeout)
00782       if rd:
00783         dat = self.recvall(28)
00784         header = struct.unpack('!7L', dat)
00785         numLeft = header[2] - 24
00786         dat += self.recvall(numLeft)
00787         return (header, dat[4:])
00788       elif self.__timeoutEnabled:
00789         raise IOError, "Event read timeout"
00790
00791 #       try:
00792 #         dat = self.recvall(28)
00793 #         header = struct.unpack('!7L', dat)
00794 #         numLeft = header[2] - 24
00795 #         dat += self.recvall(numLeft)
00796 #         return (header, dat[4:])
00797 #       except Exception, e:
00798 #         if str(e) == "timed out": # Yuck! This doesn't follow the normal pattern
00799 #           if self.__timeoutEnabled:
00800 #             raise IOError, "Event read timed out"
00801 #         else:
00802 #           raise e
00803 #     return None
00804
00805 #       rd, wr, ex = select.select([self.socket()], [], [], self.__timeout)
00806 #       if rd:
00807 #         dat = self.recvall(24)
00808 #         header = struct.unpack('!LLLLLL', dat)
00809 #         numLeft = (header[2] & 0xFFFF) - 20
00810 #         dat += self.recvall(numLeft)
00811 #         return (header, dat[4:])
00812 #       elif self.__timeoutEnabled:
00813 #         raise IOError, "Event read timeout"
00814
00815
00816   def setEventMode(self, mode):
00817     raise RuntimeError, "*** setEventMode deprecated, use gOCS methods instead"
00818
00819   def setUserParm(self, parm):
00820     raise RuntimeError, "*** setUserParm deprecated, use gOCS methods instead"
00821
00822   def readFile(self):
00823     """\brief Read the event from a file.
00824
00825     """
00826     # The archive file includes the first two datagram words
00827     dat = self.__f.read(20)
00828     header = (0,)
00829     header += struct.unpack('!LLLLL', dat)
00830     numLeft = (header[2] & 0xFFFF) - 20
00831     dat += self.__f.read(numLeft)
00832     return (header, dat)
00833
00834   def open(self,filename):
00835     """\brief Open the event archive file for input.
00836
00837     \param filename Event archive file name
00838     """
00839     self.__f=file(filename,'r+b')
00840     self.read = self.readFile
00841
00842   def close(self):
00843     """\brief Close the event source file.
00844     """
00845     self.__f.close()
00846
00847   def abort(self):
00848     """\brief Abort out of a readEvent().
00849
00850     Can be used from another thread
00851     """
00852     self.__abort = 1
00853
00854   def setTimeoutEnabled(self, flag):
00855     """\brief Enable or disable event timeout
00856
00857     \param flag 1 = Enable event timeout
00858                 0 = Disable event timeout (default)
00859     """
00860     self.__timeoutEnabled = flag;
00861
00862   def isTimeoutEnabled(self):
00863     """\brief Checks the event timeout state
00864
00865     \return 1 = If event timeout is enabled
00866             0 = If event timeout is disabled
00867     """
00868     return self.__timeoutEnabled
00869
00870   def setTimeout(self, timeout = 1.0):
00871     """\brief Set the timeout value.
00872
00873     \param timeout Event timeout value as a floating point number in seconds.
00874                    Default is 1 second.  Use 'None' to disable the timeout.
00875     """
00876     #self.__timeout = timeout
00877     self.socket().settimeout(timeout)
00878
00879   def getTimeout(self):
00880     """\brief Query the current timeout value.
00881
00882     \return Current event timeout value as a floating point number in seconds
00883     """
00884     #return self.__timeout
00885     return self.socket().gettimeout()
00886
00887   def unpack(self, fmt, str):
00888     """\brief Wrapper method for unpack
00889
00890     \param  fmt Unpack format
00891     \param  str String to be unpacked
00892
00893     \return     Unpacked data tuple
00894     """
00895     try:
00896       result = struct.unpack(fmt, str)
00897     except:
00898       if self.__debugErrorOutput:
00899         logException()
00900         logStack()
00901       return ()
00902     else:
00903       return result
00904
00905
00906 class EvtCli(EvtCliIO):
00907   """\brief Event handler client
00908
00909 \b Contents:
00910
00911   Receives an event from TCP socket or a file stream and
00912   parses it into the evt object.
00913
00914 \b Overview:
00915
00916   The event client is responsible for communicating with the event server
00917   and retrieve events triggered by a script or an external source.
00918   The source of the event can be either a TCP socket or an archive file.
00919
00920   The event client uses lazy parsing to parse the event. This means the
00921   user application needs to call the parsing routines that corresponds
00922   to the section of the event that the user is interested in. The parser
00923   methods populate event objects inside the Evt class in the event client,
00924   so after the parser method is called these objects can be accessed or
00925   iterated over. The parser methods only apply to the current contribution.
00926   By default after readEvent() the first contribution after the GEM
00927   contribution is the current contribution. Use the setCurrentContribution
00928   method to change the current contribution. Use the getContributionList
00929   method to find out which contributions exist in the event.
00930
00931   Available parser methods:
00932     - evDumpSummary()
00933     - evDumpCAL_LogAccepts()
00934     - evDumpCAL_Logs()
00935     - evDumpTKR()
00936     - evDumpDiagnostic()
00937     - evDumpTEM_Error()
00938     - evDumpEventAEM()
00939
00940   Contribution related methods:
00941   - getContributionList()
00942   - getCurrentContribution()
00943   - setCurrentContribution()
00944   - dumpContributionData()
00945
00946   Retrieving the timestamp and timebase:
00947   - evGetTimestamp()
00948   - evGetTimebase()
00949
00950 \b Usage:
00951
00952   For reading events from a socket:
00953   \code
00954     from gEvtCli import *
00955     ec = EvtCli(debug=0)
00956     ec.connect('gitot')
00957     while ec.readEvent() == 0:
00958       ec.setCurrentContribution(...)
00959       if ec.getContributionStatus() == 0:
00960         ec.evDumpXXX()
00961         :
00962       else:
00963         print "Error %s in contribution %s ",
00964           (ec.getContributionStatusStr(), cId)
00965     ec.disconnect()
00966   \endcode
00967   For reading events from an archived event file:
00968   \code
00969     from gEvtCli import *
00970     ec = EvtCli(debug=0)
00971     ec.open('030305165528.ldf')
00972     while ec.readEvent() == 0:
00973       ec.setCurrentContribution(...)
00974       if ec.getContributionStatus() == 0:
00975         ec.evDumpXXX()
00976         :
00977       else:
00978         print "Error %s in contribution %s ",
00979           (ec.getContributionStatusStr(), cId)
00980     ec.close()
00981   \endcode
00982   For looping over contributions:
00983   \code
00984     from gEvtCli import *
00985     ec = EvtCli(debug=0)
00986     ec.connect('gitot')
00987     status = ec.readEvent()
00988     contList = ec.getContributionList()
00989     for cId in contList:
00990       ec.setCurrentContribution(cId)
00991       if ec.getContributionStatus() == 0:
00992         ec.evDumpSummary()
00993         if cId.startswith('TEM'):
00994           ec.evDumpCAL_LogAccepts()
00995           ec.evDumpCAL_Logs()
00996           ec.evDumpTKR()
00997           ec.evDumpTEM_Error()
00998           ec.evDumpDiagnostic()
00999         elif cId == 'AEM':
01000           ec.evDumpEventAEM()
01001       else:
01002         print "Error %s in contribution %s ",
01003           (ec.getContributionStatusStr(), cId)
01004   \endcode
01005   """
01006
01007   __SWEEP_MARKER = 5            # Arbitrary marker value for recognizing
01008                                 #   when the event pipeline is flushed
01009   EVENT_SRC_SOCK = 0
01010   EVENT_SRC_FILE = 1
01011   DATAGRAM_IDENTITY = 0x201F1010
01012   UNRECOGNIZED_BUFFER_IDENTITY = 0x201F1020
01013   MINIMAL_BYTES = 32
01014   FIRST_CONTRIBUTION_OFFSET = 4 # In 32-bit words
01015 ## New event format
01016 ##  EXPECTED_EVENT_VERSION = 0x101F0010
01017 ##  EXPECTED_EVENT_VERSION = 0x102F0010
01018 ##  EXPECTED_EVENT_VERSION = 0x103F0010
01019   EXPECTED_EVENT_VERSION = 0x104F0010
01020 ##
01021
01022   # Errors that the getOnlineStatus() method can return
01023   ERROR_BASE             = 0x1000
01024   GGLT_STATUS_ERROR      = ERROR_BASE + (1 << 0)
01025   MINIMAL_SIZE_ERROR     = ERROR_BASE + (1 << 1)
01026   EOE_ERROR              = ERROR_BASE + (1 << 2)
01027   UNPACK_ERROR           = ERROR_BASE + (1 << 3)
01028   IO_ERROR               = ERROR_BASE + (1 << 4)
01029   EVENT_VERSION_MISMATCH = ERROR_BASE + (1 << 5)
01030   PLAYBACK_ERROR         = ERROR_BASE + (1 << 6) # Agrees with evtSvr.c
01031   READ_TIMEOUT_ERROR     = ERROR_BASE + (1 << 7)
01032   EOF_ERROR              = ERROR_BASE + (1 << 8)
01033
01034   # Errors that the getContributionStatus() method can return
01035   CONTRIB_ERR_NONE        = 0
01036   CONTRIB_ERR_PARITY      = 1
01037   CONTRIB_ERR_TRUNCATED   = 2
01038   CONTRIB_ERR_WRITE_FAULT = 3
01039   CONTRIB_ERR_TIMEDOUT    = 4
01040
01041   CONTRIBUTOR = {  0:'TEM0',
01042                    1:'TEM1',
01043                    2:'TEM2',
01044                    3:'TEM3',
01045                    4:'TEM4',
01046                    5:'TEM5',
01047                    6:'TEM6',
01048                    7:'TEM7',
01049                    8:'TEM8',
01050                    9:'TEM9',
01051                   10:'TEM10',
01052                   11:'TEM11',
01053                   12:'TEM12',
01054                   13:'TEM13',
01055                   14:'TEM14',
01056                   15:'TEM15',
01057                   16:'GEM',
01058                   17:'AEM',
01059                   32:'OSW'
01060                 }
01061
01062   (
01063     TEM0,
01064     TEM1,
01065     TEM2,
01066     TEM3,
01067     TEM4,
01068     TEM5,
01069     TEM6,
01070     TEM7,
01071     TEM8,
01072     TEM9,
01073     TEM10,
01074     TEM11,
01075     TEM12,
01076     TEM13,
01077     TEM14,
01078     TEM15,
01079     GEM,
01080     AEM,
01081     _NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,_NA,
01082     OSW,
01083   ) = \
01084   ( range (0,33) )
01085
01086   # Debug levels
01087   DEBUG_NONE          = 0
01088   DEBUG_ALL           = 1
01089   DEBUG_EVENT_DUMP    = 1 << 1
01090   DEBUG_WARNINGS      = 1 << 2
01091   DEBUG_PARSER_OUTPUT = 1 << 3
01092   DEBUG_ERROR_OUTPUT  = 1 << 4
01093
01094   def __init__(self, debug=0):
01095     """\brief Event client constructor
01096
01097     \param debug  Debug mode (0=Debug, 1=No debug)
01098     """
01099
01100     if debug is None:
01101       self.setDebug(0)
01102     else:
01103       self.setDebug(int(debug))
01104
01105     EvtCliIO.__init__(self, self.__debug)
01106
01107     self.__sock              = None
01108     self.__src               = None
01109     self.evt                 = Evt()
01110     self.__evContPacket      = evContPacket_Singleton(0)
01111     self.__evSummary         = evSummary_Singleton(0)
01112     self.__evCellHeader      = evCellHeader_Singleton(0)
01113     self.__gglt_status       = None
01114     self.__online_status      = 0
01115     self.__evt_status        = None
01116     self.__evt_size          = None
01117     self.__version_info      = None
01118     self.latInterfaceStatus  = LATInterfaceStatus(0)
01119
01120     # Make sure the custom event client does not override EvtCliIO.read() method
01121     customEvtCli = EvtCli.__subclasses__()
01122     if len(customEvtCli) != 0:
01123       customEvtCli = customEvtCli[0]
01124       if 'read' in customEvtCli.__dict__:
01125         raise RuntimeError, "Custom event client %s should not override the read() method" % customEvtCli.__name__
01126
01127   def setDebug(self, debug):
01128     """\brief Set the debug mode
01129
01130     \param debug Debug mode
01131                  The following debug modes are available and can be added together
01132                  for combinations:
01133                      0: No Debug
01134                      1: Debug All
01135                      2: Event Dump
01136                      4: Warnings
01137                      8: Parser Output
01138                     16: Error Output
01139     """
01140     self.__debug             = debug
01141     self.__debugWarnings     = debug & (EvtCli.DEBUG_ALL | EvtCli.DEBUG_WARNINGS)
01142     self.__debugEventDump    = debug & (EvtCli.DEBUG_ALL | EvtCli.DEBUG_EVENT_DUMP)
01143     self.__debugErrorOutput  = debug & (EvtCli.DEBUG_ALL | EvtCli.DEBUG_ERROR_OUTPUT)
01144     self.__debugParserOutput = debug & (EvtCli.DEBUG_ALL | EvtCli.DEBUG_PARSER_OUTPUT)
01145
01146
01147   def readEvent(self, dat=None):
01148     """\brief Read an event
01149
01150     Reads one event from an archive file or socket
01151
01152     \param  dat If not None then interpret this data as event instead
01153
01154     \return     gglt_status
01155     """
01156     evt = self.evt
01157     evt.clearEvent()
01158     evt.cont_offset = EvtCli.FIRST_CONTRIBUTION_OFFSET
01159     self.__online_status = 0
01160
01161     if dat is not None:
01162       header = (0,)
01163       header += struct.unpack('!LLLLL', dat[0:20])
01164       self.dat = dat
01165     else:
01166       (header, self.dat) = self.read()
01167
01168     self.header = header
01169
01170     self.__gglt_status  = header[0]
01171     self.__version_info = header[3]
01172     self.__evt_status   = header[4] >> 16
01173     self.__evt_size     = header[4] & 0xFFFF
01174
01175     if self.__debugEventDump:
01176       print "gglt_status   =", self.__gglt_status
01177       print "Event version = 0x%08x" % self.__version_info
01178       print
01179       print hexConvert(self.dat)
01180     if self.__gglt_status != 0:
01181       if self.__gglt_status == EvtCli.PLAYBACK_ERROR:
01182         self.__online_status |= EvtCli.PLAYBACK_ERROR
01183       else:
01184         self.__online_status |= EvtCli.GGLT_STATUS_ERROR
01185         if self.__debugWarnings:
01186           log.error("*** gEvtCli: gglt status 0x%x, this event is suspect"
01187                     % self.__gglt_status)
01188           log.error("*** skipping event initialization, data dump follows")
01189           log.error("\n%s" % hexConvert(self.dat))
01190     if len(self.dat) < EvtCli.MINIMAL_BYTES:
01191       self.__online_status |= EvtCli.MINIMAL_SIZE_ERROR
01192       if self.__debugWarnings:
01193         log.error("*** gEvtCli: datagram size %d less than minimal bytes %d"
01194                   %(len(self.dat), EvtCli.MINIMAL_BYTES))
01195
01196     if self.__version_info != EvtCli.EXPECTED_EVENT_VERSION:
01197       self.__online_status |= EvtCli.EVENT_VERSION_MISMATCH
01198       if self.__debugWarnings:
01199         log.error("*** gEvtCli: event version 0x%08x is not the expected 0x%08x"
01200                   %(self.__version_info, EvtCli.EXPECTED_EVENT_VERSION))
01201
01202     if self.__online_status != 0:
01203       return self.__online_status
01204
01205     if self.__debugEventDump:
01206       print "\nEvent Size            =", self.__evt_size
01207       print "Event Status          =", self.__evt_status
01208       ts = self.evGetTimestamp()
01209       print "Event Timestamp (GMT) =", asctime(gmtime(ts)), \
01210                                       "and", int(modf(ts)[0]*1000), "ms"
01211       print "Event timebase        =", hex(self.evGetTimebase())
01212
01213     # Get the summary word stored in the OSW contribution
01214     # to determine if the event has error.
01215     evt.summary = self.__evSummary(self.getDWord(self.evGetSummary()))
01216     self.__evt_error = self.evt.summary.error
01217
01218     # Contribution offset (skip over the OSW contribution)
01219     evt.cont_offset += ((header[5] & 0xFFFF) << 2)
01220     cont_header = self.getDWord(evt.cont_offset)
01221     evt.cont_packet = self.__evContPacket(cont_header & 0xFFFF)
01222     evt.cont_status = evt.cont_packet.error
01223     evt.summary = self.__evSummary(self.getDWord(self.evGetSummary()))
01224     evt.cont_cellHeader = self.__evCellHeader(cont_header >> 16)
01225     evt.contributor = evt.cont_cellHeader.source
01226     evt.cont_size   = (cont_header & 0x00FF) << 4
01227     evt.cont_end    = (evt.cont_offset << 2) + evt.cont_size
01228
01229     if self.__debugEventDump:
01230       print
01231       self.dumpContributionData()
01232
01233     return self.__online_status
01234
01235   def getGGLTStatus(self):
01236     """\brief Retrieve the GGLT status.
01237
01238     If this status value is non zero then the event is considered "bad"
01239     """
01240     return self.__gglt_status
01241
01242   def getGGLTStatusStr(self):
01243     """\brief Return the string equivalent of the GGLT status code.
01244
01245     """
01246     return self.latInterfaceStatus.errstr(self.__gglt_status)
01247
01248   def getOnlineStatus(self):
01249     """\brief Retrieve the Online status code.
01250
01251     See getOnlineStatusStr method for a list of possible errors
01252
01253     """
01254     return self.__online_status
01255
01256   def getEvtStatus(self):
01257     """\brief Return the event status from the event header.
01258
01259     """
01260     return self.__evt_status
01261
01262   def getContributionStatus(self):
01263     """\brief Return the contribution status
01264
01265     \return Contribution status
01266     """
01267     return self.evt.cont_status
01268
01269   def getContributionStatusStr(self):
01270     """\brief Return the contribution status string
01271
01272     \return Contribution status string
01273     """
01274     statusList = {0: 'NONE',
01275                   1: 'PARITY',
01276                   2: 'TRUNCATED',
01277                   3: 'WRITE_FAULT',
01278                   4: 'TIMEDOUT',
01279                  }
01280     if self.evt.cont_status in statusList:
01281       return statusList[self.evt.cont_status]
01282     else:
01283       return 'UNKNOWN ERROR'
01284
01285   def getOnlineStatusStr(self):
01286     """\brief Retrieve the string equivalent of the Online status code.
01287
01288     The error can be one of the following:
01289
01290     GGLT_STATUS_ERROR     : A bad event was received. Call getGGLTStatusStr method
01291                             for the description.
01292     MINIMAL_SIZE_ERROR    : The event size was below the acceptable size.
01293     EOE_ERROR             : End of event was reached before the parse completed.
01294     UNPACK_ERROR          : There was an error while unpacking part of the event for parsing.
01295     IO_ERROR              : An I/O error occurred while retrieving the event (socket or file).
01296     EVENT_VERSION_MISMATCH: An event with an old or unsupported format was received.
01297     PLAYBACK_ERROR        : End of file was received while playing back an event archive file.
01298     READ_TIMEOUT_ERROR    : A read timeout occurred while waiting for the event to be
01299                             retrieved (Set by rcTransitions).
01300     EOF_ERROR             : End of file is reached while reading the event file.
01301
01302     \return Online status string
01303
01304     """
01305     statusList = ['GGLT_STATUS_ERROR',
01306                   'MINIMAL_SIZE_ERROR',
01307                   'EOE_ERROR',
01308                   'UNPACK_ERROR',
01309                   'IO_ERROR',
01310                   'EVENT_VERSION_MISMATCH',
01311                   'PLAYBACK_ERROR',
01312                   'READ_TIMEOUT_ERROR',
01313                   'EOF_ERROR',
01314                  ]
01315     s = ''
01316     status = self.__online_status & 0xFFF
01317     bitIndex = 0
01318     while (bitIndex < 12):
01319       if (1 << bitIndex) & status:
01320         if bitIndex < len(statusList):
01321           s += statusList[bitIndex] + ' '
01322         else:
01323           s += 'UNKNOWN_ERROR '
01324       bitIndex += 1
01325     return s.strip()
01326
01327   def getEvtSize(self):
01328     """\brief Return the event size
01329
01330     \return Event size
01331     """
01332     return self.__evt_size
01333
01334   def isErrorEvent(self):
01335     """Determines whether at least one contribution
01336     has the error bit set in its summary word.
01337
01338     \return 1: If at least one contribution has an error.
01339             0: Otherwise
01340     """
01341     return self.__evt_error
01342
01343   def isSweepEvent(self):
01344     """\brief Determine if a sweep event is received.
01345
01346     User script can call this method in process() to determine if
01347     the current event is a sweep event. A try block around the call
01348     should be used in case a bad event is received.
01349
01350     \return 0: Not a sweep event.
01351             1: A sweep event.
01352     """
01353     if self.evt.summary.marker == EvtCli.__SWEEP_MARKER:
01354       return 1
01355     else:
01356       return 0
01357
01358   def isGGLTStatus(self, status=None):
01359     """\brief Determine if the current event is bad.
01360
01361     User script can call this method in process() to determine if
01362     the current event is a bad event (gglt_status != 0).
01363
01364     \param  Optional status value
01365
01366     \return 0: Not a bad event.
01367             1: A bad event.
01368     """
01369     if status is None: status = self.__online_status
01370     return self.checkOnlineStatus(status, EvtCli.GGLT_STATUS_ERROR)
01371
01372   def checkOnlineStatus(self, status, mask):
01373     """\brief Checks if the bit mask \a mask matches the \a status that is
01374     assumed as an Online status.
01375
01376     \param status The status word to be checked against
01377     \param mask   The mask bit(s) to be checked
01378
01379     \return 1 if there is a match
01380             0 if there is no match
01381
01382     """
01383     if status < 0:
01384       return 0
01385     elif not (status & 0x1000):
01386       return 0
01387     else:
01388       return status & mask & 0xFFF
01389
01390   def checkGGLTstatus(self, status, mask):
01391     """\brief Checks if the bit mask \a mask matches the \a status
01392     that is assumed as a GGLT status.
01393
01394     \param status The status word to be checked against
01395     \param mask   The mask bit(s) to be checked
01396
01397     \return 1 if there is a match
01398             0 if there is no match
01399
01400     """
01401     if status > 0:
01402       return 0
01403     elif status & 0x1000:
01404       return 0
01405     else:
01406       return status & mask
01407
01408   # The following function is experimental code: Do Not Use.
01409   def readEventSocket(self):
01410     # Maybe better to do this with setsockopt(SO_RCVLOWAT, 12) and select()
01411     l   = 0
01412     buf = ""
01413     while l < 12:
01414       buf += self.recv(4096 - l)
01415       l    = len(buf)
01416     (retCode, version, status, length) = self.unpack('!lLhH', buf[0:12])
01417     i = 0
01418     #print "readEventSocket:           %u, length = %u, l = %u" % (i, length, l)
01419     while l < length:
01420       buf += self.recv(4096 - l)
01421       l    = len(buf)
01422       i   += 1
01423       print "readEventSocket: Got more: %u, length = %u, l = %u" % (i, length,l)
01424     return (retCode, buf, l)
01425
01426   def setCurrentContribution(self, contributionId):
01427     """\brief Given a contribution id, set the current contribution data
01428     needed for the parsing routines.
01429
01430     \param  contributionId Integer contribution id
01431
01432     \return The offset to the contribution requested.
01433             -1 If the contribution requested is not found
01434                or contribution offset was found to be larger
01435                than the event size
01436             Note: Use getContributionStatus() method after
01437                calling this routine to find out if the
01438                contribution has an error.
01439
01440     """
01441     cont_offset = EvtCli.FIRST_CONTRIBUTION_OFFSET
01442     if isNumberType(contributionId):
01443       cId = contributionId
01444     else:
01445       for (key, value) in EvtCli.CONTRIBUTOR.items():
01446         if value == contributionId:
01447           cId = key
01448           break
01449     evt = self.evt
01450     while(True):
01451       cont_header = self.getDWord(cont_offset)
01452       evt.cont_packet = self.__evContPacket(cont_header & 0xFFFF)
01453       contributor = (cont_header >> 17) & 0x3F
01454       cont_size = evt.cont_packet.length << 4
01455       cont_cellHeader = self.__evCellHeader(cont_header >> 16)
01456       if contributor == cId:
01457         evt.cont_status = evt.cont_packet.error
01458         # Make sure it is a good contribution
01459         if evt.cont_status == 0:
01460           evt.cont_cellHeader = cont_cellHeader
01461           evt.contributor = contributor
01462           evt.cont_size = cont_size
01463           evt.cont_offset = cont_offset
01464           evt.cont_end = (cont_offset << 2) + cont_size
01465           evt.summary = self.__evSummary(self.getDWord(self.evGetSummary()))
01466           if self.__debugEventDump:
01467             self.dumpContributionData()
01468           return self.evt.cont_offset
01469       cont_offset += (cont_size >> 2)
01470       if cont_cellHeader.respond == 0:
01471         return -1
01472       if not (self.__evt_size > (cont_offset << 2)):
01473         return -1
01474
01475   def getCurrentContribution(self):
01476     """\brief Return the integer id of the current contribution
01477
01478     \return Current constribution id
01479     """
01480     return self.evt.cont_cellHeader.source
01481
01482   def getContributionList(self):
01483     """\brief Walk through the whole event and construct a list of contribution id strings
01484
01485     \return A list of contributors that have contributed to the current event
01486     """
01487     cont_offset = EvtCli.FIRST_CONTRIBUTION_OFFSET
01488     contributorList = []
01489     evt = self.evt
01490     while(True):
01491       cont_header = self.getDWord(cont_offset)
01492       cont_size = (cont_header & 0x00FF) << 4
01493       evt.cont_cellHeader = self.__evCellHeader(self.getDWord(cont_offset) >> 16)
01494       #if cont_size == 0:
01495       #  return contributorList
01496       contributor = (cont_header >> 17) & 0x3F
01497       contributorList = contributorList + [EvtCli.CONTRIBUTOR[contributor]]
01498       cont_offset += (cont_size >> 2)
01499       if evt.cont_cellHeader.respond == 0:
01500         return contributorList
01501       if not (self.__evt_size > (cont_offset << 2)):
01502         return contributorList
01503
01504   def dumpContributionData(self):
01505     """\brief Prints out information pertaining to the current contribution.
01506
01507     """
01508     if self.getContributionStatus() != 0:
01509       print("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***")
01510       print("   ***    This contribution is suspect. Error: %-15s ***"
01511             % self.getContributionStatusStr())
01512       print("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n")
01513
01514     self.evDumpSummary(16)
01515     print
01516     print "Event Contributor=", EvtCli.CONTRIBUTOR[self.evt.contributor]
01517     print "Contribution size=", self.evt.cont_size
01518     print "\nPacket     = 0x%04X" % int(self.evt.cont_packet)
01519     print "\terror      =", hex(int(self.evt.cont_packet.error))
01520     print "\tsequence   =", hex(int(self.evt.cont_packet.sequence))
01521     print "\tlength     =", hex(int(self.evt.cont_packet.length))
01522     print "\nCell header= 0x%04X" % int(self.evt.cont_cellHeader)
01523     print "\tparity     =", hex(int(self.evt.cont_cellHeader.parity))
01524     print "\tsource     =", hex(int(self.evt.cont_cellHeader.source))
01525     print "\tprotocol   =", hex(int(self.evt.cont_cellHeader.protocol))
01526     print "\tdestination=", hex(int(self.evt.cont_cellHeader.destination))
01527     print "\trespond    =", hex(int(self.evt.cont_cellHeader.respond))
01528     print
01529     print hexConvert(self.dat[(self.evt.cont_offset<<2):self.evt.cont_end])
01530     print
01531
01532   def evGetTimestamp(self):
01533     """\brief Return the timestamp of the event in seconds.
01534
01535     The resolution of this timestamp is 1/60th of a second, by default.
01536     Consult VxWorks documentation for sysClkRateSet() and clock_setres()
01537     to see how to change this default. Beware that increasing the resolution
01538     from the default may cause adverse effects due to the increased
01539     interrupt rate generated.
01540
01541     \return Timestamp of the event in seconds.
01542     """
01543 ## New Event Format
01544 ##    tv_sec  = self.getDWord(EvtCli.FIRST_CONTRIBUTION_OFFSET+2)
01545 ##    tv_nsec = self.getDWord(EvtCli.FIRST_CONTRIBUTION_OFFSET+3)
01546     tv_sec  = self.getDWord(EvtCli.FIRST_CONTRIBUTION_OFFSET+3)
01547     tv_nsec = self.getDWord(EvtCli.FIRST_CONTRIBUTION_OFFSET+4)
01548 ##
01549     return (tv_sec + (tv_nsec / 1000000000.0))
01550
01551   def evGetTimebase(self):
01552     """\brief Return the timestamp of the event derived from the PPC timebase register.
01553
01554     This is a 64 bit value that increments at an SBC implementation dependant
01555     rate (60 nS on MVME2306s).  The value is reset at PPC reset time.
01556
01557     \return Timestamp of the event in PPC timebase ticks.
01558     """
01559     return self.unpack('!Q',
01560 ## New event format
01561 ##                       self.dat[(EvtCli.FIRST_CONTRIBUTION_OFFSET+4) << 2:
01562 ##                                (EvtCli.FIRST_CONTRIBUTION_OFFSET+6) << 2])[0]
01563                        self.dat[(EvtCli.FIRST_CONTRIBUTION_OFFSET+5) << 2:
01564                                 (EvtCli.FIRST_CONTRIBUTION_OFFSET+7) << 2])[0]
01565 ##
01566
01567   # Not used anymore -ST
01568   #def extend(self, buffer):
01569   #  if self.dat is not None:
01570   #    self.dat += buffer
01571
01572   def getUserId(self):
01573     """\brief Return the user id passed to the event client.
01574
01575     \return Current user id
01576     """
01577     return 123 # Deprecated.
01578
01579   def evGetTKR_Accepts(self, pAccept):
01580     """\brief Walks tower event contribution to the TKR accepts data.
01581
01582     Fills in the evGetTKR_Accepts structure pointed to by \a pAccept
01583     with the TKR accepts data.  Also returns a pointer to the TKR
01584     accepts information.
01585
01586     \param   pAccept Array to be filled with TKR accepts data
01587     \return  Offset to the start of TKR accepts data
01588
01589     """
01590     p = self.evGetCAL_LogAccepts() + 1 + self.evGetCAL_NumAccepts() * (1 + 3 * self.evt.summary.readout4)
01591     if pAccept != None:
01592       for i in range(N_GTCC):
01593         dWordOffset = int(p + (9 * i) / 32)
01594         bitOffset  = (9 * i) % 32
01595         if ((32 - bitOffset) >= 9):
01596           if (dWordOffset << 2) > self.evt.cont_end:
01597             self.print_EOE_Warning()
01598             return -1
01599           pAccept[i] = (self.getDWord(dWordOffset) >> (32 - bitOffset - 9)) & 0x1FF
01600           self.evt.addTKRaccept(pAccept[i])
01601         else:
01602           if ((dWordOffset+1) << 2) > self.evt.cont_end:
01603             self.print_EOE_Warning()
01604             return -1
01605           pAccept[i] = (self.getDWord(dWordOffset)   << (9 - (32 - bitOffset)) & 0x1FF) | \
01606                        (self.getDWord(dWordOffset+1) >> (32 - (9 - (32 - bitOffset))))
01607           self.evt.addTKRaccept(pAccept[i])
01608     return p
01609
01610   def evGetCAL_NumAccepts(self):
01611     """\brief Counts the number of hit calorimeter logs in the tower
01612     event contribution.
01613
01614     Given a pointer to an entire TEM event contribution walk the data
01615     structure to the calorimeter log accepts word and return the sum of
01616     the number of hit logs.
01617
01618     \return Number of hit logs
01619     """
01620     nAccepts = 0
01621     la = self.getDWord(self.evGetCAL_LogAccepts())
01622     for i in range(8):
01623       nAccepts = nAccepts + ((la >> (i<<2)) & 0xF)
01624     return nAccepts
01625
01626   def evDumpGEM(self):
01627     """\brief Parses the GEM contribution by populating the data in self.evt.gem
01628
01629     Requires calling evtCli.setCurrentContribution(EvtCli.GEM) before usage.
01630
01631     """
01632     offset = self.evGetSummary() + 1
01633     vec = self.getDWord(offset)
01634     self.evt.gem.ROI_Vector = (vec >> 16)
01635     self.evt.gem.TKR_Vector = vec & 0xFFFF
01636     vec = self.getDWord(offset+1)
01637     self.evt.gem.CAL_HE_Vector = (vec >> 16)
01638     self.evt.gem.CAL_LE_Vector = vec & 0xFFFF
01639     vec = self.getDWord(offset+2)
01640     self.evt.gem.triggerSummary = (vec >> 16)
01641     self.evt.gem.CNO_Vector = vec & 0xFFFF
01642     self.evDumpGEM_Veto_List(offset+3)
01643     self.evt.gem.liveTime = self.getDWord(offset+7)
01644     self.evt.gem.prescaled = self.getDWord(offset+8)
01645     self.evt.gem.busy = self.getDWord(offset+9)
01646     self.evt.gem.sent = self.getDWord(offset+10)
01647     self.evt.gem.triggerTime = self.getDWord(offset+11)
01648     self.evt.gem.onePPSTime = self.getDWord(offset+12)
01649     self.evt.gem.deltaEventTime = self.getDWord(offset+13)
01650
01651   def evDumpGEM_Veto_List(self, offset):
01652     """\brief Parses the Veto List block of the GEM contribution
01653
01654     Used by evDumpGEM
01655
01656     \param offset 32-bit word offset to the veto list block
01657
01658     """
01659     veto = self.getDWord(offset)
01660     self.evt.gem.vetoList.XZP = (veto >> 16)
01661     self.evt.gem.vetoList.XZM = veto & 0xFFFF
01662     veto = self.getDWord(offset+1)
01663     self.evt.gem.vetoList.YZP = (veto >> 16)
01664     self.evt.gem.vetoList.YZM = veto & 0xFFFF
01665     self.evt.gem.vetoList.XY = self.getDWord(offset+2)
01666     veto = self.getDWord(offset+3)
01667     self.evt.gem.vetoList.NA = (veto >> 16)
01668     self.evt.gem.vetoList.RBN = veto & 0xFFFF
01669
01670   def getWord(self,wordOffset):
01671     """\brief Unpack and return a 16-bit word value located at wordOffset
01672
01673     \param  wordOffset Pointer to data
01674
01675     \return            16-bit word value
01676     """
01677     result = self.unpack('!H',self.dat[(wordOffset<<1):((wordOffset+1)<<1)])
01678     if result != ():
01679       return result[0]
01680     else:
01681       return 0
01682
01683   def getDWord(self,dWordOffset):
01684     """\brief Unpack and return a 32-bit word value located at dWordOffset
01685
01686     \param  dWordOffset Pointer to data
01687
01688     \return             32-bit word value
01689     """
01690     result = self.unpack('!L',self.dat[(dWordOffset<<2):((dWordOffset+1)<<2)])
01691     if result != ():
01692       return result[0]
01693     else:
01694       return 0
01695
01696   def getByte(self,byteOffset):
01697     """\brief Unpack and return an 8-bit byte value located at byteOffset
01698
01699     \param  byteOffset Pointer to data
01700
01701     \return            8-bit byte value
01702     """
01703     result = self.unpack('B',self.dat[byteOffset])
01704     if result != ():
01705       return result[0]
01706     else:
01707       return 0
01708
01709   def evGetCAL_Logs(self):
01710     """\brief Walks tower event contribution to the CAL log data.
01711
01712     Given a pointer to an entire TEM event contribution walk the data
01713     structure to the beginning of the calorimeter log data.
01714
01715     \return Offset to the beginning of the calorimeter log data
01716     """
01717     return self.evGetCAL_LogAccepts() + 1
01718
01719   def evGetCAL_LogAccepts(self):
01720     """\brief Walks the tower event contribution to the calorimeter
01721     log accepts word.
01722
01723     Given a pointer to an entire TEM event contribution walk the data
01724     structure returning a pointer to the calorimeter log accepts word.
01725
01726     The 32-bit calorimeter log accepts word is immediately after the event
01727     summary word, i.e. the 2nd 32-bit word in the data.
01728
01729     \return Offset to the calorimeter log accepts word.
01730     """
01731     return self.evGetSummary() + 1
01732
01733   def evDumpCAL_LogAccepts(self):
01734     """\brief Decodes the log accepts word and stores it in evt.CAL_LogAccepts.
01735
01736     """
01737     la = evCAL_LogAccepts(self.getCurrentContribution(), self.getDWord(self.evGetCAL_LogAccepts()))
01738     if self.__debugParserOutput:
01739       print("\n   CAL Log Accepts")
01740       # look for bogus accept values ( anything greater than 12 )
01741       for i in range(N_GCCC):
01742         if ((la.ui >> (i<<2)) & 0xF) > 12:
01743           print("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***")
01744           print("   *** Log accepts greater than 12.  This event is suspect     ***")
01745           print("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n")
01746
01747       print("   ================================================")
01748       print("   GCCC   | GCCC_01 | GCCC_03 | GCCC_02 | GCCC_00 |")
01749       print("   -------+---------+---------+---------+---------+-------------")
01750       print("   layer  | y3   y2 | y1   y0 | x3   x2 | x1   x0 |  Raw")
01751       print("   -------+----+----+----+----+----+----+----+----+-------------")
01752       print("   hits   | %02d   %02d | %02d   %02d | %02d   %02d | %02d   %02d |  0x%08x" %
01753            (la.y3, la.y2, la.y1, la.y0, la.x3, la.x2, la.x1, la.x0, la.ui))
01754     self.evt.addCAL_LogAccept(la)
01755
01756
01757   def evDumpCAL_Logs(self):
01758     """\brief Decodes all the log data for the event and stores it in evt.CAL_LogData
01759
01760     """
01761     la = evCAL_LogAccepts(0, self.getDWord(self.evGetCAL_LogAccepts()))
01762     if ( la.ui == 0 ):
01763       # nothing to decode
01764       return
01765
01766     # get log data
01767     pLogData = self.evGetCAL_Logs()
01768
01769     if self.__debugParserOutput:
01770       print("\n   CAL Log Data")
01771       print("   =====================================================")
01772       print("   -----   -----+------+------+------+------+-----------")
01773       print("   layer    Col   -Rng   -ADC   +Rng   +ADC   Raw")
01774       print("   -----   -----+------+------+------+------+-----------")
01775
01776     twr = self.getCurrentContribution()
01777     if ( self.evt.summary.readout4 == 0):
01778       # regular read out
01779       # step through the 8 layers
01780       for i in range(8):
01781         nHitLogs = (la.ui >> (i<<2)) & 0xF
01782         if (nHitLogs):
01783           for j in range(nHitLogs):
01784             self.__dumpCAL_Log(twr, pLogData, i)
01785             pLogData = pLogData + 1
01786     else:
01787       # read out 4 range data
01788       # loop over accepts in groups of 2 -- 8 all together
01789       for i in range(4):
01790         # loop over 4 ranges
01791         for j in range(4):
01792           # loop over current 2 accepts
01793           for k in range(2):
01794             nHitLogs = (la.ui >> (((i<<1) + k)<<2)) & 0xF
01795             for l in range(nHitLogs):
01796               self.__dumpCAL_Log(twr, pLogData, ((i<<1) + k))
01797               pLogData = pLogData + 1
01798
01799   def __dumpCAL_Log(self, twr, pLogData, layer):
01800     """\brief Decodes the log data
01801
01802     \param pLogData Pointer to data from one accepted CAL log
01803     \param layer    Which layer the log data is a member of
01804
01805     """
01806     if (pLogData<<2) > self.evt.cont_end:
01807       self.print_EOE_Warning()
01808     else:
01809       ld = evCAL_LogData(self.getDWord(pLogData))
01810       if self.__debugParserOutput:
01811         print("    %c%d       %02d    %d     %04x    %d     %04x   0x%08x" %
01812           (q(layer < 4,'x','y'), layer % 4,
01813           ld.column,
01814           ld.rangeADC_neg,
01815           ld.valADC_neg,
01816           ld.rangeADC_pos,
01817           ld.valADC_pos,
01818           ld.ui))
01819       self.evt.addCAL_LogData(twr, layer, ld)
01820
01821
01822   def evGetSummary(self):
01823     """\brief Return the offset to the summary word of the current contribution.
01824
01825     In a contribution, first word after the header is the summary word
01826
01827     \return Offset to the summary word of the current contribution
01828     """
01829     return self.evt.cont_offset + 1
01830
01831   def __dumpTkrStrip(self, pAccepts, acceptArray):
01832     """\brief Decodes all TKR event strip data and stores it in evt.TKRstrips
01833
01834     \param  pAccepts     Pointer to 32-bit aligned tracker event data
01835     \param  acceptArray  pointer to array of decoded tkr accept vectors
01836
01837     \return              Number of strip hits
01838     """
01839     nStrip = 0
01840     if self.__debugParserOutput:
01841       print("\n   TKR Strips")
01842       print("   ========================================================")
01843       print("   GTCC  | GTRC | GTFE | Strip # | Raw      |")
01844       print("   ------+------+------+---------+----------+")
01845     stripData = evTKR_Strip(0)
01846     for i in range(N_GTCC):
01847       # foreach set bit in GTCC accept vector
01848       accept = acceptArray[i]
01849       for j in range(N_GTRC):
01850         if ( (accept >> (N_GTRC - 1 - j)) & 0x1):
01851           # walk strip data until done bit found
01852           done = 0
01853           while 1:
01854             stripData = self.evGetTKR_StripN(pAccepts, nStrip)
01855
01856             if stripData.done != 0:
01857               stripData.done = 0
01858               done = 1
01859             self.evt.addTKRstrip(GTCC_MAP[i], j, stripData)
01860             nStrip = nStrip + 1
01861             if self.__debugParserOutput:
01862               print("    %d    |  %d   |  %02d  |   %02d    | 0x%03x    |" % (GTCC_MAP[i], j, stripData.gtfe, stripData.strip, stripData.ui))
01863             if done != 0: break
01864     return nStrip
01865
01866   def evGetTKR_StripN(self, pAccepts, stripN, stripData=None):
01867     """\brief Fetches a 12-bit strip word from pAccepts, indexed by stripN.
01868
01869     pAccepts points to the top of the accepts data ... the strip data
01870     starts 72 bits ( 8 * 9 ) from the beginning of accepts.  I.e. it
01871     starts 8 bits into the 3rd 32-bit word.
01872
01873     \param  pAccepts  Pointer to 32-bit aligned tracker event data
01874     \param  stripN    The index of the 12-bit strip to fetch from pAccepts
01875     \param  stripData Optional argument, if passed, avoid creating the object
01876     \return          An evTKR_Strip object instance.
01877     """
01878     # Don't create the object if we are only counting, ie. called from evGetTKR_NumStrips()
01879     if stripData is None:
01880       stripData = evTKR_Strip(0)
01881     # skip the first two 32-bit words
01882     pAccepts = pAccepts + 2
01883     # each strip is 12 bits long.  the first strip starts 8 bits into the 32-bit word
01884     nBits = 8 + 12 * stripN
01885     dWordOffset = pAccepts + (nBits / 32)
01886     bitOffset = nBits % 32
01887     if ((32 - bitOffset) >= 12):
01888       if (dWordOffset<<2) > self.evt.cont_end:
01889         self.print_EOE_Warning()
01890         stripData.done = 1
01891       else:
01892         # all 12 bits are in this word
01893         stripData.ui = (self.getDWord(dWordOffset) >> (32 - bitOffset - 12)) & 0xFFF
01894     else:
01895       if ((dWordOffset+1)<<2) > self.evt.cont_end:
01896         self.print_EOE_Warning()
01897         stripData.done = 1
01898       else:
01899         # need to sew bits together across word boundary
01900         stripData.ui = (((self.getDWord(dWordOffset)   << ( 12 - ( 32 - bitOffset))) & 0xFFF) | \
01901                     (self.getDWord(dWordOffset+1) >> ( 32 - ( 12 - ( 32 - bitOffset)))))
01902     return stripData
01903
01904
01905   def __dumpTkrTOT(self, pAccepts, acceptArray, nStrip):
01906     """\brief Decodes all TKR event TOT data and stores them in evt.TKTtots
01907
01908     \param pAccepts    Pointer to 32-bit aligned tracker event data
01909     \param acceptArray Pointer to array of decoded tkr accept vectors
01910     \param nStrip      Number of TKR strips decoded
01911
01912     """
01913     if self.__debugParserOutput:
01914       print("\n   TKR TOT")
01915       print("   ========================================================")
01916       print("   GTCC  | GTRC | TOT    |")
01917       print("   ------+------+--------+")
01918
01919     #determine where TOTs start -- count 8-bit bytes from the begining of the accepts
01920     #accepts bits = 9 bits * 8 GTCC = 72 bits = 9 bytes
01921     #strip bits   = 12 bits * nStrip = (12 bits * nStrip)/8 bytes
01922
01923     #if nStrip is odd then we're on a nibble boundry -- add one more byte
01924
01925     byteSkip = 9 + (( 12 * nStrip ) / 8)
01926     if ( nStrip & 0x1 ):
01927       byteSkip += 1
01928     # foreach GTCC
01929     for i in range(N_GTCC):
01930       # foreach set bit in GTCC accept vector
01931       for j in range(N_GTRC):
01932         if ( (acceptArray[i] >> (N_GTRC - j - 1)) & 0x1):
01933           # print TOT
01934           byteOffset = (pAccepts<<2) + byteSkip
01935           if byteOffset > self.evt.cont_end:
01936             self.print_EOE_Warning()
01937             return -1
01938           tot = self.getByte(byteOffset)
01939           if self.__debugParserOutput:
01940             print("    %d    |  %d   | 0x%02x   |"%(GTCC_MAP[i], j, tot))
01941           byteSkip += 1
01942           self.evt.addTKRtot(GTCC_MAP[i], j, tot)
01943
01944   def evDumpTKR(self):
01945     """\brief Decodes all the TKR event data and stores it in the event object.
01946
01947     """
01948     tkrAcpt = [0]*N_GTCC
01949     nAccept = 0
01950
01951     p = self.evGetTKR_Accepts(tkrAcpt)
01952     if p == -1: return
01953     if self.__debugParserOutput:
01954       print("\n   TKR Accepts")
01955       print("   ========================================================")
01956       #   print("   Raw word 0:  0x%08x\n", p[0])
01957       #   print("   Raw word 1:  0x%08x\n", p[1])
01958       #   print("   Raw word 2:  0x%08x\n", p[2])
01959       print("   ========================================================")
01960       print("   GTCC  |  X/Y  |  L/R  |  E/O  |  Accepts    | Raw")
01961       print("   ------+-------+-------+-------+-------------+-----------")
01962     for i in range(N_GTCC):
01963       if self.__debugParserOutput:
01964         print("    %d    |   %c   | %5s | %4s  |  " % (GTCC_MAP[i],
01965               q(i < 4,'x','y'),
01966               q(((i == 1) | (i == 2) | (i == 4) | ( i == 7)),"right","left"),
01967               q(i % 2,"even","odd"))),
01968       bits = ""
01969       for j in range(N_GTRC):
01970         if ( (tkrAcpt[i] >> (N_GTRC - j - 1)) & 0x1):
01971           bits += "1"
01972           nAccept += 1
01973         else:
01974           bits += "0"
01975       if self.__debugParserOutput:
01976         print("\b%s  | 0x%03x"%(bits,tkrAcpt[i]))
01977     if self.__debugParserOutput:
01978       print("   ------+-------+-------+-------+-------------+-----------")
01979
01980     if (nAccept != 0):
01981       # dump strip data
01982       nStrips = self.__dumpTkrStrip(p, tkrAcpt)
01983
01984       # dump TOT data
01985       self.__dumpTkrTOT(p, tkrAcpt, nStrips)
01986
01987   def evBitCount(self, x):
01988     """\brief Count the number of set bits in x
01989
01990     \param  x 32-bit word value
01991
01992     \return   Set bit count
01993     """
01994     count = 0
01995     for i in range(32):
01996       count = count + (( x >> i ) & 0x1)
01997     return count
01998
01999
02000   def evGetTKR_NumStrips(self):
02001     """Returns number of hit strips in the event
02002
02003     \return Number of hit strips
02004     """
02005     nStrip = 0
02006     tkrAcpt = [0]*N_GTCC
02007
02008     pAccepts = self.evGetTKR_Accepts(tkrAcpt)
02009     if pAccepts == -1: return
02010     stripData = evTKR_Strip(0)
02011     # foreach GTCC
02012     for i in range(N_GTCC):
02013       # foreach set bit in GTCC accept vector
02014       for j in range(N_GTRC):
02015         if ( (tkrAcpt[i] >> (N_GTRC - 1 - j)) & 0x1):
02016           # walk strip data until done bit found
02017           done = 0
02018           while not done:
02019             stripData = self.evGetTKR_StripN(pAccepts, nStrip, stripData)
02020             done = stripData.done
02021             nStrip += 1
02022     return nStrip
02023
02024   def evGetTKR_TOT(self):
02025     """\brief Returns pointer to start of tracker TOT list
02026
02027     \return Offset to the tracker TOT list
02028     """
02029     nStrips = self.evGetTKR_NumStrips()
02030
02031     if nStrips == 0:
02032       return 0
02033
02034
02035     #  the TOTs come after the accepts (72-bits or 9 bytes) and after
02036     #  the strips ( 12-bits per strip ).  If the number of strips is odd
02037     #  we need to add one extra byte.
02038
02039     pTOT = self.evGetTKR_Accepts(None) << 2
02040     pTOT += 9  # size of the accept words
02041     pTOT += (( 12 * nStrips ) / 8) # size of the strip words
02042     pTOT += (nStrips & 0x1)  # pad with one byte if number of strips is odd
02043     return pTOT
02044
02045
02046   def evGetTKR_NumAccepts(self):
02047     """\brief Counts the number of accepted TKR layer-ends.
02048
02049     \return Number of accepted TKR layer-ends.
02050     """
02051     tkrAcpt = [0]*N_GTCC
02052     self.evGetTKR_Accepts(tkrAcpt)
02053
02054     nBits = 0
02055     for i in range(N_GTCC):
02056       nBits += self.evBitCount(tkrAcpt[i])
02057     return nBits
02058
02059
02060   def evGetTEM_Diagnostic(self):
02061     """\brief Returns pointer to start of diagnostic event data.
02062
02063     Caller should check the event summary word if a diagnostic
02064     contribution is present before calling this function.
02065
02066     \return Offset to start of diagnostic event data
02067     """
02068     start = self.evGetTKR_Accepts(None) << 2
02069     nTkrAccepts = self.evGetTKR_NumAccepts()
02070     if nTkrAccepts == 0:
02071       # no tracker strip data, just skip over tracker accept data
02072       end = start + 9
02073     else:
02074       end = self.evGetTKR_TOT() # beginning of TOT data
02075       end += nTkrAccepts # one byte after the TOT data
02076
02077     #  the diagnostic data comes after the tracker data and must be on a
02078     #  32-bit boundary
02079
02080     offset = end - start
02081     #offset = offset + q((offset % 4), 4 - (offset % 4), 0)
02082     if (offset % 4):
02083       offset += (4 - (offset % 4))
02084     return ((start + offset) >> 2)
02085
02086   def evGetTEM_Error(self):
02087     """\brief Returns pointer to the error word contribution of event data.
02088
02089     Caller should check the event summary word if an error
02090     contribution is present before calling this function.
02091
02092     \return Offset to the error word contribution
02093     """
02094     # the error contribution comes after the diagnostic contribution
02095     pErr = self.evGetTEM_Diagnostic()
02096     # check if we have a diagnostic contribution
02097     es = self.evt.summary
02098     if es.diag:
02099       # skip over diagnostic contribution
02100       pErr += (evDiag_Data.size >> 2)
02101     return pErr
02102
02103
02104   def __dumpErrGCCC(self, es, pErr, nWord, forcePrint=0):
02105     """\brief Decodes the GCCC error contribution.
02106
02107     \param  es         Error summary 16-bit word
02108     \param  pErr       Pointer to 16-bit aligned tower event error contribution
02109     \param  nWord      Index into begining of error data
02110     \param  forcePrint If specified, dump the error even if in non-debug mode
02111
02112     \return            Current offset into the error contribution
02113     """
02114     errSummary = es
02115
02116     if self.__debugParserOutput or forcePrint: print
02117
02118     # loop over 4 GCCC
02119     for gcccId in range(N_GCCC):
02120       # test summary bit for this GCCC
02121       if ( ( errSummary.gcccErr >> gcccId) & 0x1 ):
02122         # dump the error message
02123         idx = nWord
02124         nWord += 1
02125         errLen = self.getWord(pErr+idx)
02126         if self.__debugParserOutput or forcePrint:
02127           print("GCCC error word count %d" % errLen)
02128         # obtained "mapped GCCC" number
02129         mGCCC = GCCC_MAP[gcccId]
02130         #layer = q(( mGCCC % 2 ),'y','x')
02131         if (mGCCC % 2):
02132           layer = 'y'
02133         else:
02134           layer = 'x'
02135         while (errLen):
02136           errLen -= 1
02137           idx = nWord
02138           nWord += 1
02139           errGCCC = evErr_GCCC(self.getWord(pErr+idx))
02140           self.evt.addErrGCCCmsg(evErr_GCCC_Message(mGCCC, errGCCC))
02141           if errGCCC.errType == 0:
02142             # start bit missing
02143             if self.__debugParserOutput or forcePrint:
02144               print("   GCCC %d Start Bit Missing: raw ( 0x%04x )" % (mGCCC, errGCCC.ui))
02145           elif errGCCC.errType == 1:
02146             # parity error
02147             if self.__debugParserOutput or forcePrint:
02148               print("   GCCC %d Parity Error: raw ( 0x%04x )\n" % (mGCCC, errGCCC.ui))
02149           else:
02150             # unknown GCCC error message
02151             print("****************************************************")
02152             print("**")
02153             print("** Unknown GCCC error message type:  %d\n" % errGCCC.errType)
02154             print("** Raw value                      :  0x%04x" % errGCCC.ui)
02155             print("**")
02156             print("****************************************************")
02157             return nWord
02158           # both error types have the same display format
02159           if self.__debugParserOutput or forcePrint:
02160             print("   ================================================")
02161             print("   | %c%d- | %c%d- | %c%d+ | %c%d+ | Sweep | Type |" %
02162               (layer, q(( mGCCC % 2 ) , (mGCCC + 2)%4 , mGCCC + 1),
02163                layer, q(( mGCCC % 2 ) , (mGCCC + 1)%4 , mGCCC),
02164                layer, q(( mGCCC % 2 ) , (mGCCC + 2)%4 , mGCCC + 1),
02165                layer, q(( mGCCC % 2 ) , (mGCCC + 1)%4 , mGCCC)
02166               )
02167             )
02168             print("   ------+-----+-----+-----+-------+------+--------")
02169             print("   | %d%d  | %d%d  | %d%d  | %d%d  |   %d   |  %d   |" %
02170               ((errGCCC.errParm >> 7) & 0x1, (errGCCC.errParm >> 6) & 0x1,
02171                (errGCCC.errParm >> 5) & 0x1, (errGCCC.errParm >> 4) & 0x1,
02172                (errGCCC.errParm >> 3) & 0x1, (errGCCC.errParm >> 2) & 0x1,
02173                (errGCCC.errParm >> 1) & 0x1, (errGCCC.errParm     ) & 0x1,
02174                errGCCC.sweepNum, errGCCC.errType
02175               )
02176             )
02177             print("   ------------------------------------------------")
02178             print
02179     return nWord
02180
02181
02182   def __dumpErrGTCC(self, es, pErr, nWord, forcePrint=0):
02183     """\brief Decodes the GTCC error contribution.
02184
02185     \param  es         Error summary 16-bit word
02186     \param  pErr       Pointer to 16-bit aligned tower event error contribution
02187     \param  nWord      Index into begining of error data
02188     \param  forcePrint If specified, dump the error even if in non-debug mode
02189
02190     \return            Current offset into the error contribution
02191     """
02192     errSummary = es
02193
02194     # loop over 8 GTCC
02195     for gtccId in range(N_GTCC):
02196       # test summary bit for this GTCC
02197       if ( ( errSummary.gtccErr >> gtccId) & 0x1 ):
02198         # dump the error message
02199         errLen = curErrLen = self.getWord(pErr+nWord)
02200         # loop over all errors
02201         while (curErrLen):
02202           curErrWords = 0
02203           errGTCCmsg = evErr_GTCC_Message()
02204           errGTCC = evErr_GTCC(self.getWord(pErr+nWord+curErrLen))
02205           errGTCCmsg.errGTCC = errGTCC
02206           errGTCCmsg.gtcc = GTCC_ERR_MAP[gtccId]
02207           self.evt.addErrGTCCmsg(errGTCCmsg)
02208           if self.__debugParserOutput or forcePrint:
02209             print
02210             print ("   GTCC %d, GTRC %d Error Message: raw ( 0x%04x )" %
02211                     ( errGTCCmsg.gtcc,
02212                       errGTCC.nGTRC,
02213                       errGTCC.ui
02214                     )
02215                   )
02216             print("   ================================================")
02217           # process error bits from LSB upto LSB
02218           if errGTCC.phsGTRC:
02219             # print GTRC error parameter from stack
02220             curErrWords+=1
02221             err = self.getWord(pErr+nWord+curErrLen-curErrWords)
02222             errGTCCmsg.parameters['PHS_GTRC'] = err
02223             if self.__debugParserOutput or forcePrint:
02224               print("   GTRC Phasing Error:   0x%04x" % err)
02225               print("   =============+=============")
02226               print("       Layer    |     Tag")
02227               print("   Rcvd   Expct | Rcvd   Expct")
02228               print("   =============+=============")
02229               print("    %02d     %02d   |  %d      %d" % ((err>>12) & 0xF, (err>>8) & 0xF, (err>>2) & 0x3, err & 0x3))
02230               print
02231           if ( errGTCC.phsGTFE):
02232             # print 5 GTFE error parameters from stack -- comes before
02233             # FIFO FULL error words if any.
02234             errGTCCmsg.parameters['PHS_GTFE'] = []
02235             for i in range(5):
02236               gtfePhs = self.getWord(pErr+nWord+curErrLen-curErrWords-5+i)
02237               errGTCCmsg.parameters['PHS_GTFE'].append(gtfePhs)
02238               if self.__debugParserOutput or forcePrint:
02239                 print("   GTFE Phasing Error:   0x%04x\n" % gtfePhs)
02240             curErrWords += 5
02241           if errGTCC.fifoFull:
02242             #  print 1 error parameter from stack -- last word on parameter stack, immediately
02243             #  before the error word.
02244             curErrWords+=1
02245             errGTCCmsg.parameters['FIFO_FULL'] = self.getWord(pErr+nWord+curErrLen-curErrWords)
02246             if self.__debugParserOutput or forcePrint:
02247               print("   FIFO Full Error:   0x%04x\n" % errGTCCmsg.parameters['FIFO_FULL'])
02248           if self.__debugParserOutput or forcePrint:
02249             if errGTCC.cblTimeOut:
02250                 print("   Cable Timeout Error")
02251             if errGTCC.hdrParity:
02252                 print("   Header Parity Error")
02253             if errGTCC.wrdCntParity:
02254                 print("   Word Count Parity Error")
02255             if errGTCC.GTRCsum:
02256                 print("   GTRC Summary Error")
02257             if errGTCC.dataParity:
02258                 print("   Data Parity Error")
02259           curErrLen -= curErrWords + 1
02260         if self.__debugParserOutput or forcePrint:
02261           print("   ------------------------------------------------")
02262           print
02263         nWord += errLen + 1
02264     return nWord
02265
02266   def __dumpErrCablePhase(self, pErr, nWord, forcePrint=0):
02267     """\brief Decodes the cable phase error contribution.
02268
02269     \param  pErr       Pointer to 16-bit aligned tower event error contribution
02270     \param  nWord      Index into begining of error data
02271     \param  forcePrint If specified, dump the error even if in non-debug mode
02272
02273     \return            Current offset into the error contribution
02274     """
02275
02276     # decode cable phase error structure
02277     cblPhs = evErr_CablePhase(self.getWord(pErr+nWord))
02278     self.evt.errCablePhase = cblPhs
02279     if self.__debugParserOutput or forcePrint:
02280       print("   Cable Controller Phasing Error: raw ( 0x%04x )" % cblPhs.ui)
02281       print("   ================================================")
02282       print("   GTCC |"),
02283     # loop over 8 GTCCs
02284       for i in range(N_GTCC):
02285         print("\b %d |" % GTCC_ERR_MAP[7 - i]),
02286       print
02287       print("   -----+"),
02288       # loop over 8 GTCCs
02289       for i in range(N_GTCC):
02290         print("\b---+"),
02291       print
02292       print("   Tag  |"),
02293       # loop over 8 GTCCs
02294       for i in range(N_GTCC):
02295         print("\b %d |" % (cblPhs.ui >> ((7-i) << 1) & 0x3)),
02296       print
02297       print("   ------------------------------------------------")
02298       print
02299
02300     # increment past cable phase error
02301     return nWord+1
02302
02303
02304   def __dumpErrCableTimeOut(self, pErr, nWord, forcePrint=0):
02305     """\brief Decodes the cable timeout error contribution.
02306
02307     \param  pErr       Pointer to 16-bit aligned tower event error contribution
02308     \parm   nWord      Index into begining of error data
02309     \param  forcePrint If specified, dump the error even if in non-debug mode
02310
02311     \return            Current offset into the error contribution
02312     """
02313     cblTimeOut = evErr_CableTimeOut(self.getWord(pErr+nWord))
02314     self.evt.errCableTimeOut = cblTimeOut
02315     if self.__debugParserOutput or forcePrint:
02316       print("   Cable Time Out Error: raw ( 0x%04x )" % cblTimeOut.ui)
02317       print("   ================================================")
02318       print("   GCCC | "),
02319     # loop over 4 GCCCs
02320       for i in range(N_GCCC):
02321         if (cblTimeOut.ui >> i) & 0x1:
02322           print("\b%d  " % GCCC_MAP[i]),
02323       print
02324       print("   ------------------------------------------------")
02325       print("   GTCC | "),
02326     # loop over 8 GTCCs
02327       for i in range(N_GTCC):
02328         if (cblTimeOut.ui >> (i+4)) & 0x1:
02329           print("\b%d  " % GTCC_ERR_MAP[i]),
02330       print
02331       print("   ------------------------------------------------")
02332       print
02333
02334     # increment past cable timeout error
02335     return nWord+1
02336
02337
02338   def evDumpTEM_Error(self, forcePrint=0):
02339     """\brief Decodes the event error contribution.
02340
02341     If an error contribution is present this prints up to 20 16-bit
02342     words of the error contribution.
02343
02344     \param  forcePrint If specified, dump the error even if in non-debug mode
02345     """
02346     errWord = 0
02347
02348     # check if we have an error contribution
02349     es = self.evt.summary
02350     if ( es.error == 0):
02351       return 0
02352
02353     pErr = self.evGetTEM_Error() << 1
02354     errVal = self.getWord(pErr+errWord)
02355     if errVal:
02356       if self.__debugParserOutput or forcePrint:
02357         print ("   Event Error Info")
02358         print ("   ================================================")
02359
02360       if self.__debugParserOutput or forcePrint:
02361         # print 16-bit error words
02362         errPtr = pErr
02363         i = 0
02364         while errPtr < self.evt.cont_size / 2:
02365           print ("    raw %d: 0x%04x" % (i, self.getWord(errPtr)))
02366           errPtr = errPtr + 1
02367           i += 1
02368           if i > 20: break
02369         print
02370
02371       # print error summary
02372       errSummary = evErr_Summary(errVal)
02373       self.evt.errSummary = errSummary
02374       if self.__debugParserOutput or forcePrint:
02375         print("   Error Summary: raw ( 0x%04x )" % errSummary.ui)
02376         print("   ================================================")
02377         print("   | cbl t/o | cbl phs |    TKR    |   CAL ")
02378         print("   ----------+---------+-----------+---------------")
02379       gtccErrBits = ""
02380       for i in range(N_GTCC):
02381         if ( (errSummary.gtccErr >> (7-i)) & 0x1):
02382           gtccErrBits = gtccErrBits + "1"
02383         else:
02384           gtccErrBits = gtccErrBits + "0"
02385       gcccErrBits = ""
02386       for i in range(4):
02387         if ( (errSummary.gcccErr >> (3-i)) & 0x1):
02388           gcccErrBits += "1"
02389         else:
02390           gcccErrBits += "0"
02391       if self.__debugParserOutput or forcePrint:
02392         print("   |    %d    |    %d    |  %s |  %s" % (errSummary.cblTimeOut, errSummary.cblPhsErr, gtccErrBits, gcccErrBits))
02393         print("   ------------------------------------------------")
02394
02395       # increment error pointer past error summary word
02396       errWord += 1
02397
02398       # error contributions are order as the LSB of the error summary,
02399       # i.e. the contributions come as: CAL, TKR, cable timeout, cable phase
02400
02401       if errSummary.gcccErr:
02402         errWord = self.__dumpErrGCCC( errSummary, pErr, errWord, forcePrint)
02403       if errSummary.gtccErr:
02404         errWord = self.__dumpErrGTCC( errSummary, pErr, errWord, forcePrint)
02405       if errSummary.cblPhsErr:
02406         errWord = self.__dumpErrCablePhase( pErr, errWord, forcePrint)
02407       if errSummary.cblTimeOut:
02408         errWord = self.__dumpErrCableTimeOut( pErr, errWord, forcePrint)
02409
02410       if self.__debugParserOutput or forcePrint:
02411         print("   ------------------------------------------------")
02412
02413     return 0
02414
02415   def __dumpCalDiag(self, diag):
02416     """\brief Decodes all the Calorimeter diagnostic info
02417
02418     \param diag Pointer to event diagnostic data
02419     """
02420     print("   Calorimeter Diagnostic Data")
02421     print("   ================================================")
02422
02423     for i in range(len(diag.cal)):
02424       print("                     layer %s    GCCC %d" % (diag.cal[i].layer, diag.cal[i].gccc ))
02425       print("               ----------------+-------------------")
02426       print("                Neg Layer-End  |  Pos Layer-End")
02427       print("               ----------------+-------------------")
02428       print("   Log Accepts "),
02429       nle_str = ""
02430       ple_str = ""
02431       for j in range(N_GCFE):
02432         if (diag.cal[i].negLayerEnd.logAccepts >> j) & 0x1:
02433           nle_str += "1"
02434         else:
02435           nle_str += "0"
02436       for j in range(N_GCFE):
02437         if (diag.cal[i].posLayerEnd.logAccepts >> j) & 0x1:
02438           ple_str += "1"
02439         else:
02440           ple_str += "0"
02441       print("%s   |  %s") % (nle_str, ple_str)
02442       print("               ----------------+-------------------")
02443       print("   Trg Low Eng         %d       |        %d" %
02444         (diag.cal[i].negLayerEnd.trgRequestLow, diag.cal[i].posLayerEnd.trgRequestLow))
02445       print("               ----------------+-------------------")
02446       print("   Trg High Eng        %d       |        %d" %
02447         (diag.cal[i].negLayerEnd.trgRequestHigh, diag.cal[i].posLayerEnd.trgRequestHigh))
02448       print("               ------------------------------------\n")
02449
02450   def __dumpTkrDiag(self, diag):
02451     """\brief Decodes all the tracker diagnostic info
02452
02453     \param diag Pointer to event diagnostic data
02454
02455     """
02456     print("   Tracker Diagnostic Data")
02457     print("   =============================")
02458
02459     print("   GTCC     | Trigger Request (GTRC)")
02460     print("   ---------+-------------------")
02461
02462     for i in range(len(diag.tkr)):
02463       print("   GTCC_%d   | " % diag.tkr[i].gtcc),
02464       trq_str = ""
02465       for j in range(N_GTRC):
02466         if (diag.tkr[i].trgRequests >> (N_GTRC - 1 - j)) & 0x1:
02467           trq_str += "1"
02468         else:
02469           trq_str += "0"
02470       print("%s" % trq_str)
02471       print("   ---------+-------------------")
02472     print
02473
02474   def evDumpDiagnostic(self):
02475     """\brief Decodes the event diagnostic contribution
02476
02477     """
02478
02479     # check if we have a diagnostic contribution
02480     es = self.evt.summary
02481     if es.diag == 0:
02482       return 0
02483
02484     pDiag = self.evGetTEM_Diagnostic() << 1
02485     if pDiag:
02486       diag = evDiag_Data()
02487       for i in range(len(diag.cal)):
02488         diag.cal[i].gccc           = GCCC_MAP[i>>1]
02489         diag.cal[i].layer          = "%c%d" % (q(i<4,'x','y'), i%4)
02490         diag.cal[i].negLayerEnd.ui = self.getWord(pDiag)
02491         pDiag += 1
02492         diag.cal[i].posLayerEnd.ui = self.getWord(pDiag)
02493         pDiag += 1
02494       for i in range(len(diag.tkr)):
02495         diag.tkr[i].ui = self.getWord(pDiag)
02496         diag.tkr[i].gtcc = GTCC_MAP[i]
02497         pDiag += 1
02498       self.evt.diag = diag
02499       if self.__debugParserOutput:
02500         # print out the diagnostic
02501         print("\n   Event Diagnostic Info")
02502         print("   ================================================\n")
02503         self.__dumpCalDiag( diag)
02504         self.__dumpTkrDiag( diag)
02505         print("   End of Event Diagnostic Info")
02506         print("   ================================================")
02507         print
02508     return 1
02509
02510   def evDumpSummary(self, minEvSize=24):
02511     """\brief Decodes the event summary word.
02512
02513     Given a pointer to tower event contribution print the event summary word.
02514
02515     \param minEvSize Minimum event size w/o error (default=24)
02516     """
02517     es = self.evt.summary
02518     print
02519     print("   Event Contribution Size (bytes): %d" % self.evt.cont_size)
02520     if self.evt.cont_size < minEvSize:
02521       print
02522       print("   *** WARNING *** WARNING *** WARNING *** WARNING ***")
02523       print("   *** Event size less than minimal bytes (%d)     ***" % minEvSize)
02524       print("   *** WARNING *** WARNING *** WARNING *** WARNING ***")
02525     print("   Event Contribution Source Addr : 0x%02x" % self.evt.contributor)
02526     print("   Event Contribution Summary Word: 0x%08x" % es.ui)
02527     print("   =====================================")
02528     print("   %-20s: %05d-%02d" % ("Event Number-Tag", es.evNumber, es.tag))
02529     print("   =====================================")
02530     print("   %-20s: %d" % ("Error", es.error))
02531     print("   %-20s: %d" % ("TRG Parity Error", es.trgParityErr))
02532     print("   =====================================")
02533     print("   %-20s: %d" % ("Diagnostic", es.diag))
02534     print("   %-20s: %d" % ("Cal Strobe", es.calStrobe))
02535     print("   %-20s: %d" % ("Readout 4", es.readout4))
02536     print("   %-20s: %d" % ("Zero suppress", es.zeroSuppress))
02537     print("   %-20s: %d" % ("TACK", es.TACK))
02538     print("   %-20s: %d" % ("Marker", es.marker))
02539
02540     if es.error or es.trgParityErr:
02541       print
02542       print("   *** WARNING *** WARNING *** WARNING *** WARNING ***")
02543       print("   *** This event has errors -- See Summary Word   ***")
02544       print("   *** WARNING *** WARNING *** WARNING *** WARNING ***")
02545     return 0
02546
02547   def __dumpAEMvec(self, cbl, type):
02548     """\brief Decodes the set bits specified by \a cbl and \a type
02549
02550     This method is used by the old AEM event parser evDumpEventAEM_G2
02551
02552     \param cbl  Which cable is being decoded
02553     \param type ACD vector type 1-veto, 2-zs
02554     """
02555     hitVect = self.evGetAEM_Vec(cbl, type)
02556     if self.__debugParserOutput:
02557       print("    %02d             " % cbl),
02558       for i in range(N_GAFE):
02559         print("%d" % ((hitVect >> i) & 0x1)),
02560       print("  0x%05x" % hitVect)
02561       print("   -----   ---------------------------------------------------------")
02562
02563   def __dumpAEMlist(self, type):
02564     """\brief Decodes the list of hit vectors specified by \a type.
02565
02566     This method is used by the old AEM event parser evDumpEventAEM_G2
02567
02568     This function is used to decode the AEM Veto List and the AEM Accepts List.
02569
02570     \param type ACD vector type
02571     """
02572     if self.__debugParserOutput:
02573       print("   -----   ---------------------------------------------------------")
02574       print("   Cable   Channel "),
02575       # number channels 17 down to 0
02576       for i in range(8):
02577         print("1"),
02578       for i in range(10):
02579         print("0"),
02580       print("  Raw")
02581       print("                   "),
02582       for i in range(17, -1, -1):
02583         print("%d" % (i % 10)),
02584       print
02585       print("   -----   ---------------------------------------------------------")
02586
02587     # find i_th 18 bit word
02588     for i in range(N_GARC):
02589       self.__dumpAEMvec(i, type)
02590
02591   def evDumpAEM_Vetos(self):
02592     """\brief Decodes the AEM veto hit list contribution
02593
02594     This method is used by the old AEM event parser evDumpEventAEM_G2
02595
02596     """
02597     if self.__debugParserOutput:
02598       print("\n   AEM Veto Hit Vectors")
02599       print("   =================================================================")
02600     self.__dumpAEMlist(AEM.EV_AEM_VETO)
02601     return 0
02602
02603   def __getCblDataAEM(self, cbl):
02604     """\brief Returns pointer to AEM event data header for cable specified by \a cbl.
02605
02606     This method is used by the old AEM event parser evDumpEventAEM_G2
02607
02608     \param  cbl Which cable is being decoded
02609     \return     Offset to the AEM event data header
02610     """
02611     # the data begins one word after the event summary
02612     pCur = (self.evGetSummary() + 1) << 1
02613     while (cbl):
02614       # skip to the third word and test the "PHAs Follow" bit
02615       pCur += 2
02616       if self.getWord(pCur) & (0x1 <<10):
02617         # walk PHAs
02618         pCur += 1
02619         morePHAs = 1
02620         while (morePHAs):
02621           # check bit 15 for more PHAs
02622           morePHAs = self.getWord(pCur) & 0x4000
02623           pCur += 1
02624       else:
02625         pCur += 1
02626       cbl -= 1
02627     return pCur
02628
02629   def evDumpAEM_Accepts(self):
02630     """\brief Decodes the AEM accept list contribution
02631
02632     This method is used by the old AEM event parser evDumpEventAEM_G2
02633
02634     """
02635     if self.__debugParserOutput:
02636       print("\n   AEM Accept Hit Vectors")
02637       print("   =================================================================")
02638     self.__dumpAEMlist(AEM.EV_AEM_ZEROSUP)
02639     return 0
02640
02641   def evGetAEM_PHA(self, cbl):
02642     """\brief Returns pointer to start of AEM PHA values
02643
02644     This method is used by the old AEM event parser evDumpEventAEM_G2
02645
02646     \param cbl Which cable is being decoded
02647     """
02648     # fetch pointer to header for requested cable
02649     pHdr = self.__getCblDataAEM(cbl)
02650     # check "has PHA" bit is set
02651     if self.getWord(pHdr+2) & (0x1 << 10):
02652       # return pointer to first PHA value
02653       pPHA = pHdr+3
02654     else:
02655       pPHA = None
02656     return pPHA
02657
02658   def evGetAEM_Vec(self, cbl, type):
02659     """\brief Returns the 18-bit vector for cable specified by \a cbl and \a type
02660
02661     This method is used by the old AEM event parser evDumpEventAEM_G2
02662
02663     \param  cbl  Which cable is being decoded
02664     \param  type ACD vector type
02665     \return      18-bit vector
02666
02667     """
02668     # fetch pointer to header for requested cable
02669     pHdr = self.__getCblDataAEM(cbl)
02670
02671     if ( type == AEM.EV_AEM_VETO):
02672       # decode veto vector
02673       vec = ((self.getWord(pHdr) << 3) | (self.getWord(pHdr+1) >> 13)) & 0x3FFFF
02674       self.evt.aem.vetoHitVectors[cbl] = vec
02675     elif ( type == AEM.EV_AEM_ZEROSUP ):
02676       # decode zero suppress vector
02677       vec = ((self.getWord(pHdr+1) << 5) | (self.getWord(pHdr+2) >> 11)) & 0x3FFFF
02678       self.evt.aem.acceptHitVectors[cbl] = vec
02679     else:
02680       vec = 0
02681
02682     return vec
02683
02684
02685   def evDumpAEM_PHA(self):
02686     """\brief Decodes the AEM PHA contribution.
02687
02688     This method is used by the old AEM event parser evDumpEventAEM_G2
02689
02690     Given a pointer to AEM event contribution print the PHA values.
02691     """
02692     if self.__debugParserOutput:
02693       print("\n   AEM PHA Values")
02694       print("   ================================================================")
02695       print("   ** Warning:  This decoder assumes GARC register MAX_PHA = 18")
02696       print("   ** and GARC registers PHA_EN_0/1 = 0xFFFF.")
02697       print("   ================================================================\n")
02698       print("   ----+-----+-------+------------+--------------------")
02699       print("   Cbl   Rng    ADC    Parity Err    Raw")
02700       print("   ----+-----+-------+------------+--------------------")
02701
02702     for cbl in range(N_GARC):
02703       # do we have any PHAs for this cable ?
02704       pRaw = self.evGetAEM_PHA(cbl)
02705       if pRaw != None:
02706         if ( self.getWord(pRaw) == 0 ):
02707           # null terminator PHA value -- go to next cable
02708           continue
02709         morePHAs = 1
02710         while (morePHAs):
02711           pha = evAEM_PHA(self.getWord(pRaw))
02712           self.evt.aem.addPHA(cbl, pha)
02713           pRaw += 1
02714           if self.__debugParserOutput:
02715             print("    %02d    %d    0x%03x      %d         0x%04x" % (cbl, pha.range, pha.ADC, pha.parityErr, pha.ui))
02716           # check bit 15 for more PHAs
02717           morePHAs = pha.more
02718
02719     if self.__debugParserOutput:
02720       print("   ----------------------------------------------------\n")
02721
02722     return 0
02723
02724
02725 # @fn       unsigned int evDumpEventAEM( unsigned int *pEv)
02726 # @param pEv pointer to 32-bit aligned AEM event contribution
02727 # @brief    Decodes the event contribution
02728 # @return   OK
02729
02730   def evDumpEventAEM_G2(self):
02731     """\brief Given a pointer to AEM event contribution print its contents.
02732
02733     This method is the old G2 compatible AEM event parser, please use the new
02734     event parser evDumpEventAEM for G3 based AEM events.
02735
02736     """
02737     if self.__debugParserOutput:
02738       # minimum event size is 24
02739       self.evDumpSummary(24)
02740
02741     self.evDumpAEM_Vetos()
02742     self.evDumpAEM_Accepts()
02743     self.evDumpAEM_PHA()
02744     # evDumpAEM_Error()
02745     return 0
02746
02747
02748   def evDumpEventAEM(self):
02749     """\brief The new AEM event parsing routine.
02750
02751     This parser works according to the latest specs
02752     where not all cable contributions are guaranteed to
02753     be provided.
02754     """
02755     self.evt.aem.clearEvent()
02756     if self.__debugParserOutput:
02757       # minimum contribution size is 16
02758       self.evDumpSummary(16)
02759     # the data begins one word after the event summary
02760     pHdr = (self.evGetSummary() + 1) << 1
02761     endOfCables = 0
02762     while not endOfCables:
02763       # Skip to the third word to check end of cables and cable number
02764       cblHdr3 = self.getWord(pHdr+2)
02765       cblNo = (cblHdr3 >> 4) & 0xF
02766       endOfCables = (cblHdr3 >> 8) & 0x1
02767       # Check if there are no contributions
02768       if endOfCables and cblNo == 0xF:
02769         break
02770       # decode veto vector
02771       vec = ((self.getWord(pHdr) << 3) | (self.getWord(pHdr+1) >> 13)) & 0x3FFFF
02772       self.evt.aem.vetoHitVectors[cblNo] = vec
02773       # decode zero suppress vector
02774       vec = ((self.getWord(pHdr+1) << 5) | (self.getWord(pHdr+2) >> 11)) & 0x3FFFF
02775       self.evt.aem.acceptHitVectors[cblNo] = vec
02776       # check "has PHA" bit is set
02777       if cblHdr3  & (0x1 << 10):
02778         pPHA = pHdr + 3
02779         morePHAs = 1
02780         while (morePHAs):
02781           pha = evAEM_PHA(self.getWord(pPHA))
02782           self.evt.aem.addPHA(cblNo, pha)
02783           pPHA += 1
02784           morePHAs = pha.more
02785         pHdr = pPHA
02786       else:
02787         pHdr += 3
02788     if self.__debugParserOutput:
02789       # Dump the hit vectors
02790       for typ in (AEM.EV_AEM_VETO, AEM.EV_AEM_ZEROSUP):
02791         if typ == AEM.EV_AEM_VETO:
02792           print("\n   AEM Veto Hit Vectors")
02793         else:
02794           print("\n   AEM Accept Hit Vectors")
02795         print("   =================================================================")
02796         print("   -----   ---------------------------------------------------------")
02797         print("   Cable   Channel "),
02798         # number channels 17 down to 0
02799         for i in range(8):
02800           print("1"),
02801         for i in range(10):
02802           print("0"),
02803         print("  Raw")
02804         print("                   "),
02805         for i in range(17, -1, -1):
02806           print("%d" % (i % 10)),
02807         print
02808         print("   -----   ---------------------------------------------------------")
02809         cbl = 0
02810         if typ == AEM.EV_AEM_VETO:
02811           hitVect = self.evt.aem.vetoHitVectors
02812         else:
02813           hitVect = self.evt.aem.acceptHitVectors
02814         for vec in hitVect:
02815           print("    %02d             " % cbl),
02816           for i in range(N_GAFE):
02817             print("%d" % ((vec >> i) & 0x1)),
02818           print("  0x%05x" % vec)
02819           print("   -----   ---------------------------------------------------------")
02820           cbl += 1
02821
02822       # Dump the PHA values
02823       print("\n   AEM PHA Values")
02824       print("   ================================================================")
02825       print("   ** Warning:  This decoder assumes GARC register MAX_PHA = 18")
02826       print("   ** and GARC registers PHA_EN_0/1 = 0xFFFF.")
02827       print("   ================================================================\n")
02828       print("   ----+-----+-------+------------+--------------------")
02829       print("   Cbl   Rng    ADC    Parity Err    Raw")
02830       print("   ----+-----+-------+------------+--------------------")
02831
02832       cablesWithPHA = self.evt.aem.PHA.keys()
02833       cablesWithPHA.sort()
02834       for cbl in cablesWithPHA:
02835         phaVect = self.evt.aem.PHA[cbl]
02836         for pha in phaVect:
02837           print("    %02d    %d    0x%03x      %d         0x%04x" %
02838                    (cbl, pha.range, pha.ADC, pha.parityErr, pha.ui) )
02839       print("   ----------------------------------------------------\n")
02840
02841
02842   def print_EOE_Warning(self):
02843     """\brief Print warning if we have reached the end of the contribution prematurely
02844
02845     """
02846     if self.__debugWarnings:
02847       log.error("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***")
02848       log.error("   *** Reached the end of event data while parsing             ***")
02849       log.error("   ***               This event is suspect                     ***")
02850       log.error("   *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***")
02851       logStack()
02852
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gException.py Source File

client

gException.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Exception classes"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/11/05 00:52:47 $").split(' ')[1]
00015 __version__  = "$Revision: 2.13 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import exceptions
00022 import gOcsMessages
00023 import gFswMessages
00024
00025 class LATInterfaceStatus(object):
00026   __ERRSTR = {}
00027
00028   def __invertdict(byid):
00029     byid.update(gOcsMessages.OcsMessages.OCSSTR)
00030     byid.update(gFswMessages.FswMessages.FSWSTR)
00031     byname = {}
00032     for (id, name) in byid.items():
00033       byname[name[0]] = id
00034     return byname
00035
00036   __ERRSTATUS = __invertdict(__ERRSTR)
00037
00038   def status(name):
00039     try:
00040       return LATInterfaceStatus.__ERRSTATUS[name]
00041     except:
00042       return None
00043
00044   def name(status):
00045     try:
00046       return LATInterfaceStatus.__ERRSTR[status]
00047     except:
00048       return ["OCS_UNKNERR",
00049               "OCS client/server don't agree on error code: 0x%08x" %status]
00050
00051   def message(status):
00052     [name, desc] = LATInterfaceStatus.name(status)
00053     return ' %s (0x%08x): %s' % (name, status, desc)
00054
00055   status  = staticmethod(status)
00056   name    = staticmethod(name)
00057   message = staticmethod(message)
00058
00059   def __init__(self, status):
00060     self.__status = status
00061
00062   def __str__(self):
00063     return LATInterfaceStatus.message(self.__status)
00064
00065   def errstr(self, status=None):
00066     if status is not None: self.__status = status
00067     return LATInterfaceStatus.name(self.__status)
00068
00069
00070 class LATInterfaceException(exceptions.Exception):
00071   def __init__(self, status):
00072     exceptions.Exception.__init__(self, status)
00073     self.status = status
00074
00075   def __str__(self):
00076     return LATInterfaceStatus.message(self.status)
00077
00078   def errstr(self):
00079     return LATInterfaceStatus.name(self.status)
00080
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gFswMessages.py Source File

client

gFswMessages.py

00001 # This file is generated by LATTE makefile system, do not edit.
00002 # To build this file:
00003 #   cd LATTE
00004 #   gmake client.fswmsgs
00005
00006 import LATTE.copyright_SLAC
00007
00008 class FswMessages(object):
00009   FSWSTR = {
00010     0x0f802a9d: [  "LCBD_RUNDX", "Result item, LATp undefined error %0x%08x"],
00011     0x0f802abd: [  "LCBD_RUND3", "Result item, LATp undefined error 3"],
00012     0x0f802acd: [  "LCBD_RUND7", "Result item, LATp undefined error 7"],
00013     0x0f803895: [ "LCBD_RTOERR", "Result item, LATp timeout error"],
00014     0x0f804348: [   "LCBD___OK", "Success"],
00015     0x0f805679: [  "LCBD_NOCLK", "No 20MHz LATp side clock present"],
00016     0x0f8096c3: [ "LCBD_RIUND4", "Result in-bound, Undefined status #4, descriptor 0x%08x"],
00017     0x0f8096c7: [ "LCBD_RIUND5", "Result in-bound, Undefined status #5, descriptor 0x%08x"],
00018     0x0f8096cb: [ "LCBD_RIUND6", "Result in-bound, Undefined status #6, descriptor 0x%08x"],
00019     0x0f8096cf: [ "LCBD_RIUND7", "Result in-bound, Undefined status #7, descriptor 0x%0x08x"],
00020     0x0f809885: ["LCBD_RTRUNRN", "Result item, LATp transmit underrun error"],
00021     0x0f809ac3: [ "LCBD_ROUND4", "Result out-bound, Undefined status #4, descriptor %0x08x"],
00022     0x0f809acb: [ "LCBD_ROUND6", "Result out-bound, Undefined status #6, descriptor %0x08x"],
00023     0x0f80a395: [ "LCBD_RDPERR", "Result item, LATp cell parity error"],
00024     0x0f80a795: [ "LCBD_RHPERR", "Result item, LATp header parity error"],
00025     0x0f813d59: [ "LCBD_NOROOM", "No room to add the specified PCI/LATP allowable version numbers"],
00026     0x0f814857: [ "LCBD_ENBDSB", "Attempt to both enable and disable an interrupt source %x"],
00027     0x0f81520b: ["LCBD_RESFORK", "Response FORK creation failed %x"],
00028     0x0f8166b5: [ "LCBD_EIUND1", "Event receive, Undefined error #1, descriptor 0x%08x"],
00029     0x0f816ac3: [ "LCBD_EOUND4", "Event transfer, Undefined error #4, descriptor 0x%08x"],
00030     0x0f816acb: [ "LCBD_EOUND6", "Event transfer, Undefined error #6, descriptor 0x%08x"],
00031     0x0f817eeb: [ "LCBD_AIBSEM", "Asynch semaphore creation failed"],
00032     0x0f818625: [ "LCBD_AIBCAN", "Asynch initialization operation cancelled"],
00033     0x0f818718: [ "LCBD_AIBCOM", "Asynch initialization operation completed"],
00034     0x0f821031: ["LCBD_REQFULL", "Request queue is full"],
00035     0x0f82232d: ["LCBD_RINVLST", "Result item, LATp invalid or inconsistent list"],
00036     0x0f8260cd: [ "LCBD_UNINIT", "Driver is uninitialized"],
00037     0x0f82866f: ["LCBD_RIPCITA", "Result in-bound, PCI target abort, descriptor 0x%08x"],
00038     0x0f82885f: ["LCBD_RIPCIMA", "Result in-bound, PCI master abort, descriptor 0x%08x"],
00039     0x0f8288bb: ["LCBD_RIPCIPE", "Result in-bound, PCI parity error, descriptor 0x%08x"],
00040     0x0f82966f: ["LCBD_ROPCITA", "Result out-bound, PCI target abort, descriptor 0x%08x"],
00041     0x0f82985f: ["LCBD_ROPCIMA", "Result out-bound, PCI master abort, descriptor 0x%08x"],
00042     0x0f8298bb: ["LCBD_ROPCIPE", "Result out-bound, PCI parity error, descriptor 0x%08x"],
00043     0x0f82c0c3: [ "LCBD_UCBRWI", "UCB PBS/RW_init failed with code %d"],
00044     0x0f82c0cb: [ "LCBD_UCBRWD", "UCB PBS/RW_destroy failed with code %d"],
00045     0x0f8300d7: [ "LCBD_PIDIRQ", "Unable to connect PID interrupt handler"],
00046     0x0f8319d3: [ "LCBD_PCIREV", "PCI FPGA revision number 0x%2x is not supported by this driver"],
00047     0x0f831ed7: [ "LCBD_PCIIRQ", "Unable to connect PCI interrupt handler"],
00048     0x0f83c663: ["LCBD_STATSIFL", "Unable to initialize statistics block"],
00049     0x0f84269b: ["LCBD_NTFYTSK", "Unable to create notification service task"],
00050     0x0f8426eb: ["LCBD_NTFYSEM", "Unable to create semaphore for notification control block"],
00051     0x0f851691: ["LCBD_EITRUNC", "Event receive, LATp truncate error,  descriptor 0x%08x"],
00052     0x0f859395: ["LCBD_EIDPERR", "Event receive, LATp cell parity error, descriptor 0x%08x"],
00053     0x0f85d66f: ["LCBD_EOPCITA", "Event transfer, PCI target abort, descriptor 0x%08x"],
00054     0x0f85d85f: ["LCBD_EOPCIMA", "Event transfer, PCI master abort, descriptor 0x%08x"],
00055     0x0f85d8bb: ["LCBD_EOPCIPE", "Event transfer, PCI parity error, descriptor 0x%08x"],
00056     0x0f85fb9b: ["LCBD_AIBTASK", "Asynch initialization task creation failed %x"],
00057     0x0f862677: ["LCBD_ISRRSTQ", "The ISR RESULT FORK queue was not set before enabling"],
00058     0x0f863df7: ["LCBD_ISREVTQ", "The ISR EVENT FORK queue was not set before enabling"],
00059     0x0f86760b: ["LCBD_EVTFORK", "Event FORK creation failed %x"],
00060     0x0f86c63f: ["LCBD_DRNRSTF", "Found %d outstanding operations in the result FIFO"],
00061     0x0f86dd63: ["LCBD_DRNNPCI", "Could not drain ques, PCI side not initialized"],
00062     0x0f86ddbf: ["LCBD_DRNEVTF", "Found %d outstanding operations in the event  FIFO"],
00063     0x0f86f3df: ["LCBD_INSEBUF", "Insufficient memory to allocate event buffer"],
00064     0x0f879bdf: ["LCBD_INVEBUF", "Invalid event buffer %8.8x"],
00065     0x0f890f09: ["LCBD_OFFLINE", "Driver is offline"],
00066     0x0f8ab4d7: ["LCBD_ROQEMPTY", "Result out-bound, Result queue empty 0x%08x"],
00067     0x0f8abd43: ["LCBD_ROBUFEMP", "Result out-bound, Intermediate LCB FIFO buffer empty, descriptor 0x%08x"],
00068     0x0f8b9a13: ["LCBD_FCBMTXI", "PBS/MTX_init failed for event fcb code = %8.8x"],
00069     0x0f8b9a1b: ["LCBD_FCBMTXD", "PBS/MTX_destroy failed for event fcb code = %8.8x"],
00070     0x0f8bf8d3: ["LCBD_FPGAREV", "FPGA revision numbers combination PCI=0x%2x LATp=0x%2x is not support by this driver"],
00071     0x0f8c03bb: ["LCBD_PIDIRQD", "Unable to disconnect PID interrupt handler"],
00072     0x0f8c7bbb: ["LCBD_PCIIRQD", "Unable to disconnect PCI interrupt handler"],
00073     0x0f8c8873: ["LCBD_PCIFAIL", "Unable to detect PCI board with vendorID 0x%04x, deviceID 0x%04x"],
00074     0x0f90aafb: ["LCBD_NTFYNFND", "Unable to locate the nut on the que head"],
00075     0x0f90ba13: ["LCBD_NTFYMTXI", "Unable to create mutex for NUT que"],
00076     0x0f90ba1b: ["LCBD_NTFYMTXD", "Unable to destroy mutex for NUT que, code = %8.8x"],
00077     0x0f966777: ["LCBD_NULEVTCB", "Event callback handler specified as NULL"],
00078     0x0f97b4d7: ["LCBD_EOQEMPTY", "Event transfer, Event queue empty 0x%08x"],
00079     0x0f97bd43: ["LCBD_EOBUFEMP", "Event transfer, Intermediate LCB FIFO buffer empty, descriptor 0x%08x"],
00080     0x0f9ea7d7: ["LCBD_INVPROTO", "Invalid Protocol number, protocol = %d > 3"],
00081     0x0fa3ba6b: ["LCBD_CLTOOBIG", "Command List length is too big,  length = 0x%08x"],
00082     0x0fa586b7: ["LCBD_CLMISALN", "Command List is misaligned, list = 0x%08x"],
00083     0x0fb22263: ["LCBD_PCIMAPLP", "Unable to map local address to PCI memory"],
00084     0x0fb223b3: ["LCBD_PCIMAPPL", "Unable to map PCI memory to local address"],
00085     0x20801dd6: [    "LEM_INFO", "%s %04d: %s"],
00086     0x20801f97: [   "LEM_RIERR", "Result item has error field set"],
00087     0x20802f57: [   "LEM_TOHV1", "Timeout acquiring AEM Environment HV1"],
00088     0x20802f5b: [   "LEM_TOHV2", "Timeout acquiring AEM Environment HV2"],
00089     0x2080320b: [   "LEM_TOVDD", "Timeout acquiring AEM Environment VDD"],
00090     0x20803605: [    "LEM_WARN", "%s %04d: %s"],
00091     0x20803ad7: [   "LEM_ERROR", "%s %04d: %s"],
00092     0x20809d43: [  "LEM_TOTEMP", "Timeout acquiring AEM Environment TEMP"],
00093     0x2080c997: [  "LEM_SUMERR", "Summary error bit was set in response"],
00094     0x20815733: [  "LEM_NOIMPL", "Feature not implemented"],
00095     0x2082c3d7: [  "LEM_PARITY", "There was a parity error on the register read"],
00096     0x208333a8: [ "LEM_SUCCESS", "Success"],
00097     0x20848e97: [ "LEM_LISTERR", "Error handling command list"],
00098     0x208793eb: [ "LEM_INVALID", "Response from AEM Environment register block is invalid"],
00099     0x2089de97: [ "LEM_UNKNOWN", "Cannot map error %08x"],
00100     0x7f0308bb: [  "MSG_GAPEND", "Message blackout ends (%d messages dropped)"],
00101     0x7f0333a8: [ "MSG_SUCCESS", "Success"],
00102     0x7f094bbb: ["MSG_TNM2LONG", "A task name is restricted to <= %d letters"],
00103     0x7f0d2c6b: [ "MSG_PKT2FEW", "Initialization parameter packet count too small"],
00104     0x7f143873: ["MSG_ALOCFAIL", "Could not allocate %d bytes"],
00105     0x7f21b0fb: ["MSG_OUTNTFND", "Target of MSG_deletOutputRtn() not found"],
00106     0x7f268bd7: ["MSG_UNIXEROR", "Unrecognised message 0x%08x (possibly unix error)"],
00107     0x7f26ae38: ["MSG_UNIXGOOD", "Unrecognised message 0x%08x (possibly unix success)"],
00108     0x7f277a58: ["MSG_UNKNOWNS", "Unrecognised message 0x%08x (success)"],
00109     0x7f277a8b: ["MSG_UNKNOWNE", "Unrecognised message 0x%08x (error)"],
00110     0x7f277ab2: ["MSG_UNKNOWNI", "Unrecognised message 0x%08x (information)"],
00111     0x7f277b19: ["MSG_UNKNOWNW", "Unrecognised message 0x%08x (warning)"],
00112     0x7f2a3073: ["MSG_FORKFAIL", "Forking the message task failed"],
00113     0x7f2a6073: ["MSG_FINDFAIL", "Cannot find alternate messages in message database"],
00114     0x7f2e7873: ["MSG_FPAIFAIL", "FPA initialization failed"],
00115     0x7f2ec073: ["MSG_FPAGFAIL", "FPA_get() failed during start"],
00116     0x7f310e37: ["MSG_GAPBEGIN", "Message blackout starts (trying to report 0x%08x)"],
00117     0x7f326f2b: ["MSG_BADSTATE", "Request illegal in current state of message"],
00118     0x7f3493a3: ["MSG_PKT2SMAL", "Initialization parameter packet length too small"],
00119     0x21005033: [   "PIG_NOSUP", "PIG does not support this feature at this time."],
00120     0x21005927: [   "PIG_NOPDU", "No PDUs are selected for power"],
00121     0x210077f8: [   "PIG_INMUD", "Happy as a pig in mud"],
00122     0x21009433: [   "PIG_UNSUP", "Function unsupported"],
00123     0x210094db: [  "PIG_TEMCFG", "Application of configuration would cause TEM %d to be powered from both PDUs"],
00124     0x210109a2: [  "PIG_SQUEAL", "%s"],
00125     0x2101520b: [ "PIG_RESFORK", "Failed creating result queue with error %08x"],
00126     0x21017b8b: [  "PIG_LCBQUE", "Attempt to execute a command list failed with errors %x"],
00127     0x210194db: [  "PIG_ACDCFG", "Application of configuration would cause the ACD to be powered from both PDUs"],
00128     0x2101abdb: [  "PIG_EPUCFG", "Application of configuration would cause EPU %d to be powered from both PDUs"],
00129     0x210288b3: [  "PIG_FNCALL", "Function call on line %d of function %s returned error %08x"],
00130     0x21032887: [  "PIG_BADSIU", "Bad siu_id passed to PIG_lcb_start %d"],
00131     0x21032cbb: [  "PIG_BADORD", "An attempt was made to reorder the order array with %d elements into a bad order (repeated or missing elements)"],
00132     0x210333a8: [ "PIG_SUCCESS", "Success"],
00133     0x210399db: [ "PIG_ERRREAD", "Error %x reading %s"],
00134     0x2103a79b: [ "PIG_ERRLOAD", "Error %x executing load number %d"],
00135     0x2104269b: [ "PIG_NTFYTSK", "Failed creating notify queue with error %08x"],
00136     0x2105dc73: [ "PIG_LCBFAIL", "LCB failed to initialise: Final state was %d"],
00137     0x2106760b: [ "PIG_EVTFORK", "Failed creating event queue with error %08x"],
00138     0x210c9ddb: [ "PIG_BADREAD", "Reading %s produced wrong result: 0x%x (received) != 0x%x (expected)"],
00139     0x21250c5b: ["PIG_OVERFLOW", "Too many command items (%d) have been placed on command list (capacity %d)"],
00140   }
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGEM.py Source File

database

gGEM.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST GEM functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/10/21 21:38:29 $").split(' ')[1]
00015 __version__ = "$Revision: 2.9 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022 import gAttr
00023
00024 class GGEM(gDb.Gdb):
00025   """\brief GGEM node.
00026
00027   """
00028   __attrs = []
00029
00030   __EPU_ADDR = 0x20
00031
00032   def __init__(self, client, parent):
00033     """\brief Initialize child objects.
00034
00035     """
00036     self.GEMC    = None
00037     self.GEMMG   = None
00038     self.GEMST   = None
00039     self.GEMSC   = None
00040     self.GEMVG   = None
00041     self.GEMIE   = None
00042     self.GEMW    = None
00043     gDb.Gdb.__init__(self, client, parent, 0)
00044
00045   def getEPUaddr(self):
00046     # Hard code EPU_ADDR to 0x20 to work with the Caligula FSW release
00047     #response = self.cmdrsp('getEPUaddr', 'slh')
00048     #return response.status()
00049     return GGEM.__EPU_ADDR
00050
00051   def downGEMC(self):
00052     """\brief Navigate to the GGEMC node
00053
00054     \return         The GGEMC object instance
00055     """
00056     return self.GEMC
00057
00058   def existsGEMC(self):
00059     """\brief Check if the GGEMC instance exists in the schema.
00060
00061     \return       1 if it exists, 0 if it doesn't.
00062     """
00063     return self.GEMC != None
00064
00065   def downGEMMG(self):
00066     """\brief Navigate to the GGEMMG node
00067
00068     \return         The GGEMMG object instance
00069     """
00070     return self.GEMMG
00071
00072   def existsGEMMG(self):
00073     """\brief Check if the GGEMMG instance exists in the schema.
00074
00075     \return       1 if it exists, 0 if it doesn't.
00076     """
00077     return self.GEMMG != None
00078
00079   def downGEMST(self):
00080     """\brief Navigate to the GGEMST node
00081
00082     \return         The GGEMST object instance
00083     """
00084     return self.GEMST
00085
00086   def existsGEMST(self):
00087     """\brief Check if the GGEMST instance exists in the schema.
00088
00089     \return       1 if it exists, 0 if it doesn't.
00090     """
00091     return self.GEMST != None
00092
00093   def downGEMSC(self):
00094     """\brief Navigate to the GGEMSC node
00095
00096     \return         The GGEMSC object instance
00097     """
00098     return self.GEMSC
00099
00100   def existsGEMSC(self):
00101     """\brief Check if the GGEMSC instance exists in the schema.
00102
00103     \return       1 if it exists, 0 if it doesn't.
00104     """
00105     return self.GEMSC != None
00106
00107   def downGEMVG(self):
00108     """\brief Navigate to the GGEMVG node
00109
00110     \return         The GGEMVG object instance
00111     """
00112     return self.GEMVG
00113
00114   def existsGEMVG(self):
00115     """\brief Check if the GGEMVG instance exists in the schema.
00116
00117     \return       1 if it exists, 0 if it doesn't.
00118     """
00119     return self.GEMVG != None
00120
00121   def downGEMVG(self):
00122     """\brief Navigate to the GGEMVG node
00123
00124     \return         The GGEMVG object instance
00125     """
00126     return self.GEMVG
00127
00128   def existsGEMVG(self):
00129     """\brief Check if the GGEMVG instance exists in the schema.
00130
00131     \return       1 if it exists, 0 if it doesn't.
00132     """
00133     return self.GEMVG != None
00134
00135   def downGEMIE(self):
00136     """\brief Navigate to the GGEMIE node
00137
00138     \return         The GGEMIE object instance
00139     """
00140     return self.GEMIE
00141
00142   def existsGEMIE(self):
00143     """\brief Check if the GGEMIE instance exists in the schema.
00144
00145     \return       1 if it exists, 0 if it doesn't.
00146     """
00147     return self.GEMIE != None
00148
00149   def downGEMW(self):
00150     """\brief Navigate to the GGEMW node
00151
00152     \return         The GGEMW object instance
00153     """
00154     return self.GEMW
00155
00156   def existsGEMW(self):
00157     """\brief Check if the GGEMW instance exists in the schema.
00158
00159     \return       1 if it exists, 0 if it doesn't.
00160     """
00161     return self.GEMW != None
00162
00163 ## private:
00164
00165   def __removeGEMC(self):
00166     self.GEMC = None
00167
00168   def __addGEMC(self):
00169     ggemc = GGEMC(self.client(), self)
00170     self.GEMC = ggemc
00171     return ggemc
00172
00173   def __removeGEMMG(self):
00174     self.GEMMG = None
00175
00176   def __addGEMMG(self):
00177     ggemmg = GGEMMG(self.client(), self)
00178     self.GEMMG = ggemmg
00179     return ggemmg
00180
00181   def __removeGEMST(self):
00182     self.GEMST = None
00183
00184   def __addGEMST(self):
00185     ggemst = GGEMST(self.client(), self)
00186     self.GEMST = ggemst
00187     return ggemst
00188
00189   def __removeGEMSC(self):
00190     self.GEMSC = None
00191
00192   def __addGEMSC(self):
00193     ggemsc = GGEMSC(self.client(), self)
00194     self.GEMSC = ggemsc
00195     return ggemsc
00196
00197   def __removeGEMVG(self):
00198     self.GEMVG = None
00199
00200   def __addGEMVG(self):
00201     ggemvg = GGEMVG(self.client(), self)
00202     self.GEMVG = ggemvg
00203     return ggemvg
00204
00205   def __removeGEMIE(self):
00206     self.GEMIE = None
00207
00208   def __addGEMIE(self):
00209     ggemie = GGEMIE(self.client(), self)
00210     self.GEMIE = ggemie
00211     return ggemie
00212
00213   def __removeGEMW(self):
00214     self.GEMW = None
00215
00216   def __addGEMW(self):
00217     ggemw = GGEMW(self.client(), self)
00218     self.GEMW = ggemw
00219     return ggemw
00220
00221
00222 class GGEMC(gDb.Gdb):
00223   """\brief GEMC sub-node of GGEM (controller).
00224
00225   Has GGEMC specific registers and dataless commands.
00226
00227   Valid Registers:
00228   - \c configuration
00229   - \c address
00230   - \c periodic_mode
00231   - \c periodic_limits
00232   - \c periodic_rate
00233   - \c sequence
00234   - \c cr_statistics
00235   - \c event_statistics
00236
00237   Dataless Commands:
00238   - \c cmd_nop
00239   - \c cmd_reset
00240   - \c cmd_trigger
00241
00242   """
00243   __attrs = [
00244     # Registers
00245     gAttr.GattrRaw('configuration',    0, 4),
00246     gAttr.GattrRaw('address',          1, 4),
00247     gAttr.GattrRaw('periodic_mode',    3, 4),
00248     gAttr.GattrRaw('periodic_limits',  4, 4),
00249     gAttr.GattrRaw('periodic_rate',    5, 4),
00250     gAttr.GattrRaw('sequence',         6, 4),
00251     gAttr.GattrRaw('cr_statistics',    7, 4),
00252     gAttr.GattrRaw('event_statistics', 8, 4),
00253     # Dataless Commands
00254     gAttr.GattrDlc('cmd_nop',          0, 0),
00255     gAttr.GattrDlc('cmd_reset',        1, 0),
00256     gAttr.GattrDlc('cmd_trigger',      2, 0),
00257     ]
00258
00259   def __init__(self, client, parent):
00260     """\brief Initialize valid registers as Gattrs
00261     """
00262     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00263
00264   def read(self, reg):
00265     return self.cmdrsp('GEMconReadSync', 'slh', 'LADR_GEM', reg, '!I')
00266
00267   def load(self, reg, value):
00268     return self.cmdrsp('GEMconLoadSync', 'slh', 'LADR_GEM', reg, value)
00269
00270   def send(self, cmd):
00271     return self.cmdrsp('GEMconCmdSync', 'slh', 'LADR_GEM', cmd)
00272
00273
00274 class GGEMMG(gDb.Gdb):
00275   """\brief GEMMG sub-node of GGEM (TAM generator).
00276
00277   Has GGEMMG specific registers and dataless commands.
00278
00279   Valid Registers:
00280   - \c engine_0
00281   - \c engine_1
00282   - \c engine_2
00283   - \c engine_3
00284   - \c engine_4
00285   - \c engine_5
00286   - \c engine_6
00287   - \c engine_7
00288   - \c engine_8
00289   - \c engine_9
00290   - \c engine_a
00291   - \c engine_b
00292   - \c engine_c
00293   - \c engine_d
00294   - \c engine_e
00295   - \c engine_f
00296
00297   """
00298   __attrs = [
00299     # Registers
00300     gAttr.GattrRaw('engine_0',    0, 4),
00301     gAttr.GattrRaw('engine_1',    1, 4),
00302     gAttr.GattrRaw('engine_2',    2, 4),
00303     gAttr.GattrRaw('engine_3',    3, 4),
00304     gAttr.GattrRaw('engine_4',    4, 4),
00305     gAttr.GattrRaw('engine_5',    5, 4),
00306     gAttr.GattrRaw('engine_6',    6, 4),
00307     gAttr.GattrRaw('engine_7',    7, 4),
00308     gAttr.GattrRaw('engine_8',    8, 4),
00309     gAttr.GattrRaw('engine_9',    9, 4),
00310     gAttr.GattrRaw('engine_a',   10, 4),
00311     gAttr.GattrRaw('engine_b',   11, 4),
00312     gAttr.GattrRaw('engine_c',   12, 4),
00313     gAttr.GattrRaw('engine_d',   13, 4),
00314     gAttr.GattrRaw('engine_e',   14, 4),
00315     gAttr.GattrRaw('engine_f',   15, 4),
00316     ]
00317
00318   def __init__(self, client, parent):
00319     """\brief Initialize valid registers as Gattrs.
00320     """
00321     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00322
00323   def read(self, reg):
00324     return self.cmdrsp('GEMtamReadSync', 'slh', 'LADR_GEM', reg, '!I')
00325
00326   def load(self, reg, value):
00327     return self.cmdrsp('GEMtamLoadSync', 'slh', 'LADR_GEM', reg, value)
00328
00329
00330 class GGEMST(gDb.Gdb):
00331   """\brief GEMST sub-node of GGEM (statistics).
00332
00333   Has GGEMST specific registers and dataless commands.
00334
00335   Valid Registers:
00336   - \c livetime
00337   - \c prescaled
00338   - \c discarded
00339   - \c sent
00340   - \c tile_counters
00341   - \c tile_0
00342   - \c tile_1
00343
00344   Dataless Commands:
00345   - \c cmd_reset
00346
00347   """
00348   __attrs = [
00349     # Registers
00350     gAttr.GattrRaw('livetime',        0, 4),
00351     gAttr.GattrRaw('prescaled',       1, 4),
00352     gAttr.GattrRaw('discarded',       2, 4),
00353     gAttr.GattrRaw('sent',            3, 4),
00354     gAttr.GattrRaw('tile_counters',   4, 4),
00355     gAttr.GattrRaw('tile_0',          5, 4),
00356     gAttr.GattrRaw('tile_1',          6, 4),
00357     # Dataless Commands
00358     gAttr.GattrDlc('cmd_reset',       0, 0),
00359     ]
00360
00361   def __init__(self, client, parent):
00362     """\brief Initialize valid registers as Gattrs.
00363     """
00364     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00365
00366   def read(self, reg):
00367     return self.cmdrsp('GEMstatReadSync', 'slh', 'LADR_GEM', reg, '!I')
00368
00369   def load(self, reg, value):
00370     return self.cmdrsp('GEMstatLoadSync', 'slh', 'LADR_GEM', reg, value)
00371
00372   def send(self, cmd):
00373     return self.cmdrsp('GEMstatCmdSync', 'slh', 'LADR_GEM', cmd)
00374
00375
00376 class GGEMSC(gDb.Gdb):
00377   """\brief GEMSC sub-node of GGEM (scheduler).
00378
00379   Has GGEMSC specific registers and dataless commands.
00380
00381   Valid Registers:
00382   - \c conditions_00_07
00383   - \c conditions_08_0f
00384   - \c conditions_10_17
00385   - \c conditions_18_1f
00386   - \c conditions_20_27
00387   - \c conditions_28_2f
00388   - \c conditions_30_37
00389   - \c conditions_38_3f
00390   - \c conditions_40_47
00391   - \c conditions_48_4f
00392   - \c conditions_50_57
00393   - \c conditions_58_5f
00394   - \c conditions_60_67
00395   - \c conditions_68_6f
00396   - \c conditions_70_77
00397   - \c conditions_78_7f
00398   - \c conditions_80_87
00399   - \c conditions_88_8f
00400   - \c conditions_90_97
00401   - \c conditions_98_9f
00402   - \c conditions_a0_a7
00403   - \c conditions_a8_af
00404   - \c conditions_b0_b7
00405   - \c conditions_b8_bf
00406   - \c conditions_c0_c7
00407   - \c conditions_c8_cf
00408   - \c conditions_d0_d7
00409   - \c conditions_d8_df
00410   - \c conditions_e0_e7
00411   - \c conditions_e8_ef
00412   - \c conditions_f0_f7
00413   - \c conditions_f8_ff
00414
00415   """
00416   __attrs = [
00417     # Registers
00418     gAttr.GattrRaw('conditions_00_07', 0x00, 4),
00419     gAttr.GattrRaw('conditions_08_0f', 0x01, 4),
00420     gAttr.GattrRaw('conditions_10_17', 0x02, 4),
00421     gAttr.GattrRaw('conditions_18_1f', 0x03, 4),
00422     gAttr.GattrRaw('conditions_20_27', 0x04, 4),
00423     gAttr.GattrRaw('conditions_28_2f', 0x05, 4),
00424     gAttr.GattrRaw('conditions_30_37', 0x06, 4),
00425     gAttr.GattrRaw('conditions_38_3f', 0x07, 4),
00426     gAttr.GattrRaw('conditions_40_47', 0x08, 4),
00427     gAttr.GattrRaw('conditions_48_4f', 0x09, 4),
00428     gAttr.GattrRaw('conditions_50_57', 0x0a, 4),
00429     gAttr.GattrRaw('conditions_58_5f', 0x0b, 4),
00430     gAttr.GattrRaw('conditions_60_67', 0x0c, 4),
00431     gAttr.GattrRaw('conditions_68_6f', 0x0d, 4),
00432     gAttr.GattrRaw('conditions_70_77', 0x0e, 4),
00433     gAttr.GattrRaw('conditions_78_7f', 0x0f, 4),
00434     gAttr.GattrRaw('conditions_80_87', 0x10, 4),
00435     gAttr.GattrRaw('conditions_88_8f', 0x11, 4),
00436     gAttr.GattrRaw('conditions_90_97', 0x12, 4),
00437     gAttr.GattrRaw('conditions_98_9f', 0x13, 4),
00438     gAttr.GattrRaw('conditions_a0_a7', 0x14, 4),
00439     gAttr.GattrRaw('conditions_a8_af', 0x15, 4),
00440     gAttr.GattrRaw('conditions_b0_b7', 0x16, 4),
00441     gAttr.GattrRaw('conditions_b8_bf', 0x17, 4),
00442     gAttr.GattrRaw('conditions_c0_c7', 0x18, 4),
00443     gAttr.GattrRaw('conditions_c8_cf', 0x19, 4),
00444     gAttr.GattrRaw('conditions_d0_d7', 0x1a, 4),
00445     gAttr.GattrRaw('conditions_d8_df', 0x1b, 4),
00446     gAttr.GattrRaw('conditions_e0_e7', 0x1c, 4),
00447     gAttr.GattrRaw('conditions_e8_ef', 0x1d, 4),
00448     gAttr.GattrRaw('conditions_f0_f7', 0x1e, 4),
00449     gAttr.GattrRaw('conditions_f8_ff', 0x1f, 4),
00450     ]
00451
00452   def __init__(self, client, parent):
00453     """\brief Initialize valid registers as Gattrs.
00454     """
00455     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00456
00457   def read(self, reg):
00458     return self.cmdrsp('GEMschedReadSync', 'slh', 'LADR_GEM', reg, '!I')
00459
00460   def load(self, reg, value):
00461     return self.cmdrsp('GEMschedLoadSync', 'slh', 'LADR_GEM', reg, value)
00462
00463
00464 class GGEMVG(gDb.Gdb):
00465   """\brief GEMVG sub-node of GGEM (ROI generator).
00466
00467   Has GGEMVG specific registers and dataless commands.
00468
00469   Valid Registers:
00470
00471   - \c ROI_00, ROI_01, ROI_02,...,ROI_53
00472
00473   """
00474   __attrs = []
00475   # Registers
00476   for i in range(54):
00477     __attrs.append(gAttr.GattrRaw('ROI_%02d' % i, i, 4))
00478
00479   def __init__(self, client, parent):
00480     """\brief Initialize valid registers as Gattrs.
00481     """
00482     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00483
00484   def read(self, reg):
00485     return self.cmdrsp('GEMroiReadSync', 'slh', 'LADR_GEM', reg, '!I')
00486
00487   def load(self, reg, value):
00488     return self.cmdrsp('GEMroiLoadSync', 'slh', 'LADR_GEM', reg, value)
00489
00490
00491 class GGEMIE(gDb.Gdb):
00492   """\brief GEMIE sub-node of GGEM (input enables).
00493
00494   Has GGEMIE specific registers and dataless commands.
00495
00496   Valid Registers:
00497   - \c towers_0_3
00498   - \c towers_4_7
00499   - \c towers_8_11
00500   - \c towers_12_15
00501   - \c acd_cno
00502   - \c tiles_000_013
00503   - \c tiles_014_032
00504   - \c tiles_033_NA3
00505   - \c tiles_100_113
00506   - \c tiles_114_NA5
00507   - \c tiles_200_213
00508   - \c tiles_214_NA7
00509   - \c tiles_300_313
00510   - \c tiles_314_NA9
00511   - \c tiles_400_413
00512   - \c tiles_414_NA1
00513   - \c tiles_500_NA10
00514   - \c tower_busy
00515
00516   """
00517   __attrs = [
00518     # Registers
00519     gAttr.GattrRaw('towers_0_3',      0, 4),
00520     gAttr.GattrRaw('towers_4_7',      1, 4),
00521     gAttr.GattrRaw('towers_8_11',     2, 4),
00522     gAttr.GattrRaw('towers_12_15',    3, 4),
00523     gAttr.GattrRaw('acd_cno',         4, 4),
00524     gAttr.GattrRaw('tiles_000_013',   5, 4),
00525     gAttr.GattrRaw('tiles_014_032',   6, 4),
00526     gAttr.GattrRaw('tiles_033_NA3',   7, 4),
00527     gAttr.GattrRaw('tiles_100_113',   8, 4),
00528     gAttr.GattrRaw('tiles_114_NA5',   9, 4),
00529     gAttr.GattrRaw('tiles_200_213',  10, 4),
00530     gAttr.GattrRaw('tiles_214_NA7',  11, 4),
00531     gAttr.GattrRaw('tiles_300_313',  12, 4),
00532     gAttr.GattrRaw('tiles_314_NA9',  13, 4),
00533     gAttr.GattrRaw('tiles_400_413',  14, 4),
00534     gAttr.GattrRaw('tiles_414_NA1',  15, 4),
00535     gAttr.GattrRaw('tiles_500_NA10', 16, 4),
00536     gAttr.GattrRaw('tower_busy',     17, 4),
00537     ]
00538
00539   def __init__(self, client, parent):
00540     """\brief Initialize valid registers as Gattrs.
00541
00542     """
00543     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00544
00545   def read(self, reg):
00546     return self.cmdrsp('GEMieReadSync', 'slh', 'LADR_GEM', reg, '!I')
00547
00548   def load(self, reg, value):
00549     return self.cmdrsp('GEMieLoadSync', 'slh', 'LADR_GEM', reg, value)
00550
00551
00552 class GGEMW(gDb.Gdb):
00553   """\brief GEMW sub-node of GGEM.
00554
00555   Has GGEMW specific registers.
00556
00557   Valid Registers:
00558   - \c window_width
00559   - \c window_open_mask
00560   """
00561   __attrs = [
00562     # Registers
00563     gAttr.GattrRaw('window_width',      0, 4),
00564     gAttr.GattrRaw('window_open_mask',  1, 4),
00565     ]
00566
00567   def __init__(self, client, parent):
00568     """\brief Initialize valid registers as Gattrs.
00569     """
00570     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00571
00572   def read(self, reg):
00573     return self.cmdrsp('GEMwinReadSync', 'slh', 'LADR_GEM', reg, '!I')
00574
00575   def load(self, reg, value):
00576     return self.cmdrsp('GEMwinLoadSync', 'slh', 'LADR_GEM', reg, value)
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGLT.py Source File

database

gGLT.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST GLT functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/08/19 22:36:46 $").split(' ')[1]
00015 __version__ = "$Revision: 2.5 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from threading import Event
00022
00023 from gDb import Gdb
00024 import gAttr
00025 import LATTE.client.gBits as gBits
00026
00027 class GGLT(Gdb):
00028   """\brief Global Trigger
00029
00030   Has GGLT specific registers and dataless commands.
00031
00032   Valid Registers:
00033   - \c mask
00034   - \c busy_disable
00035   - \c ext_cal_strobe
00036   - \c ext_tack
00037   - \c counter_mask
00038   - \c counter
00039   - \c ext_clk_out_enable
00040
00041   \deprecated
00042   - \c \b configuration Use the <a href='classgLAT_1_1GGLT.html#conf_fields'>bit fields</a> instead
00043   - \c \b options Use the <a href='classgLAT_1_1GGLT.html#option_fields'>bit fields</a> instead
00044   - \c \b aem_counter_mask Use 'counter_mask' instead
00045   - \c \b aem_counter Use 'counter' instead
00046
00047   Dataless Commands:
00048   - \c cmd_reset
00049   - \c cmd_self_trigger
00050
00051   <a name="option_fields"></a>
00052   Options Register Bit Fields:
00053   - \c parity
00054   - \c tag
00055   - \c event_number
00056
00057   <a name="conf_fields"></a>
00058   Configuration Register Bit Fields:
00059   - \c destination
00060   - \c marker
00061   - \c tack
00062   - \c zero_suppress
00063   - \c four_range_readout
00064   - \c cal_strobe
00065
00066   Mask Register Bit Fields:
00067   - \c internal_trg
00068   - \c external_trg
00069   - \c cal_low
00070   - \c cal_high
00071   - \c three_in_a_row
00072   - \c acd_veto_00
00073   - \c acd_veto_01
00074   - \c acd_veto_02
00075   - \c acd_veto_03
00076   - \c acd_veto_04
00077   - \c acd_veto_05
00078   - \c acd_veto_06
00079   - \c acd_veto_07
00080   - \c acd_veto_08
00081   - \c acd_veto_09
00082   - \c acd_veto_10
00083   - \c acd_veto_11
00084   - \c acd_veto_12
00085   - \c acd_veto_13
00086   - \c acd_veto_14
00087   - \c acd_veto_15
00088   - \c acd_veto_16
00089   - \c acd_veto_17
00090   - \c acd_cno
00091
00092   """
00093   __attrs = [
00094       # Registers
00095       gAttr.GattrRaw('mask',                1,  4),
00096       gAttr.GattrRaw('busy_disable',        3,  2),
00097       gAttr.GattrRaw('ext_cal_strobe',      4,  2),
00098       gAttr.GattrRaw('ext_tack',            5,  2),
00099       gAttr.GattrRaw('counter_mask',        6,  4),
00100       gAttr.GattrRaw('counter',             7,  4),
00101       gAttr.GattrRaw('ext_clk_out_enable',  8,  4),
00102       # Dataless Commands
00103       gAttr.GattrDlc('cmd_reset',           9,  0),
00104       gAttr.GattrDlc('cmd_self_trigger',   10,  0),
00105       # Bit fields
00106       gAttr.GattrRaw('parity',             11,  2),
00107       gAttr.GattrRaw('tag',                12,  2),
00108       gAttr.GattrRaw('event_number',       13,  2),
00109       gAttr.GattrRaw('destination',        14,  2),
00110       gAttr.GattrRaw('marker',             15,  2),
00111       gAttr.GattrRaw('tack',               16,  2),
00112       gAttr.GattrRaw('zero_suppress',      17,  2),
00113       gAttr.GattrRaw('four_range_readout', 18,  2),
00114       gAttr.GattrRaw('cal_strobe',         19,  2)
00115       ]
00116
00117   __mask_BF = [
00118       ('internal_trg',     0,  1),
00119       ('external_trg',     1,  2),
00120       ('cal_low',          2,  3),
00121       ('cal_high',         3,  4),
00122       ('three_in_a_row',   4,  5),
00123       ('acd_veto_00',      5,  6),
00124       ('acd_veto_01',      6,  7),
00125       ('acd_veto_02',      7,  8),
00126       ('acd_veto_03',      8,  9),
00127       ('acd_veto_04',      9, 10),
00128       ('acd_veto_05',     10, 11),
00129       ('acd_veto_06',     11, 12),
00130       ('acd_veto_07',     12, 13),
00131       ('acd_veto_08',     13, 14),
00132       ('acd_veto_09',     14, 15),
00133       ('acd_veto_10',     15, 16),
00134       ('acd_veto_11',     16, 17),
00135       ('acd_veto_12',     17, 18),
00136       ('acd_veto_13',     18, 19),
00137       ('acd_veto_14',     19, 20),
00138       ('acd_veto_15',     20, 21),
00139       ('acd_veto_16',     21, 22),
00140       ('acd_veto_17',     22, 23),
00141       ('acd_cno',         23, 24)
00142       ]
00143
00144   __TRG_DISABLE_MASK = 0xFFFFFFFFL
00145
00146   __EPU_ADDR = 0x20
00147
00148   def __init__(self, client, parent=None):
00149     """\brief Initialize valid registers as Gattrs.
00150
00151     Assign default values to members
00152     """
00153     self.__dirtyMask = 0
00154     self.__saveMask = None
00155     self.__bitsMask = 0xFFFFFFFFL
00156     self.__triggersEnabled = Event()
00157     self.__enableTime = None
00158     self.__disableTime = None
00159     self.__gltMode = 1
00160     self.__destinationOverride = 0
00161     self.__lcbAddr = None
00162     Gdb.__init__(self, client, parent, 0, self.__attrs)
00163
00164   def getEPUaddr(self):
00165     # Hard code EPU_ADDR to 0x20 to work with the Caligula FSW release
00166     #response = self.cmdrsp('getEPUaddr', 'slh')
00167     #return response.status()
00168     return GGLT.__EPU_ADDR
00169
00170   def read(self, reg):
00171     return self.cmdrsp('ggGLTread', reg, '!I')
00172
00173   def load(self, reg, value):
00174     return self.cmdrsp('ggGLTload', reg, value)
00175
00176   def send(self, cmd):
00177     return self.cmdrsp('ggGLTcmd', cmd)
00178
00179   def initialize(self):
00180     if self.__gltMode == 1:
00181       # We need to find which bits are enabled
00182       self.refreshMask()
00183       #self.regs['mask'].set(self, GGLT.__TRG_DISABLE_MASK) # Revisit: Why next?
00184       Gdb.__setattr__(self, 'mask', GGLT.__TRG_DISABLE_MASK)
00185       self.__bitsMask = Gdb.__getattr__(self, 'mask')
00186       Gdb.__setattr__(self, 'mask', int(self.__saveMask))
00187     if self.__lcbAddr is None:
00188       self.__lcbAddr = self.getEPUaddr()
00189     if self.__destinationOverride == 0:
00190       Gdb.__setattr__(self, 'destination', self.__lcbAddr)
00191
00192   def waitForMaskEnable(self, tmo = None):
00193     """\brief Waits until the enableMask() method is called.
00194
00195     This is usually needed by non-self-triggering scripts where
00196     the _commandSynch thread needs to wait until RunControl
00197     actually enables the mask before continuing.
00198
00199     \param tmo  Optional parameter giving the wait timeout in seconds
00200     """
00201     self.__triggersEnabled.wait(tmo)
00202
00203   def enableMask(self):
00204     """\brief Commits the mask value to hardware.
00205
00206     \return The value of the dirty flag before the commit is made.
00207     """
00208     if self.__gltMode == 1:
00209       if self.__dirtyMask:
00210         if int(self.__saveMask) == GGLT.__TRG_DISABLE_MASK:
00211           self.__triggersEnabled.clear()
00212           Gdb.__setattr__(self, 'mask', int(self.__saveMask))
00213           self.__disableTime = self.regs['mask'].getTimeStamp()
00214         else:
00215           Gdb.__setattr__(self, 'mask', int(self.__saveMask))
00216           self.__enableTime = self.regs['mask'].getTimeStamp()
00217           self.__triggersEnabled.set()
00218         self.__dirtyMask = 0
00219         return 1
00220       else:
00221         return 0
00222     else:
00223       return 0
00224
00225   def disableMask(self):
00226     """\brief Disables all trigger masks but doesn't change the cached mask value.
00227
00228     This way when the triggers are enabled again, the old setting can be applied.
00229     """
00230     #Note: This method should not modify the cached value.
00231     if self.__gltMode == 1:
00232       self.__dirtyMask = 1
00233       self.__triggersEnabled.clear()
00234       Gdb.__setattr__(self, 'mask', GGLT.__TRG_DISABLE_MASK)
00235       self.__disableTime = self.regs['mask'].getTimeStamp()
00236
00237   def triggersDisabled(self):
00238     """\brief Check if the triggers are disabled.
00239
00240     \return True  if triggers are disabled,
00241             False if triggers are disabled.
00242     """
00243     return not self.__triggersEnabled.isSet()
00244
00245   def isMaskDirty(self):
00246     """\brief Return the mask dirty flag.
00247
00248     \return Mask dirty flag.
00249     """
00250     return self.__dirtyMask
00251
00252   def refreshMask(self):
00253     """\brief Refreshes the cached value of the mask from the hardware.
00254     """
00255     self.__saveMask = gBits.bf(Gdb.__getattr__(self, 'mask'))
00256
00257   def getEnableTime(self):
00258     """\brief Returns the VxWorks timestamp at the time the triggers are enabled.
00259
00260     \return Trigger enable time
00261     """
00262     return self.__enableTime
00263
00264   def getDisableTime(self):
00265     """\brief Returns the VxWorks timestamp at the time the triggers are disabled.
00266
00267     \return Trigger disable time
00268     """
00269     return self.__disableTime
00270
00271   def setDestinationOverride(self, override):
00272     """\brief Sets the flag to determine whether the user should be able to
00273     override the destination value.
00274
00275     \param override 0=Destination is supplied as the LCB address as returned by CmdCli.getLcbAddr()
00276                     1=The user supplied destination value takes effect
00277     """
00278     self.__destinationOverride = override
00279     if override == 0:
00280       Gdb.__setattr__(self, 'destination', self.__lcbAddr)
00281
00282
00283 ## private:
00284
00285   def __setGLTmode(self, mode):
00286     """Controls the GLT behaviour
00287
00288     \param mode If set to 0 the GLT behaves in immediate mode
00289                 meaning the trigger mask settings take effect
00290                 immediately.
00291                 If set to 1 then the settings are stored in a
00292                 cached variable and the script needs to call
00293                 enableMask() and/or disableMask() to commit
00294                 the changes from the cache to the hardware.
00295     """
00296     self.__gltMode = mode
00297
00298   def __getGLTmode(self):
00299     """Retrieves the current GLT mode
00300
00301     \return Current GLT mode
00302     """
00303     return self.__gltMode
00304
00305   def __getattr__(self, attribute):
00306     attr = attribute.lower()
00307     if attr == 'mask' and self.__gltMode == 1:
00308       return int(self.__saveMask)
00309     else:
00310       for (bitField, fromBit, toBit) in self.__mask_BF:
00311         if attr == bitField:
00312           if self.__gltMode == 1:
00313             return self.__saveMask[fromBit:toBit]
00314           else:
00315             mask = gBits.bf(Gdb.__getattr__(self, 'mask'))
00316             return mask[fromBit:toBit]
00317     return Gdb.__getattr__(self, attribute)
00318
00319   def __setattr__(self, attribute, value):
00320     attr = attribute.lower()
00321     if attr == 'mask' and self.__gltMode == 1:
00322       self.__dirtyMask = 1
00323       self.__saveMask = gBits.bf(value & self.__bitsMask)
00324       return
00325     elif attr == 'cmd_self_trigger':
00326       pass
00327     elif attr == 'destination':
00328       if not self.__destinationOverride:
00329         return
00330     else:
00331       for (bitField, fromBit, toBit) in self.__mask_BF:
00332         if attr == bitField:
00333           if self.__gltMode == 1:
00334             newVal = gBits.bf(0)
00335             newVal[fromBit:toBit] = value
00336             if (int(newVal) | self.__bitsMask) == self.__bitsMask:
00337               self.__dirtyMask = 1
00338               self.__saveMask[fromBit:toBit] = value
00339           else:
00340             mask = gBits.bf(Gdb.__getattr__(self, 'mask'))
00341             mask[fromBit:toBit] = value
00342             Gdb.__setattr__(self, 'mask', int(mask))
00343           return
00344     Gdb.__setattr__(self, attribute, value)
00345
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gGroup.py Source File

database

gGroup.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Class for handling named groups"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/11 03:10:10 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020
00021 class Ggroup:
00022   def __init__(self, group, enabled = True):
00023     """Class for handling named groups.
00024     """
00025     self.__group   = group
00026     self.__enabled = enabled
00027
00028   def name(self):
00029     "Return the group's name."
00030     return self.__group
00031
00032   def enabled(self):
00033     "Return status of the group."
00034     return self.__enabled
00035
00036   def enable(self):
00037     "Enable a group."
00038     self.__enabled = True
00039
00040   def disable(self):
00041     "Disable a group."
00042     self.__enabled = False
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gHdb.py Source File

database

gHdb.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Housekeeping system base class"
00012 __author__  = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/09/25 01:51:35 $").split(' ')[1]
00014 __version__ = "$Revision: 1.7 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__ = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import gAttr
00021 from LATTE.client.gNode     import Node
00022 from LATTE.database.gDb     import _regList
00023
00024 # GHdb class
00025 # class GHdb(Node):
00026   # """\brief Base class for all GLAST Housekeeping functional blocks.
00027
00028      # Uses __getattr__ and __setattr__ methods to feature an SCL like syntax
00029      # for referencing attributes
00030   # """
00031   # def __init__(self, client, parent, id, valid_regs=[]):
00032     # """gNode constructor.
00033
00034     # \param valid_regs A list of valid attribute names.
00035     # """
00036     # Node.__init__(self, client)
00037     # self.__parent = parent
00038     # self.__id     = id
00039     # number        = 0
00040
00041     # self.__dict__['regs'] = _regList()
00042     # for tuple in valid_regs:
00043       # name                        = tuple[0]
00044       # self.__dict__['regs'][name] = GattrHsk(self, number)
00045       # number                      += 1
00046
00047   # def up(self):
00048     # """Return the parent of this component
00049     # """
00050     # return self.__parent
00051
00052   # def id(self):
00053     # """Return the hardware id of this component
00054     # """
00055     # return self.__id
00056
00057   # def getName(self):
00058     # return self.__class__.__name__
00059
00060 # private:
00061   # def __setattr__(self, attribute, value):
00062     # dict = self.__dict__
00063     # if attribute in dict:
00064       # dict[attribute] = value
00065       # return
00066     # try:
00067       # regs = dict['regs']
00068     # except KeyError:
00069       # dict[attribute] = value
00070       # return
00071     # try:
00072       # regs[attribute].set(self, value)
00073     # except KeyError:
00074       # try:
00075         # attr = regs[attribute.lower()]
00076       # except KeyError:
00077         # raise AttributeError("Attribute " + attribute + " not found")
00078       # regs[attribute] = attr
00079       # attr.set(self, value)
00080
00081   # def __getattr__(self, attribute):
00082     # dict = self.__dict__
00083     # if attribute in dict:
00084       # return dict[attribute]
00085     # try:
00086       # regs = dict['regs']
00087       # return regs[attribute].get(self)
00088     # except KeyError:
00089       # try:
00090         # attr = regs[attribute.lower()]
00091       # except KeyError:
00092         # raise AttributeError("Attribute " + attribute + " not found")
00093       # regs[attribute] = attr
00094       # return attr.get(self)
00095
00096 class GattrHsk(gAttr.Gattr):
00097   """\brief Class which is instantiated for each housekeeping quantity
00098   """
00099   class __AttrHsk(object):
00100     """Helper class for private use in this file only.
00101     """
00102     def __init__(self, node, attr):
00103       self.__attr = attr
00104       self.__node = node
00105
00106       self.__data = None
00107
00108       #print id(self), id(attr), node.getName(), attr.getName(), attr.flags()
00109       if attr.flags() == (gAttr.ATTR_READ | gAttr.ATTR_NO_DIRECT_ACCESS):
00110         self.set = self.__badSet
00111         self.get = self.__badGet
00112       else:
00113         self.set = self.__set
00114         self.get = self.__get
00115
00116       # Callthroughs to 'parent' class
00117       self.setEGU        = self.__attr.setEGU
00118       self.setRule       = self.__attr.setRule
00119       self.setConstraint = self.__attr.setConstraint
00120       self.getEGU        = self.__attr.getEGU
00121       self.getRule       = self.__attr.getRule
00122       self.getConstraint = self.__attr.getConstraint
00123
00124       self.id               = attr.id
00125
00126     def __set(self, val, bypass=0, node=None):
00127       if node is not None:
00128         self.__data = self.__attr.set(node, val, bypass)
00129       else:                             # For backward compatibility
00130         self.__data = self.__attr.set(self.__node, val, bypass)
00131
00132     def __get(self, bypass=0, node=None):
00133       if node is not None:
00134         val = self.__attr.get(node, self.__data, bypass)
00135       else:                             # For backward compatibility
00136         val = self.__attr.get(self.__node, self.__data, bypass)
00137       return val
00138
00139     def __badSet(self, node, val, bypass=0):
00140       return -1                         # revisit
00141       #raise LATInterfaceException(1)
00142
00143     def __badGet(self, node, val, bypass=0):
00144       return -1                         # revisit
00145       #raise LATInterfaceException(1)
00146
00147     def getNode(self):
00148       return self.__node
00149
00150   def __init__(self, name, id,
00151                rule       = gAttr.Gattr.defaultRule,
00152                constraint = gAttr.Gattr.defaultConstraint,
00153                egu        = gAttr.Gattr.defaultEgu):
00154     """GattrHsk constructor
00155
00156     \param name        The name of the attribute.
00157     \param id          Positional identifier.
00158     \param rule        Optional. Attribute rule.
00159     \param constraint  Optional. Attribute constraint.
00160     \param egu         Optional. Attribute EGU
00161     """
00162     # instantiate the Gattr.
00163     gAttr.Gattr.__init__( self,
00164                           name=name, id=id, size=0, flags=gAttr.REG_READ_WRITE,
00165                           rule=rule, constraint=constraint, egu=egu )
00166
00167   def create(self, node):
00168     return GattrHsk.__AttrHsk(node, self)
00169
00170   def set(self, node, val, bypass=True):
00171     """
00172     Method for setting the value of an attribute.
00173     Calls the functions in the attribute's node for setting values.
00174
00175     \param val    Register value to be set
00176     \param bypass Optional. Flag for bypassing EGU conversion
00177                   Default is to *not* convert to EGU.
00178     """
00179     if bypass or val == None:
00180       raw = val
00181     else:
00182       (val, rejected) = self._Gattr__constraint.evaluate(val)
00183       if rejected:
00184         return None
00185       raw = self._Gattr__egu.raw(val)
00186
00187     return raw
00188
00189   def get(self, node, raw, bypass=False):
00190     """
00191     Method for getting the value of an attribute.
00192     If bypass=0 (the default), the value will be returned in EU.
00193     If bypass=1, the raw value will be returned.
00194     """
00195
00196     if bypass or raw == None:
00197       return raw
00198     else:
00199       egu = self._Gattr__egu.egu(raw)
00200       self._Gattr__rule.evaluate(egu, self, node)
00201       return egu
00202
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gHSK.py Source File

database

gHSK.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 ## \namespace gHSK
00011 ##
00012 ## \brief GLAST LAT record definitions.
00013 ##
00014 ## \b Contents:
00015 ##
00016 ##
00017 ## \b Overview:
00018 ##
00019 ##  This module provides classes that are used as the building blocks for the
00020 ##  Housekeeping hierarchy.
00021 ##
00022
00023 __facility__ = "Online"
00024 __abstract__ = "GLAST LAT functional block hierarchy"
00025 __author__  = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00026 __date__     = ("$Date: 2004/09/14 22:18:59 $").split(' ')[1]
00027 __version__ = "$Revision: 1.8 $"
00028 __release__  = "$Name: P04-06-05 $"
00029 __credits__ = "SLAC"
00030
00031 import LATTE.copyright_SLAC
00032
00033 import os, types
00034 import gSchemaConfig
00035 import gDb
00036 import gHdb
00037 import logging                    as     log
00038 from xml.dom                      import Node
00039 from xml.dom.ext.reader           import Sax2
00040 # from gHdb                         import GHdb
00041 from gGroup                       import *
00042
00043
00044 # GHSK class
00045 class GHSK(gDb.Gdb):
00046   """\brief GLAST HSK node Record
00047
00048   """
00049
00050   def __init__(self, client):
00051     """\brief Initialize valid attributes as Gattrs.
00052
00053     Assign default values to members
00054     """
00055     self.HTEM = gDb.Children(self, HTEM)
00056     self.HAEM = None
00057     self.HGEM = None
00058     self.HEBM = None
00059     self.HPDU = gDb.Children(self, HPDU)
00060     self.HCOM = None
00061     self.HCPU = None
00062     self.HNUL = HNUL(self)           # NULL node.  Used to reference non-used bytes in hsk
00063
00064     self.__schemaComments            = []
00065     self.__schemaName                = ''
00066     self.__configComments            = []
00067     self.__configName                = ''
00068     self.__configVersion             = ''
00069     self.__includeFiles              = []
00070     self.__declarations              = None
00071     self.__configurations            = {}
00072     self.__opaque                    = {}
00073     gDb.Gdb.__init__(self, client, None, None)
00074
00075   def downHTEM(self, childId):
00076     """\brief Navigate to the HTEM indicated by \a childId
00077
00078     \param  childId The id of the child HTEM
00079
00080     \return         A HARC object instance
00081     """
00082     return self.HTEM.down(childId)
00083
00084   def downHAEM(self):
00085     """\brief Navigate to the HAEM node
00086
00087     \return         The HAEM object instance
00088     """
00089     return self.HAEM
00090
00091   def downHGEM(self):
00092     """\brief Navigate to the HGEM node
00093
00094     \return         The HGEM object instance
00095     """
00096     return self.HGEM
00097
00098   def downHEBM(self):
00099     """\brief Navigate to the HEBM node
00100
00101     \return         The HEBM object instance
00102     """
00103     return self.HEBM
00104
00105   def downHPDU(self, childId):
00106     """\brief Navigate to the HPDU node
00107
00108     \return         The HPDU object instance
00109     """
00110     return self.HPDU.down(childId)
00111
00112   def downHCOM(self):
00113     """\brief Navigate to the HCOM node
00114
00115     \return         The HCOM object instance
00116     """
00117     return self.HCOM
00118
00119   def downHCPU(self):
00120     """\brief Navigate to the HCPU node
00121
00122     \return         The HCPU object instance
00123     """
00124     return self.HCPU
00125
00126   def downHNUL(self):
00127     """\brief Navigate to the HNUL node
00128
00129     \return         The HNUL object instance
00130     """
00131     return self.HNUL
00132
00133   def existsHTEM(self, temID):
00134     """\brief Check if the HTEM instance with the id
00135     \a temID exists in the schema.
00136
00137     \param  temID ACD readout controller id
00138
00139     \return       1 if it exists, 0 if it doesn't.
00140     """
00141     return self.HTEM.exists(temID)
00142
00143   def existsHAEM(self):
00144     """\brief Check if the HAEM instance exists in the schema.
00145
00146     \return       True if it exists, False if it doesn't.
00147     """
00148     return self.HAEM != None
00149
00150   def existsHGEM(self):
00151     """\brief Check if the HGEM instance exists in the schema.
00152
00153     \return       True if it exists, False if it doesn't.
00154     """
00155     return self.HGEM != None
00156
00157   def existsHEBM(self):
00158     """\brief Check if the HEBM instance exists in the schema.
00159
00160     \return       True if it exists, False if it doesn't.
00161     """
00162     return self.HEBM != None
00163
00164   def existsHPDU(self, hpduID):
00165     """\brief Check if the HPDU instance exists in the schema.
00166
00167     \return       True if it exists, False if it doesn't.
00168     """
00169     return self.HPDU.exists(hpduID)
00170
00171   def existsHCOM(self):
00172     """\brief Check if the HCOM instance exists in the schema.
00173
00174     \return       True if it exists, False if it doesn't.
00175     """
00176     return self.HCOM != None
00177
00178   def existsHCPU(self):
00179     """\brief Check if the HCPU instance exists in the schema.
00180
00181     \return       True if it exists, False if it doesn't.
00182     """
00183     return self.HCPU != None
00184
00185   def readSchema(self, schema):
00186     self.HTEM = gDb.Children(self, HTEM)
00187     self.HAEM = None
00188     self.HGEM = None
00189     self.HEBM = None
00190     self.HPDU = gDb.Children(self, HPDU)
00191     self.HCOM = None
00192     self.HCPU = None
00193     from gSchemaConfig import gSCprocessRegistry
00194     gSCprocessRegistry['GHSK'] = processGHSK
00195     gSchemaConfig.readSchema(self, schema)
00196
00197   def readConfig(self, cfgFileName):
00198     return readHskConfig(self, cfgFileName)
00199
00200   def applyConfig(self, seq):
00201     applyHskConfig(self, seq)
00202
00203   def getConfigurations(self):
00204     """\brief Get list of configurations.
00205
00206     Return a list of configuration tuples where
00207     each tuple contains the configDOM, configName and configRelease.
00208
00209     \return Configuration tuple list.
00210     """
00211     return self.__configurations
00212
00213   def getDeclarations(self):
00214     """\brief Get list of declarations.
00215
00216     Return a list of declarations
00217
00218     \return Declarations.
00219     """
00220     return self.__declarations
00221
00222   def getRules(self):
00223     """\brief Retrieves the rule dictionary as defined by the
00224     current schema/configuration.
00225
00226     \return Dictionary containing Grule objects (or its descendants).
00227     """
00228     return self.__declarations['rules']
00229
00230   def getOpaque(self, name):
00231     """\brief Retrieves the named opaque data included in the schema
00232
00233     \param  name Name of the opaque XML data
00234
00235     \return      A list of XML DOM objects matching \a name
00236     """
00237     if name in self.__opaque:
00238       return self.__opaque[name]
00239
00240   def __addHTEM(self, temID):
00241     return self.HTEM.add(temID)
00242
00243   def __addHAEM(self):
00244     self.HAEM = HAEM(self.client(), self)
00245     return self.HAEM
00246
00247   def __addHGEM(self):
00248     self.HGEM = HGEM(self.client(), self)
00249     return self.HGEM
00250
00251   def __addHEBM(self):
00252     self.HEBM = HEBM(self.client(), self)
00253     return self.HEBM
00254
00255   def __addHPDU(self, pduID):
00256     return self.HPDU.add(pduID)
00257
00258   def __addHCOM(self):
00259     self.HCOM = HCOM(self.client(), self)
00260     return self.HCOM
00261
00262   def __addHCPU(self):
00263     self.HCPU = HCPU(self.client(), self)
00264     return self.HCPU
00265
00266   def __removeHTEM(self, temID):
00267     self.HTEM.remove(temID)
00268
00269   def __removeHAEM(self):
00270     self.HAEM = None
00271
00272   def __removeHGEM(self):
00273     self.HGEM = None
00274
00275   def __removeHEBM(self):
00276     self.HEBM = None
00277
00278   def __removeHPDU(self, pduID):
00279     self.HPDU.remove(pduID)
00280
00281   def __removeHCOM(self):
00282     self.HCOM = None
00283
00284   def __removeHCPU(self):
00285     self.HCPU = None
00286
00287
00288 class HTEM(gDb.Gdb):
00289   """\brief GLAST TEM HSK node record
00290
00291   Valid Attributes:
00292   - \c tkr_digital_v
00293   - \c tkr_digital_i
00294   - \c tkr_analoga_v
00295   - \c tkr_analoga_i
00296   - \c tkr_analogb_v
00297   - \c tkr_analogb_i
00298   - \c tkr_bias_v
00299   - \c tkr_bias_i
00300   - \c cal_digital_v
00301   - \c cal_digital_i
00302   - \c cal_analog_v
00303   - \c cal_analog_i
00304   - \c cal_bias_v
00305   - \c cal_bias_i
00306   - \c tem_digital_v
00307   - \c tem_digital_i
00308   - \c afee_[0-3]_t[0-1]
00309   - \c tkr_c[0-7]_t[0-1]
00310   - \c tkr_lrs_0_low
00311   - \c tkr_lrs_0_high
00312   - \c tkr_lrs_1_low
00313   - \c tkr_lrs_1_high
00314   - \c tkr_lrs_mask
00315   - \c cal_lrs_0
00316   - \c cal_lrs_0_mask
00317   - \c cal_lrs_1
00318   - \c cal_lrs_1_mask
00319   - \c deadtime
00320   """
00321   # Environmental
00322   __regs = [
00323     gHdb.GattrHsk('TKR_DIGITAL_V',  0),
00324     gHdb.GattrHsk('TKR_DIGITAL_I',  1),
00325     gHdb.GattrHsk('TKR_ANALOGA_V',  2),
00326     gHdb.GattrHsk('TKR_ANALOGA_I',  3),
00327     gHdb.GattrHsk('TKR_ANALOGB_V',  4),
00328     gHdb.GattrHsk('TKR_ANALOGB_I',  5),
00329     gHdb.GattrHsk('TKR_BIAS_V'   ,  6),
00330     gHdb.GattrHsk('TKR_BIAS_I'   ,  7),
00331     gHdb.GattrHsk('CAL_DIGITAL_V',  8),
00332     gHdb.GattrHsk('CAL_DIGITAL_I',  9),
00333     gHdb.GattrHsk('CAL_ANALOG_V' , 10),
00334     gHdb.GattrHsk('CAL_ANALOG_I' , 11),
00335     gHdb.GattrHsk('CAL_BIAS_V'   , 12),
00336     gHdb.GattrHsk('CAL_BIAS_I'   , 13),
00337     gHdb.GattrHsk('TEM_DIGITAL_V', 14),
00338     gHdb.GattrHsk('TEM_DIGITAL_I', 15),
00339   ]
00340   offset = 16
00341   for i in range(4):
00342     __regs.append(gHdb.GattrHsk('AFEE_%d_T0'%i, offset   ))
00343     __regs.append(gHdb.GattrHsk('AFEE_%d_T1'%i, offset+1 ))
00344     offset += 2
00345   for i in range(8):
00346     __regs.append(gHdb.GattrHsk('TKR_C%d_T0'%i, offset   ))
00347     __regs.append(gHdb.GattrHsk('TKR_C%d_T1'%i, offset+1 ))
00348     offset += 2
00349   # LRS counters
00350   __regs.append(gHdb.GattrHsk('TKR_LRS_0_LOW',  offset+0 ))
00351   __regs.append(gHdb.GattrHsk('TKR_LRS_0_HIGH', offset+1 ))
00352   __regs.append(gHdb.GattrHsk('TKR_LRS_1_LOW',  offset+2 ))
00353   __regs.append(gHdb.GattrHsk('TKR_LRS_1_HIGH', offset+3 ))
00354   __regs.append(gHdb.GattrHsk('TKR_LRS_MASK',   offset+4 ))
00355   __regs.append(gHdb.GattrHsk('CAL_LRS_0',      offset+5 ))
00356   __regs.append(gHdb.GattrHsk('CAL_LRS_0_MASK', offset+6 ))
00357   __regs.append(gHdb.GattrHsk('CAL_LRS_1',      offset+7 ))
00358   __regs.append(gHdb.GattrHsk('CAL_LRS_1_MASK', offset+8 ))
00359   __regs.append(gHdb.GattrHsk('DEADTIME',       offset+9 ))
00360
00361
00362   def __init__(self, client, parent, temID):
00363     """\brief Initialize valid housekeeping quantities as Gattrs
00364     """
00365     gDb.Gdb.__init__(self, client, parent, temID, self.__regs)
00366
00367
00368 class HAEM(gDb.Gdb):
00369   """\brief GLAST AEM HSK node Record
00370
00371   Valid Attributes:
00372   - \c FreeI
00373   - \c Temperature
00374   - \c HVI
00375   - \c DAQV
00376   - \c CommonStatus
00377   - \c CableStatus
00378
00379   """
00380   __regs = [
00381     # DAQ board hsk quantities
00382     gHdb.GattrHsk('FreeI'        , 0),
00383     gHdb.GattrHsk('Temperature'  , 1),
00384     gHdb.GattrHsk('HVI'          , 2),
00385     gHdb.GattrHsk('DAQV'         , 3),
00386     gHdb.GattrHsk('CommonStatus' , 4),
00387     gHdb.GattrHsk('CableStatus'  , 5),
00388   ]
00389   def __init__(self, client, parent):
00390     """\brief Initialize valid housekeeping quantities as Gattrs
00391     """
00392     self.HARC = gDb.Children(self, HARC)
00393     gDb.Gdb.__init__(self, client, parent, None, self.__regs)
00394
00395   def downHARC(self, arcID):
00396     """\brief Navigate to the HARC indicated by \a arcID
00397
00398     \param  arcID The id of the child HARC
00399
00400     \return         A HARC object instance
00401     """
00402     try:
00403       return self.HARC[arcID]
00404     except KeyError:
00405       return None
00406
00407   def existsHARC(self, arcID):
00408     """\brief Check if the HARC instance with the id
00409     \a arcID exists in the schema.
00410
00411     \param  arcId ACD readout controller id
00412
00413     \return       1 if it exists, 0 if it doesn't.
00414     """
00415     if arcID in self.HARC:
00416       return 1
00417     else:
00418       return 0
00419
00420   def __addHARC(self, arcID):
00421     if arcID in self.HARC:
00422       raise KeyError('*** HARC: ARC already exists with ID: %d' % arcID)
00423     else:
00424       self.HARC[arcID] = HARC(self.client(), self, arcID)
00425     return self.HARC[arcID]
00426
00427   def __removeHARC(self, arcID):
00428     if arcID in self.HARC:
00429       self.HARC.__delitem__(arcID)
00430
00431
00432 class HARC(gDb.Gdb):
00433   """\brief GLAST ARC HSK node record
00434
00435   Valid Attributes:
00436   - \c Vdd
00437   - \c Temperature
00438   - \c HV1
00439   - \c HV2
00440   """
00441   __regs = [
00442     gHdb.GattrHsk('Vdd'         , 0),
00443     gHdb.GattrHsk('Temperature' , 1),
00444     gHdb.GattrHsk('HV1'         , 2),
00445     gHdb.GattrHsk('HV2'         , 3),
00446   ]
00447   def __init__(self, client, parent, arcID):
00448     """\brief Initialize valid housekeeping quantities as Gattrs
00449     """
00450     gDb.Gdb.__init__(self, client, parent, arcID, self.__regs)
00451
00452 class HGEM(gDb.Gdb):
00453   """\brief GLAST GEM HSK node record
00454
00455   Valid Attributes:
00456   - \c Events
00457   - \c Livetime
00458   - \c Prescaled
00459   - \c Busy
00460   - \c Sent
00461   - \c PPS
00462   - \c LastPPS
00463   - \c TriggerTime
00464   """
00465   __regs = [
00466     gHdb.GattrHsk('Events'        , 0),
00467     gHdb.GattrHsk('Livetime'      , 1),
00468     gHdb.GattrHsk('Prescaled'     , 2),
00469     gHdb.GattrHsk('Busy'          , 3),
00470     gHdb.GattrHsk('Sent'          , 4),
00471     gHdb.GattrHsk('PPS'           , 5),
00472     gHdb.GattrHsk('LastPPS'       , 6),
00473     gHdb.GattrHsk('TriggerTime'   , 7),
00474   ]
00475   def __init__(self, client, parent):
00476     """\brief Initialize valid housekeeping quantities as Gattrs
00477     """
00478     gDb.Gdb.__init__(self, client, parent, None, self.__regs)
00479
00480 class HEBM(gDb.Gdb):
00481   """\brief GLAST EBM HSK node record
00482
00483   Valid Attributes:
00484   - \c Events
00485   - \c GEMreceive
00486   - \c TEM[0-15]receive
00487   - \c AEMreceive
00488   - \c SIU0receive
00489   - \c SIU1receive
00490   - \c EPU0receive
00491   - \c EPU1receive
00492   - \c EPU2receive
00493   - \c SIU0transmit
00494   - \c SIU1transmit
00495   - \c EPU0transmit
00496   - \c EPU1transmit
00497   - \c EPU2transmit
00498   - \c SSRtransmit
00499   """
00500   __regs = [
00501     gHdb.GattrHsk('Events'         ,  0),
00502     gHdb.GattrHsk('GEMreceive'     ,  1),
00503     gHdb.GattrHsk('TEM0receive'    ,  2),
00504     gHdb.GattrHsk('TEM1receive'    ,  3),
00505     gHdb.GattrHsk('TEM2receive'    ,  4),
00506     gHdb.GattrHsk('TEM3receive'    ,  5),
00507     gHdb.GattrHsk('TEM4receive'    ,  6),
00508     gHdb.GattrHsk('TEM5receive'    ,  7),
00509     gHdb.GattrHsk('TEM6receive'    ,  8),
00510     gHdb.GattrHsk('TEM7receive'    ,  9),
00511     gHdb.GattrHsk('TEM8receive'    , 10),
00512     gHdb.GattrHsk('TEM9receive'    , 11),
00513     gHdb.GattrHsk('TEM10receive'   , 12),
00514     gHdb.GattrHsk('TEM11receive'   , 13),
00515     gHdb.GattrHsk('TEM12receive'   , 14),
00516     gHdb.GattrHsk('TEM13receive'   , 15),
00517     gHdb.GattrHsk('TEM14receive'   , 16),
00518     gHdb.GattrHsk('TEM15receive'   , 17),
00519     gHdb.GattrHsk('AEMreceive'     , 18),
00520     gHdb.GattrHsk('SIU0receive'    , 19),
00521     gHdb.GattrHsk('SIU1receive'    , 20),
00522     gHdb.GattrHsk('EPU0receive'    , 21),
00523     gHdb.GattrHsk('EPU1receive'    , 22),
00524     gHdb.GattrHsk('EPU2receive'    , 23),
00525     gHdb.GattrHsk('SIU0transmit'   , 24),
00526     gHdb.GattrHsk('SIU1transmit'   , 25),
00527     gHdb.GattrHsk('EPU0transmit'   , 26),
00528     gHdb.GattrHsk('EPU1transmit'   , 27),
00529     gHdb.GattrHsk('EPU2transmit'   , 28),
00530     gHdb.GattrHsk('SSRtransmit'    , 29),
00531   ]
00532   def __init__(self, client, parent):
00533     """\brief Initialize valid housekeeping quantities as Gattrs
00534     """
00535     gDb.Gdb.__init__(self, client, parent, None, self.__regs)
00536
00537 class HPDU(gDb.Gdb):
00538   """\brief GLAST PDU HSK node record
00539
00540   Valid Attributes:
00541   - \c ACDShellTemp0
00542   - \c ACDShellTemp1
00543   - \c ACDconvTemp
00544   - \c ACDpowerState
00545   - \c ACDpowerSupply
00546   - \c GridTemp[0-12]
00547   - \c RadiatorTemp[0-12]
00548   - \c RadiatorAfrzTemp0
00549   - \c RadiatorAfrzTemp1
00550   - \c CalBaseplateTemp[0-16]
00551   - \c VHCP_DSHP_M_Temp[0-6]
00552   - \c VHCP_DSHP_P_Temp[0-6]
00553   - \c VHCP_XLHP_M_Temp[0-6]
00554   - \c VHCP_XLHP_P_Temp[0-6]
00555   - \c VHCPRes_M_Temp[0-6]
00556   - \c VHCPRes_P_Temp[0-6]
00557   - \c TEM[0-16]_PCBTemp
00558   - \c TEM[0-16]_digital33V
00559   - \c TEM[0-16]_PSTemp
00560   - \c TEM[0-16]_powerState
00561   - \c ACDpmtRailTemp[0-4]
00562   - \c ACDBEAgridTemp[0-1]
00563   - \c GridRadiatorTemp[0-4]
00564   - \c EPUdigitalVoltage[0-3]
00565   - \c EPUTemp[0-3]
00566   - \c EPUCratePowerStat[0-3]
00567   - \c EPUConverterStat[0-3]
00568   """
00569   __regs = []
00570   __regs.append(gHdb.GattrHsk('ACDShellTemp0',  0))
00571   __regs.append(gHdb.GattrHsk('ACDShellTemp1',  1))
00572   __regs.append(gHdb.GattrHsk('ACDconvTemp',    2))
00573   __regs.append(gHdb.GattrHsk('ACDpowerState',  3))
00574   __regs.append(gHdb.GattrHsk('ACDpowerSupply', 4))
00575   offset = 5
00576   for i in range(12):
00577     __regs.append(gHdb.GattrHsk('GridTemp%d'%i,     offset  ))
00578     __regs.append(gHdb.GattrHsk('RadiatorTemp%d'%i, offset+1))
00579     offset += 2
00580   __regs.append(gHdb.GattrHsk('RadiatorAfrzTemp0',  offset+0))
00581   __regs.append(gHdb.GattrHsk('RadiatorAfrzTemp1',  offset+1))
00582   offset += 2
00583   for i in range(16):
00584     __regs.append(gHdb.GattrHsk('CalBaseplateTemp%d'%i, offset))
00585     offset += 1
00586
00587   for i in range(6):
00588     __regs.append(gHdb.GattrHsk('VHCP_DSHP_M_Temp%d'%i, offset+0))
00589     __regs.append(gHdb.GattrHsk('VHCP_DSHP_P_Temp%d'%i, offset+1))
00590     __regs.append(gHdb.GattrHsk('VHCP_XLHP_M_Temp%d'%i, offset+2))
00591     __regs.append(gHdb.GattrHsk('VHCP_XLHP_P_Temp%d'%i, offset+3))
00592     __regs.append(gHdb.GattrHsk('VHCPRes_M_Temp%d'%i,   offset+4))
00593     __regs.append(gHdb.GattrHsk('VHCPRes_P_Temp%d'%i,   offset+5))
00594     offset += 6
00595
00596   for i in range(16):
00597     __regs.append(gHdb.GattrHsk('TEM%d_PCBTemp'%i,    offset+0))
00598     __regs.append(gHdb.GattrHsk('TEM%d_digital33V'%i, offset+1))
00599     __regs.append(gHdb.GattrHsk('TEM%d_PSTemp'%i,     offset+2))
00600     __regs.append(gHdb.GattrHsk('TEM%d_powerState'%i, offset+3))
00601     offset += 4
00602   for i in range(4):
00603     __regs.append(gHdb.GattrHsk('ACDpmtRailTemp%d'%i, offset))
00604     offset += 1
00605   __regs.append(gHdb.GattrHsk('ACDBEAgridTemp0',offset+0))
00606   __regs.append(gHdb.GattrHsk('ACDBEAgridTemp1',offset+1))
00607   offset += 2
00608   for i in range(4):
00609     __regs.append(gHdb.GattrHsk('GridRadiatorTemp%d'%i,offset))
00610     offset += 1
00611   for i in range(3):
00612     __regs.append(gHdb.GattrHsk('EPUdigitalVoltage%d'%i,offset+0))
00613     __regs.append(gHdb.GattrHsk('EPUTemp%d'%i,          offset+1))
00614     __regs.append(gHdb.GattrHsk('EPUCratePowerStat%d'%i,offset+2))
00615     __regs.append(gHdb.GattrHsk('EPUConverterStat%d'%i, offset+3))
00616     offset += 4
00617   __regs.append(gHdb.GattrHsk('Spare0',offset  ))
00618   __regs.append(gHdb.GattrHsk('Spare1',offset+1))
00619   offset += 2
00620
00621   def __init__(self, client, parent, pduID):
00622     """\brief Initialize valid housekeeping quantities as Gattrs
00623     """
00624     gDb.Gdb.__init__(self, client, parent, pduID, self.__regs)
00625
00626 class HCOM(gDb.Gdb):
00627   """\brief GLAST Communications statistics HSK node record
00628
00629   Valid Attributes:
00630   - \c Traffic_LCB0
00631   - \c Traffic_LCB0
00632   - \c Traffic_LCB0
00633   - \c Traffic_1553
00634   - \c Traffic_SSR
00635   """
00636   __regs = [
00637     gHdb.GattrHsk('Traffic_LCB0',0),
00638     gHdb.GattrHsk('Traffic_LCB0',1),
00639     gHdb.GattrHsk('Traffic_LCB0',2),
00640     gHdb.GattrHsk('Traffic_1553',3),
00641     gHdb.GattrHsk('Traffic_SSR' ,4),
00642   ]
00643   def __init__(self, client, parent):
00644     """\brief Initialize valid housekeeping quantities as Gattrs
00645     """
00646     gDb.Gdb.__init__(self, client, parent, None, self.__regs)
00647
00648 class HCPU(gDb.Gdb):
00649   """\brief GLAST CPU metrics HSK node record
00650
00651   Valid Attributes:
00652   - \c CPU_Idle_[0-3]
00653   - \c CPU_Temp_[0-3]
00654   - \c MemUsage_[0-3]
00655   - \c CacheMisses_[0-3]
00656   - \c TaskStats_[0-3]
00657   """
00658   __regs = []
00659   offset = 0
00660   for i in range(3):
00661     __regs.append(gHdb.GattrHsk('CPU_Idle_%d'%i,    offset+0))
00662     __regs.append(gHdb.GattrHsk('CPU_Temp_%d'%i,    offset+1))
00663     __regs.append(gHdb.GattrHsk('MemUsage_%d'%i,    offset+2))
00664     __regs.append(gHdb.GattrHsk('CacheMisses_%d'%i, offset+3))
00665     __regs.append(gHdb.GattrHsk('TaskStats_%d'%i,   offset+4))
00666     offset += 5
00667   def __init__(self, client, parent):
00668     """\brief Initialize valid housekeeping quantities as Gattrs
00669     """
00670     gDb.Gdb.__init__(self, client, parent, None, self.__regs)
00671
00672 class HNUL(gDb.Gdb):
00673   """\brief GLAST HSK null record
00674
00675   Valid Attributes:
00676   - \c EMPTY
00677   """
00678   __regs = [
00679     gHdb.GattrHsk('EMPTY',0),
00680   ]
00681   def __init__(self, parent):
00682     """\brief Initialize valid housekeeping quantities as Gattrs
00683     """
00684     gDb.Gdb.__init__(self, None, parent, None, self.__regs)
00685
00686 def processGHSK(isSchema, ghdb, node, declarations):
00687   fn = "processGHSK"
00688   for n in gSchemaConfig.getChildNodes(node):
00689     tagName = n.tagName.lower()
00690     if tagName   == 'htem':
00691       processHTEM(isSchema, ghdb, n, declarations)
00692     elif tagName == 'haem':
00693       processHAEM(isSchema, ghdb, n, declarations)
00694     elif tagName == 'hgem':
00695       processHGEM(isSchema, ghdb, n, declarations)
00696     elif tagName == 'hebm':
00697       processHEBM(isSchema, ghdb, n, declarations)
00698     elif tagName == 'hpdu':
00699       processHPDU(isSchema, ghdb, n, declarations)
00700     elif tagName == 'hcom':
00701       processHCOM(isSchema, ghdb, n, declarations)
00702     elif tagName == 'hcpu':
00703       processHCPU(isSchema, ghdb, n, declarations)
00704     elif tagName == 'opaque':
00705       gSchemaConfig.addOpaque(ghdb, n)
00706     elif isSchema:
00707       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00708     elif tagName in ghdb.regs:
00709       gSchemaConfig.setRegister(ghdb.regs[tagName], n, declarations)
00710     else:
00711       log.error("%s: Configuration error processing GHSK...Invalid attribute %s" % (fn, n.tagName))
00712
00713   return ghdb
00714
00715
00716 def processHTEM(isSchema, ghdb, node, declarations):
00717   fn = "processHTEM"
00718   if node.hasAttribute('ID'):
00719     htemIdSeq = gSchemaConfig.uncompressSequence(node.getAttribute('ID'))
00720   else:
00721     raise KeyError("%s: Configuration error processing HTEM ...No ID attribute for HTEM." % (fn) )
00722
00723   for htemId in htemIdSeq:
00724     if isSchema:
00725       htem = __privateFn(ghdb, '__addHTEM')(ghdb, htemId)
00726     elif ghdb.existsHTEM(htemId):
00727       htem = ghdb.downHTEM(htemId)
00728     else:
00729       log.debug("%s: Configuration error processing HTEM ...Not populated" %(fn))
00730       continue
00731     for n in gSchemaConfig.getChildNodes(node):
00732       tagName = n.tagName.lower()
00733       if tagName == 'opaque':
00734         gSchemaConfig.addOpaque(htem, n)
00735       elif isSchema:
00736         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00737       elif tagName in htem.regs:
00738         gSchemaConfig.setRegister(htem.regs[tagName], n, declarations)
00739       else:
00740         log.error("%s: Configuration error processing HTEM # %d ...Invalid attribute %s" % (fn, htemId, n.tagName))
00741         print "JHPBAD: htem.regs", tagName, htem.regs
00742         print htem.regs[tagName]
00743
00744 def processHAEM(isSchema, ghdb, node, declarations):
00745   fn = "processHAEM"
00746   if isSchema:
00747     haem = __privateFn(ghdb, '__addHAEM')(ghdb)
00748   elif ghdb.existsHAEM():
00749     haem = ghdb.downHAEM()
00750   else:
00751     log.debug("%s: Configuration error processing HAEM ...Not populated" %(fn))
00752     return
00753   for n in gSchemaConfig.getChildNodes(node):
00754     tagName = n.tagName.lower()
00755     if tagName == 'harc':
00756       processHARC(isSchema, haem, n, declarations)
00757     elif tagName == 'opaque':
00758       gSchemaConfig.addOpaque(haem, n)
00759     elif isSchema:
00760       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00761     elif tagName in haem.regs:
00762       gSchemaConfig.setRegister(haem.regs[tagName], n, declarations)
00763     else:
00764       log.error("%s: Configuration error processing HAEM ...Invalid attribute %s" %(fn, n.tagName))
00765
00766 def processHARC(isSchema, ghdb, node, declarations):
00767   fn = "processHARC"
00768   if node.hasAttribute('ID'):
00769     harcIdSeq = gSchemaConfig.uncompressSequence(node.getAttribute('ID'))
00770   else:
00771     raise KeyError("%s: Configuration error processing HARC ...No ID attribute for HARC." % (fn) )
00772
00773   for harcId in harcIdSeq:
00774     if isSchema:
00775       harc = __privateFn(ghdb, '__addHARC')(ghdb, harcId)
00776     elif ghdb.existsHARC(harcId):
00777       harc = ghdb.downHARC(harcId)
00778     else:
00779       log.debug("%s: Configuration error processing HARC ...Not populated" %(fn))
00780       continue
00781     for n in gSchemaConfig.getChildNodes(node):
00782       tagName = n.tagName.lower()
00783       if tagName == 'opaque':
00784         gSchemaConfig.addOpaque(harc, n)
00785       elif isSchema:
00786         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00787       elif tagName in harc.regs:
00788         gSchemaConfig.setRegister(harc.regs[tagName], n, declarations)
00789       else:
00790         log.error("%s: Configuration error processing HARC # %d ...Invalid attribute %s" % (fn, harcId, n.tagName))
00791
00792
00793
00794
00795
00796 def processHGEM(isSchema, ghdb, node, declarations):
00797   fn = "processHGEM"
00798   if isSchema:
00799     hgem = __privateFn(ghdb, '__addHGEM')(ghdb)
00800   elif ghdb.existsHGEM():
00801     hgem = ghdb.downHGEM()
00802   else:
00803     log.debug("%s: Configuration error processing HGEM ...Not populated" %(fn))
00804     return
00805
00806   for n in gSchemaConfig.getChildNodes(node):
00807     tagName = n.tagName.lower()
00808     if tagName == 'opaque':
00809       gSchemaConfig.addOpaque(hgem, n)
00810     elif isSchema:
00811       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00812     elif tagName in hgem.regs:
00813       gSchemaConfig.setRegister(hgem.regs[tagName], n, declarations)
00814     else:
00815       log.error("%s: Configuration error processing HGEM ...Invalid attribute %s" %(fn, n.tagName))
00816
00817
00818 def processHEBM(isSchema, ghdb, node, declarations):
00819   fn = "processHEBM"
00820   if isSchema:
00821     hebm = __privateFn(ghdb, '__addHEBM')(ghdb)
00822   elif ghdb.existsHEBM():
00823     hebm = ghdb.downHEBM()
00824   else:
00825     log.debug("%s: Configuration error processing HEBM ...Not populated" %(fn))
00826     return
00827
00828   for n in gSchemaConfig.getChildNodes(node):
00829     tagName = n.tagName.lower()
00830     if tagName == 'opaque':
00831       gSchemaConfig.addOpaque(hebm, n)
00832     elif isSchema:
00833       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00834     elif tagName in hebm.regs:
00835       gSchemaConfig.setRegister(hebm.regs[tagName], n, declarations)
00836     else:
00837       log.error("%s: Configuration error processing HEBM ...Invalid attribute %s" %(fn, n.tagName))
00838
00839
00840 def processHPDU(isSchema, ghdb, node, declarations):
00841   fn = "processHPDU"
00842   if node.hasAttribute('ID'):
00843     hpduIdSeq = gSchemaConfig.uncompressSequence(node.getAttribute('ID'))
00844   else:
00845     raise KeyError("%s: Configuration error processing HPDU ...No ID attribute for HPDU." % (fn) )
00846
00847   for hpduId in hpduIdSeq:
00848     if isSchema:
00849       hpdu = __privateFn(ghdb, '__addHPDU')(ghdb,hpduId)
00850     elif ghdb.existsHPDU(hpduId):
00851       hpdu = ghdb.downHPDU(hpduId)
00852     else:
00853       log.debug("%s: Configuration error processing HPDU %d ...Not populated" %(fn, hpduId))
00854       return
00855
00856     for n in gSchemaConfig.getChildNodes(node):
00857       tagName = n.tagName.lower()
00858       if tagName == 'opaque':
00859         gSchemaConfig.addOpaque(hpdu, n)
00860       elif isSchema:
00861         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00862       elif tagName in hpdu.regs:
00863         gSchemaConfig.setRegister(hpdu.regs[tagName], n, declarations)
00864       else:
00865         log.error("%s: Configuration error processing HPDU ...Invalid attribute %s" %(fn, n.tagName))
00866
00867
00868 def processHCOM(isSchema, ghdb, node, declarations):
00869   fn = "processHCOM"
00870   if isSchema:
00871     hcom = __privateFn(ghdb, '__addHCOM')(ghdb)
00872   elif ghdb.existsHCOM():
00873     hcom = ghdb.downHCOM()
00874   else:
00875     log.debug("%s: Configuration error processing HCOM ...Not populated" %(fn))
00876     return
00877
00878   for n in gSchemaConfig.getChildNodes(node):
00879     tagName = n.tagName.lower()
00880     if tagName == 'opaque':
00881       gSchemaConfig.addOpaque(hcom, n)
00882     elif isSchema:
00883       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00884     elif tagName in hcom.regs:
00885       gSchemaConfig.setRegister(hcom.regs[tagName], n, declarations)
00886     else:
00887       log.error("%s: Configuration error processing HCOM ...Invalid attribute %s" %(fn, n.tagName))
00888
00889
00890 def processHCPU(isSchema, ghdb, node, declarations):
00891   fn = "processHCPU"
00892   if isSchema:
00893     hcpu = __privateFn(ghdb, '__addHCPU')(ghdb)
00894   elif ghdb.existsHCPU():
00895     hcpu = ghdb.downHCPU()
00896   else:
00897     log.debug("%s: Configuration error processing HCPU ...Not populated" %(fn))
00898     return
00899
00900   for n in gSchemaConfig.getChildNodes(node):
00901     tagName = n.tagName.lower()
00902     if tagName == 'opaque':
00903       gSchemaConfig.addOpaque(hcpu, n)
00904     elif isSchema:
00905       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00906     elif tagName in hcpu.regs:
00907       gSchemaConfig.setRegister(hcpu.regs[tagName], n, declarations)
00908     else:
00909       log.error("%s: Configuration error processing HCPU ...Invalid attribute %s" %(fn, n.tagName))
00910
00911
00912
00913 def readHskConfig(ghsk, cfgFileName):
00914   """Read a hsk configuration XML file and add its DOM
00915   to the dictionary of configurations.
00916
00917   \param  ghsk        Populated schema
00918   \param  cfgFileName Name of the configuration file in XML format
00919   \return             The numeric key value of the dictionary entry.
00920                       -1 if it fails to read the configuration file.
00921   """
00922   fn = "readHskConfig"
00923   mainFilePath = os.path.dirname(cfgFileName)
00924   mainFileName = os.path.basename(cfgFileName)
00925   if mainFilePath != '': os.chdir(mainFilePath)
00926
00927   try:
00928     cfgDoc = Sax2.FromXmlFile(cfgFileName)
00929   except:
00930     log.exception("%s: Error reading configuration file" % fn)
00931     os.chdir(curDir)
00932     return -1
00933
00934   cfgNode = cfgDoc.documentElement
00935
00936   includeFiles = []
00937   gSchemaConfig.processIncludes(cfgDoc, cfgNode, includeFiles, mainFilePath)
00938   ghsk._GHSK__includeFiles += includeFiles
00939   cfgDict = ghsk.getConfigurations()
00940   configSeq = len(cfgDict)
00941   configName = ''
00942   configVersion = ''
00943   if cfgNode.hasAttribute('name'):
00944     configName = str(cfgNode.getAttribute('name'))
00945   if cfgNode.hasAttribute('version'):
00946     configVersion = str(cfgNode.getAttribute('version'))
00947
00948   cfgDict[configSeq] = (cfgNode, configName, configVersion)
00949   return configSeq
00950
00951 def applyHskConfig(ghsk, seq=None):
00952   """Applies the configuration that may have existed when the schema is read.
00953      The configuration portion of the schema is stored as a DOM reference
00954      in the GHSK node. This function accesses that DOM and sets the attributes
00955      accordingly
00956
00957   Input ::
00958
00959     (1) GHSK root of the object model
00960     (2) Optional sequence number of the configuration
00961
00962   Output: None
00963
00964   Usage::
00965
00966     applyConfig(ghsk)"""
00967
00968   fn = "applyHskConfig"
00969   configs = []
00970   if seq is None:
00971     if len(ghsk.getConfigurations()) == 0:
00972       log.debug("%s: Nothing to do, no configuration exists" % fn)
00973       return
00974     else:
00975       configSeqList = ghsk.getConfigurations().keys()
00976       configSeqList.sort()
00977       for seq in configSeqList:
00978         configs.append(ghsk.getConfigurations()[seq][0])
00979   elif type(seq) == types.IntType:
00980     if ghsk.getConfigurations().has_key(seq):
00981       configs.append(ghsk.getConfigurations()[seq][0])
00982     else:
00983       log.error("%s: Configuration with sequence %d could not be found" % (fn, seq))
00984       return
00985
00986   for config in configs:
00987     for n in gSchemaConfig.getChildNodes(config):
00988       processHskConfigProperties(ghsk, n, ghsk.getDeclarations())
00989       if n.nodeType == Node.ELEMENT_NODE:
00990         tagname = n.tagName.lower()
00991         if tagname == 'ghsk':
00992           if config.hasAttribute('name'):
00993             configName = config.getAttribute('name')
00994           else:
00995             configName = '(no name)'
00996           log.debug("%s: Applying configuration: %s" % (fn, configName))
00997           processGHSK(0, ghsk, n, ghsk.getDeclarations())
00998
00999 def processHskConfigProperties(ghsk, node, declarations):
01000   fn = "processHskConfigProperties"
01001   if node.nodeType == Node.ELEMENT_NODE:
01002     cfgTagname = node.tagName.lower()
01003     if cfgTagname == 'declarations':
01004       gSchemaConfig.processDeclarations(0, node, declarations)
01005     elif cfgTagname == 'constraints':
01006       gSchemaConfig.processConstraints(node, declarations['groups'], declarations['constraints'])
01007     elif cfgTagname == 'rules':
01008       gSchemaConfig.processRules(node, declarations['groups'], declarations['rules'])
01009     elif cfgTagname == 'egus':
01010       gSchemaConfig.processEGUs(node, declarations['egus'])
01011     elif cfgTagname in ('ghsk'):
01012       pass
01013     else:
01014       log.error("%s: Unrecognized configuration tag: %s" % (fn, cfgTagname))
01015
01016
01017
01018
01019 def __privateFn(cls, function):
01020   # local routine to return an arbitrary class attribute.
01021   # used to return private methods of classes.
01022   gname = cls.__class__.__name__
01023   gdict = cls.__class__.__dict__
01024   return gdict['_' + gname + function]
01025
01026
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLAT.py Source File

database

gLAT.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 ## \namespace gLAT
00011 ##
00012 ## \brief GLAST LAT record definitions.
00013 ##
00014 ## \b Contents:
00015 ##
00016 ##  GLAST LAT functional block hierarchy representation in Python. See the following documents for more info:
00017 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/TEM.pdf">The Tower Electronics Module (TEM) - Programming ICD specification (LAT-TD-00605-D1)</a>
00018 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/AEM.pdf">ACD Electronics Module (AEM) - Programming ICD specification (LAT-TD-00639-D1)</a>
00019 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/EBM.pdf">The Event Builder Module - Programming ICD specification (LAT-TD-01546)</a>
00020 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/GEM.pdf">The GLT Electronics Module - Programming ICD specification (LAT-TD-01545)</a>
00021 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/CRU.pdf">The Command/Response Unit - Programming ICD specification (LAT-TD-01547)</a>
00022 ##  <p><a href="http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/docs/PDU.pdf">The Power Distribution Unit - Programming ICD specification (LAT-TD-01543)</a>
00023 ##
00024 ## \b Overview:
00025 ##
00026 ##  This module provides classes that are used as the building blocks for the
00027 ##  LAT hierarchy. All classes inherit from Gnode class and add their own member
00028 ##  methods and functions where necessary. Here is a list of classes defined:
00029 ##
00030 ##    - GLAT: Root node for the hierarchy
00031 ##    - GPDU: Power Distribution Unit
00032 ##    - GPDUC: PDU Controller
00033 ##    - GPEQ: PDU Environmental Monitors
00034 ##    - GTWR: Tower
00035 ##    - GTEM: Tower Electronics Module
00036 ##    - GCCC: Calorimeter Cable Controller
00037 ##    - GCRC: Calorimeter Readout Controller
00038 ##    - GCFE: Calorimeter Front-end Controller
00039 ##    - GTCC: Tracker Cable Controller
00040 ##    - GTRC: Tracker Readout Controller
00041 ##    - GTFE: Tracker Front-end Controller
00042 ##    - GTIC: Trigger Interface Controller
00043 ##    - GAEM: ACD Common Controller
00044 ##    - GAEQ: ACD Environmental Monitors
00045 ##    - GARC: ACD Readout Controller
00046 ##    - GAFE: ACD Front-End Controller
00047 ##    - GGLT: Global Trigger
00048 ##    - GEBM: Event Builder Module
00049 ##    - GEBMC: Event Builder Module Controller
00050 ##    - GEBMST: Event Builder Module Statistics
00051 ##    - GGEM: GLT Electronics Module
00052 ##    - GGEMC: GLT Electronics Module Controller
00053 ##    - GGEMMG: GLT Electronics Module TAM generator
00054 ##    - GGEMST: GLT Electronics Module Statistics
00055 ##    - GGEMSC: GLT Electronics Module Scheduler
00056 ##    - GGEMVG: GLT Electronics Module ROI generator
00057 ##    - GGEMIE: GLT Electronics Module Input enables
00058 ##    - GGEMW: GLT Electronics Module Window
00059 ##    - GCRU: Command Response Unit
00060
00061 __facility__ = "Online"
00062 __abstract__ = "GLAST LAT functional block hierarchy"
00063 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00064 __date__     = ("$Date: 2004/10/21 23:28:40 $").split(' ')[1]
00065 __version__ = "$Revision: 2.11 $"
00066 __release__  = "$Name: P04-06-05 $"
00067 __credits__ = "SLAC"
00068
00069 import LATTE.copyright_SLAC
00070 import gSchemaConfig
00071 import gDb
00072 import gAttr
00073
00074 from gLCB import GLCB
00075 from gCRU import GCRU
00076 from gEBM import GEBM
00077 from gGEM import GGEM
00078 from gAEM import GAEM
00079 from gPDU import GPDU
00080 from gTEM import GTEM
00081
00082
00083 # GLAT class
00084 class GLAT(gDb.Gdb):
00085   """\brief GLAST LAT node Record
00086
00087   The GLAT node provides access to parity registers and
00088   event statistics registers.
00089
00090   Valid Registers:
00091   - \c parity_latp_cell_header
00092   - \c parity_latp_cell_body
00093   - \c parity_tem_cmd_str
00094   - \c parity_tem_access_desc
00095   - \c parity_tem_cmd_payload
00096   - \c parity_aem_cmd_str
00097   - \c parity_aem_access_desc
00098   - \c parity_aem_cmd_payload
00099   - \c stats_failed_events
00100   - \c stats_failed_event_sends
00101   - \c stats_valid_events
00102   - \c stats_discarded_event_sends
00103   - \c stats_length_mismatch_count
00104   - \c stats_events_not_sent
00105
00106   Event statistics:
00107
00108   The following statistics registers are initialized
00109   at the start of each RunControl run:
00110
00111   - \c stats_failed_events -- Counts events where
00112   the eventHandler receives a bad status for the event.
00113
00114   - \c stats_failed_event_sends -- Counts events where
00115   the socket send failed with an error other than
00116   EWOULDBLOCK.
00117
00118   - \c stats_valid_events -- Counts when a valid event
00119   has been successfully sent to the client.
00120
00121   - \c stats_discarded_event_sends -- Counts cases when an
00122   event send failed due to the fact that the send
00123   returned an EWOULDBLOCK error.
00124
00125   - \c stats_length_mismatch_count -- Counts cases when
00126   the length argument passed to the event handler did
00127   not match the length provided in the event header.
00128
00129   - \c stats_events_not_sent -- Counts when the event
00130   mode is set to DONOT_SEND_EVENTS where the incoming
00131   events will not be forwarded to the client over the
00132   socket.
00133
00134   """
00135   __attrs = [
00136     # Registers
00137     gAttr.GattrReg('parity_latp_cell_header',      0, 2), # Deprecated: use gLCB
00138     gAttr.GattrReg('parity_latp_cell_body',        1, 2), # Deprecated: use gLCB
00139     gAttr.GattrReg('parity_tem_cmd_str',           2, 2),
00140     gAttr.GattrReg('parity_tem_access_desc',       3, 2),
00141     gAttr.GattrReg('parity_tem_cmd_payload',       4, 2),
00142     gAttr.GattrReg('stats_failed_events',          8, 2), # Deprecated: use gOCS
00143     gAttr.GattrReg('stats_failed_event_sends',     9, 2), # Deprecated: use gOCS
00144     gAttr.GattrReg('stats_valid_events',          10, 2), # Deprecated: use gOCS
00145     gAttr.GattrReg('stats_discarded_event_sends', 11, 2), # Deprecated: use gOCS
00146     gAttr.GattrReg('stats_length_mismatch_count', 12, 2), # Deprecated: use gOCS
00147     gAttr.GattrReg('stats_events_not_sent',       13, 2)  # Deprecated: use gOCS
00148     ]
00149
00150   def __init__(self, client):
00151     """\brief Initialize valid registers as Gattrs.
00152
00153     Assign default values to members
00154     """
00155     self.LCB                         = GLCB(client)
00156     self.CRU                         = None
00157     self.AEM                         = None
00158     self.GEM                         = None
00159     self.EBM                         = None
00160     self.PDU                         = gDb.Children(self, GPDU)
00161     self.TEM                         = gDb.Children(self, GTEM)
00162     self.__schemaComments            = []
00163     self.__schemaName                = ''
00164     self.__configComments            = []
00165     self.__configName                = ''
00166     self.__configVersion             = ''
00167     self.__includeFiles              = []
00168     self.__declarations              = None
00169     self.__configurations            = {}
00170     self.__deadChannels              = None
00171     self.__noisyChannels             = None
00172     self.__opaque                    = {}
00173     self.__serialnos                 = {}
00174     gDb.Gdb.__init__(self, client, None, 0, self.__attrs)
00175
00176   def read(self, reg):
00177     return self.cmdrsp('ggLATread', reg, '!I')
00178
00179   def load(self, reg, value):
00180     return self.cmdrsp('ggLATload', reg, value)
00181
00182   def readSchema(self, name):
00183     self.CRU                         = None
00184     self.AEM                         = None
00185     self.GEM                         = None
00186     self.EBM                         = None
00187     self.PDU                         = gDb.Children(self, GPDU)
00188     self.TEM                         = gDb.Children(self, GTEM)
00189     return gSchemaConfig.readSchema(self, name)
00190
00191   def writeSchema(self, fileName):
00192     gSchemaConfig.writeSchema(self, file(fileName, "w+"), snapshotMode=0)
00193
00194   def writeConfig(self, fileName, seq=None):
00195     gSchemaConfig.writeConfig(self, file(fileName, "w+"), seq)
00196
00197   def takeSnapshot(self, stream, fileName,
00198                    captureGTIC, captureGAEQ,
00199                    trigger, configName, configVersion):
00200     gSchemaConfig.takeSnapshot(self, stream, fileName,
00201                                captureGTIC, captureGAEQ,
00202                                trigger, configName, configVersion)
00203
00204   def readConfig(self, cfgFileName):
00205     return gSchemaConfig.readConfig(self, cfgFileName)
00206
00207   def applyConfig(self, seq=None, gxbrd=None):
00208     gSchemaConfig.applyConfig(self, seq, gxbrd)
00209
00210   def downTEM(self, childId):
00211     """\brief Navigate to the GTEM indicated by \a childId
00212
00213     \param  childId The id of the child TEM
00214     \return         a GTEM object instance
00215     """
00216     return self.TEM.down(childId)
00217
00218   def allTEM(self):
00219     return self.TEM.all()
00220
00221   def downPDU(self, childId):
00222     """\brief Navigate to the GPDU indicated by \a childId
00223
00224     \param  childId The id of the child PDU
00225     \return         a GPDU object instance
00226     """
00227     return self.PDU.down(childId)
00228
00229   def downAEM(self):
00230     """\brief Navigate to the GAEM
00231
00232     \return the GAEM object instance
00233     """
00234     return self.AEM
00235
00236   def downGEM(self):
00237     """\brief Navigate to the GGEM
00238
00239     \return the GGEM object instance
00240     """
00241     return self.GEM
00242
00243   def downEBM(self):
00244     """\brief Navigate to the GEBM
00245
00246     \return the GEBM object instance
00247     """
00248     return self.EBM
00249
00250   def downLCB(self):
00251     """\brief Navigate to the GLCB
00252
00253     \return the GLCB object instance
00254     """
00255     return self.LCB
00256
00257   def downCRU(self):
00258     """\brief Navigate to the GCRU
00259
00260     \return the GCRU object instance
00261     """
00262     return self.CRU
00263
00264   def TEMcnt(self):
00265     """\brief Return the TEM count
00266
00267     \return Current TEM count
00268     """
00269     return len(self.TEM)
00270
00271   def existsTEM(self, temId):
00272     """\brief Check if the GTEM instance with the id \a temId exists
00273     in the schema.
00274
00275     \param  temId TEM id
00276     \return       1 if it exists, 0 if it doesn't.
00277     """
00278     return self.TEM.exists(temId)
00279
00280   def existsPDU(self, pduId):
00281     """\brief Check if the GPDU instance with the id \a pduId exists
00282     in the schema.
00283
00284     \param  pduId PDU id
00285     \return       1 if it exists, 0 if it doesn't.
00286     """
00287     return self.PDU.exists(pduId)
00288
00289   def existsAEM(self):
00290     """\brief Check if the GAEM instance exists in the schema.
00291
00292     \return 1 if it exists, 0 if it doesn't.
00293     """
00294     return self.AEM != None
00295
00296   def existsGEM(self):
00297     """\brief Check if the GGEM instance exists in the schema.
00298
00299     \return 1 if it exists, 0 if it doesn't.
00300     """
00301     return self.GEM != None
00302
00303   def existsEBM(self):
00304     """\brief Check if the GEBM instance exists in the schema.
00305
00306     \return 1 if it exists, 0 if it doesn't.
00307     """
00308     return self.EBM != None
00309
00310   def existsCRU(self):
00311     """\brief Check if the GCRU instance exists in the schema.
00312
00313     \return 1 if it exists, 0 if it doesn't.
00314     """
00315     return self.CRU != None
00316
00317   def existsLCB(self):
00318     """\brief Check if the GLCB instance exists in the schema.
00319
00320     \return 1 if it exists, 0 if it doesn't.
00321     """
00322     return self.LCB != None
00323
00324   def getConfigurations(self):
00325     """\brief Get list of configurations.
00326
00327     Return a list of configuration tuples where
00328     each tuple contains the configDOM, configName and configRelease.
00329
00330     \return Configuration tuple list.
00331     """
00332     return self.__configurations
00333
00334   def getDeclarations(self):
00335     """\brief Get list of declarations.
00336
00337     Return a list of declarations
00338
00339     \return Declarations.
00340     """
00341     return self.__declarations
00342
00343   def getRules(self):
00344     """\brief Retrieves the rule dictionary as defined by the
00345     current schema/configuration.
00346
00347     \return Dictionary containing Grule objects (or its descendants).
00348     """
00349     return self.__declarations['rules']
00350
00351   def getAllOpaque(self):
00352     """\brief Return all opaque data.
00353
00354     \return All opaque data regardless of the node they are
00355             associated with.
00356     """
00357     return self.__opaque
00358
00359   def getAllSerialNos(self):
00360     """\brief Return all opaque data.
00361
00362     \return All serial number data regardless of the node
00363             they are associated with.
00364     """
00365     return self.__serialnos
00366
00367   ##private:
00368
00369   def __removeTEM(self, temId):
00370     self.TEM.remove(temId)
00371
00372   def __addTEM(self, temId):
00373     return self.TEM.add(temId)
00374
00375   def __removePDU(self, pduId):
00376     self.PDU.remove(pduId)
00377
00378   def __addPDU(self, pduId):
00379     return self.PDU.add(pduId)
00380
00381   def __removeAEM(self):
00382     self.AEM = None
00383
00384   def __addAEM(self):
00385     self.AEM = GAEM(self.client(), self)
00386     return self.AEM
00387
00388   def __removeEBM(self):
00389     self.EBM = None
00390
00391   def __addEBM(self):
00392     self.EBM = GEBM(self.client(), self)
00393     return self.EBM
00394
00395   def __removeGEM(self):
00396     self.GEM = None
00397
00398   def __addGEM(self):
00399     self.GEM = GGEM(self.client(), self)
00400     return self.GEM
00401
00402   def __removeCRU(self):
00403     self.CRU = None
00404
00405   def __addCRU(self):
00406     self.CRU = GCRU(self.client(), self)
00407     return self.CRU
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLCB.py Source File

database

gLCB.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST LCB functional block"
00013 __author__  = "R. Claus <claus@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/10/15 23:56:05 $").split(' ')[1]
00015 __version__ = "$Revision: 2.4 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022 import gAttr
00023
00024 class GLCB(gDb.Gdb):
00025   """\brief LCB node.
00026
00027   Has GLCB specific registers and dataless commands.
00028
00029   Valid Registers:
00030   - \c csr
00031   - \c parity_latp_cell_header
00032   - \c parity_latp_cell_body
00033
00034   """
00035   __attrs = [
00036     # Registers
00037     gAttr.GattrReg('csr',                    0, 2),
00038     gAttr.GattrBF('parity_latp_cell_header', 0, 4, 5),
00039     gAttr.GattrBF('parity_latp_cell_body',   0, 5, 6)
00040     ]
00041
00042   def __init__(self, client):
00043     """\brief Initialize valid registers as Gattrs.
00044     """
00045     gDb.Gdb.__init__(self, client, None, 0, self.__attrs)
00046
00047   def read(self, reg):
00048     return self.cmdrsp('LIOX_sync_CSR', 'slh', 0, 0, '!I', '!I')
00049
00050   def load(self, reg, value):
00051     return self.cmdrsp('LIOX_sync_CSR', 'slh', value, 0xffff, 0, 0)
00052
00053   def getLCBCSR(self):                  # For backward compatibility
00054     """LCBCSR read command
00055
00056     \return       The LCB CSR register contents
00057
00058     """
00059     return self.read(0).payloads()[0]
00060
00061   def setLCBCSR(self, value):           # For backward compatibility
00062     """LCBCSR load command
00063
00064     \param  value - LCB CSR register value to be loaded
00065     \return         A tuple containing the user id, status and timestamp
00066
00067     """
00068     return self.load(0, value)
00069
00070   def setEvtEnable(self, parm):
00071     """\brief Sets the LCB event enable bit to true or false.
00072
00073     \param parm boolean.
00074     """
00075     response = self.cmdrsp('ggEvtEnable', 'GGLT_handle', parm)
00076     #if parm: value = 0x2  # Turn on events
00077     #else:    value = 0x0  # Turn off events
00078     #response = self.cmdrsp('LIOX_sync_CSR', 'slh', value, 0x2, 0, 0)
00079
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GlobalPanelImpl.py Source File

runcontrol

GlobalPanelImpl.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "RunControl Global Panel Implementation"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "10/11/2002"
00014 __version__  = "$Revision: 2.5.2.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from qt                          import SIGNAL, QCursor, Qt, QAction, QKeySequence, QPixmap
00022 import                                  os
00023 import                                  sys
00024
00025 import                                  GlobalPanel
00026 from EnvMonImpl                  import EnvMonImpl
00027 from LATTE.browser.BrowserImpl   import BrowserImpl
00028
00029 class GlobalPanelImpl(GlobalPanel.GlobalPanel):
00030
00031   def __init__(self, rc, common, parent = None, name = None, fl = 0):
00032     GlobalPanel.GlobalPanel.__init__(self, parent, name, fl)
00033     self.__rc      = rc
00034     self.__common  = common
00035     self.__parent  = parent
00036
00037     self.connect(self.MSGLoggerButton,SIGNAL("clicked()"),self.loadMSGLogger)
00038     self.connect(self.cmdEnvMon,SIGNAL("clicked()"),self.startEnvMon)
00039     self.connect(self.cmdBrowser,SIGNAL("clicked()"),self.startBrowser)
00040     self.connect(self.cmdBrowseExport,SIGNAL("clicked()"),self.browseExportedFiles)
00041
00042     self.toolsMessage_LoggerAction = QAction(self.__rc,"toolsMessage_LoggerAction")
00043     self.toolsEnvironmental_MonitoringAction = QAction(self.__rc,"toolsEnvironmental_MonitoringAction")
00044     self.toolsRegister_BrowserAction = QAction(self.__rc,"toolsRegister_BrowserAction")
00045     self.toolsBrowse_Exported_FilesAction = QAction(self.__rc,"toolsBrowse_Exported_FilesAction")
00046     self.toolsMessage_LoggerAction.setText("Message Logger")
00047     self.toolsMessage_LoggerAction.setMenuText("&Message Logger")
00048     self.toolsMessage_LoggerAction.setAccel(QKeySequence("Ctrl+Shift+M"))
00049     self.toolsEnvironmental_MonitoringAction.setText("Environmental Monitoring")
00050     self.toolsEnvironmental_MonitoringAction.setMenuText("&Environmental Monitoring")
00051     self.toolsEnvironmental_MonitoringAction.setAccel(QKeySequence("Ctrl+Shift+E"))
00052     self.toolsRegister_BrowserAction.setText("Register Browser")
00053     self.toolsRegister_BrowserAction.setMenuText("&Register Browser")
00054     self.toolsRegister_BrowserAction.setToolTip("Register Browser")
00055     self.toolsRegister_BrowserAction.setAccel(QKeySequence("Ctrl+Shift+R"))
00056     self.toolsBrowse_Exported_FilesAction.setText("Browse Exported Files")
00057     self.toolsBrowse_Exported_FilesAction.setMenuText("&Browse Exported Files")
00058     self.toolsBrowse_Exported_FilesAction.setToolTip("Browse Exported Files")
00059     self.toolsBrowse_Exported_FilesAction.setAccel(QKeySequence("Ctrl+Shift+B"))
00060     self.toolsMessage_LoggerAction.addTo(self.__rc.Tools)
00061     self.toolsEnvironmental_MonitoringAction.addTo(self.__rc.Tools)
00062     self.toolsRegister_BrowserAction.addTo(self.__rc.Tools)
00063     self.toolsBrowse_Exported_FilesAction.addTo(self.__rc.Tools)
00064
00065     self.connect(self.toolsMessage_LoggerAction,SIGNAL("activated()"),self.loadMSGLogger)
00066     self.connect(self.toolsEnvironmental_MonitoringAction,SIGNAL("activated()"),self.startEnvMon)
00067     self.connect(self.toolsRegister_BrowserAction,SIGNAL("activated()"),self.startBrowser)
00068     self.connect(self.toolsBrowse_Exported_FilesAction,SIGNAL("activated()"),self.browseExportedFiles)
00069     if self.__common.options().securedir is not None:
00070       if os.path.splitext(os.path.split(sys.executable)[1])[0] == 'pythonw':
00071         self.loadMSGLogger()
00072
00073     if not self.isrealfile(sys.__stdout__):
00074       sys.stdout = NullStream()
00075
00076     if not self.isrealfile(sys.__stderr__):
00077       sys.stderr = NullStream()
00078
00079
00080   def isrealfile(self, file):
00081       """
00082       Test if file is on the os filesystem
00083       """
00084       if not hasattr(file, 'fileno'): return False
00085
00086       try: tmp = os.dup(file.fileno())
00087       except: return False
00088       else: os.close(tmp); return True
00089
00090
00091   def applyPermissions(self, operator):
00092     adminOverride = operator.isAdministrator()
00093     if 'start_message_logger' in operator.getPermissions() or adminOverride:
00094       self.toolsMessage_LoggerAction.setEnabled(1)
00095       self.MSGLoggerButton.setEnabled(1)
00096     else:
00097       self.toolsMessage_LoggerAction.setEnabled(0)
00098       self.MSGLoggerButton.setEnabled(0)
00099
00100     if 'start_env_monitor' in operator.getPermissions() or adminOverride:
00101       self.toolsEnvironmental_MonitoringAction.setEnabled(1)
00102       self.cmdEnvMon.setEnabled(1)
00103     else:
00104       self.toolsEnvironmental_MonitoringAction.setEnabled(0)
00105       self.cmdEnvMon.setEnabled(0)
00106
00107     if 'start_reg_browser' in operator.getPermissions() or adminOverride:
00108       self.toolsRegister_BrowserAction.setEnabled(1)
00109       self.cmdBrowser.setEnabled(1)
00110     else:
00111       self.toolsRegister_BrowserAction.setEnabled(0)
00112       self.cmdBrowser.setEnabled(0)
00113
00114     if 'browse_exported_files' in operator.getPermissions() or adminOverride:
00115       self.toolsBrowse_Exported_FilesAction.setEnabled(1)
00116       self.cmdBrowseExport.setEnabled(1)
00117     else:
00118       self.toolsBrowse_Exported_FilesAction.setEnabled(0)
00119       self.cmdBrowseExport.setEnabled(0)
00120
00121   def loadMSGLogger(self):
00122     if self.__common.getMSGLogger() is not None:
00123       self.__common.getMSGLogger().show()
00124
00125   def startEnvMon(self):
00126     env = EnvMonImpl(self.__common, None, None)
00127     env.resize(698,438)
00128     env.show()
00129
00130   def startBrowser(self):
00131     lat = self.__common.getLAT()
00132     xbrd = self.__common.getXBRD()
00133     self.__browser = BrowserImpl(lat, xbrd, None, None, Qt.WDestructiveClose)
00134     self.__browser.resize(698,438)
00135     self.__browser.show()
00136
00137   def browseExportedFiles(self):
00138     dbn = self.__common.getDBN()
00139     if '_LastExportPath' in dbn:
00140       import webbrowser
00141       webbrowser.open(url=self.__common.getDBN()['_LastExportPath'], new=1)
00142
00143 class NullStream:
00144     """
00145     A file like class that writes nothing
00146     """
00147     def close(self): pass
00148     def flush(self): pass
00149     def write(self, str): pass
00150     def writelines(self, sequence): pass
00151
00152
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLog.py Source File

client

gLog.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Logging methods"
00013 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/11/05 02:21:49 $").split(' ')[1]
00015 __version__  = "$Revision: 2.8 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import sys
00022 import traceback
00023 import logging as log
00024
00025 def logStack():
00026   for line in traceback.format_stack():
00027     log.debug(__stripLineFeed(line))
00028
00029 def logException(msg=""):
00030   etype, value, tb = sys.exc_info()
00031   if tb is None:
00032     logStack()
00033   else:
00034     #for line in traceback.format_exception(etype, value, tb):
00035     #  log.error(__stripLineFeed(line))
00036     log.exception(msg)
00037
00038 def __stripLineFeed(str):
00039   return str.replace('\n', ' ')
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gLoopback.py Source File

client

gLoopback.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Loopback mode handler class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:57:25 $").split(' ')[1]
00015 __version__  = "$Revision: 2.2 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import socket
00020 import threading
00021 import struct
00022
00023 class Loopback(object):
00024   def __init__(self):
00025     self.__lock = threading.Lock()
00026     self.__lock.acquire()
00027     self.__sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00028     self.__sock.bind(('localhost', 0))
00029     self.__sock.connect(self.__sock.getsockname())
00030
00031   def socket(self):
00032     return self.__sock
00033
00034   def commit(self, value):
00035     packet = struct.pack('I', value)
00036     self.__sock.send(packet)
00037     self.__lock.acquire()
00038
00039   def acknowledge(self):
00040     packet = self.__sock.recv(4)
00041     self.__lock.release()
00042     value = struct.unpack('I', packet)
00043     return value[0]
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gMem.py Source File

database

gMem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST remote memory accessors"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/09/20 18:13:04 $").split(' ')[1]
00015 __version__ = "$Revision: 1.5 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import struct
00022 import gDb
00023 import gAttr
00024
00025 class GMem(gDb.Gdb):
00026   """\brief Memory node.
00027
00028   Has GMem specific registers
00029
00030   Dataless Commands:
00031   none
00032
00033   """
00034   __VX_READ  = 0
00035   __VX_WRITE = 1
00036
00037   __fmt = {1 : 'B', 2 : 'H', 4 : 'I', 8 : 'Q'}
00038
00039   def __init__(self, client):
00040     """\brief Initialize valid registers as Gattrs.
00041     """
00042     gDb.Gdb.__init__(self, client, None, 0)
00043
00044   def gMEMread(self, addr, size=4):
00045     """SBC MEM read command
00046
00047     \param  addr SBC address
00048     \param  size Addressing used (1=8bit, 2=16bit, 4=32bit, 8=64bit, default is 4)
00049     \return A tuple containing the user id, status and value
00050
00051     """
00052     payload = '!' + self.__fmt[size]
00053     return self.cmdrsp('vxMemProbe', addr, GMem.__VX_READ, size, payload)
00054
00055   def gMEMload(self, addr, val, size=4):
00056     """SBC MEM load command
00057
00058     \param  addr SBC address
00059     \param  val  Value to be set at address \a addr
00060     \param  size Addressing used (1=8bit, 2=16bit, 4=32bit, 8=64bit, default is 4)
00061     \return A tuple containing the user id, status and timestamp
00062     """
00063     input = '>' + struct.pack('>'+self.__fmt[size], val) # val to big endian
00064     return self.cmdrsp('vxMemProbe', addr, GMem.__VX_WRITE, size, input)
00065
00066   def gMEMbusToLocal(self, space, addr):
00067     """Translate an address in some space to local (PPC) space
00068
00069     \param  space Bus address space in which \a addr resides
00070     \param  addr  Bus address to convert
00071     \return A tuple containing the user id, status, local address value and timestamp
00072
00073     """
00074     return self.cmdrsp('sysBusToLocalAdrs', space, addr, '!I')
00075
00076   def gMEMlocalToBus(self, space, addr):
00077     """Translate an address in local (PPC) space to some space
00078
00079     \param  space Bus address space in which \a addr resides
00080     \param  addr  Local address to convert
00081     \return A tuple containing the user id, status, bus address value and timestamp
00082
00083     """
00084     return self.cmdrsp('sysLocalToBusAdrs', space, addr, '!I')
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gNAT.py Source File

database

gNAT.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST COMM Card I/O node"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:09:08 $").split(' ')[1]
00015 __version__ = "$Revision: 2.4 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022 import gAttr
00023
00024 class GNAT(gDb.Gdb):
00025   """\brief GNAT node Record
00026
00027   This node contains COMM card related functions.
00028   Each GNAT node is associated with one COMM card.
00029   A GNAT node can either be instantiated through the
00030   createGNATinstance method of GTEM, GAEM or GGLT nodes or
00031   it can be instantiated as a standalone node by creating an
00032   instance of it and calling its initHandle method with the
00033   pysical address of the COMM card. The other parameter that it
00034   needs is a slot. A slot is a placeholder for a GNAT handle.
00035   There are currently 16 slots available. When calling the
00036   createGNATinstance or initHandle methods the desired slot is
00037   passed and this is where the handle is stored for the duration
00038   of the session.
00039   Currently the GNAT node serves to major purposes:
00040
00041     (1) Statistics:
00042
00043         Contains registers for retrieving TX/RX ctrl and data cells
00044         as well as RX header parity and TX busy assert flags.
00045
00046     (2) Pattern generator functionality:
00047
00048         It is possible to use the exposed methods and registers to
00049         write bit streams to the COMM card. This functionality is
00050         available mostly for internal testing and should not be of
00051         and particular use to the subsystems.
00052   """
00053   __attrs = [
00054       # Registers
00055       gAttr.GattrRaw('stats_rx_ctrl_cells',     0, 2),
00056       gAttr.GattrRaw('stats_rx_data_cells',     1, 2),
00057       gAttr.GattrRaw('stats_rx_header_parity',  2, 2),
00058       gAttr.GattrRaw('stats_rx_cell_parity',    3, 2),
00059       gAttr.GattrRaw('stats_tx_ctrl_cells',     4, 2),
00060       gAttr.GattrRaw('stats_tx_data_cells',     5, 2),
00061       gAttr.GattrRaw('stats_tx_busy_assert',    6, 2),
00062       gAttr.GattrRaw('stats_clear',             7, 2),
00063       gAttr.GattrRaw('output_mask',             8, 4)
00064       ]
00065
00066   def __init__(self, client):
00067     """\brief Initialize valid registers as Gattrs.
00068
00069     Assign default values to members
00070
00071     Usage:
00072     \code
00073       gn = GNAT()
00074     \endcode
00075     """
00076     gDb.Gdb.__init__(self, client, None, 0, self.__attrs)
00077
00078   def initHandle(self, slot, physAddr):
00079     """\brief Initializes a new GNAT handle given a physical VME address.
00080
00081     \param slot     A number between 0 and 15 to hold the GNAT handle.
00082                     Each GNAT handle should be assigned a unique slot number.
00083                     The GNAT handle persists at that slot while the session is active.
00084     \param physAddr Physical VME address of the COMM card.
00085
00086     \return Status
00087
00088     Usage:
00089     \code
00090       gn = GNAT()
00091       gn.setCmd(lat.getCmd())
00092       gn.initHandle(0, 0x08000000)
00093     \endcode
00094     """
00095     if self.__cmdCli is not None:
00096       (userId, status, timestamp) = self.__cmdCli.gGNATgetGh(slot, physAddr)
00097       if status != 0:
00098         if self.__cmdCli.ignoreErrors():
00099           print "Error:", gutil.LATInterfaceStatus(status)
00100         else:
00101           raise gutil.LATInterfaceException(status)
00102       else:
00103         self._Gnode__id = slot
00104       return status
00105     else:
00106       raise RuntimeError, 'No command client. Use setCmd prior to calling this function'
00107
00108   def clearBuffer(self):
00109     """\brief Zero out the contents of the bundle.
00110
00111     Calls gBndlClear( gh);
00112
00113     \return Status
00114     """
00115     if self.__cmdCli is not None:
00116       (userId, status, timestamp) = self.__cmdCli.gGNATclearBuffer(self._Gnode__id)
00117       if status != 0:
00118         if self.__cmdCli.ignoreErrors():
00119           print "Error:", gutil.LATInterfaceStatus(status)
00120         else:
00121           raise gutil.LATInterfaceException(status)
00122       return status
00123     else:
00124       raise RuntimeError, 'No command client. Use setCmd prior to calling this function'
00125
00126   def addChannel(self, channelNo, itemList):
00127     """Inserts data into a channel
00128
00129     \param  channelNo The channel number (0 - 15) to insert the chnlData into.
00130                       The maximum channel number is defined in GNAT/gnat.h as MAX_CHANNEL.
00131     \param  itemList  A sequence of 32-bit words.
00132                       The maximum number of words in the array is 5.
00133
00134     \return           Status
00135
00136     Usage:
00137     \code
00138       data = [0xdeadbeefL, 0xdeadbeefL, 0xdeadbeefL]
00139       gn.addChannel(channelNo=1, itemList=data)
00140     \endcode
00141     """
00142     if self.__cmdCli is not None:
00143       (userId, status, timestamp) = self.__cmdCli.gGNATaddChannel(self._Gnode__id, channelNo, itemList)
00144       if status != 0:
00145         if self.__cmdCli.ignoreErrors():
00146           print "Error:", gutil.LATInterfaceStatus(status)
00147         else:
00148           raise gutil.LATInterfaceException(status)
00149       return status
00150
00151   def loadFIFO(self):
00152     """\brief This is a combination of gBndlGetBndl() and gWritePF16v().
00153
00154     It transfers the data from the intermediate bundle buffer into the
00155     playback FIFO.
00156
00157     \return  Status
00158     """
00159     if self.__cmdCli is not None:
00160       (userId, status, timestamp) = self.__cmdCli.gGNATloadFIFO(self._Gnode__id)
00161       if status != 0:
00162         if self.__cmdCli.ignoreErrors():
00163           print "Error:", gutil.LATInterfaceStatus(status)
00164         else:
00165           raise gutil.LATInterfaceException(status)
00166       return status
00167
00168   def flushPlaybackFIFO(self):
00169     """\brief This is a combination of gFlushPF() and gEnablePF().
00170
00171     Flushes the playback FIFO.
00172
00173     \return Status
00174     """
00175     if self.__cmdCli is not None:
00176       (userId, status, timestamp) = self.__cmdCli.gGNATflushPlaybackFIFO(self._Gnode__id)
00177       if status != 0:
00178         if self.__cmdCli.ignoreErrors():
00179           print "Error:", gutil.LATInterfaceStatus(status)
00180         else:
00181           raise gutil.LATInterfaceException(status)
00182       return status
00183
00184   def flushRecordFIFO(self):
00185     """\brief This is a combination of gFlushRF() and gEnableRF().
00186
00187     Flushes the record FIFO.
00188
00189     \return Status
00190     """
00191     if self.__cmdCli is not None:
00192       (userId, status, timestamp) = self.__cmdCli.gGNATflushRecordFIFO(self._Gnode__id)
00193       if status != 0:
00194         if self.__cmdCli.ignoreErrors():
00195           print "Error:", gutil.LATInterfaceStatus(status)
00196         else:
00197           raise gutil.LATInterfaceException(status)
00198       return status
00199
00200   def writeFIFO(self, data):
00201     """\brief A wrapper around gWritePF().
00202
00203     So user could write a single word to the
00204     FIFO or the user could prepare their own array of words,
00205     bypassing the bundle/channel interface.
00206
00207     \param  data   A single or a sequence of 16-bit words
00208     \return        Status
00209
00210     Usage:
00211     \code
00212       data = [0xa0a0, 0xb0b0, 0xc0c0]
00213       gn.writeFIFO(data)
00214       data = 0x1234
00215       gn.writeFIFO(data)
00216     \endcode
00217     """
00218     if self.__cmdCli is not None:
00219       if isNumberType(data):
00220         (userId, status, timestamp) = self.__cmdCli.gGNATwritePF16(self._Gnode__id, data)
00221       else:
00222         (userId, status, timestamp) = self.__cmdCli.gGNATwritePF16v(self._Gnode__id, data)
00223       if status != 0:
00224         if self.__cmdCli.ignoreErrors():
00225           print "Error:", gutil.LATInterfaceStatus(status)
00226         else:
00227           raise gutil.LATInterfaceException(status)
00228       return status
00229
00230   def writeFIFO32(self, data):
00231     """\brief A wrapper around gWritePF()
00232
00233     So user could write a single word to the
00234     FIFO or the user could prepare their own array of words,
00235     bypassing the bundle/channel interface.
00236
00237     \param data A single or a sequence of 16-bit words
00238
00239     \return     Status
00240
00241     Usage:
00242     \code
00243       data = [0xa0a0a0a0L, 0xdeadbeefL, 0xc0c0c0c0L]
00244       gn.writeFIFO32(data)
00245       data = 0x12345678L
00246       gn.writeFIFO(data)
00247     \endcode
00248     """
00249     if self.__cmdCli is not None:
00250       if isNumberType(data):
00251         (userId, status, timestamp) = self.__cmdCli.gGNATwritePF32(self._Gnode__id, data)
00252       else:
00253         (userId, status, timestamp) = self.__cmdCli.gGNATwritePF32v(self._Gnode__id, data)
00254       if status != 0:
00255         if self.__cmdCli.ignoreErrors():
00256           print "Error:", gutil.LATInterfaceStatus(status)
00257         else:
00258           raise gutil.LATInterfaceException(status)
00259       return status
00260
00261   def startPlayback(self):
00262     """\brief This is a wrapper around gStartPB().
00263
00264     Starts the playback.
00265
00266     \return Status
00267
00268     Usage:
00269     \code
00270       gn.startPlayback()
00271     \endcode
00272     """
00273     if self.__cmdCli is not None:
00274       (userId, status, timestamp) = self.__cmdCli.gGNATstartPlayback(self._Gnode__id)
00275       if status != 0:
00276         if self.__cmdCli.ignoreErrors():
00277           print "Error:", gutil.LATInterfaceStatus(status)
00278         else:
00279           raise gutil.LATInterfaceException(status)
00280       return status
00281
00282   def setLATpMode(self, mode):
00283     """\brief Sets the running mode of the COMM I/O board based on the boolean
00284     value of mode.
00285
00286     When mode is non-zero the mode bit of the COMM I/O
00287     control register is set to 1, which puts the board in "LATp mode".
00288     When mode is zero the mode bit is cleared, which puts the board in
00289     "dumb record FIFO mode".
00290
00291     \param mode The running mode of the COMM I/O board
00292
00293     \return     Status
00294
00295     Usage:
00296     \code
00297       gn.setLATpMode(0)
00298     \endcode
00299     """
00300     if self.__cmdCli is not None:
00301       (userId, status, timestamp) = self.__cmdCli.gGNATsetLATpMode(self._Gnode__id, mode)
00302       if status != 0:
00303         if self.__cmdCli.ignoreErrors():
00304           print "Error:", gutil.LATInterfaceStatus(status)
00305         else:
00306           raise gutil.LATInterfaceException(status)
00307       return status
00308
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gNode.py Source File

client

gNode.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Node class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:57:25 $").split(' ')[1]
00015 __version__  = "$Revision: 2.2 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 class Node(object):
00022   def __init__(self, client):
00023     self.__client = client
00024
00025   def client(self):
00026     return self.__client
00027
00028   def cmdrsp(self, functionname, *arguments):
00029     return self.__client.cmdrsp(functionname, *arguments)
00030
00031   def read(self, reg):
00032     raise Exception, "*** gNode: read() not implemented for class %s" \
00033           %(self.__class__.__name__)
00034
00035   def load(self, reg, value):
00036     raise Exception, "*** gNode: load() not implemented for class %s" \
00037           %(self.__class__.__name__)
00038
00039   def send(self, cmd):
00040     raise Exception, "*** gNode: send() not implemented for class %s" \
00041           %(self.__class__.__name__)
00042
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOCS.py Source File

database

gOCS.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "OCS node"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2005/01/22 01:56:16 $").split(' ')[1]
00015 __version__ = "$Revision: 2.11.2.2 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import logging
00022 import time
00023 import math
00024 import gDb
00025 import gAttr
00026
00027 import LATTE.client.gException as gException
00028
00029 class GOCS(gDb.Gdb):
00030   """\brief OCS node.
00031
00032   Has OCS specific registers and methods.
00033
00034   """
00035   ProtocolVersion  = 1
00036   ProtocolRevision = 1
00037
00038   __attrs = [
00039     # Registers; IDs kept for backward compatibility with GLAT
00040     gAttr.GattrReg('stats_failed_events',          8, 2),
00041     gAttr.GattrReg('stats_failed_event_sends',     9, 2),
00042     gAttr.GattrReg('stats_valid_events',          10, 2),
00043     gAttr.GattrReg('stats_discarded_event_sends', 11, 2),
00044     gAttr.GattrReg('stats_length_mismatch_count', 12, 2),
00045     gAttr.GattrReg('stats_events_not_sent',       13, 2)
00046     ]
00047
00048   def __init__(self, client):
00049     gDb.Gdb.__init__(self, client, None, 0, self.__attrs)
00050
00051   def read(self, reg):
00052     return self.cmdrsp('ggLATread', reg, '!I')
00053
00054   def load(self, reg, value):
00055     return self.cmdrsp('ggLATload', reg, value)
00056
00057   def evtHandlerSendAll(self):
00058     """\brief Sets the current event mode to send all events to the client.
00059     """
00060     response = self.cmdrsp('evtHandlerSendAll')
00061     return response.status()
00062
00063   def evtHandlerSendNothing(self):
00064     """\brief Sets the current event mode to send no data events to the client.
00065     """
00066     response = self.cmdrsp('evtHandlerSendNothing')
00067     return response.status()
00068
00069   def evtHandlerSendErrorsOnly(self):
00070     """\brief Sets the current event mode to send only error events to the client.
00071     """
00072     response = self.cmdrsp('evtHandlerSendErrorsOnly')
00073     return response.status()
00074
00075   def evtHandlerSendAcdScalers(self, marker, prescale=0):
00076     """\brief Sets the current event mode to send only events containing the
00077     ACD software scalers to the client upon recept of the given marker.
00078
00079     \param marker   - Marker to value to use
00080     \param prescale - Prescale value to use
00081     """
00082     response = self.cmdrsp('evtHandlerSendAcdScalers', marker, prescale)
00083     return response.status()
00084
00085   def evtHandlerSendPrescaled(self, prescale):
00086     """\brief Sets the current event mode to send prescaled events to the client.
00087     \param prescale - Prescale value to use
00088     """
00089     response = self.cmdrsp('evtHandlerSendPrescaled', prescale)
00090     return response.status()
00091
00092   def evtHandlerPrescaleExternal(self, prescale):
00093     """\brief Sets the current event mode to prescale externally triggered events.
00094     Only events with only the external trigger firing will be prescaled.
00095     \param prescale - Prescale value to use
00096     """
00097     response = self.cmdrsp('evtHandlerPrescaleExternal', prescale)
00098     return response.status()
00099
00100   def evtHandlerSetVerbosity(self, verbosity):
00101     """\brief Sets the event server verbosity.
00102
00103     \param verbosity - Verbosity value to use
00104     """
00105     response = self.cmdrsp('evtHandlerSetVerbosity', verbosity)
00106     return response.status()
00107
00108   def synchronize(self):
00109     """\brief Synchronize the SBC's clock with the host's clock.
00110     """
00111     (fraction, integer) = math.modf(time.time())
00112     seconds = int(integer)
00113     nanoseconds = int(fraction*1000000000)
00114     return self.cmdrsp('ocsSetTime', seconds, nanoseconds)
00115
00116   def getVersion(self):
00117     """\brief Get the protocol versions of code running on the SBC.
00118     """
00119     response = self.cmdrsp('ocsVersion', '!H', '!H')
00120     return (response.payloads()[0], response.payloads()[1])
00121
00122   def verifyVersion(self):
00123     """\brief Verify that the protocol version of the code running on the SBC
00124     is one the host code is expected to support.
00125     """
00126     (version, revision) = self.getVersion()
00127     if version != GOCS.ProtocolVersion or revision < GOCS.ProtocolRevision:
00128       logging.error("gOCS: server protocol version is %d.%d expected %d.%d"
00129                     %(version, revision,
00130                       GOCS.ProtocolVersion, GOCS.ProtocolRevision))
00131       status = gException.LATInterfaceStatus.status('OCS_BDVER')
00132       raise gException.LATInterfaceException(status)
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOcsMessages.py Source File

client

gOcsMessages.py

00001 import LATTE.copyright_SLAC
00002
00003 class OcsMessages(object):
00004   OCSSTR = {
00005     0x00000000: [      "OCS_OK", "Ok"],
00006     0x00000003: [  "OCS_NOFUNC", "Function name unknown to OCS server"],
00007     0x00000013: [  "OCS_NOHAND", "Handler name unknown to OCS server"],
00008     0x00000023: [  "OCS_NOTYPE", "Argument type unknown to OCS server"],
00009     0x00000043: [   "OCS_NOREG", "Register non existent"],
00010     0x00000083: [  "OCS_BDRESP", "OCS server response has unexpected length"],
00011     0x00000103: [     "OCS_TMO", "OCS command/response timeout"],
00012     0x00000203: [   "OCS_NOSRV", "OCS server disconnected"],
00013     0x00000403: [   "OCS_BDADC", "ADC conversion is invalid"],
00014     0x00000803: [   "OCS_BDVER", "OCS server version is incompatible"],
00015   }
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gOptions.py Source File

client

gOptions.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Options class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/11/04 19:58:30 $").split(' ')[1]
00015 __version__  = "$Revision: 2.4 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import sys
00022 import getopt
00023
00024 class Options(object):
00025   def __init__(self, mandatory, optional=[], switches=[]):
00026     self.opts = {}
00027
00028     self.__mand = mandatory
00029     self.__optn = optional
00030     self.__swtc = switches
00031
00032   def __getattr__(self, attribute):
00033     if attribute in self.opts:
00034       return self.opts[attribute]
00035     return None
00036
00037   def usage(self, notes=''):
00038     msg = 'usage: %s' %(sys.argv[0])
00039     for option in self.__mand:
00040       msg += ' --%s <%sname>' %(option, option)
00041     for option in self.__optn:
00042       msg += ' [--%s <%sname>]' %(option, option)
00043     for option in self.__swtc:
00044       msg += ' [--%s]' %(option)
00045     if notes != '':
00046       msg += '\nnotes: '
00047       msg += notes
00048     print msg
00049
00050
00051   def parse(self):
00052     opts = []
00053     for option in self.__mand:
00054       opts.append(option+'=')
00055     for option in self.__optn:
00056       opts.append(option+'=')
00057     for option in self.__swtc:
00058       opts.append(option)
00059     results = getopt.getopt(sys.argv[1:], '', opts)
00060     if len(results[1]) > 0:
00061       raise RuntimeError, 'unknown argument(s)', results[1]
00062     for opt in results[0]:
00063       self.opts[opt[0][2:]] = opt[1]
00064     for option in self.__mand:
00065       if option not in self.opts:
00066         raise RuntimeError, 'mandatory option \'--%s\' not found' %(option)
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSED_LDF.py Source File

gosed

GOSED_LDF.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST Online Single Event Display - EBF Interface"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = "11/18/2003"
00015 __version__  = "$Revision: 1.29.2.1 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from   qt import *
00021 import LDF
00022 import Numeric
00023 import time
00024 # Important Constants
00025
00026 NUM_XY_TKR = 24
00027 NUM_Z_TKR = 36
00028 NUM_Z_CAL = 8
00029 NUM_XY_CAL = 12
00030
00031 LOG_RANGE = 12
00032 NUMBER_STRIPS = 1536
00033 STRIP_RANGE = 36
00034
00035 LAYER = ['Y0','X0','X1','Y1','Y2','X2','X3','Y3','Y4','X4','X5','Y5','Y6',
00036           'X6','X7','Y7','Y8','X8','X9','Y9','Y10','X10','X11','Y11','Y12',
00037           'X12','X13','Y13','Y14','X14','X15','Y15','Y16','X16','X17','Y17']
00038
00039 #~ TCC = ['0,1','2,3','4,5']
00040
00041 RANGE_TKR_X = [1,2,5,6,9,10,13,14,17,18,21,22,25,26,29,30,33,34]
00042 RANGE1_TKR_X = [1, 5, 9, 13, 17, 21, 25, 29, 33]
00043 RANGE2_TKR_X = [2, 6, 10, 14, 18, 22, 26, 30, 34]
00044
00045 RANGE_TKR_Y = [0,3,4,7,8,11,12,15,16,19,20,23,24,27,28,31,32,35]
00046
00047 RANGE1_TKR_Y = [4, 8, 12, 16, 20, 24, 28, 32, 35]
00048 RANGE2_TKR_Y = [0, 3, 7, 11, 15, 19, 23, 27, 31]
00049 RANGE_CAL_X = [0,2,4,6]
00050 RANGE_CAL_Y = [1,3,5,7]
00051 # TEM cc geometry (real)
00052 #~ OFFSET = [0, 0, 1, 1, 3, 3, 2, 2]
00053 #~ Minitower cc geometry (inverted)
00054 #~ OFFSET = [1, 1, 0, 0, 2, 2, 3, 3]
00055
00056
00057 ACD_SIDE0 = 0
00058 ACD_SIDE1 = 1
00059 ACD_SIDE2 = 2
00060 ACD_SIDE3 = 3
00061 ACD_SIDE4 = 4
00062 ACD_SIDE5 = 5 # ???
00063 ACD_SIDE6 = 6 # ???
00064 ACD_NA    = 7 # ???
00065 LOOKUP_ACD_TILE = {"120" :  (ACD_SIDE1, 4, 2), "NA4" : (ACD_NA,    0, 0),
00066                    "502" :  (ACD_SIDE5, 0, 0), "NA5" : (ACD_NA,    0, 0),
00067                    "121" :  (ACD_SIDE1, 3, 2), "111" : (ACD_SIDE1, 3, 1),
00068                    "101" :  (ACD_SIDE1, 3, 0), "122" : (ACD_SIDE1, 2, 2),
00069                    "112" :  (ACD_SIDE1, 2, 1), "102" : (ACD_SIDE1, 2, 0),
00070                    "103" :  (ACD_SIDE1, 1, 0), "113" : (ACD_SIDE1, 1, 1),
00071                    "123" :  (ACD_SIDE1, 1, 2), "503" : (ACD_SIDE5, 0, 0),
00072                    "104" :  (ACD_SIDE1, 0, 0), "114" : (ACD_SIDE1, 0, 1),
00073                    "124" :  (ACD_SIDE1, 0, 2), "130" : (ACD_SIDE1, 0, 3),
00074                    "110" :  (ACD_SIDE1, 4, 1), "100" : (ACD_SIDE1, 4, 0),
00075                    "220" :  (ACD_SIDE2, 2, 4), "210" : (ACD_SIDE2, 1, 4),
00076                    "600" :  (ACD_SIDE6, 0, 0), "200" : (ACD_SIDE2, 0, 4),
00077                    "000" :  (ACD_SIDE0, 4, 4), "010" : (ACD_SIDE0, 3, 4),
00078                    "020" :  (ACD_SIDE0, 2, 4), "221" : (ACD_SIDE2, 2, 3),
00079                    "211" :  (ACD_SIDE2, 1, 3), "201" : (ACD_SIDE2, 0, 3),
00080                    "001" :  (ACD_SIDE0, 4, 3), "011" : (ACD_SIDE0, 3, 3),
00081                    "021" :  (ACD_SIDE0, 2, 3), "022" : (ACD_SIDE0, 2, 2),
00082                    "NA6" :  (ACD_NA,    0, 0), "002" : (ACD_SIDE0, 4, 2),
00083                    "222" :  (ACD_SIDE2, 2, 2), "602" : (ACD_SIDE6, 0, 0),
00084                    "212" :  (ACD_SIDE2, 1, 2), "202" : (ACD_SIDE2, 0, 2),
00085                    "012" :  (ACD_SIDE0, 3, 2), "013" : (ACD_SIDE0, 3, 1),
00086                    "003" :  (ACD_SIDE0, 4, 1), "203" : (ACD_SIDE2, 0, 1),
00087                    "213" :  (ACD_SIDE2, 1, 1), "223" : (ACD_SIDE2, 2, 1),
00088                    "014" :  (ACD_SIDE0, 3, 0), "004" : (ACD_SIDE0, 4, 0),
00089                    "204" :  (ACD_SIDE2, 0, 0), "NA7" : (ACD_NA,    0, 0),
00090                    "214" :  (ACD_SIDE2, 1, 0), "224" : (ACD_SIDE2, 2, 0),
00091                    "NA10" : (ACD_NA,    0, 0), "230" : (ACD_SIDE2, 3, 0),
00092                    "324" :  (ACD_SIDE3, 0, 1), "NA9" : (ACD_NA,    0, 0),
00093                    "501" :  (ACD_SIDE5, 0, 0), "NA8" : (ACD_NA,    0, 0),
00094                    "323" :  (ACD_SIDE3, 1, 1), "313" : (ACD_SIDE3, 1, 2),
00095                    "303" :  (ACD_SIDE3, 1, 3), "322" : (ACD_SIDE3, 2, 1),
00096                    "312" :  (ACD_SIDE3, 2, 2), "302" : (ACD_SIDE3, 2, 3),
00097                    "301" :  (ACD_SIDE3, 3, 3), "311" : (ACD_SIDE3, 3, 2),
00098                    "321" :  (ACD_SIDE3, 3, 1), "500" : (ACD_SIDE5, 0, 0),
00099                    "300" :  (ACD_SIDE3, 4, 3), "310" : (ACD_SIDE3, 4, 2),
00100                    "320" :  (ACD_SIDE3, 4, 1), "330" : (ACD_SIDE3, 0, 0),
00101                    "314" :  (ACD_SIDE3, 0, 2), "304" : (ACD_SIDE3, 0, 3),
00102                    "NA0" :  (ACD_NA,    0, 0), "424" : (ACD_SIDE4, 1, 0),
00103                    "603" :  (ACD_SIDE6, 0, 0), "414" : (ACD_SIDE4, 2, 0),
00104                    "404" :  (ACD_SIDE4, 3, 0), "044" : (ACD_SIDE0, 0, 0),
00105                    "034" :  (ACD_SIDE0, 1, 0), "024" : (ACD_SIDE0, 2, 0),
00106                    "423" :  (ACD_SIDE4, 1, 1), "413" : (ACD_SIDE4, 2, 1),
00107                    "403" :  (ACD_SIDE4, 3, 1), "043" : (ACD_SIDE0, 0, 1),
00108                    "033" :  (ACD_SIDE0, 1, 1), "023" : (ACD_SIDE0, 2, 1),
00109                    "NA1" :  (ACD_NA,    0, 0), "042" : (ACD_SIDE0, 0, 2),
00110                    "422" :  (ACD_SIDE4, 1, 2), "601" : (ACD_SIDE6, 0, 0),
00111                    "412" :  (ACD_SIDE4, 2, 2), "402" : (ACD_SIDE4, 3, 2),
00112                    "032" :  (ACD_SIDE0, 1, 2), "031" : (ACD_SIDE0, 1, 3),
00113                    "041" :  (ACD_SIDE0, 0, 3), "401" : (ACD_SIDE4, 3, 3),
00114                    "411" :  (ACD_SIDE4, 2, 3), "421" : (ACD_SIDE4, 1, 3),
00115                    "030" :  (ACD_SIDE0, 1, 4), "040" : (ACD_SIDE0, 0, 4),
00116                    "400" :  (ACD_SIDE4, 3, 4), "NA2" : (ACD_NA,    0, 0),
00117                    "410" :  (ACD_SIDE4, 2, 4), "420" : (ACD_SIDE4, 1, 4),
00118                    "NA3" :  (ACD_NA,    0, 0), "430" : (ACD_SIDE4, 0, 0),
00119                    }
00120 LOOKUP_ACD_XZM = ["200", "201", "202", "203", "204",
00121                   "210", "211", "212", "213", "214",
00122                   "220", "221", "222", "223", "224",
00123                   "230"]
00124 LOOKUP_ACD_XZP = ["400", "401", "402", "403", "404",
00125                   "410", "411", "412", "413", "414",
00126                   "420", "421", "422", "423", "424",
00127                   "430"]
00128 LOOKUP_ACD_YZM = ["100", "101", "102", "103", "104",
00129                   "110", "111", "112", "113", "114",
00130                   "120", "121", "122", "123", "124",
00131                   "130"]
00132 LOOKUP_ACD_YZP = ["300", "301", "302", "303", "304",
00133                   "310", "311", "312", "313", "314",
00134                   "320", "321", "322", "323", "324",
00135                   "330"]
00136 LOOKUP_ACD_XY  = ["000", "001", "002", "003", "004",
00137                   "010", "011", "012", "013", "014",
00138                   "020", "021", "022", "023", "024",
00139                   "030", "031", "032", "033", "034",
00140                   "040", "041", "042", "043", "044"]
00141 LOOKUP_ACD_RBN = ["500", "501", "502", "503",
00142                   "600", "601", "602", "603"]
00143 LOOKUP_ACD_NA  = ["NA0", "NA1", "NA2", "NA3", "NA4",
00144                   "NA5", "NA6", "NA7", "NA8", "NA9",
00145                   "NA10"]
00146
00147
00148 class GEMcontribution(object):
00149   def __init__(self, event, contribution, gui):
00150     self.__event        = event
00151     self.__contribution = contribution
00152     self.__gui          = gui
00153
00154   def __getattr__(self, attr):
00155     """This method fakes up inheritance from an LDF.GEMcontribution.
00156     When a called method can not be found to belong to this class, this
00157     method is called.  We use it to redirect the call to the 'base' class.
00158     """
00159     return getattr(self.__contribution, attr)
00160
00161   def __drawRing(self, drawACDside, nX, nY, i, j, extraWPix, extraHPix):
00162     color = QColor("magenta")
00163
00164     tileWidth  = drawACDside.width()/nX
00165     tileHeight = drawACDside.height()/nY
00166
00167     pACD = QPainter(drawACDside.final)
00168     pACD.setPen(color)
00169     pACD.drawRect(tileWidth * i, tileHeight * j, tileWidth + extraWPix, tileHeight + extraHPix)
00170     pACD.end()
00171
00172   def __drawTile(self, drawACDside, nX, nY, mask, lookup):
00173     i = 0
00174     while (mask):
00175       if mask & 1:
00176         tile = lookup[i]
00177         tileIJ = LOOKUP_ACD_TILE[tile]
00178         if tile == "130" or tile == "330":
00179           nX = 1
00180           extraWPix = 0
00181         else:
00182           extraWPix = 1
00183         if tile == "230" or tile == "430":
00184           nY = 1
00185           extraHPix = 0
00186         else:
00187           extraHPix = 1
00188         self.__drawRing(drawACDside, nX, nY, tileIJ[1], tileIJ[2], extraWPix, extraHPix)
00189       mask >>= 1
00190       i += 1
00191
00192   def plot(self):
00193     gui = self.__gui
00194     tl  = self.tileList()
00195
00196     drawHatACD   = gui.drawHatACD
00197     drawSide1ACD = gui.drawSide1ACD
00198     drawSide2ACD = gui.drawSide2ACD
00199     drawSide3ACD = gui.drawSide3ACD
00200     drawSide4ACD = gui.drawSide4ACD
00201
00202     self.__drawTile(drawSide4ACD, 4, 5, tl.XZP(), LOOKUP_ACD_XZP)
00203     self.__drawTile(drawSide2ACD, 4, 5, tl.XZM(), LOOKUP_ACD_XZM)
00204     self.__drawTile(drawSide3ACD, 5, 4, tl.YZP(), LOOKUP_ACD_YZP)
00205     self.__drawTile(drawSide1ACD, 5, 4, tl.YZM(), LOOKUP_ACD_YZM)
00206     self.__drawTile(drawHatACD,   5, 5, tl.XY(),  LOOKUP_ACD_XY)
00207     #self.__drawTile(gui.drawNAACD,  tl.NA(),  LOOKUP_ACD_NA)
00208     #self.__drawTile(gui.drawRBNACD, tl.RBN(), LOOKUP_ACD_RBN)
00209
00210     # Request that the screen is updated, for those Widgets that need it
00211     if drawHatACD.isVisible():
00212       drawHatACD.update()
00213       drawSide1ACD.update()
00214       drawSide2ACD.update()
00215       drawSide3ACD.update()
00216       drawSide4ACD.update()
00217
00218     if gui.drawGOSEDData.isVisible():
00219       out = gui.drawGOSEDData.trigger
00220
00221       opt = self.onePPStime()
00222
00223       out.append("ROI vector        = 0x%04x" % (self.roiVector()))
00224       out.append("TKR vector        = 0x%04x" % (self.tkrVector()))
00225       out.append("CAL HE vector     = 0x%04x" % (self.calHEvector()))
00226       out.append("CAL LE vector     = 0x%04x" % (self.calLEvector()))
00227       out.append("Condition summary = 0x%04x" % (self.conditionSummary()))
00228       out.append("CNO vector        = 0x%04x" % (self.cnoVector()))
00229       out.append("Veto list:")
00230       out.append("  XZP, XZM        = 0x%04x, 0x%04x" % (tl.XZP(), tl.XZM()))
00231       out.append("  YZP, YZM        = 0x%04x, 0x%04x" % (tl.YZP(), tl.YZM()))
00232       out.append("  XY              = 0x%08x"       % (tl.XY()))
00233       out.append("  NA, RBN         = 0x%04x, 0x%04x" % (tl.NA(), tl.RBN()))
00234       out.append("Live time         = 0x%08x = %d" % (self.liveTime(), self.liveTime()))
00235       out.append("Prescaled         = 0x%08x = %d" % (self.prescaled(), self.prescaled()))
00236       out.append("Discarded         = 0x%08x = %d" % (self.discarded(), self.discarded()))
00237       out.append("Sent              = 0x%08x = %d" % (self.sent(), self.sent()))
00238       out.append("Trigger time      = 0x%08x = %d" % (self.triggerTime(), self.triggerTime()))
00239       out.append("One PPS time:")
00240       out.append("  seconds, timebase = 0x%02x, 0x%07x = %d, %d" % \
00241                  (opt.seconds(), opt.timebase(), opt.seconds(), opt.timebase()))
00242       out.append("Delta event time  = 0x%08x = %d" % (self.deltaEventTime(), self.deltaEventTime()))
00243
00244
00245 class AEMcontributionIterator(LDF.AEMcontributionIterator):
00246   __drawSide = []
00247   def __init__(self,event,contribution, gui, lci):
00248     LDF.AEMcontributionIterator.__init__(self,event,contribution)
00249     self.__gui      = gui
00250     self.__acdPeds  = lci.getAcdPeds()
00251     self.__minValue = gui.GOSEDPreferencesGUI.minACD()
00252     self.__maxValue = gui.GOSEDPreferencesGUI.maxACD()
00253
00254     self.__drawSide.append(self.__drawHatTile)
00255     self.__drawSide.append(self.__drawSide1Tile)
00256     self.__drawSide.append(self.__drawSide2Tile)
00257     self.__drawSide.append(self.__drawSide3Tile)
00258     self.__drawSide.append(self.__drawSide4Tile)
00259     self.__drawSide.append(self.__drawSide5Tile)
00260     self.__drawSide.append(self.__drawSide6Tile)
00261     self.__drawSide.append(self.__drawNATile)
00262
00263   def __drawTile(self, drawACDside, nX, nY, i, j, ab, color):
00264     tileWidth  = drawACDside.width()/nX
00265     tileHeight = drawACDside.height()/nY
00266
00267     # To embed triangles in tiles:
00268     # For every i,   add 1
00269     # For every i+1, substract 1
00270     arr = QPointArray()
00271     if ab:
00272       arr.setPoints([tileWidth*i     + 1, tileHeight*j     + 1,
00273                      tileWidth*(i+1) - 1, tileHeight*j     + 1,
00274                      tileWidth*i     + 1, tileHeight*(j+1) - 1])
00275     else:
00276       arr.setPoints([tileWidth*(i+1) - 1, tileHeight*(j+1) - 1,
00277                      tileWidth*(i+1) - 1, tileHeight*j     + 1,
00278                      tileWidth*i     + 1, tileHeight*(j+1) - 1])
00279
00280     pACD = QPainter(drawACDside.final)
00281     #pACD.setRasterOp(Qt.AndROP)
00282     pACD.setBrush(color)
00283     pACD.setPen(color)
00284     pACD.drawPolygon(arr)
00285     pACD.end()
00286
00287   def __drawHatTile(self, i, j, ab, color):
00288     drawHatACD = self.__gui.drawHatACD
00289     self.__drawTile(drawHatACD, 5, 5, i, j, ab, color)
00290
00291   def __drawSide1Tile(self, i, j, ab, color):
00292     drawSide1ACD = self.__gui.drawSide1ACD
00293     if j < 3:
00294       self.__drawTile(drawSide1ACD, 5, 4, i, j, ab, color)
00295     else:
00296       self.__drawTile(drawSide1ACD, 1, 4, i, j, ab, color)
00297
00298   def __drawSide2Tile(self, i, j, ab, color):
00299     drawSide2ACD = self.__gui.drawSide2ACD
00300     if i < 3:
00301       self.__drawTile(drawSide2ACD, 4, 5, i, j, ab, color)
00302     else:
00303       self.__drawTile(drawSide2ACD, 4, 1, i, j, ab, color)
00304
00305   def __drawSide3Tile(self, i, j, ab, color):
00306     drawSide3ACD = self.__gui.drawSide3ACD
00307     if j > 0:
00308       self.__drawTile(drawSide3ACD, 5, 4, i, j, ab, color)
00309     else:
00310       self.__drawTile(drawSide3ACD, 1, 4, i, j, ab, color)
00311
00312   def __drawSide4Tile(self, i, j, ab, color):
00313     drawSide4ACD = self.__gui.drawSide4ACD
00314     if i > 0:
00315       self.__drawTile(drawSide4ACD, 4, 5, i, j, ab, color)
00316     else:
00317       self.__drawTile(drawSide4ACD, 4, 1, i, j, ab, color)
00318
00319   def __drawSide5Tile(self, i, j, ab, color):
00320     pass
00321
00322   def __drawSide6Tile(self, i, j, ab, color):
00323     pass
00324
00325   def __drawNATile(self, i, j, ab, color):
00326     pass
00327
00328   def plot(self, prefix = ""):
00329     gui = self.__gui
00330
00331     drawHatACD   = gui.drawHatACD
00332     drawSide1ACD = gui.drawSide1ACD
00333     drawSide2ACD = gui.drawSide2ACD
00334     drawSide3ACD = gui.drawSide3ACD
00335     drawSide4ACD = gui.drawSide4ACD
00336
00337     self.iterate()
00338
00339     # Request that the screen is updated, for those Widgets that need it
00340     if drawHatACD.isVisible():
00341       drawHatACD.update()
00342       drawSide1ACD.update()
00343       drawSide2ACD.update()
00344       drawSide3ACD.update()
00345       drawSide4ACD.update()
00346
00347   def header(self, cable, hdr):
00348     if self.__gui.drawGOSEDData.isVisible():
00349       out = self.__gui.drawGOSEDData.acd
00350
00351       out.append( "Cable %d = FREE board '%s' header:" % \
00352                   (cable, self.map().freeName(self.event().identity(), cable)))
00353       out.append( "  start-bit           = %01x"   % (hdr.startBit()))
00354       out.append( "  hit-map             = 0x%05x" % (hdr.hitMap()))
00355       out.append( "  accept-map          = 0x%05x" % (hdr.acceptMap()))
00356       out.append( "  PHA vector          = %01x"   % (hdr.phaVector()))
00357       out.append( "  header parity error = %01x"   % (hdr.parityError()))
00358       if ( hdr.phaVector() ):
00359         out.append( "                                Value    parity")
00360         out.append( "  Channel  Tile  Side Range (hex)  (dec) error  More")
00361       else:
00362         out.append( "Cable %d has no data" % (cable))
00363
00364   def pha(self, cable, channel, p):
00365     id   = self.event().identity()
00366     tbl  = self.map().lookup(id, cable, channel)
00367     tile = tbl.name()
00368     pha  = p.ADCvalue()
00369     if self.__acdPeds is not None:   # subtract pedestals if available
00370       pha -= self.__acdPeds[cable,channel,p.ADCrange(),0]
00371
00372     if self.__gui.drawGOSEDData.isVisible():
00373       out = self.__gui.drawGOSEDData.acd
00374       if tbl.a():  side = 'A'
00375       else:        side = 'B'
00376       out.append("     %2d   %4s     %s    %d   0x%03x = %4d    %d     %d" % \
00377                  (channel, tbl.name(), side, p.ADCrange(), p.ADCvalue(),
00378                   p.ADCvalue(), p.parityError(), p.more()))
00379
00380     import colorScale
00381     dv = float(self.__maxValue - self.__minValue)
00382     if dv == 0.0:  dv = 1.0e-308
00383     r, g, b = colorScale.colorScale((float(pha) - float(self.__minValue)) / dv)
00384
00385     color = QColor(r, g, b)
00386
00387     tileSide = LOOKUP_ACD_TILE[tile]
00388     self.__drawSide[tileSide[0]](tileSide[1], tileSide[2], tbl.a(), color)
00389
00390 # class CALcontributionIterator1(LDF.CALcontributionIterator):
00391 #   """ \brief CAL contribution Filter
00392
00393 #   This class obtains the information of CAL from EBF to setup the min and max
00394 #   engery of the event. To do so it filters by event, twr, and range. Using the
00395 #   GOSED Preferences menu (from the Tools tab on the menu bar), if the scale is
00396 #   selected as ACD Calibration, the min and max values will be determined for
00397 #   every event as the min and max value of ACD counts that that event has.
00398 #   If Default is selected, min and max will be 0 and 1000 ACD counts,
00399 #   respectively. If Custom is selected, the user will select its own min and
00400 #   max values of interest from the GOSED Preferences menu """
00401
00402 #   def __init__(self, event, contribution, gui, lci):
00403 #     """ CALcontributionIterator1 contructor
00404
00405 #     \param event         Event
00406 #     \param contribution  Contribution
00407 #     \param gui           GOSED
00408 #     """
00409
00410 #     LDF.CALcontributionIterator.__init__(self, event, contribution)
00411 #     self.__gui                = gui
00412
00413 #     # Determine which tower and range are currently selected
00414 #     self.__selectedTower      = \
00415 #                         self.__gui.drawGOSEDTWR.selectTWR.id(self.__gui.drawGOSEDTWR.selectTWR.selected())
00416 #     self.__selectedRange      = \
00417 #                         self.__gui.drawGOSEDCALTKR.selectRNG.id(self.__gui.drawGOSEDCALTKR.selectRNG.selected())
00418
00419 #     # Initialize variables
00420 #     self.__maxValue           = 0
00421 #     self.__minValue           = 1000000
00422
00423 #     self.__logCount           = 0
00424 #     self.__energyCount        = 0
00425
00426 #     self.__maxValue2          = 0
00427 #     self.__minValue2          = 1000000
00428
00429 #     self.__logCount2          = 0
00430 #     self.__energyCount2       = 0
00431
00432 #     self.__calPeds      = lci.getCalPeds()
00433
00434 #   def plot(self):
00435 #     """ This def will call the iterate() function to return the min and max
00436 #     value within the scale format selected by the user (Event, Custom or
00437 #     Default)
00438
00439 #     \return Values filtered in the iteration: minValue, maxValue, logCount,
00440 #             energyCount
00441 #     """
00442 #     # Determine the length of the event CAL data and return if it is 0
00443 #     length = self.contribution().numLogAccepts()
00444 #     if length == 0:
00445 #       return
00446
00447 #     # Obtain tower number from LDF. This tower will have CAL data since
00448 #     # it passed the filter above
00449 #     towerSource = LDF.LATPcellHeader.source(self.contribution().header())
00450
00451 #     # Enables TWRs with CAL data
00452 #     twrButton = self.__gui.drawGOSEDTWR.selectTWR.find(towerSource)
00453 #     twrButton.setEnabled(1)
00454
00455
00456 #     # If the file was just opened select the first twr entry in the event to
00457 #     # filter by it.
00458 #     if self.__selectedTower == -1:
00459 #       self.__selectedTower = towerSource
00460 #       twrButton.setChecked(1)
00461
00462 #     # Filter by twr ATK 12/05/03 We need to calculate limits for all the TWrs
00463 #     # to plot values in GOTED
00464 #     #~ if towerSource != self.__selectedTower:
00465 #       #~ return
00466
00467 #     # Iterate calls the log function for every event entry
00468 #     self.iterate()
00469
00470 #     # If no twr was selected, we set limits as Default (see if this is obsolete
00471 #     # since now we always select the first twr when opening the file)
00472 #     if self.__minValue == 1000000:
00473 #       self.__minValue = 0
00474
00475 #     if self.__maxValue == 0:
00476 #       self.__maxValue = 1000
00477
00478 #     # Change limits if user has changed scale format
00479 #     if self.__gui.preferredLimits == "Default":
00480 #       self.__minValue = 0
00481 #       self.__maxValue = 1000
00482
00483 #     elif self.__gui.preferredLimits == "Custom":
00484 #       self.__minValue = self.__gui.GOSEDPreferencesGUI.minCAL()
00485 #       self.__maxValue = self.__gui.GOSEDPreferencesGUI.maxCAL()
00486
00487 #     # And for the CAL & TKR Window:
00488 #     if self.__minValue2 == 1000000:
00489 #       self.__minValue2 = 0
00490
00491 #     if self.__maxValue2 == 0:
00492 #       self.__maxValue2 = 1000
00493
00494 #     # Change limits if user has changed scale format
00495 #     if self.__gui.preferredLimits == "Default":
00496 #       self.__minValue2 = 0
00497 #       self.__maxValue2 = 1000
00498
00499 #     elif self.__gui.preferredLimits == "Custom":
00500 #       self.__minValue2 = self.__gui.GOSEDPreferencesGUI.minCAL()
00501 #       self.__maxValue2 = self.__gui.GOSEDPreferencesGUI.maxCAL()
00502
00503 #     # Return calculated values in the iteration
00504 #     return {"minValue": self.__minValue, "maxValue": self.__maxValue,
00505 #             "logCount": self.__logCount, "energyCount": self.__energyCount,
00506 #             "minValue2": self.__minValue2, "maxValue2": self.__maxValue2,
00507 #             "logCount2": self.__logCount2, "energyCount2": self.__energyCount2}
00508
00509 #   def log(self, tower, layer, theLog):
00510 #     """ This function enables the TWR and RNG display buttons for which there
00511 #     is CAL data in the event. It also checks the TWR and RNG display button for
00512 #     the first entry in the event data. Log returns if the value of the TWR or
00513 #     RNG is not the same as the one selected (the first time it returns for all
00514 #     entries that have twr and rng values other than the the first tower and
00515 #     range entry in the event). If the entry passes the filter it obtains its
00516 #     energy value (in ACD counts) and range,and contrasts them with the actual
00517 #     min and max values to update them if necesary.
00518
00519 #     \return tower, layer, theLog
00520 #     """
00521 #     # Get range values, we are gonna make sure that posValue and negValue are
00522 #     # the same for each entry
00523 #     posValue = theLog.positive().value()
00524 #     negValue = theLog.negative().value()
00525
00526 #     posRange = theLog.positive().range()
00527 #     negRange = theLog.negative().range()
00528
00529 #     # Subtract pedestals if available
00530 #     if self.__calPeds is not None:
00531 #       posValue -= self.__calPeds[tower,layer,theLog.column(),0,posRange,0]
00532 #       negValue -= self.__calPeds[tower,layer,theLog.column(),1,negRange,0]
00533
00534 #     #Assuming positive and negative range are the same for an event log entry
00535 #     RNGButton = self.__gui.drawGOSEDCAL.selectRNG.find(posRange)
00536 #     RNGButton.setEnabled(1)
00537
00538 #     RNGButton2 = self.__gui.drawGOSEDCALTKR.selectRNG.find(posRange)
00539 #     RNGButton2.setEnabled(1)
00540
00541 #     #~ print "Exists data in CAL 1 iterator log function before filters"
00542
00543 #     # If the file was just opened select the first rng entry in the event to
00544 #     # filter by it.
00545 #     if self.__selectedRange == -1:
00546 #       self.__selectedRange   = posRange
00547 #       RNGButton.setChecked(1)
00548
00549 #     #~ if self.__selectedRange2 == -1:
00550 #       #~ self.__selectedRange2   = posRange
00551 #       #~ RNGButton2.setChecked(1)
00552
00553 #     # Return if the entry does not have the selected rng value.
00554 #     # If negRange is not the same as posRange the entry is discarded (check if
00555 #     # this is a good idea)
00556 #     if self.__selectedRange  != -1 and self.__selectedRange  != 4:
00557 #       if posRange != self.__selectedRange  or negRange != self.__selectedRange:
00558 #         pass
00559
00560 #       else:
00561 #         # Once we have filtered to obtain the desired entries calculate the average
00562 #         # energy in ACD counts and contrast it with the present min and max values.
00563 #         averageEnergy = (posValue + negValue)/2
00564
00565 #         # Update counts of log and energy entries
00566 #         self.__logCount += 1
00567 #         self.__energyCount += averageEnergy
00568
00569 #         # Update min and max values for the filtered event with the new value
00570 #         # if necessary.
00571 #         if averageEnergy > self.__maxValue:
00572 #           self.__maxValue = averageEnergy
00573
00574 #         if averageEnergy < self.__minValue:
00575 #           self.__minValue = averageEnergy
00576
00577 #     # Return if the entry does not have the selected rng value.
00578 #     # If negRange is not the same as posRange the entry is discarded (check if
00579 #     # this is a good idea)
00580 #     #~ if self.__selectedRange2  != -1 and self.__selectedRange2  != 4:
00581 #       #~ if posRange != self.__selectedRange2  or negRange != self.__selectedRange2:
00582 #         #~ return
00583
00584 #     # Once we have filtered to obtain the desired entries calculate the average
00585 #     # energy in ACD counts and contrast it with the present min and max values.
00586 #     #~ averageEnergy2 = (posValue + negValue)/2
00587
00588 #     #~ # Update counts of log and energy entries
00589 #     #~ self.__logCount2 += 1
00590 #     #~ self.__energyCount2 += averageEnergy2
00591
00592 #     #~ # Update min and max values for the filtered event with the new value
00593 #     #~ # if necessary.
00594 #     #~ if averageEnergy2 > self.__maxValue2:
00595 #       #~ self.__maxValue2 = averageEnergy2
00596
00597 #     #~ if averageEnergy2 < self.__minValue2:
00598 #       #~ self.__minValue2 = averageEnergy2
00599 #     #~ print "Exists data in CAL 1 iterator log function after filters"
00600
00601
00602 class CALcontributionIterator2(LDF.CALcontributionIterator):
00603   """ \brief CAL contribution Displayer
00604
00605   This class obtains the filtered entries from CALcontributorIterator1 and
00606   converts them to the appropriate format to display them
00607   """
00608
00609   def __init__(self, event, contribution, gui, limits, lci):
00610     """ CALcontributionIterator2 contructor
00611
00612     \param event         Event
00613     \param contribution  Contribution
00614     \param gui           GOSED
00615     \param limits        Tuple with filtered values (min value, max value,
00616                          log count and energy count) obtained from
00617                          CALcontributionIterator1
00618     """
00619
00620     LDF.CALcontributionIterator.__init__(self, event, contribution)
00621     self.__event              = event
00622     self.__contribution       = contribution
00623     self.__gui                = gui
00624     self.__limits             = limits
00625     self.__tower              = None
00626     self.__calPeds            = lci.getCalPeds()
00627
00628     # Determine which tower and range are currently selected
00629     self.__selectedTower      = \
00630                       gui.drawGOSEDTWR.selectTWR.id(gui.drawGOSEDTWR.selectTWR.selected())
00631     self.__selectedRange      = \
00632                       gui.drawGOSEDCAL.selectRNG.id(gui.drawGOSEDCALTKR.selectRNG.selected())
00633     self.__selectedRange2     = \
00634                       gui.drawGOSEDCALTKR.selectRNG.id(gui.drawGOSEDCALTKR.selectRNG.selected())
00635
00636     # Initialize GOTED TKR temporary Pixmaps
00637     self.__ebfZ_CAL = {}
00638
00639     # Initialize limits
00640     if limits is None:
00641       self.__minValue = 0
00642       self.__maxValue = 1000
00643
00644       self.__logCount    = 0
00645       self.__energyCount = 0
00646
00647       #~ self.__minValue2 = 0
00648       #~ self.__maxValue2 = 1000
00649
00650       #~ self.__logCount2    = 0
00651       #~ self.__energyCount2 = 0
00652
00653       # Change limits if user has changed scale format
00654       if gui.preferredLimits == "Custom":
00655         self.__minValue = gui.GOSEDPreferencesGUI.minCAL()
00656         self.__maxValue = gui.GOSEDPreferencesGUI.maxCAL()
00657
00658         #~ self.__minValue2 = gui.GOSEDPreferencesGUI.minCAL()
00659         #~ self.__maxValue2 = gui.GOSEDPreferencesGUI.maxCAL()
00660 #        return
00661
00662     else:
00663       self.__minValue = limits["minValue"]
00664       self.__maxValue = limits["maxValue"]
00665
00666       #~ self.__minValue2 = limits["minValue2"]
00667       #~ self.__maxValue2 = limits["maxValue2"]
00668
00669     # Create CAL color spectrum dividing the min to max interval in 6.
00670     # If Energy Scale has been selected as Default or Custom the corresponding
00671     # values will the input min and max values here.
00672 #    interval = (self.__maxValue - self.__minValue)/6
00673 #    self.__interval = interval
00674
00675     #~ for view in (gui.drawGOSEDCAL, gui.drawGOSEDCALTKR):
00676 #     gui.drawGOSEDCALTKR.redLbl.setText(str(self.__minValue) + " - " +
00677 #                                        str(self.__minValue + 1*interval))
00678 #     gui.drawGOSEDCALTKR.orangeLbl.setText(str(self.__minValue + 1*interval) +
00679 #                                           " - " +
00680 #                                           str(self.__minValue + 2*interval))
00681 #     gui.drawGOSEDCALTKR.yellowLbl.setText(str(self.__minValue + 2*interval) +
00682 #                                           " - " +
00683 #                                           str(self.__minValue + 3*interval))
00684 #     gui.drawGOSEDCALTKR.greenLbl.setText(str(self.__minValue + 3*interval) +
00685 #                                          " - " +
00686 #                                          str(self.__minValue + 4*interval))
00687 #     gui.drawGOSEDCALTKR.blueLbl.setText(str(self.__minValue + 4*interval) +
00688 #                                         " - " +
00689 #                                         str(self.__minValue + 5*interval))
00690 #     gui.drawGOSEDCALTKR.violetLbl.setText(str(self.__minValue + 5*interval) +
00691 #                                           " - " + str(self.__maxValue))
00692
00693     #~ self.__interval2 = (self.__maxValue2 - self.__minValue2)/6
00694     #~ gui.drawGOSEDCALTKR.redLbl.setText(str(self.__minValue2) + " - " +
00695                               #~ str(self.__minValue2 + 1*self.__interval2))
00696     #~ gui.drawGOSEDCALTKR.orangeLbl.setText(str(self.__minValue2 + 1*self.__interval2) +
00697                                  #~ " - " +
00698                                  #~ str(self.__minValue2 + 2*self.__interval2))
00699     #~ gui.drawGOSEDCALTKR.yellowLbl.setText(str(self.__minValue2 + 2*self.__interval2) +
00700                                  #~ " - " +
00701                                  #~ str(self.__minValue2 + 3*self.__interval2))
00702     #~ gui.drawGOSEDCALTKR.greenLbl.setText(str(self.__minValue2 + 3*self.__interval2) +
00703                                 #~ " - " +
00704                                 #~ str(self.__minValue2 + 4*self.__interval2))
00705     #~ gui.drawGOSEDCALTKR.blueLbl.setText(str(self.__minValue2 + 4*self.__interval2) +
00706                                #~ " - " +
00707                                #~ str(self.__minValue2 + 5*self.__interval2))
00708     #~ gui.drawGOSEDCALTKR.violetLbl.setText(str(self.__minValue2 + 5*self.__interval2) +
00709                                  #~ " - " + str(self.__maxValue2))
00710
00711
00712
00713   def plot(self):
00714     """ Plot here will call the iterate() function to display the filtered
00715     event within the scale format selected by the user (Event, Custom or
00716     Default)
00717
00718     There are three sorts of pixmaps (and the 3 equivalent for the YZ projection):
00719     background = Background Pixmap with the skeleton of the CAL
00720     final      = Final pixmap that is going to be loaded to the display. If no
00721                  data passed the filter, the custom widget drawXZ_CAL will
00722                  automatically load background to final for display
00723     ebfXZ_CAL  = Temporary Pixmap that, if there is data that passed the filter
00724                  for the current event, it gets painted with it over background.
00725                  If so it is then passed to final (once the iteration is over).
00726     """
00727     gui = self.__gui
00728
00729     # Return if there is no CAL data in the event.
00730     length = self.__contribution.numLogAccepts()
00731     if length == 0:
00732       return
00733
00734     # Obtain tower number from LDF. This tower will have CAL data since
00735     # it passed the filter above
00736     towerSource = LDF.LATPcellHeader.source(self.contribution().header())
00737
00738     # Initialize GOTED Frames, for all TWRs with CAL data
00739     #~ gui.drawGOTED.towerList[towerSource].setEnabled(1)
00740
00741     # Initialize GOTED CAL Pixmaps, for all TWRs with CAL data
00742     self.__ebfZ_CAL[towerSource] = QPixmap(gui.drawGOTED.TWR0.width(),
00743                                            gui.drawGOTED.TWR0.height())
00744
00745     # If there is already a pixmap loaded from TKR, build from it
00746     if gui.drawGOTED.final[towerSource].isNull():
00747       copyBlt(self.__ebfZ_CAL[towerSource], 0, 0, gui.drawGOTED.background)
00748     else:
00749       copyBlt(self.__ebfZ_CAL[towerSource], 0, 0,
00750               gui.drawGOTED.final[towerSource])
00751
00752     # Iterate over event entries to paint filtered entries onto temporary pixmap
00753     self.iterate()
00754
00755     # ATK - 09 Jan 04: Implementation on hold, needs to consider
00756     # pairing of layers in trays to create proper top projection of the tower:
00757     # Here we presently just pass back white background pixmap instead of top
00758     # projection
00759     #
00760     # Pass GOTED Pixmaps
00761     bitBlt(gui.drawGOTED.towerList[towerSource], 0, 0,
00762            self.__ebfZ_CAL[towerSource], 0, 0)
00763     bitBlt(gui.drawGOTED.final[towerSource], 0, 0,
00764            self.__ebfZ_CAL[towerSource], 0, 0)
00765     #~ bitBlt(gui.towerList[towerSource], 0, 0,
00766            #~ self.__ebfZ_CAL[towerSource], 0, 0)
00767
00768     # Filter by selected tower:
00769     if towerSource != self.__selectedTower:
00770       return
00771
00772     # Frame in red the selected TWR
00773     Zpm = gui.clickTWR(self.__selectedTower)
00774     #~ if Zpm is not None:
00775     bitBlt(gui.drawGOTED.towerList[towerSource], 0, 0, Zpm , 0, 0)
00776     bitBlt(gui.drawGOTED.final[towerSource], 0, 0, Zpm , 0, 0)
00777
00778     # Request that the screen is updated, for those Widgets that need it
00779     if gui.drawXZ_CAL.isVisible():
00780       gui.drawYZ_CAL.update()
00781       gui.drawXZ_CAL.update()
00782     if gui.drawXZ_CAL2.isVisible():
00783       gui.drawYZ_CAL2.update()
00784       gui.drawXZ_CAL2.update()
00785     if gui.drawGOSEDData.isVisible():
00786       gui.drawGOSEDData.update()
00787
00788     # Fill in total count of Log hits and total average Energy
00789     gui.drawGOSEDData.totLogHits.setText(str(self.__logCount))
00790     gui.drawGOSEDData.totEnergy.setText(str(self.__energyCount))
00791
00792
00793   def __drawLog(self, final, posArr, posColor, negArr, negColor):
00794     pCAL = QPainter(final)
00795     pCAL.setBrush(posColor)
00796     pCAL.setPen(posColor)
00797     pCAL.drawPolygon(posArr)
00798     pCAL.setBrush(negColor)
00799     pCAL.setPen(negColor)
00800     pCAL.drawPolygon(negArr)
00801
00802     pCAL.end()
00803
00804   def log(self, tower, layer, theLog):
00805     """ This function iterates over all current event entries and displays
00806     all those entries that passed the filter of for CAL in
00807     CALContributorIterator1.
00808
00809     \return tower, layer, theLog
00810     """
00811     # Initialize variables
00812     layerTag = ["X0", "Y0", "X1", "Y1", "X2", "Y2", "X3", "Y3"]
00813     gccc     = [  0,    3,    0,    3,    2,    1,    2,    1]
00814     gcrc     = [  0,    0,    1,    1,    2,    2,    3,    3]
00815
00816     # Initialize variables for the filtered entry
00817     gui = self.__gui
00818     column = theLog.column()
00819
00820     positive = theLog.positive()
00821     negative = theLog.negative()
00822
00823     posRange = positive.range()
00824     posValue = positive.value()
00825     negRange = negative.range()
00826     negValue = negative.value()
00827
00828     # Subtract pedestals if available
00829     calPeds = self.__calPeds
00830     if calPeds is not None:
00831       posValue -= calPeds[tower,layer,theLog.column(),0,posRange,0]
00832       negValue -= calPeds[tower,layer,theLog.column(),1,negRange,0]
00833
00834     #Assuming positive and negative range are the same for an event log entry
00835     RNGButton = gui.drawGOSEDCAL.selectRNG.find(posRange)
00836     RNGButton.setEnabled(1)
00837
00838     RNGButton2 = gui.drawGOSEDCALTKR.selectRNG.find(posRange)
00839     RNGButton2.setEnabled(1)
00840
00841     # If the file was just opened (first TWR entry was automatically selected in
00842     # CALContributorIterator1) do the same (automatically select) first RNG entry
00843     if self.__selectedRange  == -1:
00844       self.__selectedRange = posRange
00845       RNGButton.setChecked(1)
00846
00847     if self.__selectedRange2  == -1:
00848       self.__selectedRange2 = posRange
00849       RNGButton2.setChecked(1)
00850
00851     # If we are scaling by energy in ADC counts, determine energy color for the
00852     # entry value within the energy spectrum:
00853     scale = gui.drawGOSEDCALTKR.scaleSelection.currentItem()
00854     if scale == 0 or scale == 4:
00855       value = (posValue + negValue)/2
00856
00857       # Update counts of log and energy entries
00858       self.__logCount += 1
00859       self.__energyCount += value
00860
00861       # Ric is overriding the color here:
00862       import colorScale
00863       dv = float(self.__maxValue) - float(self.__minValue)
00864       if dv == 0.0:  dv = 1.0e-308
00865       v = (float(posValue) - float(self.__minValue)) / dv
00866       r, g, b = colorScale.colorScale(v)
00867
00868       posColor = QColor(r, g, b)
00869
00870       v = (float(negValue) - float(self.__minValue)) / dv
00871       r, g, b = colorScale.colorScale(v)
00872
00873       negColor = QColor(r, g, b)
00874
00875     # If we are scaling by range from 0 to 3, determine energy color for the
00876     # entry value within the range spectrum:
00877     elif scale == 1 or scale == 2:
00878
00879       if posRange == 0 or negRange == 0:
00880         color = QColor(255,0,0)
00881
00882       elif posRange == 1 or negRange == 1:
00883         color = QColor(255,255,0)
00884
00885       elif posRange == 2 or negRange == 2:
00886         color = QColor(0,170,0)
00887
00888       elif posRange == 3 or negRange == 3:
00889         color = QColor(0,0,255)
00890
00891       negColor = color
00892       posColor = color
00893
00894     # Initialize GOTED Pixmaps for TWRs with CAL data
00895     if gui.drawGOTED.final[tower].isNull():
00896       gui.drawGOTED.final[tower] = QPixmap(gui.drawGOTED.TWR0.width(),
00897                                            gui.drawGOTED.TWR0.height())
00898
00899     # ATK - 09 Jan 04: Implementation on hold, needs to consider
00900     # pairing of layers in trays to create proper top projection of the tower:
00901     #
00902     #~ # Paint XY GOTED projection for every tower with data
00903     #~ pCAL = QPainter(self.__ebfZ_CAL[tower])
00904     #~ pCAL.setBrush(color)
00905     #~ pCAL.setPen(color)
00906     #print gui.TWR0.geometry().width(), gui.TWR0.height()
00907     #~ pCAL.drawRect(column*gui.drawGOTED.TWR0.width()/12,
00908                        #~ column*gui.drawGOTED.TWR0.height()/12,
00909                        #~ gui.drawGOTED.TWR0.width()/12,
00910                        #~ gui.drawGOTED.TWR0.height()/12
00911                        #~ )
00912
00913     #~ pCAL.end()
00914
00915     # Filter by selected tower:
00916     if tower != self.__selectedTower:
00917       return
00918
00919     # If there is data in the selected tower intialize final pixmaps in the draw class.
00920     logWidth  = gui.drawXZ_CAL.final.width() / 12
00921     logHeight = gui.drawXZ_CAL.final.height() / 8
00922
00923     arrA = QPointArray()
00924     # Points: Make them one pixel less in height, on bottom
00925     arrA.setPoints([logWidth*column     + 1, logHeight*layer     + 1,  # Top    Left
00926                     logWidth*(column+1) - 1, logHeight*layer     + 1,  # Top    Right
00927                     logWidth*column     + 1, logHeight*(layer+1) - 2]) # Bottom Left
00928     arrB = QPointArray()
00929     arrB.setPoints([logWidth*(column+1) - 1, logHeight*(layer+1) - 2,  # Bottom Right
00930                     logWidth*(column+1) - 1, logHeight*layer     + 1,  # Top    Right
00931                     logWidth*column     + 1, logHeight*(layer+1) - 2]) # Bottom Left
00932
00933     # Once the color has been determined, paint log with it
00934     # in the correct projection.
00935     if gui.drawXZ_CAL.isVisible():
00936       if layer in range(1, 9, 2):
00937         self.__drawLog(gui.drawXZ_CAL.final, arrA, posColor, arrB, negColor)
00938       elif layer in range(0, 8, 2):
00939         self.__drawLog(gui.drawYZ_CAL.final, arrA, posColor, arrB, negColor)
00940
00941     if gui.drawXZ_CAL2.isVisible():
00942       if layer in range(1, 9, 2):
00943         self.__drawLog(gui.drawXZ_CAL2.final, arrA, posColor, arrB, negColor)
00944       elif layer in range(0, 8, 2):
00945         self.__drawLog(gui.drawYZ_CAL2.final, arrA, posColor, arrB, negColor)
00946
00947     # Fill in CAL listview window with the entry data:
00948     if gui.drawGOSEDData.isVisible():
00949       messageItem = QListViewItem( gui.drawGOSEDData.CALview,
00950                                    gui.drawGOSEDData.CALview.lastItem())
00951       messageItem.setText( 0, "   " +str(tower))
00952       messageItem.setText( 1, "   " +str(layerTag[layer]))  # RiC: Should be col 2
00953       messageItem.setText( 2, str(gccc[layer]))      # RiC: Should be col 1
00954       messageItem.setText( 3, str(column))
00955       if self.__calPeds is not None:
00956         messageItem.setText( 4, "%d" % posValue)
00957         messageItem.setText( 5, str(posRange))
00958         messageItem.setText( 6, "%d" % negValue)
00959         messageItem.setText( 7, str(negRange))
00960       else:
00961         messageItem.setText( 4, "0x%03x" % posValue)
00962         messageItem.setText( 5, str(posRange))
00963         messageItem.setText( 6, "0x%03x" % negValue)
00964         messageItem.setText( 7, str(negRange))
00965       messageItem.setText( 8, str(gcrc[layer]))
00966       messageItem.setText( 9, "    " +str(column))
00967
00968 class TKRcontributionIterator(LDF.TKRcontributionIterator):
00969   """ \brief TKR contribution Displayer
00970
00971   This class obtains the information of TKR from EBF to setup the tkr data in
00972   GOSED. To do so it filters by event and twr, iterating over all the entries
00973   in the event.
00974   """
00975
00976   def __init__(self, event, contribution, gui):
00977     """ TKRcontributionIterator contructor
00978
00979     \param event         Event
00980     \param contribution  Contribution
00981     \param gui           GOSED
00982     """
00983
00984     # Initialize variables
00985     LDF.TKRcontributionIterator.__init__(self, event, contribution)
00986     self.__xy      = ['Y', 'X', 'X', 'Y']
00987     self.__gui     = gui
00988     self.__gtcc    = [6, 3, 7, 2, 5, 0, 4, 1]
00989     self.__event   = event
00990     self.__tower   = None
00991
00992     self.hitCount   = 0
00993     self.layerCount = 0
00994
00995     # Retreive current selected tower:
00996     self.__selectedTower = gui.drawGOSEDTWR.selectTWR.id(gui.drawGOSEDTWR.selectTWR.selected())
00997
00998     # Initialize GOTED TKR temporary Pixmaps
00999     self.__ebfZ_TKR = {}
01000
01001
01002   def plot(self):
01003     """ Plot here will call the iterateStrips() function to display the filtered
01004     event.
01005
01006     There are three sorts of pixmaps (and the 3 equivalent for the YZ projection):
01007     background = Background Pixmap with the skeleton of the CAL
01008     final      = Final pixmap that is going to be loaded to the display. If no
01009                  data passed the filter, the custom widget drawXZ_CAL will
01010                  automatically load background to final for display
01011     """
01012
01013     gui = self.__gui
01014
01015     # Return if there is no TKR data in the event.
01016     tkrContribution = self.contribution()
01017     length  = tkrContribution.numAccepts(self.__event)
01018     if length != 0:
01019       # Obtain tower number from EBF
01020       towerSource = LDF.LATPcellHeader.source(self.contribution().header())
01021
01022       # Initialize GOTED Frames, for all TWRs with TKR data
01023       #~ gui.drawGOTED.towerList[towerSource].setEnabled(1)
01024
01025       #~ print "tower Header", towerHeader
01026
01027       # Enable all towers that have data for the event
01028       twrButton = gui.drawGOSEDTWR.selectTWR.find(towerSource)
01029       twrButton.setEnabled(1)
01030
01031       # If we fix that tower can be passed directly to plot(), we can save having to
01032       # enter iteratestrips by adding the next 7 lines for all the towers that are not
01033       # the selected one. With the above line this is fixed. ATK 11/21/03
01034       if self.__selectedTower == -1:
01035         if gui.firstTower == None:
01036           gui.firstTower = towerSource
01037           self.__selectedTower = towerSource
01038           twrButton.setChecked(1)
01039
01040       # Initialize GOTED temporary pixmap, for all Towers with data.
01041       self.__ebfZ_TKR[towerSource] = QPixmap(gui.drawGOTED.towerList[towerSource].width(),
01042                                              gui.drawGOTED.towerList[towerSource].height())
01043
01044       if gui.drawGOTED.final[towerSource].isNull():
01045         copyBlt(self.__ebfZ_TKR[towerSource], 0, 0, gui.drawGOTED.background)
01046       else:
01047         copyBlt(self.__ebfZ_TKR[towerSource], 0, 0, gui.drawGOTED.final[towerSource])
01048
01049       #~ # Pass GOTED Pixmaps
01050       #~ bitBlt(gui.drawGOTED.towerList[towerSource], 0, 0, self.__ebfZ_TKR[towerSource], 0, 0)
01051       #~ bitBlt(gui.drawGOTED.final[towerSource], 0, 0, self.__ebfZ_TKR[towerSource], 0, 0)
01052
01053     # Iterate over strip data.
01054     self.iterateStrips()
01055
01056     if length != 0:
01057       # ATK - 09 Jan 04: Implementation on hold, needs to consider
01058       # pairing of layers in trays to create proper top projection of the tower:
01059       # Here we presently just pass back white background pixmap instead of top
01060       # projection
01061       #
01062       # Pass GOTED Pixmaps
01063       bitBlt(gui.drawGOTED.towerList[towerSource], 0, 0,
01064             self.__ebfZ_TKR[towerSource], 0, 0)
01065       bitBlt(gui.drawGOTED.final[towerSource], 0, 0,
01066             self.__ebfZ_TKR[towerSource], 0, 0)
01067       #~ bitBlt(gui.towerList[towerSource], 0, 0,
01068             #~ self.__ebfZ_TKR[towerSource], 0, 0)
01069
01070     # Iterate over TOT data
01071     self.iterateTOTs()
01072
01073     if length != 0:
01074       # Filter by selected tower:
01075       if towerSource != self.__selectedTower:
01076         return
01077
01078       # Frame in red the selected TWR
01079       Zpm = gui.clickTWR(self.__selectedTower)
01080       #~ if Zpm is not None:
01081       bitBlt(gui.drawGOTED.towerList[towerSource], 0, 0, Zpm , 0, 0)
01082       bitBlt(gui.drawGOTED.final[towerSource], 0, 0, Zpm , 0, 0)
01083
01084       # Request that the screen is updated, for those Widgets that need it
01085       if gui.drawYZ_TKR.isVisible():
01086         gui.drawYZ_TKR.update()
01087         gui.drawXZ_TKR.update()
01088       if gui.drawYZ_TKR2.isVisible():
01089         gui.drawYZ_TKR2.update()
01090         gui.drawXZ_TKR2.update()
01091
01092   def strip(self, tower, layerEnd, hit):
01093     """ This function iterates over all current event entries and displays
01094     all those entries that passed the filter of for TWR.
01095
01096     \return tower, layerEnd, hit
01097     """
01098     # Initialize variables
01099     gui   = self.__gui
01100     layer = layerEnd >> 1
01101     rc    = layer / 4
01102     cc    = self.__gtcc[layer % 4]
01103
01104     (xTKR, yTKR, zTKR, stripNum) = (LDF.TKRstrip.gtfe(hit),
01105                                     LDF.TKRstrip.gtfe(hit), layer, hit)
01106
01107     # Initialize GOTED Pixmaps for TWRs with TKR data
01108     if gui.drawGOTED.final[tower].isNull():
01109       gui.drawGOTED.final[tower] = QPixmap(gui.drawGOTED.TWR0.width(),
01110                                            gui.drawGOTED.TWR0.height())
01111
01112     # We only have the mageneta color for TKR
01113     color = QColor("magenta")
01114
01115     # ATK - 09 Jan 04: Implementation on hold, needs to consider
01116     # pairing of layers in trays to create proper top projection of the tower:
01117     #
01118     # Paint XY GOTED projection for every tower with data
01119     #~ self.pTKR = QPainter(self.__ebfZ_TKR[tower])
01120     #~ self.pTKR.setBrush(color)
01121     #~ self.pTKR.setPen(color)
01122     #~ self.pTKR.drawLine(stripNum*gui.drawGOTED.TWR0.width()/1536,
01123                        #~ stripNum*gui.drawGOTED.TWR0.height()/1536 - 2,
01124                        #~ stripNum*gui.drawGOTED.TWR0.width()/1536,
01125                        #~ stripNum*gui.drawGOTED.TWR0.height()/1536 + 2
01126                        #~ )
01127     #~ self.pTKR.drawLine(stripNum*gui.drawGOTED.TWR0.width()/1536 - 2,
01128                        #~ stripNum*gui.drawGOTED.TWR0.height()/1536 + 1,
01129                        #~ stripNum*gui.drawGOTED.TWR0.width()/1536 + 2,
01130                        #~ stripNum*gui.drawGOTED.TWR0.height()/1536 + 1
01131                        #~ )
01132     #~ self.pTKR.end()
01133
01134     # Filter by selected tower:
01135     if tower != self.__selectedTower:
01136       return
01137
01138     x = stripNum*gui.drawXZ_TKR.final.width()/NUMBER_STRIPS
01139     y = (35-zTKR)*7
01140
01141     # Paint ebf pixmap with filtered data of the current event
01142     if self.__xy[layer & 0x3] == "X":
01143       pTKR = QPainter(gui.drawXZ_TKR.final)
01144       pTKR.setBrush(color)
01145       pTKR.setPen(color)
01146       if y in RANGE1_TKR_X:
01147         pTKR.drawLine(x,     y + 1, x,     y + 1 + 6)
01148         pTKR.drawLine(x - 2, y + 4, x + 2, y + 4)
01149         #pTKR.drawRect(stripNum*STRIP_RANGE*4/NUMBER_STRIPS + 1,
01150         #              y + 1, 4 , 6)
01151       else:
01152         pTKR.drawLine(x,     y,     x,     y + 6 + 1)
01153         pTKR.drawLine(x - 2, y + 4, x + 2, y + 4)
01154         #pTKR.drawRect(x, y + 2, 1 , 6)
01155         #pTKR.drawRect(stripNum*STRIP_RANGE*4/NUMBER_STRIPS + 1,
01156         #              y + 2, 4 , 6)
01157       bitBlt(gui.drawXZ_TKR2.final, 0, 0, gui.drawXZ_TKR.final, 0, 0)
01158
01159     elif self.__xy[layer & 0x3] == "Y":
01160       pTKR = QPainter(gui.drawYZ_TKR.final)
01161       pTKR.setBrush(color)
01162       pTKR.setPen(color)
01163       if y in RANGE1_TKR_Y:
01164         pTKR.drawLine(x,     y + 2, x,     y + 2 + 6)
01165         pTKR.drawLine(x - 2, y + 4, x + 2, y + 4)
01166         #pTKR.drawRect(x, y + 2, 1, 6)
01167         #pTKR.drawRect(stripNum*STRIP_RANGE*4/NUMBER_STRIPS + 1,
01168         #              y + 1, 4 , 6)
01169
01170       else:
01171         pTKR.drawLine(x,     y + 1, x,     y + 1 + 6)
01172         pTKR.drawLine(x - 2, y + 4, x + 2, y + 4)
01173         #pTKR.drawRect(x, y + 1, 1 , 6)
01174         #pTKR.drawRect(stripNum*STRIP_RANGE*4/NUMBER_STRIPS + 1,
01175         #              y + 2, 4 , 6)
01176
01177       bitBlt(gui.drawYZ_TKR2.final, 0, 0, gui.drawYZ_TKR.final, 0, 0)
01178
01179     pTKR.end()
01180
01181     # Add one to the number of hits count
01182     self.hitCount += 1
01183
01184     # Load entry in the TKR list view
01185     if gui.drawGOSEDData.isVisible():
01186       messageItem = QListViewItem( gui.drawGOSEDData.TKRview,
01187                                    gui.drawGOSEDData.TKRview.lastItem())
01188       # If we wanted a check list here is how to do it:
01189       #~ messageItem = QCheckListItem( gui.drawGOSEDData.TKRview,"", QCheckListItem.CheckBox)
01190
01191       messageItem.setText( 0, "   " +str(tower))
01192       messageItem.setText( 1, "   " +str(LAYER[layer]))
01193       messageItem.setText( 2, str(layer))
01194       messageItem.setText( 3, str(cc) + ',' + str(cc + 1))
01195       messageItem.setText( 4, str(rc))
01196       messageItem.setText( 5, str(LDF.TKRstrip.gtfe(hit)))
01197       messageItem.setText( 6, str(hit))
01198       messageItem.setText( 7, "0x%04x" % hit)
01199
01200     gui.drawGOSEDData.totHits.setText(str(self.hitCount))
01201
01202   # Not implemented
01203   def TOT(self, tower, layerEnd, tot):
01204     pass
01205
01206 class OSWcontributionIterator(LDF.OSWcontributionIterator):
01207   def __init__(self, event, contribution):
01208     LDF.OSWcontributionIterator.__init__(self, event, contribution)
01209     self.__timestamp = None
01210     self.__timebase  = None
01211
01212   def timestamp(self):
01213     return self.__timestamp
01214
01215   def OSWtime(self, timeStamp, timebase):
01216     ts = LDF.OSWtimeSpec(timeStamp)
01217
01218     self.__timestamp = (ts.sec(), ts.nsec())
01219
01220     return 0
01221
01222
01223 class DIAGcontributionIterator(LDF.DIAGcontributionIterator):
01224   __CALlayerLabel = ["x0", "x1", "x2", "x3", "y0", "y1", "y2", "y3"]
01225   __gccc          = [0, 2, 3, 1]
01226
01227   def __init__(self,event,contribution,dataStart, gui):
01228     LDF.DIAGcontributionIterator.__init__(self,event,contribution)
01229     self.offset(dataStart)  # Set the start of the diagnostic data
01230     self.__gui    = gui
01231     self.__diagCALView   = self.__gui.drawGOSEDData.diagCAL
01232     self.__diagTKRView   = self.__gui.drawGOSEDData.diagTKR
01233
01234   def CALdiag(self, tower, layer, diag):
01235     gccc          = self.__gccc[layer>>1]
01236     layer         = self.__CALlayerLabel[layer]
01237     negLogAccepts = diag.logAccepts (1)        # negative
01238     negHigh       = diag.high       (1)        # negative
01239     negLow        = diag.low        (1)        # negative
01240     posLogAccepts = diag.logAccepts (0)        # positive
01241     posHigh       = diag.high       (0)        # positive
01242     posLow        = diag.low        (0)        # positive
01243
01244     if self.__gui.drawGOSEDData.isVisible():
01245       item = QListViewItem(self.__diagCALView)
01246       item.setText(0, str(gccc))
01247       item.setText(1, str(layer))
01248       item.setText(2, "0x%03x" % negLogAccepts)
01249       item.setText(3, str(negHigh))
01250       item.setText(4, str(negLow))
01251       item.setText(5, "0x%03x" % posLogAccepts)
01252       item.setText(6, str(posHigh))
01253       item.setText(7, str(posLow))
01254
01255     #~ diagCALView.insertItem(item)
01256     return 0
01257
01258   def TKRdiag(self, tower, gtcc, diag):
01259     gtrc         = (diag.datum() & 0xffff)
01260
01261     if self.__gui.drawGOSEDData.isVisible():
01262       item = QListViewItem(self.__diagTKRView)
01263       item.setText(0, str(gtcc))
01264       item.setText(1, "0x%03x" % gtrc)
01265
01266     #print "    %1d   0x%03x" % (gtcc, (diag.datum() & 0xffff))
01267     return 0
01268
01269
01270 class ERRcontributionIterator(LDF.ERRcontributionIterator):
01271   __gccc  = [0, 2, 3, 1]
01272   __gtcc  = [3, 6, 2, 7, 0, 5, 1, 4]
01273   __pn    = ["+", "-"]
01274   __xy    = ["X", "Y"]
01275   __layer = [0, 2, 2, 0]
01276
01277   def __init__(self,event,contribution,dataStart, gui):
01278     LDF.ERRcontributionIterator.__init__(self,event,contribution)
01279     self.offset(dataStart)  # Set the start of the error data
01280     self.__gui   = gui
01281
01282     self.__errorWindow = self.__gui.drawGOSEDData.error
01283
01284   def gcccError(self, tower, gccc, err):
01285     #if not self.__errorWindow.isVisible():  return 0
01286     if err.type() == 0:
01287
01288       self.__errorWindow.append("  GCCC %d had missing start bit(s) on sweep %d (raw: 0x%04x):" % \
01289              (gccc, err.sweep(), err.raw()))
01290     else:
01291       self.__errorWindow.append("  GCCC %d had parity error(s) on sweep %d (raw: 0x%04x):" % \
01292              (gccc, err.sweep(), err.raw()))
01293     for i in range(8):
01294       if err.param() & (1 << i):
01295         self.__errorWindow.append("    %s%s%d, wire %d" % \
01296                                    (self.__pn[i > 3],
01297                                     self.__xy[gccc & 1],
01298                                     self.__layer[gccc] + ((i >> 1) & 1),
01299                                     i & 1))
01300     self.__errorWindow.append(" ")
01301     return 0
01302
01303   def gtccError(self, tower, gtcc, err):
01304     #if not self.__errorWindow.isVisible():  return 0
01305     self.__errorWindow.append("GTCC %d, GTRC %d (msg: 0x%04x):" % \
01306                               (gtcc, err.GTRC(), err.raw()))
01307     return 0
01308
01309   def phaseError(self, tower, err):
01310     #if not self.__errorWindow.isVisible():  return 0
01311     self.__errorWindow.append(" ")
01312     self.__errorWindow.append("Cable Controller phasing error tags (raw: 0x%04x):" % \
01313            (err))
01314
01315     tag = [0, 0, 0, 0, 0, 0, 0, 0]
01316     msg  = ""
01317     for c in range(8):  tag[self.__gtcc[c]] = (err >> (c << 1)) & 0x0003
01318     self.__errorWindow.append("  GTCC:  0  1  2  3  4  5  6  7")
01319     for c in range(8):  msg += "  %d" % (tag[c])
01320     self.__errorWindow.append("   tag:%s" % (msg))
01321     self.__errorWindow.append(" ")
01322     return 0
01323
01324   def timeoutError(self, tower, err):
01325     #if not self.__errorWindow.isVisible():  return 0
01326     self.__errorWindow.append(" ")
01327     self.__errorWindow.append("Cable Controller timeouts (raw: 0x%03x):" % (err))
01328     cTmos = err & 0x000f
01329     msg = "    GCCC:"
01330     for i in range(4):
01331       if cTmos & (1 << i):  msg += " %d" % (self.__gccc[i])
01332     tTmos = (err >> 4) & 0x00ff
01333     msg  += ", GTCC:"
01334     for i in range(8):
01335       if tTmos & (1 << i):  msg += " %d" % (self.__gtcc[i])
01336     self.__errorWindow.append("  %s" % (msg))
01337     self.__errorWindow.append(" ")
01338     return 0
01339
01340   def gtrcPhaseError(self, tower, gtcc, gtrc, err):
01341     #if not self.__errorWindow.isVisible():  return 0
01342     self.__errorWindow.append("  GTRC phasing error (raw: 0x%04x)"   % \
01343                               (err.raw()))
01344     self.__errorWindow.append("    Current tag number:           %d" % \
01345                               (err.currentTag()))
01346     self.__errorWindow.append("    Layer 0 tag number:           %d" % \
01347                               (err.layer0Tag()))
01348     self.__errorWindow.append("    Expected layer number:        %d" % \
01349                               (err.expectedLayer()))
01350     self.__errorWindow.append("    Layer number received by TEM: %d" % \
01351                               (err.receivedLayer()))
01352     self.__errorWindow.append(" ")
01353     return 0
01354
01355   def __tag(self, tag, err):
01356     for i in range(5):
01357       tag.append(err & 0x3)
01358       err >>= 2
01359
01360     return tag
01361
01362   def gtfePhaseError(self, tower, gtcc, gtrc, err1, err2, err3, err4, err5):
01363     #if not self.__errorWindow.isVisible():  return 0
01364     tags = " 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x" % (err1, err2, err3, err4, err5)
01365     self.__errorWindow.append("  GTFE phasing error tags (raw: %s)" % (tags))
01366     tag = []
01367     self.__tag(tag, err1)
01368     self.__tag(tag, err2)
01369     self.__tag(tag, err3)
01370     self.__tag(tag, err4)
01371     self.__tag(tag, err5 >> 2)
01372     self.__errorWindow.append("    GTFE  0  1  2  3  4  5  6  7  8  9 10 11")
01373     str = "      0-11 "
01374     for i in range(12):
01375       str += "%2d " % tag[i]
01376     self.__errorWindow.append( str )
01377     str = "     12-23 "
01378     for i in range(12, 24):
01379       str += "%2d " % tag[i]
01380     self.__errorWindow.append( str )
01381     self.__errorWindow.append(" ")
01382     return 0
01383
01384   def gtccFIFOerror(self, tower, gtcc, err):
01385     #if not self.__errorWindow.isVisible():  return 0
01386     self.__errorWindow.append("  FIFO full error, projected word count = 0x%04x" % \
01387            (err))
01388     return 0
01389
01390   def gtccTMOerror(self, tower, gtcc):
01391     #if not self.__errorWindow.isVisible():  return 0
01392     self.__errorWindow.append("  Cable timeout error")
01393     return 0
01394
01395   def gtccHDRParityError(self, tower, gtcc):
01396     #if not self.__errorWindow.isVisible():  return 0
01397     self.__errorWindow.append("  Header parity error")
01398     return 0
01399
01400   def gtccWCParityError(self, tower, gtcc):
01401     #if not self.__errorWindow.isVisible():  return 0
01402     self.__errorWindow.append("  Word count parity error")
01403     return 0
01404
01405   def gtrcSummaryError(self, tower, gtcc):
01406     #if not self.__errorWindow.isVisible():  return 0
01407     self.__errorWindow.append("  GTRC summary error")
01408     return 0
01409
01410   def gtccDataParityError(self, tower, gtcc):
01411     #if not self.__errorWindow.isVisible():  return 0
01412     self.__errorWindow.append("  Data parity error")
01413     return 0
01414
01415 class myLATcomponentIterator(LDF.LATcomponentIterator):
01416   """ \brief LAT component Displayer
01417
01418   This class obtains the information of all the LAT components from EBF and
01419   passes it to the corresponding component iterators, to be displayed in GOSED.
01420   """
01421   def __init__(self, gui):
01422     """ myLATcomponentIterator contructor
01423
01424     \param gui           GOSED
01425     """
01426
01427     # Initialize variables
01428     LDF.LATcomponentIterator.__init__(self)
01429     self.__calSrc          = None
01430     self.__tkrContribution = None
01431     self.__gui             = gui
01432     self.__diagnosticData  = 0
01433     self.__acdPeds         = None
01434     self.__calPeds         = None
01435     self.readPedestals()
01436
01437   def UDFcomponent(self, event, ebfContribution):
01438     return 0
01439
01440   def __displayEvtStats(self, eventNumber, eventTag, timestamp):
01441     draw = self.__gui.drawGOSEDData
01442
01443     draw.eventNumber.setText(str(eventNumber))
01444     draw.eventTag.setText(str(eventTag))
01445     evtTime = time.ctime(timestamp[0])
01446     draw.timeStamp.setText("%s + %09d nS" % (evtTime, timestamp[1]))
01447
01448   def GLTcomponent(self, event, contribution):
01449     """ Obtain the "fingerprints" of the event
01450     """
01451     buffer = Numeric.fromstring(contribution.data(), 'i')
01452     eventNumber = LDF.EventSummary.eventNumber(contribution.summary())
01453     eventTag = LDF.EventSummary.tag(contribution.summary())
01454
01455     #timestamp = time.asctime(time.gmtime(buffer[0])) #+ str(buffer[1]) + " mS"
01456
01457     self.__displayEvtStats(eventNumber, eventTag, buffer)
01458     return 0
01459
01460   def OSWcomponent(self, event, contribution):
01461     """ Obtain the 'fingerprints' of the event
01462     """
01463     eventNumber = LDF.EventSummary.eventNumber(contribution.summary())
01464     eventTag = LDF.EventSummary.tag(contribution.summary())
01465
01466     oswContribIter = OSWcontributionIterator(event, contribution)
01467     oswContribIter.iterate()
01468
01469     self.__displayEvtStats(eventNumber, eventTag, oswContribIter.timestamp())
01470     return 0
01471
01472   def GEMcomponent(self, event, gemContribution):
01473     """ Obtain the ACD information of the event
01474     """
01475     gemContrib = GEMcontribution(event, gemContribution, self.__gui)
01476     gemContrib.plot()
01477     return 0
01478
01479   def ACDcomponent(self, event, aemContribution):
01480     """ Obtain the ACD information of the event
01481     """
01482     acdContrib = AEMcontributionIterator(event, aemContribution, self.__gui, self)
01483     acdContrib.plot()
01484     return 0
01485
01486   def TKRcomponent(self, event, tkrContribution):
01487     """ Obtain the TKR information of the event to be processed by
01488     TKRcontributionIterator.
01489     """
01490     tkrIterator  = TKRcontributionIterator(event, tkrContribution, self.__gui)
01491     tkrIterator.plot()
01492
01493     if tkrIterator.diagnostic() is not None:
01494       self.TKRend(tkrIterator.diagnostic())
01495
01496     return 0
01497
01498
01499   def CALcomponent(self, event, calContribution):
01500     """ Obtain the CAL information of the event to be processed by
01501     CALcontributionIterator1 and CALcontributionIterator2.
01502     """
01503 #    calContrib1 = CALcontributionIterator1(event, calContribution, self.__gui, self)
01504
01505 #    limits = calContrib1.plot()
01506     #~ if limits is None:
01507       #~ return
01508
01509     limits = None
01510     calContrib2 = CALcontributionIterator2(event, calContribution, self.__gui, limits, self)
01511     calContrib2.plot()
01512
01513     self.CALend(calContrib2.CALend())
01514
01515     return 0
01516
01517
01518   def diagnostic(self, event, contribution):
01519     """ Obtain the diagnostic information of the event.
01520     """
01521     # Print the right message in the edit box for error and diagnostic
01522     self.__gui.drawGOSEDData.flagLine.setPaletteForegroundColor( QColor("black"))
01523     self.__gui.drawGOSEDData.flagLine.setText("Event has diagnostic data")
01524
01525     iter = DIAGcontributionIterator(event,contribution,self.TKRend(),self.__gui)
01526
01527     #~ self.__gui.drawGOSEDData.diagCAL.setText(CALdata)
01528     iter.iterateCAL()
01529     iter.iterateTKR()
01530
01531     #12 longwords in diagnostic
01532     self.diagnosticEnd(self.TKRend() + iter.size())
01533     return 0
01534
01535
01536   def error(self, event, contribution):
01537     """ Obtain the error information of the event.
01538     """
01539     gui = self.__gui
01540
01541     # Instead print the right message in the edit box for error and diagnostic
01542     gui.drawGOSEDData.flagLine.setPaletteForegroundColor( QColor("red"))
01543     if LDF.EventSummary.diagnostic(contribution.summary()):
01544       gui.drawGOSEDData.flagLine.setText("Event has diagnostic and error data")
01545     else:
01546       gui.drawGOSEDData.flagLine.setText("Event has error data")
01547
01548     errorWindow = gui.drawGOSEDData.error
01549
01550     # Dump error information for both CAL and TKR
01551     if  not LDF.EventSummary.error(contribution.summary()):
01552       return
01553
01554     if self.diagnosticEnd() != 0:
01555       offset=self.diagnosticEnd()
01556     else:
01557       offset=self.TKRend()
01558     iter = ERRcontributionIterator(event, contribution, offset, gui)
01559     theError = iter.theError()
01560
01561     #if errorWindow.isVisible():
01562     errorWindow.append(" Cable    Cable  ")
01563     errorWindow.append("timeout  phasing  TKR  CAL")
01564     errorWindow.append("   %1d        %1d    0x%02x  0x%01x" % \
01565                        (theError.tmo(),
01566                         theError.phs(),
01567                         theError.tkr(),
01568                         theError.cal()))
01569     errorWindow.append(" ")
01570
01571     iter.iterate()
01572
01573     self.errorEnd(offset + iter.size())
01574     return 0
01575
01576   #~ def cleanup(self, event, contribution):
01577     #~ prefix = "  "
01578     #~ src    = LATPcellHeader.source(contribution.header())
01579     #~ len    = (self.errorEnd() + 15) & 0xfffffff0L # Integer # of LATp cells
01580
01581     #~ # Check for extra data after the last LATp cell we expected
01582     #~ if (contribution.length() - len > 0):
01583       #~ print "%sFound %d bytes after end of TEM %d contribution" % \
01584             #~ (prefix, contribution.length() - len, src)
01585
01586     #~ # Check for non-zero data indicating we got lost during parsing
01587     #~ # LATp cell padding is expected to always be zeros
01588     #~ buffer  = Numeric.fromstring(contribution.payload(), 'u')
01589
01590     #~ mbz = buffer[(self.errorEnd())/4-2:]
01591
01592     #~ for word in mbz:
01593       #~ if word != 0:
01594         #~ print "%sNon-zero bytes beyond end of TEM %d contribution: 0x%08x" % \
01595               #~ (prefix, src, word)
01596     #~ return 0
01597
01598   def getAcdPeds(self):
01599     """ Returns the numarray of Acd pedestals
01600     Array shape is (12,18,2,2) (cable, channel, range, mean/rms)
01601     """
01602     return self.__acdPeds
01603   def getCalPeds(self):
01604     """ Returns the numarray of Cal pedestals
01605     Array shape is (16,8,12,2,4,2) (tower, layer, column, end, range, mean/rms)
01606     """
01607     return self.__calPeds
01608   def readPedestals(self):
01609     """ Retrieve pedestals from file. Needs ANCILLARY_ROOT in environment
01610     and assumes pedestal files are in ${ANCILLARY_ROOT}/Consumer/acdPeds.txt
01611     and calPeds.txt
01612     """
01613     import os
01614     import string
01615     if 'ANCILLARY_ROOT' in os.environ:
01616       import logging as myLog
01617       ifname = os.path.join(os.environ['ANCILLARY_ROOT'],'Consumer/acdPeds.txt')
01618       try:
01619         infile = open(ifname)
01620       except:
01621         return
01622       self.__acdPeds = Numeric.zeros((12,18,2,2))
01623       for line in infile.xreadlines():
01624         if line[0]=='!':
01625           continue
01626         # cable channel range mean rms
01627         entries = string.split(line)
01628         if len(entries)==5:
01629           self.__acdPeds[int(entries[0]),int(entries[1]),int(entries[2]),0] = float(entries[3])
01630           self.__acdPeds[int(entries[0]),int(entries[1]),int(entries[2]),1] = float(entries[4])
01631       infile.close()
01632       myLog.info('GOSED_LDF:readPedestals: Read in ACD pedestals from %s'%(ifname))
01633
01634       ifname = os.path.join(os.environ['ANCILLARY_ROOT'],'Consumer/calPeds.txt')
01635       try:
01636         infile = open(ifname)
01637       except:
01638         return
01639       self.__calPeds = Numeric.zeros((16,8,12,2,4,2))
01640       for line in infile.xreadlines():
01641         if line[0]=='!':
01642           continue
01643         # tower layer column end range mean rms
01644         entries = string.split(line)
01645         if len(entries)==7:
01646           self.__calPeds[int(entries[0]),int(entries[1]),int(entries[2]),int(entries[3]),int(entries[4]),0] = float(entries[5])
01647           self.__calPeds[int(entries[0]),int(entries[1]),int(entries[2]),int(entries[3]),int(entries[4]),1] = float(entries[6])
01648       infile.close()
01649       myLog.info('StandardPlotter:readPedestals: Read in CAL pedestals from %s'%(ifname))
01650
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDACDImpl.py Source File

gosed

GOSEDACDImpl.py

00001 # -*- coding: utf-8 -*-
00002 #!/usr/local/bin/python
00003 #
00004 #                               Copyright 2003
00005 #                                     by
00006 #                        The Board of Trustees of the
00007 #                     Leland Stanford Junior University.
00008 #                            All rights reserved.
00009 #
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST Online ACD Event Display"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = "12/12/2003"
00015 __version__  = "$Revision: 1.8 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import sys, string
00020 import operator, math
00021 from qt import *
00022 from GOSEDACD import ACDSingleEvtDisplay
00023 import colorScale
00024
00025 class ACDSingleEvtDisplayImpl(ACDSingleEvtDisplay):
00026
00027   def __init__(self, preferences, parent = None,name = None,fl = 0):
00028     ACDSingleEvtDisplay.__init__(self,parent,name,fl)
00029
00030     self.__preferences = preferences
00031
00032     self.rainbowScaleACD.setMinimumWidth(440)
00033     self.rainbowScaleACD.setMinimumHeight(15)
00034     self.rainbowScaleACD.setMaximumWidth(440)
00035     self.rainbowScaleACD.setMaximumHeight(15)
00036     self.rainbowScaleACD.setEnabled(0)
00037
00038     self.rainbowPixmap = QPixmap(440, 15)
00039     p = QPainter(self.rainbowPixmap)
00040
00041     minV  = 1.0e-15
00042     maxV  = 1.0 - minV
00043     value = minV
00044
00045     # Divide length of the frame (400) in intervals of 1
00046     dV = (maxV - minV) / float(self.rainbowScaleACD.width())
00047     tileWidth  = 1
00048     tileHeight = 15
00049     for i in range(0, self.rainbowScaleACD.width()):
00050       r, g, b = colorScale.colorScale(value)
00051       p.setBrush(QColor(r, g, b))
00052       p.setPen(QColor(r, g, b))
00053       p.drawRect(i*tileWidth,                0,
00054                  (i + 1)*tileWidth, tileHeight
00055                  )
00056       value += dV
00057
00058     self.relabel()
00059
00060     self.paintBackground()
00061
00062   def relabel(self):
00063     minValue = self.__preferences.minACD()
00064     maxValue = self.__preferences.maxACD()
00065
00066     interval = (maxValue - minValue)/5
00067
00068     self.redLbl.setText(str(minValue))
00069     self.orangeLbl.setText(str(minValue + 1*interval))
00070     self.yellowLbl.setText(str(minValue + 2*interval))
00071     self.greenLbl.setText(str(minValue + 3*interval))
00072     self.blueLbl.setText(str(minValue + 4*interval))
00073     self.violetLbl.setText(str(maxValue))
00074
00075   def paintEvent(self, pe):
00076     """ Paint Event function for the rainbow scale
00077     \param pe            paint event
00078     """
00079
00080     self.paintBackground()
00081
00082   def paintBackground(self):
00083     bitBlt(self.rainbowScaleACD, 0 , 0, self.rainbowPixmap, 0, 0)
00084
00085 if __name__ == "__main__":
00086   a = QApplication(sys.argv)
00087   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00088   w = ACDSingleEvtDisplayImpl()
00089   a.setMainWidget(w)
00090   w.show()
00091   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDCALImpl.py Source File

gosed

GOSEDCALImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 from qt import *
00005 from GOSEDCAL import GOSEDCALWindow
00006 import colorScale
00007
00008
00009 class GOSEDCALImpl(GOSEDCALWindow):
00010   def __init__(self, preferences, parent = None,name = None,fl = 0):
00011     GOSEDCALWindow.__init__(self,parent,name,fl)
00012
00013     self.__preferences = preferences
00014
00015     self.rainbowScaleCAL.setMinimumWidth(410)
00016     self.rainbowScaleCAL.setMinimumHeight(15)
00017     self.rainbowScaleCAL.setMaximumWidth(410)
00018     self.rainbowScaleCAL.setMaximumHeight(15)
00019     self.rainbowScaleCAL.setEnabled(0)
00020
00021     self.rainbowPixmap = QPixmap(410, 15)
00022     p = QPainter(self.rainbowPixmap)
00023
00024     minV  = 1.0e-15
00025     maxV  = 1.0 - minV
00026     value = minV
00027
00028     # Divide length of the frame (400) in intervals of 1
00029     dV = (maxV - minV) / float(self.rainbowScaleCAL.width())
00030     tileWidth  = 1
00031     tileHeight = 15
00032     for i in range(0, self.rainbowScaleCAL.width()):
00033       r, g, b = colorScale.colorScale(value)
00034       p.setBrush(QColor(r, g, b))
00035       p.setPen(QColor(r, g, b))
00036       p.drawRect(i*tileWidth,                0,
00037                  (i + 1)*tileWidth, tileHeight
00038                  )
00039       value += dV
00040
00041     self.relabel()
00042
00043     self.paintBackground()
00044
00045   def relabel(self):
00046     minValue = self.__preferences.minCAL()
00047     maxValue = self.__preferences.maxCAL()
00048
00049     interval = (maxValue - minValue)/5
00050
00051     self.redLbl.setText(str(minValue))
00052     self.orangeLbl.setText(str(minValue + 1*interval))
00053     self.yellowLbl.setText(str(minValue + 2*interval))
00054     self.greenLbl.setText(str(minValue + 3*interval))
00055     self.blueLbl.setText(str(minValue + 4*interval))
00056     self.violetLbl.setText(str(maxValue))
00057
00058   def paintEvent(self, pe):
00059     """ Paint Event function for the rainbow scale
00060     \param pe            paint event
00061     """
00062
00063     self.paintBackground()
00064
00065   def paintBackground(self):
00066     bitBlt(self.rainbowScaleCAL, 0 , 0, self.rainbowPixmap, 0, 0)
00067
00068
00069 if __name__ == "__main__":
00070   a = QApplication(sys.argv)
00071   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00072   w = GOSEDCALImpl()
00073   a.setMainWidget(w)
00074   w.show()
00075   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDCALTKRImpl.py Source File

gosed

GOSEDCALTKRImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 from qt import *
00005 from GOSEDCALTKR import GOSEDCALTKRWindow
00006 import colorScale
00007
00008
00009 class GOSEDCALTKRImpl(GOSEDCALTKRWindow):
00010
00011   def __init__(self, preferences, parent = None,name = None,fl = 0):
00012     GOSEDCALTKRWindow.__init__(self,parent,name,fl)
00013
00014     self.__preferences = preferences
00015
00016     self.rainbowScaleCAL.setMinimumWidth(410)
00017     self.rainbowScaleCAL.setMinimumHeight(15)
00018     self.rainbowScaleCAL.setMaximumWidth(410)
00019     self.rainbowScaleCAL.setMaximumHeight(15)
00020     self.rainbowScaleCAL.setEnabled(0)
00021
00022     self.rainbowPixmap = QPixmap(410, 15)
00023     p = QPainter(self.rainbowPixmap)
00024
00025     minV  = 1.0e-15
00026     maxV  = 1.0 - minV
00027     value = minV
00028
00029     # Divide length of the frame (400) in intervals of 1
00030     dV = (maxV - minV) / float(self.rainbowScaleCAL.width())
00031     tileWidth  = 1
00032     tileHeight = 15
00033     for i in range(0, self.rainbowScaleCAL.width()):
00034       r, g, b = colorScale.colorScale(value)
00035       p.setBrush(QColor(r, g, b))
00036       p.setPen(QColor(r, g, b))
00037       p.drawRect(i*tileWidth,                0,
00038                  (i + 1)*tileWidth, tileHeight
00039                  )
00040       value += dV
00041
00042     self.relabel()
00043
00044     self.paintBackground()
00045
00046   def relabel(self):
00047     minValue = self.__preferences.minCAL()
00048     maxValue = self.__preferences.maxCAL()
00049
00050     interval = (maxValue - minValue)/5
00051
00052     self.redLbl.setText(str(minValue))
00053     self.orangeLbl.setText(str(minValue + 1*interval))
00054     self.yellowLbl.setText(str(minValue + 2*interval))
00055     self.greenLbl.setText(str(minValue + 3*interval))
00056     self.blueLbl.setText(str(minValue + 4*interval))
00057     self.violetLbl.setText(str(maxValue))
00058
00059   def paintEvent(self, pe):
00060     """ Paint Event function for the rainbow scale
00061     \param pe            paint event
00062     """
00063
00064     self.paintBackground()
00065
00066   def paintBackground(self):
00067     bitBlt(self.rainbowScaleCAL, 0, 0, self.rainbowPixmap, 0, 0)
00068
00069
00070 if __name__ == "__main__":
00071   a = QApplication(sys.argv)
00072   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00073   w = GOSEDCALTKRImpl()
00074   a.setMainWidget(w)
00075   w.show()
00076   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDDataImpl.py Source File

gosed

GOSEDDataImpl.py

00001 # -*- coding: utf-8 -*-
00002 #!/usr/local/bin/python
00003 #
00004 #                               Copyright 2003
00005 #                                     by
00006 #                        The Board of Trustees of the
00007 #                     Leland Stanford Junior University.
00008 #                            All rights reserved.
00009 #
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST Online ACD Event Display"
00013 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = "12/12/2003"
00015 __version__  = "$Revision: 1.9 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import sys, string
00020 import operator, math
00021 from qt import *
00022 from GOSEDData import GOSEDDataWindow
00023
00024
00025 class GOSEDDataImpl(GOSEDDataWindow):
00026
00027   def __init__(self, gui, parent = None,name = None,fl = 0):
00028     GOSEDDataWindow.__init__(self,parent,name,fl)
00029
00030     self.__gui = gui
00031
00032     self.formatCALview()
00033     self.formatTKRview()
00034     self.formatDiagCALview()
00035     self.formatDiagTKRview()
00036
00037   def formatCALview(self):
00038     CALheader = self.CALview.header()
00039
00040     self.CALview.setColumnWidth(0,40)
00041     self.CALview.setColumnWidth(1,40)
00042     self.CALview.setColumnWidth(2,40)
00043     self.CALview.setColumnWidth(3,50)
00044     self.CALview.setColumnWidth(4,50)
00045     self.CALview.setColumnWidth(5,60)
00046     self.CALview.setColumnWidth(6,50)
00047     self.CALview.setColumnWidth(7,60)
00048     self.CALview.setColumnWidth(8,40)
00049     self.CALview.setColumnWidth(9,40)
00050
00051
00052   def formatTKRview(self):
00053     TKRheader = self.TKRview.header()
00054
00055     self.TKRview.setColumnWidth(0,40)
00056     self.TKRview.setColumnWidth(1,35)
00057     self.TKRview.setColumnWidth(2,60)
00058     self.TKRview.setColumnWidth(3,50)
00059     self.TKRview.setColumnWidth(4,50)
00060     self.TKRview.setColumnWidth(5,50)
00061     self.TKRview.setColumnWidth(6,50)
00062     self.TKRview.setColumnWidth(7,50)
00063
00064   def formatDiagCALview(self):
00065     CALheader = self.diagCAL.header()
00066
00067     #~ CALheader.setFixedHeight(35)
00068     CALheader.setLabel(0, "GCCC")
00069     CALheader.setLabel(1, "Layer")
00070     CALheader.setLabel(2, "  Negative\nLog Accepts")
00071     CALheader.setLabel(3, "Layer End\n   High")
00072     CALheader.setLabel(4, "Layer End\n   Low")
00073     CALheader.setLabel(5, "  Positive\nLog Accepts")
00074     CALheader.setLabel(6, "Layer End\n   High")
00075     CALheader.setLabel(7, "Layer End\n   Low")
00076
00077     self.diagCAL.setColumnWidth(0,40)
00078     self.diagCAL.setColumnWidth(1,45)
00079     self.diagCAL.setColumnWidth(2,90)
00080     self.diagCAL.setColumnWidth(3,75)
00081     self.diagCAL.setColumnWidth(4,75)
00082     self.diagCAL.setColumnWidth(5,90)
00083     self.diagCAL.setColumnWidth(6,75)
00084     self.diagCAL.setColumnWidth(7,75)
00085
00086   def formatDiagTKRview(self):
00087     TKRheader = self.diagTKR.header()
00088     TKRheader.setFixedHeight(35)
00089     TKRheader.setLabel(0, "  GTCC")
00090     TKRheader.setLabel(1, " Trigger Request GTRC")
00091     self.diagTKR.setColumnWidth(0,60)
00092     #~ self.diagTKR.setColumnWidth(1,90)
00093
00094   def showEvent(self, se):
00095     self.__gui.replot()
00096
00097
00098 if __name__ == "__main__":
00099   a = QApplication(sys.argv)
00100   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00101   w = GOSEDDataImpl()
00102   a.setMainWidget(w)
00103   w.show()
00104   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gosedImpl.py Source File

gosed

gosedImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online Single Event Display Modular"
00012 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/20/2003"
00014 __version__  = "$Revision: 1.16 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019 from   qt                    import *
00020 #~ from   gutil                 import hexConvert
00021 import sys, string
00022 import operator, math
00023 import Numeric
00024 import time
00025 import struct
00026
00027 from   gosed                 import singleEvtDisplay
00028 from   ServerPreferencesImpl import ServerPreferencesImpl
00029 from   GOSEDPreferencesImpl  import GOSEDPreferencesImpl
00030 from   GOSEDReadme           import GOSEDReadme
00031
00032 import GOSEDACDImpl
00033 import GOSEDTWRImpl
00034 import GOSEDCALImpl
00035 import GOSEDTKRImpl
00036 import GOSEDCALTKRImpl
00037 import GOSEDDataImpl
00038 import GOSEDPainter
00039 import GOTEDImpl
00040 import GOSED_LDF
00041 import LDF
00042 #~ import DataDistributorPoll as DDP
00043 from   LATTE.client.gBits    import hexConvert
00044 import LATTE.tools.DataDistributorPoll as DDP
00045
00046 import atexit
00047
00048
00049 class singleEvtDisplayImpl(singleEvtDisplay):
00050   """ \brief Glast Online Single Event Display (GOSED)
00051
00052   This class:
00053   1. Manages all the GUI functions for GOSED.
00054   2. Retreives the TKR and CAL projections' pixmaps from GOSEDPainter.
00055   3. Loads all the information from the current event processed by GOSED_LDF,
00056   """
00057
00058   def __init__(self,filename = None,parent = None,name = None,fl = 0):
00059     """ singleEvtDisplayImpl contructor
00060
00061     \param filename      None
00062     \param parent        None
00063     \param name          None
00064     \param fl            0
00065     """
00066
00067     # Initialize variables
00068     singleEvtDisplay.__init__(self,parent,name,fl)
00069     self.flagDisabledPixmap = self.image4
00070     self.flagEnabledPixmap  = self.image3
00071
00072     # Initialize variables
00073     self.__fn      = filename
00074     self.__ds      = None
00075     self.__file    = None
00076     self.__fits    = None
00077     self.__data    = None
00078     self.__evtList = []
00079
00080     self.__lci     = GOSED_LDF.myLATcomponentIterator(self)
00081     self.__ldbi    = LDF.LATdataBufferIterator(self.__lci)
00082
00083     # Set default led flags
00084     #~ self.errorFlag.setPixmap(self.flagDisabledPixmap)
00085     #~ self.diagnosticFlag.setPixmap(self.flagDisabledPixmap)
00086
00087     # Initialize Preferences windows
00088     import ConfigParser                 # Triage...
00089     self.__confParser = ConfigParser.ConfigParser() # Should have 1 Prefs GUI
00090     self.ServerPreferencesGUI = ServerPreferencesImpl(self.__confParser, self)
00091     self.GOSEDPreferencesGUI  = GOSEDPreferencesImpl(self.__confParser, self)
00092
00093     if self.GOSEDPreferencesGUI.EventlimitsButton.isChecked():
00094       self.preferredLimits = "Event"
00095     elif self.GOSEDPreferencesGUI.CALlimitsButton.isChecked():
00096       self.preferredLimits = "Default"
00097     elif self.GOSEDPreferencesGUI.CustomlimitsButton.isChecked():
00098       self.preferredLimits = "Custom"
00099     else:
00100       self.preferredLimits = "Event"
00101
00102     # Create dock windows
00103     self.createDockWindows()
00104
00105     prefs = self.GOSEDPreferencesGUI
00106
00107     # Create Painters
00108     self.drawGOSEDACD = GOSEDACDImpl.ACDSingleEvtDisplayImpl(prefs, self.__dwGOSEDACD)
00109     self.__dwGOSEDACD.setWidget(self.drawGOSEDACD)
00110
00111     self.drawGOSEDCAL = GOSEDCALImpl.GOSEDCALImpl(prefs, self.__dwGOSEDCAL)
00112     self.__dwGOSEDCAL.setWidget(self.drawGOSEDCAL)
00113
00114     self.drawGOSEDTKR = GOSEDTKRImpl.GOSEDTKRImpl(self.__dwGOSEDTKR)
00115     self.__dwGOSEDTKR.setWidget(self.drawGOSEDTKR)
00116
00117     self.drawGOSEDTWR = GOSEDTWRImpl.GOSEDTWRImpl(self.__dwGOSEDTWR)
00118     self.__dwGOSEDTWR.setWidget(self.drawGOSEDTWR)
00119
00120     self.drawGOSEDCALTKR = GOSEDCALTKRImpl.GOSEDCALTKRImpl(prefs, self.__dwGOSEDCALTKR)
00121     self.__dwGOSEDCALTKR.setWidget(self.drawGOSEDCALTKR)
00122
00123     self.drawGOSEDData = GOSEDDataImpl.GOSEDDataImpl(self, self.__dwGOSEDData)
00124     self.__dwGOSEDData.setWidget(self.drawGOSEDData)
00125
00126     self.drawGOTED = GOTEDImpl.towerEvtDisplayImpl(self.__dwGOTED)
00127     self.__dwGOTED.setWidget(self.drawGOTED)
00128
00129     # Add default setup Dock Windows ATK-060904 -- WORK THIS OUT!!
00130     self.addDockWindow(self.__dwGOSEDTWR , Qt.DockLeft, True)
00131     if not self.GOSEDPreferencesGUI.twr():  self.__dwGOSEDTWR.hide()
00132
00133     self.addDockWindow(self.__dwGOSEDCALTKR , Qt.DockLeft, False)
00134     if not self.GOSEDPreferencesGUI.calTkr():  self.__dwGOSEDCALTKR.hide()
00135
00136     self.addDockWindow(self.__dwGOSEDData, Qt.DockRight, False)
00137     if not self.GOSEDPreferencesGUI.data():  self.__dwGOSEDData.hide()
00138
00139     self.addDockWindow(self.__dwGOSEDTKR , Qt.DockLeft, False)
00140     if not self.GOSEDPreferencesGUI.tkr():  self.__dwGOSEDTKR.hide()
00141
00142     self.addDockWindow(self.__dwGOSEDACD , Qt.DockRight, True)
00143     if not self.GOSEDPreferencesGUI.acd():  self.__dwGOSEDACD.hide()
00144
00145     self.addDockWindow(self.__dwGOSEDCAL,  Qt.DockLeft,  False)
00146     if not self.GOSEDPreferencesGUI.cal():  self.__dwGOSEDCAL.hide()
00147
00148     self.addDockWindow(self.__dwGOTED,  Qt.DockRight,  True)
00149     if not self.GOSEDPreferencesGUI.ted():  self.__dwGOTED.hide()
00150
00151     # Custom Widgets setup
00152     self.setFocusPolicy(QWidget.StrongFocus)
00153
00154     # TKR and CAL
00155     self.xzTKR = self.drawGOSEDTKR.xzTKR
00156     self.yzTKR = self.drawGOSEDTKR.yzTKR
00157     self.xzCAL = self.drawGOSEDCAL.xzCAL
00158     self.yzCAL = self.drawGOSEDCAL.yzCAL
00159
00160     xzTKRLayout = QGridLayout(self.xzTKR,0,0,0,-1,"gosedLayout")
00161     yzTKRLayout = QGridLayout(self.yzTKR,0,0,0,-1,"gosedLayout")
00162     xzCALLayout = QGridLayout(self.xzCAL,0,0,0,-1,"gosedLayout")
00163     yzCALLayout = QGridLayout(self.yzCAL,0,0,0,-1,"gosedLayout")
00164
00165     self.drawXZ_TKR = GOSEDPainter.drawXZ_TKR(self, self.xzTKR)
00166     self.drawYZ_TKR = GOSEDPainter.drawYZ_TKR(self, self.yzTKR)
00167     self.drawXZ_CAL = GOSEDPainter.drawXZ_CAL(self, self.xzCAL)
00168     self.drawYZ_CAL = GOSEDPainter.drawYZ_CAL(self, self.yzCAL)
00169
00170     xzTKRLayout.addWidget(self.drawXZ_TKR,0,0)
00171     yzTKRLayout.addWidget(self.drawYZ_TKR,0,0)
00172     xzCALLayout.addWidget(self.drawXZ_CAL,0,0)
00173     yzCALLayout.addWidget(self.drawYZ_CAL,0,0)
00174
00175     self.xzTKR2 = self.drawGOSEDCALTKR.xzTKR
00176     self.yzTKR2 = self.drawGOSEDCALTKR.yzTKR
00177     self.xzCAL2 = self.drawGOSEDCALTKR.xzCAL
00178     self.yzCAL2 = self.drawGOSEDCALTKR.yzCAL
00179
00180     xzTKRLayout2 = QGridLayout(self.xzTKR2,0,0,0,-1,"gosedLayout")
00181     yzTKRLayout2 = QGridLayout(self.yzTKR2,0,0,0,-1,"gosedLayout")
00182     xzCALLayout2 = QGridLayout(self.xzCAL2,0,0,0,-1,"gosedLayout")
00183     yzCALLayout2 = QGridLayout(self.yzCAL2,0,0,0,-1,"gosedLayout")
00184
00185     self.drawXZ_TKR2 = GOSEDPainter.drawXZ_TKR(self, self.xzTKR2)
00186     self.drawYZ_TKR2 = GOSEDPainter.drawYZ_TKR(self, self.yzTKR2)
00187     self.drawXZ_CAL2 = GOSEDPainter.drawXZ_CAL(self, self.xzCAL2)
00188     self.drawYZ_CAL2 = GOSEDPainter.drawYZ_CAL(self, self.yzCAL2)
00189
00190     xzTKRLayout2.addWidget(self.drawXZ_TKR2,0,0)
00191     yzTKRLayout2.addWidget(self.drawYZ_TKR2,0,0)
00192     xzCALLayout2.addWidget(self.drawXZ_CAL2,0,0)
00193     yzCALLayout2.addWidget(self.drawYZ_CAL2,0,0)
00194
00195     # ACD
00196     self.side1ACD = self.drawGOSEDACD.side1ACD
00197     self.side2ACD = self.drawGOSEDACD.side2ACD
00198     self.side3ACD = self.drawGOSEDACD.side3ACD
00199     self.side4ACD = self.drawGOSEDACD.side4ACD
00200     self.hatACD = self.drawGOSEDACD.hatACD
00201
00202     #hatWidth    = self.hatACD.width()
00203     #hatHeight   = self.hatACD.height()
00204     #side1Width  = self.side1ACD.width()
00205     #side1Height = self.side1ACD.height()
00206
00207     side1ACDLayout = QGridLayout(self.side1ACD,0,0,0,-1,"gosedLayout")
00208     side2ACDLayout = QGridLayout(self.side2ACD,0,0,0,-1,"gosedLayout")
00209     side3ACDLayout = QGridLayout(self.side3ACD,0,0,0,-1,"gosedLayout")
00210     side4ACDLayout = QGridLayout(self.side4ACD,0,0,0,-1,"gosedLayout")
00211     hatACDLayout = QGridLayout(self.hatACD,0,0,0,-1,"gosedLayout")
00212
00213     self.drawSide1ACD = GOSEDPainter.drawSide1ACD(self, self.side1ACD)
00214     self.drawSide2ACD = GOSEDPainter.drawSide2ACD(self, self.side2ACD)
00215     self.drawSide3ACD = GOSEDPainter.drawSide3ACD(self, self.side3ACD)
00216     self.drawSide4ACD = GOSEDPainter.drawSide4ACD(self, self.side4ACD)
00217     self.drawHatACD = GOSEDPainter.drawHatACD(self, self.hatACD)
00218
00219     #~ self.drawSide1ACD.setGeometry(0,0,hatWidth,side1Height)
00220
00221     side1ACDLayout.addWidget(self.drawSide1ACD,0,0)
00222     side2ACDLayout.addWidget(self.drawSide2ACD,0,0)
00223     side3ACDLayout.addWidget(self.drawSide3ACD,0,0)
00224     side4ACDLayout.addWidget(self.drawSide4ACD,0,0)
00225     hatACDLayout.addWidget(self.drawHatACD,0,0)
00226
00227     # CAL and TKR List Views setup:
00228     self.drawGOSEDData.TKRview.setColumnAlignment(0,self.AlignCenter)
00229     self.drawGOSEDData.TKRview.setColumnAlignment(1,self.AlignLeft)
00230
00231     self.drawGOSEDData.CALview.setColumnAlignment(0,self.AlignCenter)
00232     self.drawGOSEDData.CALview.setColumnAlignment(1,self.AlignLeft)
00233
00234     for i in range(2,9):#self.drawGOSEDData.Tkrview.columns()):
00235       self.drawGOSEDData.TKRview.setColumnAlignment(i,self.AlignRight)
00236       self.drawGOSEDData.CALview.setColumnAlignment(i,self.AlignRight)
00237
00238     self.drawGOSEDData.CALview.header().setMovingEnabled(0)
00239     self.drawGOSEDData.TKRview.header().setMovingEnabled(0)
00240
00241     # Buttons setup
00242     self.clearViews()
00243
00244     self.Go.setEnabled(0)
00245     self.Next.setEnabled(0)
00246     self.Previous.setEnabled(0)
00247     self.Stop.setEnabled(0)
00248
00249     self.drawGOSEDTWR.selectTWR.setEnabled(0)
00250     self.drawGOSEDCAL.selectRNG.setEnabled(0)
00251     self.drawGOSEDCAL.RNGAll.setEnabled(0)
00252     self.drawGOSEDCALTKR.selectRNG.setEnabled(0)
00253     self.drawGOSEDCALTKR.RNGAll.setEnabled(0)
00254
00255     for i in range(16):
00256       self.drawGOTED.towerList[i].setEnabled(1)
00257
00258     # Initialize timer
00259     self.__timer = QTimer(self)
00260
00261     # Connections
00262     self.connect(self.__timer, SIGNAL("timeout()"), self.nextClicked)
00263     #~ self.connect(self.__timer, SIGNAL("timeout()"), self.next)
00264
00265     self.connect(self.drawGOSEDTWR.selectTWR, SIGNAL('clicked(int)'), self.selectChange)
00266     self.connect(self.drawGOSEDCAL.scaleSelection, SIGNAL('activated(int)'), self.selectChange)
00267     self.connect(self.drawGOSEDCALTKR.scaleSelection, SIGNAL('activated(int)'), self.selectChange)
00268     self.connect(self.drawGOSEDCAL.selectRNG, SIGNAL('clicked(int)'), self.selectChange)
00269     self.connect(self.drawGOSEDCALTKR.selectRNG, SIGNAL('clicked(int)'), self.selectChange)
00270     self.connect(self.drawGOTED.refreshButton, SIGNAL('clicked()'), self.selectChange)
00271
00272     atexit.register(self.fileExit)
00273
00274     #~ bitBlt(self.drawXZ_TKR.final, 0, 0, self.drawXZ_TKR.background)
00275     #~ bitBlt(self.drawYZ_TKR.final, 0, 0, self.drawYZ_TKR.background)
00276     #~ bitBlt(self.drawXZ_CAL.final, 0, 0, self.drawXZ_CAL.background)
00277     #~ bitBlt(self.drawYZ_CAL.final, 0, 0, self.drawYZ_CAL.background)
00278
00279     #~ bitBlt(self.drawXZ_TKR2.final, 0, 0, self.drawXZ_TKR2.background)
00280     #~ bitBlt(self.drawYZ_TKR2.final, 0, 0, self.drawYZ_TKR2.background)
00281     #~ bitBlt(self.drawXZ_CAL2.final, 0, 0, self.drawXZ_CAL2.background)
00282     #~ bitBlt(self.drawYZ_CAL2.final, 0, 0, self.drawYZ_CAL2.background)
00283
00284
00285   def createDockWindows(self):
00286
00287     # Create Dock for GLAST Online Single Event Display TWR Window (GOSEDTWR)
00288     self.__dwGOSEDTWR = QDockWindow()
00289     self.__dwGOSEDTWR.setResizeEnabled(0)
00290     self.__dwGOSEDTWR.setCloseMode(QDockWindow.Always)
00291     self.__dwGOSEDTWR.setCaption('GOSEDTWR')
00292     #~ self.__teComments = self.__comments.getWidget()
00293     #~ self.setDockEnabled(self.__dwGOSEDTWR, Qt.DockTop, 1)
00294     #~ self.setDockEnabled(self.__dwGOSEDTWR, Qt.DockBottom, 0)
00295     #~ self.setDockEnabled(self.__dwGOSEDTWR, Qt.DockRight, 0)
00296     #~ self.setDockEnabled(self.__dwGOSEDTWR, Qt.DockLeft, 0)
00297
00298     #~ self.__dwGOSEDTWR.setFixedExtentWidth(428)
00299     #~ self.__dwGOSEDTWR.setFixedExtentHeight(315)
00300
00301     # Create Dock for GLAST Online Single Event Display TKR Window (GOSEDTKR)
00302     self.__dwGOSEDTKR = QDockWindow()
00303     self.__dwGOSEDTKR.setResizeEnabled(0)
00304     self.__dwGOSEDTKR.setCloseMode(QDockWindow.Always)
00305     self.__dwGOSEDTKR.setCaption('GOSEDTKR')
00306     #~ self.__teComments = self.__comments.getWidget()
00307     #~ self.setDockEnabled(self.__dwGOSEDTKR, Qt.DockTop, 0)
00308     #~ self.setDockEnabled(self.__dwGOSEDTKR, Qt.DockBottom, 1)
00309     #~ self.setDockEnabled(self.__dwGOSEDTKR, Qt.DockRight, 0)
00310     #~ self.setDockEnabled(self.__dwGOSEDTKR, Qt.DockLeft, 0)
00311
00312     self.__dwGOSEDTKR.setFixedExtentWidth(428)
00313     self.__dwGOSEDTKR.setFixedExtentHeight(315)
00314
00315     # Create Dock for GLAST Online Single Event Display CAL Window (GOSEDCAL)
00316     self.__dwGOSEDCAL = QDockWindow()
00317     self.__dwGOSEDCAL.setResizeEnabled(0)
00318     self.__dwGOSEDCAL.setCloseMode(QDockWindow.Always)
00319     self.__dwGOSEDCAL.setCaption('GOSEDCAL')
00320     #~ self.__teComments = self.__comments.getWidget()
00321     #~ self.setDockEnabled(self.__dwGOSEDCAL, Qt.DockTop, 0)
00322     #~ self.setDockEnabled(self.__dwGOSEDCAL, Qt.DockBottom, 1)
00323     #~ self.setDockEnabled(self.__dwGOSEDCAL, Qt.DockRight, 0)
00324     #~ self.setDockEnabled(self.__dwGOSEDCAL, Qt.DockLeft, 0)
00325
00326     self.__dwGOSEDCAL.setFixedExtentWidth(428)
00327     self.__dwGOSEDCAL.setFixedExtentHeight(115)
00328
00329     # Create Dock for GLAST Online Single Event Display CAL & TKR Window (GOSEDCAL)
00330     self.__dwGOSEDCALTKR = QDockWindow()
00331     self.__dwGOSEDCALTKR.setResizeEnabled(0)
00332     self.__dwGOSEDCALTKR.setCloseMode(QDockWindow.Always)
00333     self.__dwGOSEDCALTKR.setCaption('GOSEDCAL')
00334     #~ self.__teComments = self.__comments.getWidget()
00335     #~ self.setDockEnabled(self.__dwGOSEDCALTKR, Qt.DockTop, 0)
00336     #~ self.setDockEnabled(self.__dwGOSEDCALTKR, Qt.DockBottom, 1)
00337     #~ self.setDockEnabled(self.__dwGOSEDCALTKR, Qt.DockRight, 0)
00338     #~ self.setDockEnabled(self.__dwGOSEDCALTKR, Qt.DockLeft, 0)
00339
00340     #~ self.__dwGOSEDCALTKR.setFixedExtentWidth(428)
00341     #~ self.__dwGOSEDCALTKR.setFixedExtentHeight(115)
00342
00343     # Create Dock for GLAST Online ACD Event Display (GOSEDACD)
00344     self.__dwGOSEDACD = QDockWindow()
00345     self.__dwGOSEDACD.setResizeEnabled(0)
00346     self.__dwGOSEDACD.setCloseMode(QDockWindow.Always)
00347     self.__dwGOSEDACD.setCaption('GOSEDACD')
00348     self.__dwGOSEDACD.setNewLine(True)
00349     #~ self.__teComments = self.__comments.getWidget()
00350     #~ self.setDockEnabled(self.__dwGOSEDACD, Qt.DockTop, 0)
00351     #~ self.setDockEnabled(self.__dwGOSEDACD, Qt.DockBottom, 0)
00352     #~ self.setDockEnabled(self.__dwGOSEDACD, Qt.DockRight, 1)
00353     #~ self.setDockEnabled(self.__dwGOSEDACD, Qt.DockLeft, 0)
00354     #~  ,
00355     self.__dwGOSEDACD.setFixedExtentWidth(428)
00356     self.__dwGOSEDACD.setFixedExtentHeight(428)
00357
00358     # Create Dock for GLAST Online Single Event Display Data Window(GOSED Data)
00359     self.__dwGOSEDData = QDockWindow()
00360     self.__dwGOSEDData.setResizeEnabled(1)
00361     self.__dwGOSEDData.setCloseMode(QDockWindow.Always)
00362     self.__dwGOSEDData.setCaption('GOSEDData')
00363     self.__dwGOSEDData.setNewLine(True)
00364     #~ self.__teComments = self.__comments.getWidget()
00365     #~ self.setDockEnabled(self.__dwGOSEDData, Qt.DockTop, 0)
00366     #~ self.setDockEnabled(self.__dwGOSEDData, Qt.DockBottom, 0)
00367     #~ self.setDockEnabled(self.__dwGOSEDData, Qt.DockRight, 1)
00368     #~ self.setDockEnabled(self.__dwGOSEDData, Qt.DockLeft, 0)
00369
00370     self.__dwGOSEDData.setFixedExtentWidth(428)
00371     self.__dwGOSEDData.setFixedExtentHeight(100)
00372
00373     # Create Dock for GLAST Online Tower Event Display (GOTED)
00374     self.__dwGOTED = QDockWindow()
00375     self.__dwGOTED.setResizeEnabled(1)
00376     self.__dwGOTED.setCloseMode(QDockWindow.Always)
00377     self.__dwGOTED.setCaption('GOTED')
00378     #~ self.__teComments = self.__comments.getWidget()
00379     #~ self.setDockEnabled(self.__dwGOTED, Qt.DockTop, 0)
00380     #~ self.setDockEnabled(self.__dwGOTED, Qt.DockBottom, 0)
00381     #~ self.setDockEnabled(self.__dwGOTED, Qt.DockRight, 1)
00382     #~ self.setDockEnabled(self.__dwGOTED, Qt.DockLeft, 0)
00383     self.__dwGOTED.setFixedExtentWidth(50)
00384     self.__dwGOTED.setFixedExtentHeight(50)
00385     #~ self.addDockWindow(self.__dwGOTED, Qt.DockRight)
00386
00387     # Dock in initial configuration
00388     #~ self.__dockArea = QDockArea(Qt.Horizontal, QDockArea.Normal,self)
00389     #~ self.__dockArea.moveDockWindow(self.__dwGOSEDTWR, 0)
00390     #~ self.__dockArea.moveDockWindow(self.__dwGOSEDTKR, 1)
00391     #~ self.__dockArea.moveDockWindow(self.__dwGOSEDCAL, 2)
00392     #~ self.__dockArea.moveDockWindow(self.__dwGOSEDData, 3)
00393     #~ self.__dockArea.moveDockWindow(self.__dwGOSEDACD, 4)
00394     #~ self.__dockArea.moveDockWindow(self.__dwGOTED, 5)
00395
00396
00397     #~ self.__dwGOSEDTWR.show()
00398
00399     #~ self.addDockWindow(self.__dwGOSEDTWR, self.__dwGOSEDTWR.dock())#Qt.DockLeft)
00400     #~ self.addDockWindow(self.__dwGOSEDTKR, self.__dwGOSEDTKR.dock())#Qt.DockBottom)
00401     #~ self.addDockWindow(self.__dwGOSEDCAL, self.__dwGOSEDCAL.dock())#Qt.DockBottom)
00402     #~ self.addDockWindow(self.__dwGOSEDData,self.__dwGOSEDData.dock())#Qt.DockRight)
00403     #~ self.addDockWindow(self.__dwGOSEDACD,self.__dwGOSEDACD.dock())#Qt.DockRight)
00404     #~ self.addDockWindow(self.__dwGOTED,self.__dwGOTED.dock())#Qt.DockRight)
00405     #~ self.addDockWindow(self.__dwGOSEDTWR,  Qt.DockLeft,  True)
00406     #~ self.addDockWindow(self.__dwGOSEDTKR,  Qt.DockLeft,  False)
00407
00408
00409
00410   def dockGOSEDTWR(self):
00411     #~ self.addDockWindow(self.__dwGOSEDTWR, Qt.DockTop)
00412     self.__dwGOSEDTWR.show()
00413     self.GOSEDPreferencesGUI.twr(True)
00414     self.__shown()
00415
00416   def dockGOSEDTKR(self):
00417     #~ self.addDockWindow(self.__dwGOSEDTWR, Qt.DockBottom)
00418     #~ self.drawXZ_TKR.final = QPixmap()
00419     #~ self.drawYZ_TKR.final = QPixmap()
00420     #~ self.drawXZ_CAL.final = QPixmap()
00421     #~ self.drawYZ_CAL.final = QPixmap()
00422
00423     #~ self.drawXZ_TKR2.final = QPixmap()
00424     #~ self.drawYZ_TKR2.final = QPixmap()
00425     #~ self.drawXZ_CAL2.final = QPixmap()
00426     #~ self.drawYZ_CAL2.final = QPixmap()
00427     self.__dwGOSEDTKR.show()
00428     self.GOSEDPreferencesGUI.tkr(True)
00429     self.__shown()
00430
00431   def dockGOSEDCAL(self):
00432     #~ self.addDockWindow(self.__dwGOSEDTWR, Qt.DockBottom)
00433     self.__dwGOSEDCAL.show()
00434     self.GOSEDPreferencesGUI.cal(True)
00435     self.__shown()
00436
00437   def dockGOSEDCALTKR(self):
00438     #~ self.addDockWindow(self.__dwGOSEDTWR, Qt.DockBottom)
00439     self.__dwGOSEDCALTKR.show()
00440     self.GOSEDPreferencesGUI.calTkr(True)
00441     self.__shown()
00442
00443   def dockGOSEDData(self):
00444     #~ self.addDockWindow(self.__dwGOSEDData, Qt.DockRight)
00445     self.__dwGOSEDData.show()
00446     self.GOSEDPreferencesGUI.data(True)
00447     self.__shown()
00448
00449   def dockGOTED(self):
00450     #~ self.addDockWindow(self.__dwGOTED, Qt.DockRight)
00451     self.__dwGOTED.show()
00452     self.GOSEDPreferencesGUI.ted(True)
00453     self.__shown()
00454
00455   def dockGOSEDACD(self):
00456     #~ self.addDockWindow(self.__dwGOSEDACD, Qt.DockRight)
00457     self.__dwGOSEDACD.show()
00458     self.GOSEDPreferencesGUI.acd(True)
00459     self.__shown()
00460
00461   def mousePressEvent(self, e):
00462     for i in range(16):
00463       if self.drawGOTED.towerList[i].hasMouse():
00464         Zpm = self.clickTWR(i)
00465         if Zpm is None:
00466           return
00467         twrButton = self.drawGOSEDTWR.selectTWR.find(i)
00468         twrButton.setOn(1)
00469         self.selectChange()
00470         bitBlt(self.drawGOTED.towerList[i], 0, 0, Zpm , 0, 0)
00471
00472
00473   def clickTWR(self, id):
00474     if self.drawGOTED.final[id].isNull():
00475       #~ bitBlt(Zpm, 0, 0, self.drawGOTED.noBgrZ , 0, 0)
00476       return
00477     Zpm = QPixmap(self.drawGOTED.towerList[id].width(),
00478                   self.drawGOTED.towerList[id].height())
00479     bitBlt(Zpm, 0, 0, self.drawGOTED.final[id] , 0, 0)
00480     self.pTWR = QPainter(Zpm)
00481     #~ self.pCAL.setBrush(color)
00482     self.pTWR.setPen(QColor("red"))
00483     self.pTWR.drawRect(0,0,
00484                        self.drawGOTED.towerList[id].width(),
00485                        self.drawGOTED.towerList[id].height()
00486                        )
00487     self.pTWR.end()
00488     return Zpm
00489
00490
00491   def plot(self):
00492     """ Plot is the heart of GOSED. It strips the information of the event
00493     from the data string and passes it to GOSED_LDF, initializing the
00494     iteration over all the entries of the event.
00495     It manages three kinds of sources of data:
00496     1. Data from .arch files
00497     2. Data from .fits files
00498     3. Data from server
00499     It also manages the reinizialization of all the gui's outputs, calling
00500     clearviews() to delete the information from a previous event
00501     """
00502
00503     if self.__file is not None:
00504       if str(self.__fn).endswith(".ldf", False) or str(self.__fn).endswith(".arch", False) \
00505          or str(self.__fn).endswith(".dge", False):
00506
00507         evtPtr = self.__file.tell()
00508         #~ print "plot: evtPtr =", evtPtr
00509
00510         self.__evtList.append(evtPtr)
00511         #~ print "-------> plot: eventList = ", self.__evtList
00512
00513         data = self.__file.read(8)
00514
00515         if len(data) < 8:
00516           print "End of File: " , (self.__fn)
00517           #~ self.__pauseDisplay = 1
00518           self.statusBar().message("End of File: %s" % (self.__fn), 2000)
00519           self.Next.setEnabled(0)
00520           self.Previous.setEnabled(1)
00521           self.Go.setEnabled(0)
00522           self.Stop.setEnabled(0)
00523           self.__timer.stop()
00524
00525           if self.__evtList.count(evtPtr) != 1:
00526             self.__evtList.pop()
00527             #~ print "-------> plot: eventList = ", self.__evtList
00528
00529           return
00530
00531         (identity, length) = struct.unpack('!LL', data)
00532         data              += self.__file.read(length - 8)
00533
00534     elif self.__fits is not None:
00535       data = self.__fits.read()
00536       if data is None:
00537         print "End of File: " , (self.__fn)
00538         #~ self.__pauseDisplay = 1
00539         self.statusBar().message("End of File: %s" % (self.__fn), 2000)
00540         self.__timer.stop()
00541         self.Next.setEnabled(0)
00542         self.Go.setEnabled(0)
00543         self.Stop.setEnabled(0)
00544         return
00545
00546     elif self.__ds is not None:
00547       #import gutil
00548       data, sender = self.__ds.receive()
00549       if data is None or len(data) == 0:
00550         return
00551       #print gutil.hexConvert(data)
00552
00553     else:
00554       print "No data source open for display"
00555       self.statusBar().message("No data source open for display", 2000)
00556       self.__timer.stop()
00557       return
00558
00559     # Clear the display
00560     self.drawGOSEDData.totHits.clear()  # RiC 10/30/03 added this line
00561     self.clearViews()                   # RiC 10/30/03 added this line
00562
00563     #~ Obsolete:
00564     #~ self.existsTWRdata = 0
00565     #~ self.existsCALTWRdata = 0
00566
00567     # Iterate over all entries for the current data buffer
00568     # RiC: A buffer is allowed to contain more than one event, but doesn't now.
00569     #      May have to rethink this when it does.
00570     self.__ldbi.iterate(data, len(data)) # RiC 4/2/04 switched to the new way
00571
00572   def replot(self):
00573     # Clear the display
00574     self.drawGOSEDData.totHits.clear()  # RiC 10/30/03 added this line
00575     self.clearViews()                   # RiC 10/30/03 added this line
00576
00577     # Iterate over all entries for the current data buffer
00578     # RiC: A buffer is allowed to contain more than one event, but doesn't now.
00579     #      May have to rethink this when it does.
00580     self.__ldbi.iterate() # RiC 4/2/04 switched to the new way
00581
00582   def selectChange(self):
00583     """ This function is called whenever the user makes a change of selection
00584     in TWR, RNG or Scale, to reload the event with the new filter settings.
00585     """
00586
00587     # Pass the new filter only for the implemented Scale Selections:
00588     if (self.drawGOSEDCAL.scaleSelection.currentItem() == 0 or \
00589        self.drawGOSEDCAL.scaleSelection.currentItem() == 1) and\
00590        (self.drawGOSEDCALTKR.scaleSelection.currentItem() == 0 or \
00591         self.drawGOSEDCALTKR.scaleSelection.currentItem() == 1):
00592       if self.__file is not None or \
00593          self.__fits is not None or \
00594          self.__ds is not None:
00595         self.drawGOSEDCAL.RNGAll.setEnabled(0)
00596         # Reinitialize settings, we have to do it again here since we don't call
00597         # plot() for a new event, we reiterate the current event over a new
00598         # set of filters.
00599         self.clearViews()
00600         self.drawGOSEDData.totHits.setText(str(0))
00601
00602         # Load backgrounds. We do it here and not in clearviews() not to have a
00603         # white pixmap while the event is being processed.
00604         bitBlt(self.drawXZ_TKR, 0, 0, self.drawXZ_TKR.background)
00605         bitBlt(self.drawYZ_TKR, 0, 0, self.drawYZ_TKR.background)
00606         bitBlt(self.drawXZ_CAL, 0, 0, self.drawXZ_CAL.background)
00607         bitBlt(self.drawYZ_CAL, 0, 0, self.drawYZ_CAL.background)
00608
00609         bitBlt(self.drawXZ_TKR2, 0, 0, self.drawXZ_TKR2.background)
00610         bitBlt(self.drawYZ_TKR2, 0, 0, self.drawYZ_TKR2.background)
00611         bitBlt(self.drawXZ_CAL2, 0, 0, self.drawXZ_CAL2.background)
00612         bitBlt(self.drawYZ_CAL2, 0, 0, self.drawYZ_CAL2.background)
00613
00614         bitBlt(self.drawHatACD, 0, 0, self.drawHatACD.background)
00615         bitBlt(self.drawSide1ACD, 0, 0, self.drawSide1ACD.background)
00616         bitBlt(self.drawSide2ACD, 0, 0, self.drawSide2ACD.background)
00617         bitBlt(self.drawSide3ACD, 0, 0, self.drawSide3ACD.background)
00618         bitBlt(self.drawSide4ACD, 0, 0, self.drawSide4ACD.background)
00619
00620         #~ for i in range(16):
00621           #~ if not self.drawGOTED.final[i].isNull():
00622             #~ bitBlt(self.drawYZ_CAL, 0, 0, self.drawYZ_CAL.background)
00623         self.__ldbi.iterate()
00624     else:
00625       self.statusBar().message("Auto Range not Implemented Yet", 2000)
00626
00627
00628   def clearViews(self):
00629     """ This function reloads GOSED defaults in order to process a new event.
00630     """
00631
00632 #     # Reinitialize final Pixmaps, they need to be Null at the beginning of
00633 #     # each event processing
00634 #     self.drawXZ_TKR.final = QPixmap()
00635 #     self.drawYZ_TKR.final = QPixmap()
00636 #     self.drawXZ_CAL.final = QPixmap()
00637 #     self.drawYZ_CAL.final = QPixmap()
00638
00639 #     self.drawXZ_TKR2.final = QPixmap()
00640 #     self.drawYZ_TKR2.final = QPixmap()
00641 #     self.drawXZ_CAL2.final = QPixmap()
00642 #     self.drawYZ_CAL2.final = QPixmap()
00643
00644 #     self.drawHatACD.finalHatACD = QPixmap()
00645 #     self.drawSide1ACD.finalSide1ACD = QPixmap()
00646 #     self.drawSide2ACD.finalSide2ACD = QPixmap()
00647 #     self.drawSide3ACD.finalSide3ACD = QPixmap()
00648 #     self.drawSide4ACD.finalSide4ACD = QPixmap()
00649
00650 #     #~ for i in range(16):
00651 #       #~ self.drawGOTED.final[i] = QPixmap()
00652 #       #~ bitBlt(self.drawGOTED.towerList[i], 0, 0,
00653 #              #~ self.drawGOTED.noBgrZ, 0, 0)
00654 #       #~ self.drawGOTED.towerList[i].setIcon(QPixmap())
00655
00656 #     for i in range(16):
00657 #       self.drawGOTED.final[i] = QPixmap()
00658 #       bitBlt(self.drawGOTED.towerList[i], 0, 0,
00659 #              self.drawGOTED.noBgrZ, 0, 0)
00660
00661     # Reinitialize final Pixmaps, they need to be Null at the beginning of
00662     # each event processing
00663     self.drawXZ_TKR.clear()
00664     self.drawYZ_TKR.clear()
00665     self.drawXZ_CAL.clear()
00666     self.drawYZ_CAL.clear()
00667
00668     self.drawXZ_TKR2.clear()
00669     self.drawYZ_TKR2.clear()
00670     self.drawXZ_CAL2.clear()
00671     self.drawYZ_CAL2.clear()
00672
00673     self.drawHatACD.clear()
00674     self.drawSide1ACD.clear()
00675     self.drawSide2ACD.clear()
00676     self.drawSide3ACD.clear()
00677     self.drawSide4ACD.clear()
00678
00679     #~ for i in range(16):
00680       #~ self.drawGOTED.clear()
00681       #~ bitBlt(self.drawGOTED.towerList[i], 0, 0,
00682              #~ self.drawGOTED.noBgrZ, 0, 0)
00683       #~ self.drawGOTED.towerList[i].setIcon(QPixmap())
00684
00685     for i in range(16):
00686       self.drawGOTED.clear()
00687       bitBlt(self.drawGOTED.towerList[i], 0, 0,
00688              self.drawGOTED.noBgrZ, 0, 0)
00689
00690     # Clear list views
00691     #self.drawGOSEDData.ACDview.clear()
00692     self.drawGOSEDData.acd.clear()
00693     self.drawGOSEDData.TKRview.clear()
00694     self.drawGOSEDData.CALview.clear()
00695     self.drawGOSEDData.diagTKR.clear()
00696     self.drawGOSEDData.diagCAL.clear()
00697     self.drawGOSEDData.error.clear()
00698     self.drawGOSEDData.trigger.clear()
00699
00700
00701
00702     # Disable button groups
00703     for i in range(self.drawGOSEDTWR.selectTWR.count()):
00704       twrButton = self.drawGOSEDTWR.selectTWR.find(i)
00705       twrButton.setEnabled(0)
00706
00707     for i in range(0,4):
00708       RngButton = self.drawGOSEDCAL.selectRNG.find(i)
00709       RngButton.setEnabled(0)
00710
00711     for i in range(0,4):
00712       RngButton = self.drawGOSEDCALTKR.selectRNG.find(i)
00713       RngButton.setEnabled(0)
00714
00715     #~ for i in range(16):
00716       #~ self.drawGOTED.towerList[i].setEnabled(0)
00717
00718   def clearButtonGroups(self):
00719     """ This function unchecks all the buttons. Contrary to clearviews(), this
00720     is only necesary when opening a new file, since we may have changed a
00721     selection in only one parameter (for example RNG only), and thus we don't
00722     want to loose the other filter by unchecking it (for example TWR).
00723     """
00724     for i in range(0,4):
00725       rngButton = self.drawGOSEDCAL.selectRNG.find(i)
00726       if rngButton.isOn():
00727         rngButton.setChecked(0)
00728
00729     for i in range(0,4):
00730       rngButton = self.drawGOSEDCALTKR.selectRNG.find(i)
00731       if rngButton.isOn():
00732         rngButton.setChecked(0)
00733
00734     for i in range(self.drawGOSEDTWR.selectTWR.count()):
00735       twrButton = self.drawGOSEDTWR.selectTWR.find(i)
00736       if twrButton.isOn():
00737         twrButton.setChecked(0)
00738
00739
00740   def nextClicked(self):
00741     """ Plots next event when called
00742     """
00743
00744     # INVESTIGATE HOW TO REINICIALIZE THE SELECTED TOWER FOR A NEW EVENT HERE
00745     #~ GOSED_LDF.CALcontributionIterator1.__selectedTower = -1
00746     #~ self.GOSED_LDF.CALcontributionIterator2.__selectedTower = -1
00747     #~ self.GOSED_LDF.TKRcontributionIterator.__selectedTower = -1
00748
00749     # As easy as this:
00750     self.plot()
00751
00752     #~ for i in range(16):
00753       #~ twrButton = self.drawGOSEDTWR.selectTWR.find(i)
00754       #~ if twrButton.isChecked():
00755         #~ Zpm = self.clickTWR(i)
00756         #~ if Zpm is None:
00757           #~ return
00758         #~ bitBlt(self.drawGOTED.towerList[i], 0, 0, Zpm , 0, 0)
00759
00760     # Enable Previous button
00761     if self.__ds is None and self.__fits is None and self.Go.isEnabled():
00762       self.Previous.setEnabled(1)
00763
00764     # Check if we have no data for either the CAL or the TKR and if so load
00765     # the background. We do it here and not in clearviews() not to have a
00766     # white pixmap while the event is being processed
00767 #     if self.drawGOSEDData.CALview.childCount() == 0:
00768 #       bitBlt(self.drawXZ_CAL, 0, 0, self.drawXZ_CAL.background)
00769 #       bitBlt(self.drawYZ_CAL, 0, 0, self.drawYZ_CAL.background)
00770
00771 #       bitBlt(self.drawXZ_CAL2, 0, 0, self.drawXZ_CAL2.background)
00772 #       bitBlt(self.drawYZ_CAL2, 0, 0, self.drawYZ_CAL2.background)
00773
00774 #     if self.drawGOSEDData.TKRview.childCount() == 0:
00775 #       bitBlt(self.drawXZ_TKR, 0, 0, self.drawXZ_TKR.background)
00776 #       bitBlt(self.drawYZ_TKR, 0, 0, self.drawYZ_TKR.background)
00777
00778 #       bitBlt(self.drawXZ_TKR2, 0, 0, self.drawXZ_TKR2.background)
00779 #       bitBlt(self.drawYZ_TKR2, 0, 0, self.drawYZ_TKR2.background)
00780
00781 #     if self.drawGOSEDData.acd.childCount() == 0:
00782 #       bitBlt(self.drawHatACD, 0, 0, self.drawHatACD.background)
00783 #       bitBlt(self.drawSide1ACD, 0, 0, self.drawSide1ACD.background)
00784 #       bitBlt(self.drawSide2ACD, 0, 0, self.drawSide2ACD.background)
00785 #       bitBlt(self.drawSide3ACD, 0, 0, self.drawSide3ACD.background)
00786 #       bitBlt(self.drawSide4ACD, 0, 0, self.drawSide4ACD.background)
00787
00788     #~ if not self.Go.isEnabled():
00789       #~ step = float(str(self.GOSEDPreferencesGUI.timestepValue.text()))
00790       #~ self.__timer.start(step*1000, False)   # seconds in milliseconds
00791      #~ self.__timer.start(500, False)
00792
00793
00794   def previousClicked(self):
00795     """ Finds previous event in the file and then plots it. It only
00796     works for .arch files.
00797     """
00798
00799     if self.__ds is not None:
00800       self.statusBar().message("Previous event is not available", 2000)
00801       self.Previous.setEnabled(0)
00802       return
00803
00804     if self.__fits is not None:
00805       self.statusBar().message("Can't go to Previous event in a Fits file", 2000)
00806       self.Previous.setEnabled(0)
00807       return
00808
00809     if self.__file is None:  return
00810
00811     evtPtr = 0
00812
00813     if self.__evtList != []:
00814       evtPtr = self.__evtList.pop()  # points to beginning of current  event
00815       #~ print "-------> prev1: eventList = ", self.__evtList
00816       if self.__evtList != []:
00817         evtPtr = self.__evtList.pop()  # points to beginning of previous event
00818         #~ print "-------> prev2: eventList = ", self.__evtList
00819     #~ print "previousClicked: evtPtr =", evtPtr
00820
00821     self.__file.seek(evtPtr)
00822     self.nextClicked()
00823
00824     self.Go.setEnabled(1)
00825     self.Next.setEnabled(1)
00826
00827     if evtPtr == 0:
00828       print "Beginning of File: " , (self.__fn)
00829       self.statusBar().message("Beginning of File: %s" % (self.__fn), 2000)
00830       self.Previous.setEnabled(0)
00831
00832
00833   def goClicked(self):
00834     """ Load events ininterruptedly in time steps selected by the user from
00835     the GOSED Preferences menu. It stops when the Stop Button is clicked.
00836     """
00837
00838     # Disable Browse buttons to avoid conflicting signals
00839     self.Go.setEnabled(0)
00840     self.Previous.setEnabled(0)
00841     self.Next.setEnabled(0)
00842     self.Stop.setEnabled(1)
00843
00844     step = float(str(self.GOSEDPreferencesGUI.timestepValue.text()))
00845     self.__timer.start(step*1000, False)   # seconds in milliseconds
00846
00847   def stopClicked(self):
00848     """ Stop the ininterrupted display of events triggered by the Go Button
00849     """
00850     self.__timer.stop()
00851
00852     # Enable back Browse buttons
00853     self.Go.setEnabled(1)
00854     self.Stop.setEnabled(0)
00855     if self.__ds is None:
00856       self.Next.setEnabled(1)
00857     # The Previous button is only enabled for .arch files
00858     if self.__ds is None and self.__fits is None:
00859       self.Previous.setEnabled(1)
00860
00861
00862   def fileOpen(self):
00863     """ Load data from a file
00864     """
00865
00866     # Prevent that gui gets hanged up if Cancel button is clicked at the dialog window
00867     self.__fn_Old = self.__fn
00868     self.__timer.stop()
00869
00870     self.__fn = QFileDialog.getOpenFileName(QString.null, "(*.ldf *.arch *.fits *.dge)", self)
00871
00872     # If Cancel was clicked in the File Open dialog reload existing file and return
00873     if str(self.__fn) == "":
00874       self.__fn = self.__fn_Old
00875       return
00876
00877     if not self.__fn.endsWith(".arch") and not self.__fn.endsWith(".ldf") and not str(self.__fn).endswith(".fits"):
00878       self.statusBar().message("Can't display a File other than with extension .arch or .fits", 2000)
00879       self.__fn = self.__fn_Old
00880       return
00881
00882     # Close previous data sources
00883     if self.__ds is not None:
00884       self.serverClose()
00885
00886     self.fileClose()
00887
00888     # Flag to check which one is my first tower and range in the File
00889     self.firstTower = None
00890     self.firstRNG   = None
00891     self.firstRNG2  = None
00892
00893     # Setup Browse buttons
00894     self.Go.setEnabled(1)
00895     self.Next.setEnabled(1)
00896     self.Previous.setEnabled(0)
00897     self.Stop.setEnabled(1)
00898
00899     if self.__fn.endsWith(".fits"):
00900       try:
00901         from LATTE.runcontrol import rcFitsWriter
00902       except (ImportError, IOError), e:
00903         raise "rcFitsWriter or one of its dependencies not available: %s" % e
00904       self.__fits = rcFitsWriter.rcFitsWriter(fileName=str(self.__fn), mode=rcFitsWriter.MODE_READONLY, format=rcFitsWriter.FORMAT_BYTE)
00905     else:
00906       self.__file = open(str(self.__fn), 'rb')
00907
00908     self.__evtList = []
00909
00910
00911     self.statusBar().message("Beginning of File: %s" % (self.__fn), 2000)
00912     self.drawGOSEDData.filename.setText(str(self.__fn))
00913     self.drawGOSEDTWR.selectTWR.setEnabled(1)
00914     self.drawGOSEDCAL.selectRNG.setEnabled(1)
00915     self.drawGOSEDCALTKR.selectRNG.setEnabled(1)
00916     self.GOSEDPreferencesGUI.setCustomEnabled(1)
00917     self.GOSEDPreferencesGUI.setACDCustomEnabled(1)
00918
00919     # Plot data
00920     self.plot()
00921
00922
00923   def fileClose(self):
00924     """ Close file source
00925     """
00926     self.__timer.stop()
00927
00928     #INVESTIGATE HOW TO REINICIALIZE THE SELECTED TOWER FOR A NEW EVENT HERE
00929     #~ self.selectTWR.setButton(-1)
00930
00931     if self.__file is not None:
00932       self.__file.close()
00933       self.__file = None
00934     elif self.__fits is not None:
00935       self.__fits.close()
00936       self.__fits = None
00937     else:
00938       self.statusBar().message("No file open for display", 2000)
00939       return
00940
00941     # Reinitialize everything
00942     self.clearViews()
00943     self.GOSEDPreferencesGUI.setCustomEnabled(0)
00944     self.GOSEDPreferencesGUI.setACDCustomEnabled(0)
00945
00946     self.drawGOSEDTWR.selectTWR.setEnabled(0)
00947     self.drawGOSEDCAL.selectRNG.setEnabled(0)
00948     self.drawGOSEDCALTKR.selectRNG.setEnabled(0)
00949     self.clearButtonGroups()
00950
00951
00952   def __shown(self):
00953     self.GOSEDPreferencesGUI.twr(self.__dwGOSEDTWR.isVisible())
00954     self.GOSEDPreferencesGUI.calTkr(self.__dwGOSEDCALTKR.isVisible())
00955     self.GOSEDPreferencesGUI.data(self.__dwGOSEDData.isVisible())
00956     self.GOSEDPreferencesGUI.tkr(self.__dwGOSEDTKR.isVisible())
00957     self.GOSEDPreferencesGUI.acd(self.__dwGOSEDACD.isVisible())
00958     self.GOSEDPreferencesGUI.cal(self.__dwGOSEDCAL.isVisible())
00959     self.GOSEDPreferencesGUI.ted(self.__dwGOTED.isVisible())
00960
00961   def fileExit(self):
00962     """ Exits the gui
00963     """
00964     if self.__file is not None:
00965       self.fileClose()
00966     else:
00967       self.serverClose()
00968     self.__timer.stop()
00969     self.GOSEDPreferencesGUI.saveViews()
00970     self.close()
00971
00972   def serverOpen(self, state):
00973     """  Load event data from a network server
00974     """
00975     if state:
00976       # Close previous data sources
00977       if self.__file is not None or self.__fits is not None:
00978         self.fileClose()
00979
00980       # Obsolete
00981       #~ """Flag to check which one is my first tower and range in the File"""
00982       self.firstTower = None
00983       self.firstRNG   = None
00984       self.firstRNG2  = None
00985
00986       server = str(self.ServerPreferencesGUI.selectedServer.text())
00987       print "Listening on data server", server
00988       if server == "":
00989         return
00990
00991       dsName = 'LAT_EBFdata'
00992       if self.__ds is None:
00993         self.__ds = DDP.DataDistributorPoll(dsName)
00994         if self.__ds is not None:
00995           self.__ds.connect(server)
00996           self.__ds.start()
00997           self.drawGOSEDTWR.selectTWR.setEnabled(1)
00998           self.drawGOSEDCAL.selectRNG.setEnabled(1)
00999           self.drawGOSEDCALTKR.selectRNG.setEnabled(1)
01000           self.GOSEDPreferencesGUI.setCustomEnabled(1)
01001           self.GOSEDPreferencesGUI.setACDCustomEnabled(1)
01002           self.stopClicked()
01003           self.goClicked()
01004         else:
01005           print "Unable to connect to Data Distribution server", dsName
01006     else:
01007       self.stopClicked()
01008       self.Go.setEnabled(0)
01009       self.serverClose()
01010
01011
01012   def serverClose(self):
01013     """  Close network server
01014     """
01015     if self.__ds is not None:
01016       self.__ds.stop()
01017       self.__ds.disconnect()
01018       self.__ds = None
01019       self.clearViews()
01020       self.clearButtonGroups()
01021
01022   def ServerPreferences(self):
01023     """ Calls the Server Preferences window stopping the timer.
01024     """
01025     self.__timer.stop()
01026     self.ServerPreferencesGUI.exec_loop()
01027
01028
01029   def GOSEDPreferences(self):
01030     """ Calls the GOSED Preferences window stopping the timer. It also
01031     passes the new settings to GOSED.
01032     """
01033     self.__timer.stop()
01034     self.GOSEDPreferencesGUI.exec_loop()
01035
01036     if self.GOSEDPreferencesGUI.EventlimitsButton.isChecked():
01037       self.preferredLimits = "Event"
01038     elif self.GOSEDPreferencesGUI.CALlimitsButton.isChecked():
01039       self.preferredLimits = "Default"
01040     elif self.GOSEDPreferencesGUI.CustomlimitsButton.isChecked():
01041       self.preferredLimits = "Custom"
01042
01043     # Obsolete:
01044     #~ if self.GOSEDPreferencesGUI.energyScaleButton.isChecked():
01045       #~ self.preferredScale = "Energy"
01046       #~ self.CALenergy.setEnabled(1)
01047     #~ elif self.GOSEDPreferencesGUI.rangeScaleButton.isChecked():
01048       #~ self.preferredScale = "Range"
01049       #~ self.CALenergy.setEnabled(0)
01050
01051     # Return if no data source is loaded
01052     if (self.__file is None) or (self.__fits is None) or (self.__ds is None):
01053       return
01054
01055     # If there is no event loaded click next (plot), otherwise reload the
01056     # same event with the new settings
01057     if self.__evtList == []:
01058       self.nextClicked()
01059     else:
01060       self.clearViews()
01061       # Obsolete:
01062       #~ self.existsTWRdata = 0
01063       #~ self.existsCALTWRdata = 0
01064       self.__ldbi.iterate()
01065
01066
01067   def helpOnline(self):
01068     """This function opens a web browser with I&T URL for reference.
01069     """
01070     import webbrowser
01071     webbrowser.open('http://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/Default.htm')
01072
01073
01074   def helpContents(self):
01075     """ Calls GOSED Readme file for reference.
01076     """
01077     self.GOSEDReadme = GOSEDReadme()
01078     self.GOSEDReadme.exec_loop()
01079
01080
01081   def helpAbout(self):
01082     """ Displays About GOSED info
01083     """
01084     QMessageBox.about(self,'Help About',
01085             '                              GLAST Online Single Event Display\n                                  I&T Online - Alicia T. Kavelaars\nhttp://www-glast.slac.stanford.edu/IntegrationTest/ONLINE/contact.htm\n                                       Copyright 2003 by\n       The Board of Trustees of the Leland Stanford Junior University.\n                                       All rights reserved.')
01086
01087
01088 if __name__ == "__main__":
01089   a = QApplication(sys.argv)
01090   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
01091   #if len(sys.argv) == 2:
01092   #  w = singleEvtDisplayImpl(sys.argv[1])
01093   #else:
01094   w = singleEvtDisplayImpl()
01095   a.setMainWidget(w)
01096   w.show()
01097   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDPainter.py Source File

gosed

GOSEDPainter.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online Single Event Display Painter"
00012 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/20/2003"
00014 __version__  = "$Revision: 1.13.2.1 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019 import sys, string
00020 import operator, math
00021 import Numeric
00022 import time
00023 import struct
00024
00025 #~ from gutil import hexConvert
00026
00027 from   qt import *
00028
00029 from   gosed                 import singleEvtDisplay
00030 from   ServerPreferencesImpl import ServerPreferencesImpl
00031 from   GOSEDPreferencesImpl  import GOSEDPreferencesImpl
00032 from   GOSEDReadme           import GOSEDReadme
00033 import GOSED_LDF
00034 import colorScale
00035
00036 from   LATTE.client.gBits    import hexConvert
00037 import LATTE.tools.DataDistributorPoll as DDP
00038
00039
00040 # Important Constants
00041 NUM_XY_TKR = 24
00042 NUM_Z_TKR  = 36
00043 NUM_Z_CAL  = 8
00044 NUM_XY_CAL = 12
00045
00046 RANGE_TKR_X = [1,2,5,6,9,10,13,14,17,18,21,22,25,26,29,30,33,34]
00047 RANGE1_TKR_X = [1, 5, 9, 13, 17, 21, 25, 29, 33]
00048 RANGE2_TKR_X = [2, 6, 10, 14, 18, 22, 26, 30, 34]
00049 RANGE_TKR_Y = [0,3,4,7,8,11,12,15,16,19,20,23,24,27,28,31,32,35]
00050 RANGE1_TKR_Y = [4, 8, 12, 16, 20, 24, 28, 32, 35]
00051 RANGE2_TKR_Y = [0, 3, 7, 11, 15, 19, 23, 27, 31]
00052
00053
00054 class drawSide1ACD(QWidget):
00055   """ Draws background Pixmap for the ACD Side 1 projection and updates
00056   the custom widget with the final pixmap processed by GOSED_LDF.
00057   """
00058
00059   def __init__(self, gui, parent = None,name = None,fl = 0):
00060     """ drawSide1ACD contructor
00061
00062     \param parent        None
00063     \param name          None
00064     \param fl            0
00065     """
00066
00067     # Initialize custom widget
00068     QWidget.__init__(self,parent,name,fl)
00069     self.__gui = gui
00070     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00071     self.clearWState(Qt.WState_Polished)
00072     self.setMinimumWidth(241)
00073     self.setMinimumHeight(81)
00074     self.setMaximumWidth(241)
00075     self.setMaximumHeight(81)
00076     #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00077
00078     tileWidth   = (self.width()  - 1)/5
00079     tileHeight  = (self.height() - 1)/4
00080     towerWidth  = self.width()/4
00081     towerHeight = self.height()/4
00082
00083     # Create a null final Pixmap that will indicate if there is
00084     # filtered ACD Side 1 data when it is filled in GOSED_LDF
00085     self.final      = QPixmap(self.width(), self.height())
00086     self.background = QPixmap(self.width(), self.height())
00087
00088     pACD = QPainter(self.background)
00089     pACD.setBrush(QColor("gray"))
00090     pACD.setPen(QColor(140, 140, 140))
00091     pACD.drawRect(0, 0, self.width(), self.height())
00092
00093     # Draw tile boundaries
00094     pACD.setPen(QColor(100, 100, 100))
00095
00096     for j in range(3):
00097       for i in range(5):
00098         pACD.drawRect(tileWidth * i, tileHeight * j,
00099                       tileWidth + 1, tileHeight + 1
00100                       )
00101
00102     pACD.drawRect(0, tileHeight * 3, tileWidth * 5 + 1, tileHeight + 1)
00103
00104     # Draw tower boundaries
00105     pACD.setPen(QColor(166, 163, 157))
00106
00107     for i in range(1,4):
00108       pACD.drawLine((towerWidth)*i, 1,(towerWidth)*i, self.height() - 1)
00109
00110     pACD.end()
00111
00112     self.paintFace()
00113
00114   def drawNames(self, pixmap):
00115     tileWidth   = (self.width()  - 1)/5
00116     tileHeight  = (self.height() - 1)/4
00117
00118     pACD = QPainter(pixmap)
00119
00120     # Draw tile names
00121     pACD.setPen(QColor(50, 50, 50))
00122
00123     lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00124     width = tileWidth
00125     for tile in GOSED_LDF.LOOKUP_ACD_YZM:
00126       tileSide = lookupTile[tile]
00127       if tileSide[2] == 3:  width = self.width()
00128       pACD.drawText(width * tileSide[1], tileHeight * tileSide[2],
00129                     width, tileHeight, Qt.AlignCenter, tile)
00130
00131     pACD.end()
00132
00133   def clear(self):
00134     # Pass the background to the final Pixmap
00135     self.final.fill()
00136     bitBlt(self.final, 0, 0, self.background, 0, 0)
00137
00138   def showEvent(self, se):
00139     self.__gui.replot()
00140
00141   def paintEvent(self, pe):
00142     """ Paint Event function for the Side 1 projection, paints its
00143     background and updates it with the current event pixmap (final)
00144     created in GOSED_LDF. If no data passed the filter for ACD, final
00145     will be updated as the background.
00146
00147     \param pe            paint event
00148     """
00149     self.paintFace()
00150
00151   def paintFace(self):
00152     # Load the custom widget with the final pixmap
00153     self.drawNames(self.final)
00154     bitBlt(self, 0, 0, self.final, 0, 0)
00155
00156 class drawSide2ACD(QWidget):
00157   """ Draws background Pixmap for the ACD Side 2 projection and updates
00158   the custom widget with the final pixmap processed by GOSED_LDF.
00159   """
00160
00161   def __init__(self, gui, parent = None,name = None,fl = 0):
00162     """ drawSide2ACD contructor
00163
00164     \param parent        None
00165     \param name          None
00166     \param fl            0
00167     """
00168
00169     # Initialize custom widget
00170     QWidget.__init__(self,parent,name,fl)
00171     self.__gui = gui
00172     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00173     #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00174     self.clearWState(Qt.WState_Polished)
00175     self.setMinimumWidth(81)
00176     self.setMinimumHeight(241)
00177     self.setMaximumWidth(81)
00178     self.setMaximumHeight(241)
00179
00180     tileWidth   = (self.width() - 1)/4
00181     tileHeight  = (self.height()- 1)/5
00182     towerWidth  = self.width()/4
00183     towerHeight = self.height()/4
00184
00185     # Create a null final Pixmap that will indicate if there is
00186     # filtered ACD Side 2 data when it is filled in GOSED_LDF
00187     self.final      = QPixmap(self.width(), self.height())
00188     self.background = QPixmap(self.width(), self.height())
00189
00190     pACD = QPainter(self.background)
00191     pACD.setBrush(QColor("gray"))
00192     pACD.setPen(QColor(140, 140, 140))
00193     pACD.drawRect(0, 0, self.width(), self.height())
00194
00195     # Draw tile boundaries
00196     pACD.setPen(QColor(100, 100, 100))
00197
00198     for i in range(3):
00199       for j in range(5):
00200         pACD.drawRect(tileWidth * i, tileHeight * j,
00201                       tileWidth + 1, tileHeight + 1
00202                       )
00203     pACD.drawRect(tileWidth * 3, 0, tileWidth + 1, self.height())
00204
00205     # Draw tower boundaries
00206     pACD.setPen(QColor(166, 163, 157))
00207
00208     for i in range(1,4):
00209       pACD.drawLine(1, (towerHeight)*i, self.width() - 1, (towerHeight)*i)
00210
00211     pACD.end()
00212
00213     self.paintFace()
00214
00215   def drawNames(self, pixmap):
00216     tileWidth   = (self.width() - 1)/4
00217     tileHeight  = (self.height()- 1)/5
00218
00219     pACD = QPainter(pixmap)
00220
00221     # Draw tile name
00222     pACD.setPen(QColor(50, 50, 50))
00223
00224     lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00225     height = tileHeight
00226     for tile in GOSED_LDF.LOOKUP_ACD_XZM:
00227       tileSide = lookupTile[tile]
00228       if tileSide[1] == 3:  height = self.height()
00229       x = tileWidth * tileSide[1] + (tileWidth/2 - 5) # I don't understand ...
00230       y = height    * tileSide[2] + (height/2 + 10)   # ...these offsets
00231       pACD.translate(x, y)
00232       pACD.rotate(-90.0)
00233       pACD.drawText(0, 0, tileWidth, height, Qt.AlignAuto, tile)
00234       pACD.rotate(90.0)
00235       pACD.translate(-x, -y)
00236
00237     pACD.end()
00238
00239   def clear(self):
00240     # Pass the background to the final Pixmap
00241     self.final.fill()
00242     bitBlt(self.final, 0, 0, self.background, 0, 0)
00243
00244   def showEvent(self, se):
00245     self.__gui.replot()
00246
00247   def paintEvent(self, pe):
00248     """ Paint Event function for the Side 2 projection, paints its
00249     background and updates it with the current event pixmap (final)
00250     created in GOSED_LDF. If no data passed the filter for ACD, final
00251     will be updated as the background.
00252
00253     \param pe            paint event
00254     """
00255
00256     self.paintFace()
00257
00258   def paintFace(self):
00259     # Load the custom widget with the final pixmap
00260     self.drawNames(self.final)
00261     bitBlt(self, 0, 0, self.final, 0, 0)
00262
00263
00264 class drawSide3ACD(QWidget):
00265   """ Draws background Pixmap for the ACD Side 3 projection and updates
00266   the custom widget with the final pixmap processed by GOSED_LDF.
00267   """
00268
00269   def __init__(self, gui, parent = None,name = None,fl = 0):
00270     """ drawSide3ACD contructor
00271
00272     \param parent        None
00273     \param name          None
00274     \param fl            0
00275     """
00276
00277     # Initialize custom widget
00278     QWidget.__init__(self,parent,name,fl)
00279     self.__gui = gui
00280     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00281     #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00282     self.clearWState(Qt.WState_Polished)
00283     self.setMinimumWidth(241)
00284     self.setMinimumHeight(81)
00285     self.setMaximumWidth(241)
00286     self.setMaximumHeight(81)
00287
00288     tileWidth   = (self.width()  - 1)/5
00289     tileHeight  = (self.height() - 1)/4
00290     towerWidth  = self.width()/4
00291     towerHeight = self.height()/4
00292
00293     # Create a null final Pixmap that will indicate if there is
00294     # filtered ACD Side 3 data when it is filled in GOSED_LDF
00295     self.final      = QPixmap(self.width(), self.height())
00296     self.background = QPixmap(self.width(), self.height())
00297
00298     pACD = QPainter(self.background)
00299     pACD.setBrush(QColor("gray"))
00300     pACD.setPen(QColor(140, 140, 140))
00301     pACD.drawRect(0, 0, self.width(), self.height())
00302
00303     # Draw tile boundaries
00304     pACD.setPen(QColor(100, 100, 100))
00305
00306     for i in range(5):
00307       for j in range(1, 4):
00308         pACD.drawRect(tileWidth *i,  tileHeight * j,
00309                       tileWidth + 1, tileHeight + 1
00310                       )
00311     pACD.drawRect(0, 0, self.width(), tileHeight + 1)
00312
00313     # Draw tower boundaries
00314     pACD.setPen(QColor(166, 163, 157))
00315
00316     for i in range(1,4):
00317       pACD.drawLine((towerWidth)*i, 1, (towerWidth)*i, self.height() - 1)
00318
00319     pACD.end()
00320
00321     self.paintFace()
00322
00323   def drawNames(self, pixmap):
00324     tileWidth   = (self.width()  - 1)/5
00325     tileHeight  = (self.height() - 1)/4
00326
00327     pACD = QPainter(pixmap)
00328
00329     # Draw tile name
00330     pACD.setPen(QColor(50, 50, 50))
00331
00332     lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00333     width = tileWidth
00334     for tile in GOSED_LDF.LOOKUP_ACD_YZP:
00335       tileSide = lookupTile[tile]
00336       if tileSide[2] == 0:  width = self.width()
00337       pACD.drawText(width * tileSide[1], tileHeight * tileSide[2],
00338                     width, tileHeight, Qt.AlignCenter, tile)
00339
00340     pACD.end()
00341
00342   def clear(self):
00343     # Pass the background to the final Pixmap
00344     self.final.fill()
00345     bitBlt(self.final, 0, 0, self.background, 0, 0)
00346
00347   def showEvent(self, se):
00348     self.__gui.replot()
00349
00350   def paintEvent(self, pe):
00351     """ Paint Event function for the Side 3 projection, paints its
00352     background and updates it with the current event pixmap (final)
00353     created in GOSED_LDF. If no data passed the filter for ACD, final
00354     will be updated as the background.
00355
00356     \param pe            paint event
00357     """
00358
00359     self.paintFace()
00360
00361   def paintFace(self):
00362     # Load the custom widget with the final pixmap
00363     self.drawNames(self.final)
00364     bitBlt(self, 0, 0, self.final, 0, 0)
00365
00366
00367 class drawSide4ACD(QWidget):
00368   """ Draws background Pixmap for the ACD Side 4 projection and updates
00369   the custom widget with the final pixmap processed by GOSED_LDF.
00370   """
00371
00372   def __init__(self, gui, parent = None,name = None,fl = 0):
00373     """ drawSide4ACD contructor
00374
00375     \param parent        None
00376     \param name          None
00377     \param fl            0
00378     """
00379
00380     # Initialize custom widget
00381     QWidget.__init__(self,parent,name,fl)
00382     self.__gui = gui
00383     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00384     #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00385     self.clearWState(Qt.WState_Polished)
00386     self.setMinimumWidth(81)
00387     self.setMinimumHeight(241)
00388     self.setMaximumWidth(81)
00389     self.setMaximumHeight(241)
00390
00391     tileWidth   = (self.width()  - 1)/4
00392     tileHeight  = (self.height() - 1)/5
00393     towerWidth  = self.width()/4
00394     towerHeight = self.height()/4
00395
00396     # Create a null final Pixmap that will indicate if there is
00397     # filtered ACD Side 4 data when it is filled in GOSED_LDF
00398     self.final      = QPixmap(self.width(), self.height())
00399     self.background = QPixmap(self.width(), self.height())
00400
00401     pACD = QPainter(self.background)
00402     pACD.setBrush(QColor("gray"))
00403     pACD.setPen(QColor(140, 140, 140))
00404     pACD.drawRect(0, 0, self.width(), self.height())
00405
00406     # Draw tile boundaries
00407     pACD.setPen(QColor(100, 100, 100))
00408
00409     for i in range(1,4):
00410       for j in range(5):
00411         pACD.drawRect(tileWidth * i, tileHeight * j,
00412                       tileWidth + 1, tileHeight + 1
00413                       )
00414     pACD.drawRect(0, 0, tileWidth + 1, self.height())
00415
00416     # Draw tower boundaries
00417     pACD.setPen(QColor(166, 163, 157))
00418
00419     for i in range(1,4):
00420       pACD.drawLine(1, (towerHeight)*i, self.width() - 1, (towerHeight)*i)
00421
00422     pACD.end()
00423
00424     self.paintFace()
00425
00426   def drawNames(self, pixmap):
00427     tileWidth   = (self.width()  - 1)/4
00428     tileHeight  = (self.height() - 1)/5
00429
00430     pACD = QPainter(pixmap)
00431     #pACD.setRasterOp(Qt.XorROP)         # Set pen color to background...
00432
00433     # Draw tile name
00434     #pACD.setPen(QColor("gray"))         # Same as brush color for background
00435     pACD.setPen(QColor(50, 50, 50))
00436
00437     lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00438     height = tileHeight
00439     for tile in GOSED_LDF.LOOKUP_ACD_XZP:
00440       tileSide = lookupTile[tile]
00441       if tileSide[1] == 0:  height = self.height()
00442       x = tileWidth * tileSide[1] + (tileWidth - 2) # I don't understand ...
00443       y = height    * tileSide[2] + (height/2 - 9)  # ...these offsets
00444       pACD.translate(x, y)
00445       pACD.rotate(90.0)
00446       pACD.drawText(0, 0, tileWidth, height, Qt.AlignAuto, tile)
00447       pACD.rotate(-90.0)
00448       pACD.translate(-x, -y)
00449
00450     pACD.end()
00451
00452   def clear(self):
00453     # Pass the background to the final Pixmap
00454     self.final.fill()
00455     bitBlt(self.final, 0, 0, self.background, 0, 0)
00456
00457   def showEvent(self, se):
00458     self.__gui.replot()
00459
00460   def paintEvent(self, pe):
00461     """ Paint Event function for the Side 4 projection, paints its
00462     background and updates it with the current event pixmap (final)
00463     created in GOSED_LDF. If no data passed the filter for ACD, final
00464     will be updated as the background.
00465
00466     \param pe            paint event
00467     """
00468
00469     self.paintFace()
00470
00471   def paintFace(self):
00472     # Load the custom widget with the final pixmap
00473     self.drawNames(self.final)
00474     bitBlt(self, 0, 0, self.final, 0, 0)
00475
00476
00477 class drawHatACD(QWidget):
00478   """ Draws background Pixmap for the ACD Hat projection and updates
00479   the custom widget with the final pixmap processed by GOSED_LDF.
00480   """
00481
00482   def __init__(self, gui, parent = None,name = None,fl = 0):
00483     """ drawHatACD contructor
00484
00485     \param parent        None
00486     \param name          None
00487     \param fl            0
00488     """
00489
00490     # Initialize custom widget
00491     QWidget.__init__(self,parent,name,fl)
00492     self.__gui = gui
00493     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00494     #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00495     self.clearWState(Qt.WState_Polished)
00496     self.setMinimumWidth(241)
00497     self.setMinimumHeight(241)
00498     self.setMaximumWidth(241)
00499     self.setMaximumHeight(241)
00500
00501     tileWidth   = (self.width()  - 1)/5
00502     tileHeight  = (self.height() - 1)/5
00503     towerWidth  = self.width()/4
00504     towerHeight = self.height()/4
00505
00506     # Create a null final Pixmap that will indicate if there is
00507     # filtered ACD Hat (top) data when it is filled in GOSED_LDF
00508     self.final      = QPixmap(self.width(), self.height())
00509     self.background = QPixmap(self.width(), self.height())
00510
00511     pACD = QPainter(self.background)
00512     pACD.setBrush(QColor("gray"))
00513     pACD.setPen(QColor(140, 140, 140))
00514     pACD.drawRect(0, 0, self.width(), self.height())
00515
00516     # Draw tile boundaries
00517     pACD.setPen(QColor(100, 100, 100))
00518
00519     for j in range(5):
00520       for i in range(5):
00521         pACD.drawRect(tileWidth * i, tileHeight * j,
00522                       tileWidth + 1, tileHeight + 1
00523                       )
00524
00525     # Draw tower boundaries
00526     pACD.setPen(QColor(166, 163, 157))
00527
00528     for i in range(1,4):
00529       pACD.drawLine((towerWidth)*i, 1,
00530                        (towerWidth)*i, self.height() - 1
00531                        )
00532       pACD.drawLine(1, (towerHeight)*i,
00533                        self.width() - 1, (towerHeight)*i
00534                        )
00535
00536     pACD.end()
00537
00538     self.paintFace()
00539
00540   def drawNames(self, pixmap):
00541     tileWidth   = (self.width()  - 1)/5
00542     tileHeight  = (self.height() - 1)/5
00543
00544     pACD = QPainter(pixmap)
00545
00546     # Draw tile name
00547     pACD.setPen(QColor(50, 50, 50))
00548
00549     lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00550     for tile in GOSED_LDF.LOOKUP_ACD_XY:
00551       tileSide = lookupTile[tile]
00552       pACD.drawText(tileWidth * tileSide[1], tileHeight * tileSide[2],
00553                          tileWidth, tileHeight, Qt.AlignCenter, tile)
00554
00555     pACD.end()
00556
00557   def clear(self):
00558     # Pass the background to the final Pixmap
00559     self.final.fill()
00560     bitBlt(self.final, 0, 0, self.background, 0, 0)
00561
00562   def showEvent(self, se):
00563     self.__gui.replot()
00564
00565   def paintEvent(self, pe):
00566     """ Paint Event function for the Hat projection, paints its
00567     background and updates it with the current event pixmap (final)
00568     created in GOSED_LDF. If no data passed the filter for ACD, final
00569     will be updated as the background.
00570
00571     \param pe            paint event
00572     """
00573     self.paintFace()
00574
00575   def paintFace(self):
00576     # Load the custom widget with the final pixmap
00577     self.drawNames(self.final)
00578     bitBlt(self, 0 , 0, self.final, 0, 0)
00579
00580
00581 class drawXZ_TKR(QWidget):
00582   """ Draws background Pixmap for the XZ TKR projection and updates
00583   the custom widget with the final pixmap processed by GOSED_LDF.
00584   """
00585
00586   def __init__(self, gui, parent = None,name = None,fl = 0):
00587     """ drawXZ_TKR contructor
00588
00589     \param parent        None
00590     \param name          None
00591     \param fl            0
00592     """
00593
00594     # Initialize custom widget
00595     QWidget.__init__(self,parent,name,fl)
00596     self.__gui = gui
00597     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00598     self.clearWState(Qt.WState_Polished)
00599
00600     # Create a null final Pixmap that will indicate if there is
00601     # filtered TKR data when it is filled in GOSED_LDF
00602     self.final      = QPixmap(145, 254)
00603     self.background = QPixmap(145, 254)
00604
00605     # Initialize painter
00606     pTKR = QPainter(self.background)
00607     pTKR.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00608     pTKR.setPen(QColor(170, 170, 160))
00609     #~ pTKR.setPen(QColor("lightgray"))
00610
00611     # Draw background
00612     pTKR.drawRect(0, 0, 145, 254)
00613     for y in range(36):
00614       if y in RANGE1_TKR_X:
00615         pTKR.setPen(QColor(140,140,150))
00616         pTKR.drawRect( 0, y*7, 145, 8)
00617
00618       elif y in RANGE2_TKR_X:
00619         pTKR.setPen(QColor(140,140,150))
00620         pTKR.drawRect(0, y*7 + 1, 145, 8)
00621
00622       elif y != 0 and y in range (0, 36, 2):
00623         pTKR.setPen(QColor("lightgray"))
00624         pTKR.drawLine( 0, y*7 + 1, 145, y*7 + 1)
00625         #~ pTKR.drawRect( 1, y*7 - 8, 145, 9)
00626
00627     pTKR.end() # TBErased if implemented directly in frame
00628
00629     self.paintFace()
00630
00631   def clear(self):
00632     # Pass the background to the final Pixmap
00633     self.final.fill()
00634     bitBlt(self.final, 0, 0, self.background)
00635     self.paintFace()
00636
00637   def showEvent(self, se):
00638     self.__gui.replot()
00639
00640   def paintEvent(self, pe):
00641     """ Paint Event function for the XZ TKR projection, paints its
00642     background and updates it with the current event pixmap (final)
00643     created in GOSED_LDF. If no data passed the filter for TKR, final
00644     will be updated as the background.
00645
00646     \param pe            paint event
00647     """
00648
00649     self.paintFace()
00650
00651   def paintFace(self):
00652     # Load the custom widget with the final pixmap
00653     bitBlt(self, 0, 0, self.final)
00654
00655
00656 class drawYZ_TKR(QWidget):
00657   """ Draws background Pixmap for the YZ TKR projection and updates
00658   the custom widget with the final pixmap processed by GOSED_LDF.
00659   """
00660
00661   def __init__(self, gui, parent = None,name = None,fl = 0):
00662     """ drawYZ_TKR constructor
00663
00664     \param parent        None
00665     \param name          None
00666     \param fl            0
00667     """
00668
00669     # Initialize custom widget
00670     QWidget.__init__(self,parent,name,fl)
00671     self.__gui = gui
00672     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00673     self.clearWState(Qt.WState_Polished)
00674
00675     # Initialize pixmaps
00676     self.final      = QPixmap(145, 254)
00677     self.background = QPixmap(145, 254)
00678
00679     # Initialize painter
00680     pTKR = QPainter(self.background)
00681     pTKR.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00682     pTKR.setPen(QColor(170, 170, 160))
00683     #~ pTKR.setBrush(QColor(110, 110, 110)) #"white"))
00684     #~ pTKR.setPen(QColor("lightgray"))
00685
00686     # Draw background
00687     pTKR.drawRect(0, 0, 145, 254)
00688     for y in range(36):
00689       if y in RANGE1_TKR_Y:
00690         pTKR.setPen(QColor(140,140,150))
00691         pTKR.drawRect( 0, y*7 + 1, 145, 8)
00692         #~ pTKR.drawRect( 0, y*7 + 2, 145, 8) #more symm but taller map
00693
00694       elif y in RANGE2_TKR_Y:
00695         pTKR.setPen(QColor(140,140,150))
00696         pTKR.drawRect(0, y*7, 145, 8)
00697         #~ pTKR.drawRect(0, y*7 + 1, 145, 8)
00698
00699       #~ elif y == 2:
00700         #~ pTKR.setPen(QColor("lightgray"))
00701         #~ pTKR.drawLine( 1, y*7, 145, y*7)
00702
00703       elif y in range (0, 36, 2):
00704         pTKR.setPen(QColor("lightgray"))
00705         if y == 2:
00706           pTKR.drawLine( 0, y*7, 145, y*7)
00707         else:
00708           pTKR.drawLine( 0, y*7 + 1, 145, y*7 + 1)
00709
00710     pTKR.end()
00711
00712     self.paintFace()
00713
00714   def clear(self):
00715     # Pass the background to the final Pixmap
00716     self.final.fill()
00717     bitBlt(self.final, 0, 0, self.background)
00718     self.paintFace()
00719
00720   def showEvent(self, se):
00721     self.__gui.replot()
00722
00723   def paintEvent(self, pe):
00724     """ Paint Event function for the YZ TKR projection, paints its
00725     background and updates it with the current event pixmap (final)
00726     created in GOSED_LDF. If no data passed the filter for TKR, final
00727     will be updated as the background.
00728
00729     \param pe            paint event
00730     """
00731
00732     self.paintFace()
00733
00734   def paintFace(self):
00735     # Load the custom widget with the final pixmap
00736     bitBlt(self, 0, 0, self.final)
00737
00738
00739 class drawXZ_CAL(QWidget):
00740   """ Draws background Pixmap for the XZ CAL projection and updates
00741   the custom widget with the final pixmap processed by GOSED_LDF.
00742   """
00743
00744   def __init__(self, gui, parent = None,name = None,fl = 0):
00745     """ drawXZ_CAL constructor
00746
00747     \param parent        None
00748     \param name          None
00749     \param fl            0
00750     """
00751
00752     # Initialize custom widget
00753     QWidget.__init__(self,parent,name,fl)
00754     self.__gui = gui
00755     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00756     self.clearWState(Qt.WState_Polished)
00757
00758     # Initialize pixmaps
00759     self.final      = QPixmap(145, 80)
00760     self.background = QPixmap(145, 80)
00761
00762     # Initialize painter
00763     pXZ_CAL = QPainter(self.background)
00764     r, g, b = colorScale.colorScale(0.0)
00765     #~ pXZ_CAL.setBrush(QColor(r, g, b))  #"white"))
00766     #~ pXZ_CAL.setBrush(QColor(110, 110, 110))
00767     #~ pXZ_CAL.setPen(QColor(160,160,170))
00768     pXZ_CAL.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00769     pXZ_CAL.setPen(QColor(140,140,150))
00770
00771     # Paint background
00772     for y in range(NUM_Z_CAL):
00773       if y in range(0, NUM_Z_CAL, 2):
00774         pXZ_CAL.drawRect(0, y*10, 145, 10)
00775       else:
00776         for x in range(NUM_XY_CAL):
00777           pXZ_CAL.drawRect(x*12, y*10, 13, 10)
00778
00779     pXZ_CAL.end()
00780
00781     self.paintFace()
00782
00783   def clear(self):
00784     # Pass the background to the final Pixmap
00785     self.final.fill()
00786     bitBlt(self.final, 0, 0, self.background)
00787     self.paintFace()
00788
00789   def showEvent(self, se):
00790     self.__gui.replot()
00791
00792   def paintEvent(self, pe):
00793     """ Paint Event function for the XZ CAL projection, paints its
00794     background and updates it with the current event pixmap (final)
00795     created in GOSED_LDF. If no data passed the filter for TKR, final
00796     will be updated as the background.
00797
00798     \param pe            paint event
00799     """
00800
00801     self.paintFace()
00802
00803   def paintFace(self):
00804     # Load the custom widget with the final pixmap
00805     bitBlt(self, 0, 0, self.final)
00806
00807
00808 class drawYZ_CAL(QWidget):
00809   """ Draws background Pixmap for the YZ TKR projection and updates
00810   the custom widget with the final pixmap processed by GOSED_LDF.
00811   """
00812
00813   def __init__(self, gui, parent = None,name = None,fl = 0):
00814     """ drawYZ_CAL constructor
00815
00816     \param parent        None
00817     \param name          None
00818     \param fl            0
00819     """
00820
00821     # Custom Widget setup
00822     QWidget.__init__(self,parent,name,fl)
00823     self.__gui = gui
00824     custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00825     self.clearWState(Qt.WState_Polished)
00826
00827     # Create a null final Pixmap that will indicate if there is
00828     # filtered CAL data when it is filled in GOSED_LDF
00829     #CELLVERTPITCH = int( 21.35 / 2.0)
00830     #CELLHORPITCH  = int( 27.84 / 2.0)
00831     #CSILENGTH     = int(326.00 / 2.0)
00832     #CSIWIDTH      = int( 26.70 / 2.0)
00833     #CSIHEIGHT     = int( 19.90 / 2.0)
00834
00835     self.final      = QPixmap(145, 80)
00836     self.background = QPixmap(145, 80)
00837     #self.setMinimumWidth(NUM_XY_CAL * CELLHORPITCH)
00838     #self.setMinimumHeight(NUM_Z_CAL * CELLVERTPITCH)
00839     #self.setMaximumWidth(NUM_XY_CAL * CELLHORPITCH)
00840     #self.setMaximumHeight(NUM_Z_CAL * CELLVERTPITCH)
00841
00842     #self.final      = QPixmap(NUM_XY_CAL * CELLHORPITCH, NUM_Z_CAL * CELLVERTPITCH)
00843     #self.background = QPixmap(NUM_XY_CAL * CELLHORPITCH, NUM_Z_CAL * CELLVERTPITCH)
00844
00845     # Start painter
00846     pYZ_CAL = QPainter(self.background)
00847     r, g, b = colorScale.colorScale(0.0)
00848     #~ pYZ_CAL.setBrush(QColor(r, g, b))  #"white"))
00849     #~ pYZ_CAL.setBrush(QColor(110, 110, 110))
00850     #~ pYZ_CAL.setPen(QColor(160,160,170))
00851     pYZ_CAL.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00852     pYZ_CAL.setPen(QColor(140,140,150))
00853
00854     # Paint background in background Pixmap
00855     for y in range(NUM_Z_CAL):
00856       if y in range(1, NUM_Z_CAL, 2):
00857         pYZ_CAL.drawRect(0, y*10, 145, 10)
00858         #pYZ_CAL.drawRect(0, y*CELLVERTPITCH, NUM_XY_CAL * CELLHORPITCH, CELLVERTPITCH)
00859       else:
00860         for x in range(NUM_XY_CAL):
00861           pYZ_CAL.drawRect(x*12, y*10, 13, 10)
00862           #pYZ_CAL.drawRect(x*CELLHORPITCH, y*CELLVERTPITCH, CELLHORPITCH, CELLVERTPITCH)
00863
00864     pYZ_CAL.end()
00865
00866     self.paintFace()
00867
00868   def clear(self):
00869     # Pass the background to the final Pixmap
00870     self.final.fill()
00871     bitBlt(self.final, 0, 0, self.background)
00872     self.paintFace()
00873
00874   def showEvent(self, se):
00875     self.__gui.replot()
00876
00877   def paintEvent(self, pe):
00878     """ Paint Event function for the YZ CAL projection, paints its
00879     background and updates it with the current event pixmap (final)
00880     created in GOSED_LDF. If no data passed the filter for TKR, final
00881     will be updated as the background.
00882
00883     \param pe            paint event
00884     """
00885
00886     self.paintFace()
00887
00888   def paintFace(self):
00889     # Load the custom widget with the final pixmap
00890     bitBlt(self, 0, 0, self.final)
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDPreferencesImpl.py Source File

gosed

GOSEDPreferencesImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 import os
00005 from qt import *
00006 from GOSEDPreferences import GOSEDPreferences
00007 import ConfigParser
00008
00009
00010 class GOSEDPreferencesImpl(GOSEDPreferences):
00011
00012   def __init__(self, confParser, parent = None,name = None,modal = 0,fl = 0):
00013     GOSEDPreferences.__init__(self,parent,name,modal,fl)
00014
00015     self.__gui = parent
00016
00017     self.__twr    = True
00018     self.__calTkr = True
00019     self.__data   = True
00020     self.__tkr    = False
00021     self.__acd    = False
00022     self.__cal    = False
00023     self.__ted    = False
00024
00025     self.timestepValue.setText("1")
00026     self.connect(self.timestepSlider, SIGNAL('valueChanged(int)'), self.changeStepValue)
00027     self.connect(self.scaleBox, SIGNAL('clicked(int)'), self.selectScale)
00028     self.connect(self.scaleBox_2, SIGNAL('clicked(int)'), self.selectScaleACD)
00029
00030     self.connect(self.buttonOk, SIGNAL('clicked()'), self.saveGOSED)
00031
00032     self.__confParser = confParser
00033     self.__configFile = os.path.join(os.environ['ONLINE_ROOT'],
00034                                      'LATTE/gosed/gosed.cfg')
00035
00036     cp = self.__confParser
00037     if os.path.exists(self.__configFile):
00038       cp.read(self.__configFile)
00039       try:
00040         self.timestepValue.setText(cp.get("gosed options", "timestep"))
00041         preferredLimits = cp.get("gosed options", "preferredlimits")
00042         self.minEdit.setText(cp.get("gosed options", "min"))
00043         self.maxEdit.setText(cp.get("gosed options", "max"))
00044         if preferredLimits == "Event":
00045           self.EventlimitsButton.setChecked(1)
00046         elif preferredLimits == "Default":
00047           self.CALlimitsButton.setChecked(1)
00048         elif preferredLimits == "Custom":
00049           self.CustomlimitsButton.setChecked(1)
00050           self.selectScale()
00051
00052         preferredLimits = cp.get("gosed options", "ACDpreferredLimits")
00053         self.minEditACD.setText(cp.get("gosed options", "minacd"))
00054         self.maxEditACD.setText(cp.get("gosed options", "maxacd"))
00055         if preferredLimits == "Default":
00056           self.ACDlimitsButton.setChecked(1)
00057         elif preferredLimits == "Custom":
00058           self.ACDCustomlimitsButton.setChecked(1)
00059           self.selectScaleACD()
00060
00061         self.__twr    = str(cp.get("gosed options", "twr")) == 'True'
00062         self.__calTkr = str(cp.get("gosed options", "caltkr")) == 'True'
00063         self.__data   = str(cp.get("gosed options", "data")) == 'True'
00064         self.__tkr    = str(cp.get("gosed options", "tkr")) == 'True'
00065         self.__acd    = str(cp.get("gosed options", "acd")) == 'True'
00066         self.__cal    = str(cp.get("gosed options", "cal")) == 'True'
00067         self.__ted    = str(cp.get("gosed options", "ted")) == 'True'
00068       except ConfigParser.NoSectionError:
00069         # Old behaviour
00070         self.CALlimitsButton.setChecked(1)
00071         self.ACDlimitsButton.setChecked(1)
00072         cp.add_section("gosed options")
00073         self.__defaults()
00074       except ConfigParser.NoOptionError:
00075         self.CALlimitsButton.setChecked(1)
00076         self.ACDlimitsButton.setChecked(1)
00077         self.__defaults()
00078
00079     else:
00080       cp.add_section("gosed options")
00081       self.CALlimitsButton.setChecked(1)
00082       self.ACDlimitsButton.setChecked(1)
00083       self.__defaults()
00084
00085   def __defaults(self):
00086     cp = self.__confParser
00087     cp.set("gosed options", "timestep", '1')
00088     cp.set("gosed options", "preferredLimits", 'Event')
00089     cp.set("gosed options", "min", str(0))
00090     cp.set("gosed options", "max", str(1000))
00091     cp.set("gosed options", "ACDpreferredLimits", 'Default')
00092     cp.set("gosed options", "minACD", str(0))
00093     cp.set("gosed options", "maxACD", str(4000))
00094
00095   def changeStepValue(self):
00096     self.timestepValue.setText(str(float(self.timestepSlider.value())/10.))
00097
00098   def setCustomEnabled(self, status):
00099     if status == 1:
00100       self.CustomlimitsButton.setEnabled(1)
00101     else:
00102       self.CustomlimitsButton.setEnabled(0)
00103
00104   def setACDCustomEnabled(self, status):
00105     if status == 1:
00106       self.ACDCustomlimitsButton.setEnabled(1)
00107     else:
00108       self.ACDCustomlimitsButton.setEnabled(0)
00109
00110   def selectScale(self):
00111     if self.CustomlimitsButton.isChecked():
00112       self.minEdit.setEnabled(1)
00113       self.maxEdit.setEnabled(1)
00114       self.minLbl.setEnabled(1)
00115       self.maxLbl.setEnabled(1)
00116     else:
00117       self.minEdit.setEnabled(0)
00118       self.maxEdit.setEnabled(0)
00119       self.minLbl.setEnabled(0)
00120       self.maxLbl.setEnabled(0)
00121
00122   def selectScaleACD(self):
00123     if self.ACDCustomlimitsButton.isChecked():
00124       self.minEditACD.setEnabled(1)
00125       self.maxEditACD.setEnabled(1)
00126       self.minLbl_2.setEnabled(1)
00127       self.maxLbl_2.setEnabled(1)
00128     else:
00129       self.minEditACD.setEnabled(0)
00130       self.maxEditACD.setEnabled(0)
00131       self.minLbl_2.setEnabled(0)
00132       self.maxLbl_2.setEnabled(0)
00133
00134   def minCAL(self):
00135     min = 0
00136     if self.CustomlimitsButton.isChecked():
00137       try:
00138         min = int(str(self.__gui.GOSEDPreferencesGUI.minEdit.text()))
00139       except ValueError:
00140         print "CAL min value %s is not a number" % \
00141               str(self.__gui.GOSEDPreferencesGUI.minEdit.text())
00142         self.__gui.GOSEDPreferencesGUI.minEdit.setText(str(min))
00143     return min
00144
00145   def maxCAL(self):
00146     max = 1000
00147     if self.CustomlimitsButton.isChecked():
00148       try:
00149         max = int(str(self.__gui.GOSEDPreferencesGUI.maxEdit.text()))
00150       except ValueError:
00151         print "CAL max value %s is not a number" % \
00152               str(self.__gui.GOSEDPreferencesGUI.maxEdit.text())
00153         self.__gui.GOSEDPreferencesGUI.maxEdit.setText(str(max))
00154     return max
00155
00156   def minACD(self):
00157     min = 0
00158     if self.ACDCustomlimitsButton.isChecked():
00159       try:
00160         min = int(str(self.__gui.GOSEDPreferencesGUI.minEditACD.text()))
00161       except ValueError:
00162         print "ACD min value %s is not a number" % \
00163               str(self.__gui.GOSEDPreferencesGUI.minEditACD.text())
00164         self.__gui.GOSEDPreferencesGUI.minEditACD.setText(str(min))
00165     return min
00166
00167   def maxACD(self):
00168     max = 4000
00169     if self.ACDCustomlimitsButton.isChecked():
00170       try:
00171         max = int(str(self.__gui.GOSEDPreferencesGUI.maxEditACD.text()))
00172       except ValueError:
00173         print "ACD max value %s is not a number" % \
00174               str(self.__gui.GOSEDPreferencesGUI.maxEditACD.text())
00175         self.__gui.GOSEDPreferencesGUI.maxEditACD.setText(str(max))
00176     return max
00177
00178   def twr(self, hide = None):
00179     value = self.__twr
00180     if hide is not None:  self.__twr = hide
00181     return value
00182
00183   def calTkr(self, hide = None):
00184     value = self.__calTkr
00185     if hide is not None:  self.__calTkr = hide
00186     return value
00187
00188   def data(self, hide = None):
00189     value = self.__data
00190     if hide is not None:  self.__data = hide
00191     return value
00192
00193   def tkr(self, hide = None):
00194     value = self.__tkr
00195     if hide is not None:  self.__tkr = hide
00196     return value
00197
00198   def acd(self, hide = None):
00199     value = self.__acd
00200     if hide is not None:  self.__acd = hide
00201     return value
00202
00203   def cal(self, hide = None):
00204     value = self.__cal
00205     if hide is not None:  self.__cal = hide
00206     return value
00207
00208   def ted(self, hide = None):
00209     value = self.__ted
00210     if hide is not None:  self.__ted = hide
00211     return value
00212
00213   def saveGOSED(self):
00214     cp = self.__confParser
00215     cp.set("gosed options", "timestep", str(self.timestepValue.text()))
00216     if self.EventlimitsButton.isChecked():
00217       preferredLimits = "Event"
00218     elif self.CALlimitsButton.isChecked():
00219       preferredLimits = "Default"
00220     elif self.CustomlimitsButton.isChecked():
00221       preferredLimits = "Custom"
00222       cp.set("gosed options", "min", self.minCAL())
00223       cp.set("gosed options", "max", self.maxCAL())
00224       self.__gui.drawGOSEDCAL.relabel()
00225       self.__gui.drawGOSEDCALTKR.relabel()
00226     else:
00227       preferredLimits = "Event"
00228     cp.set("gosed options", "preferredlimits", preferredLimits)
00229
00230     if self.ACDlimitsButton.isChecked():
00231       preferredLimits = "Default"
00232     elif self.ACDCustomlimitsButton.isChecked():
00233       preferredLimits = "Custom"
00234       cp.set("gosed options", "minacd", self.minACD())
00235       cp.set("gosed options", "maxacd", self.maxACD())
00236       self.__gui.drawGOSEDACD.relabel()
00237     else:
00238       preferredLimits = "Default"
00239     cp.set("gosed options", "acdpreferredlimits", preferredLimits)
00240
00241     # Write it out
00242     cp.write(file(self.__configFile, "w+"))
00243
00244     # Redraw screen using new settings
00245     self.__gui.replot()
00246
00247   def saveViews(self):
00248     cp = self.__confParser
00249     cp.set("gosed options", "twr",    self.__twr)
00250     cp.set("gosed options", "caltkr", self.__calTkr)
00251     cp.set("gosed options", "data",   self.__data)
00252     cp.set("gosed options", "tkr",    self.__tkr)
00253     cp.set("gosed options", "acd",    self.__acd)
00254     cp.set("gosed options", "cal",    self.__cal)
00255     cp.set("gosed options", "ted",    self.__ted)
00256     cp.write(file(self.__configFile, "w+"))
00257
00258 if __name__ == "__main__":
00259   a = QApplication(sys.argv)
00260   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00261   w = GOSEDPreferencesImpl()
00262   a.setMainWidget(w)
00263   w.show()
00264   a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDTKRImpl.py Source File

gosed

GOSEDTKRImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 from qt import *
00005 from GOSEDTKR import GOSEDTKRWindow
00006
00007
00008 class GOSEDTKRImpl(GOSEDTKRWindow):
00009
00010     def __init__(self,parent = None,name = None,fl = 0):
00011         GOSEDTKRWindow.__init__(self,parent,name,fl)
00012
00013 if __name__ == "__main__":
00014     a = QApplication(sys.argv)
00015     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00016     w = GOSEDTKRImpl()
00017     a.setMainWidget(w)
00018     w.show()
00019     a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOSEDTWRImpl.py Source File

gosed

GOSEDTWRImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 from qt import *
00005 from GOSEDTWR import GOSEDTWRWindow
00006
00007
00008 class GOSEDTWRImpl(GOSEDTWRWindow):
00009
00010     def __init__(self,parent = None,name = None,fl = 0):
00011         GOSEDTWRWindow.__init__(self,parent,name,fl)
00012
00013 if __name__ == "__main__":
00014     a = QApplication(sys.argv)
00015     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00016     w = GOSEDTWRImpl()
00017     a.setMainWidget(w)
00018     w.show()
00019     a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: GOTEDImpl.py Source File

gosed

GOTEDImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online Tower Event Display"
00012 __author__   = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/26/2003"
00014 __version__  = "$Revision: 1.6 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018 import sys, string
00019 import operator, math
00020 from qt import *
00021 from GOTED import towerEvtDisplay
00022 from gosed import singleEvtDisplay
00023 from ServerPreferencesImpl import ServerPreferencesImpl
00024 from GOSEDPreferencesImpl import GOSEDPreferencesImpl
00025 from GOSEDReadme import GOSEDReadme
00026 import Numeric
00027 import time
00028 import struct
00029
00030 from   LATTE.client.gBits    import hexConvert
00031 import LATTE.tools.DataDistributorPoll as DDP
00032 #~ from gutil import hexConvert
00033 #~ import DataDistributorPoll as DDP
00034
00035
00036 class towerEvtDisplayImpl(towerEvtDisplay):
00037   def __init__(self,parent = None,name = None,modal = 0,fl = 0):
00038     towerEvtDisplay.__init__(self,parent,name,fl)
00039
00040     self.towerFrame = None
00041
00042     self.final = {}
00043
00044     for i in range(16):
00045       self.final[i] = QPixmap()
00046
00047     #~ self.background = QPixmap(200, 200)
00048     #~ self.noBgrZ = QPixmap(200, 200)
00049
00050     self.background  = QPixmap(self.TWR0.width(), \
00051                          self.TWR0.height())
00052     self.noBgrZ = QPixmap(self.TWR0.width(), \
00053                          self.TWR0.height())
00054
00055     self.towerList = [self.TWR0,
00056                       self.TWR1,
00057                       self.TWR2,
00058                       self.TWR3,
00059                       self.TWR4,
00060                       self.TWR5,
00061                       self.TWR6,
00062                       self.TWR7,
00063                       self.TWR8,
00064                       self.TWR9,
00065                       self.TWR10,
00066                       self.TWR11,
00067                       self.TWR12,
00068                       self.TWR13,
00069                       self.TWR14,
00070                       self.TWR15
00071                       ]
00072     self.connect
00073
00074   def clear(self):
00075     for i in range(16):
00076       self.final[i].fill()
00077
00078   def paintEvent(self, pe):
00079     self.background  = QPixmap(self.TWR0.width(), \
00080                          self.TWR0.height())
00081     self.noBgrZ = QPixmap(self.TWR0.width(), \
00082                          self.TWR0.height())
00083
00084     self.__pZ_TKR  = QPainter(self.background) #
00085
00086     self.__pZ_TKR.setBrush(QColor("white"))
00087     self.__pZ_TKR.setPen(QColor(166,163,157))
00088
00089     self.__pZ_TKR.drawRect(0, 0,\
00090                            self.towerList[0].width(), \
00091                            self.towerList[0].height())
00092
00093     self.__pZ_TKR  = QPainter(self.noBgrZ) #
00094
00095     self.__pZ_TKR.setBrush(QColor(212,208,200))
00096     self.__pZ_TKR.setPen(QColor(166,163,157))
00097
00098     self.__pZ_TKR.drawRect(0, 0, \
00099                            self.TWR0.width(), \
00100                            self.TWR0.height())
00101     self.__pZ_TKR.end()
00102
00103     for i in range(16):
00104       if not self.final[i].isNull():
00105         bitBlt(self.towerList[i], \
00106                0, 0, self.final[i])
00107
00108
00109 if __name__ == "__main__":
00110     a = QApplication(sys.argv)
00111     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00112     w = towerEvtDisplayImpl()
00113     a.setMainWidget(w)
00114     w.show()
00115     a.exec_loop()
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gPDU.py Source File

database

gPDU.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST PDU functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/09/24 01:15:28 $").split(' ')[1]
00015 __version__ = "$Revision: 2.7 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import time
00022 import struct
00023 import gDb
00024 import gAttr
00025 import LATTE.client.gRegister as gRegister
00026
00027 class GPDU(gDb.Gdb):
00028   """\brief PDU Controller.
00029
00030   Valid Registers:
00031   - \c configuration
00032   - \c address
00033   - \c cr_statistics
00034   - \c crates
00035   - \c tems
00036   - \c acd
00037   - \c monitor
00038
00039   Dataless commands:
00040   - \c cmd_nop
00041   - \c cmd_reset
00042
00043   """
00044   __attrs = [
00045     # Registers
00046     gAttr.GattrReg('configuration', 0, 4),
00047     gAttr.GattrReg('address',       1, 4),
00048     gAttr.GattrReg('cr_statistics', 2, 4),
00049     gAttr.GattrReg('crates',        3, 4),
00050     gAttr.GattrReg('tems',          4, 4),
00051     gAttr.GattrReg('acd',           5, 4),
00052     gAttr.GattrReg('monitor',       6, 4),
00053     # Dataless commands
00054     gAttr.GattrDlc('cmd_nop',       0, 0),
00055     gAttr.GattrDlc('cmd_reset',     1, 0),
00056     ]
00057
00058   __MONITOR = 6
00059   __NPDUS   = 2
00060
00061   def __init__(self, client, parent, id):
00062     """\brief Initialize valid registers as Gattrs.
00063
00064     Assign default values to members
00065     """
00066     if id < GPDU.__NPDUS:
00067       addr = 'LADR_PDU_%d' %(id)
00068     else:
00069       raise KeyError("*** gPDU: GPDU id %d is invalid" %(id))
00070     self.PEQ = None
00071     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00072
00073   def read(self, reg):
00074     return self.cmdrsp('PDUconReadSync', 'slh', self.addr(), reg, '!I')
00075
00076   def load(self, reg, value):
00077     return self.cmdrsp('PDUconLoadSync', 'slh', self.addr(), reg, value)
00078
00079   def send(self, cmd):
00080     return self.cmdrsp('PDUconCmdSync', 'slh', self.addr(), cmd)
00081
00082   def downPEQ(self):
00083     """\brief Navigate to the GPEQ (PDU environmental monitors)
00084
00085     \return         A GPEQ object instance
00086     """
00087     return self.PEQ
00088
00089   def existsPEQ(self):
00090     """\brief Check if the GPEQ instance exists in the schema.
00091
00092     \return       1 if it exists, 0 if it doesn't.
00093     """
00094     return self.PEQ != None
00095
00096   ## private:
00097   def __removePEQ(self):
00098     self.PEQ = None
00099
00100   def __addPEQ(self):
00101     self.PEQ = GPEQ(self.client(), self)
00102     return self.PEQ
00103
00104
00105 class GPEQ(gDb.Gdb):
00106   """\brief PDU Environmental Monitors.
00107
00108   Has GPEQ specific registers and dataless commands.
00109
00110   Valid Registers:
00111   - \c adcs_00_07
00112   - \c adcs_08_15
00113   - \c adcs_16_19
00114   """
00115   __attrs = [
00116     # Registers
00117     gAttr.GattrReg('adcs_00_07', 0, 12, gAttr.REG_READ_ONLY),
00118     gAttr.GattrReg('adcs_08_15', 1, 12, gAttr.REG_READ_ONLY),
00119     gAttr.GattrReg('adcs_16_19', 2, 12, gAttr.REG_READ_ONLY),
00120
00121     # group 0
00122     gAttr.GattrReg('spare_v_0',               10,  2, gAttr.REG_READ_ONLY),
00123     gAttr.GattrReg('tem_v_12',                11,  2, gAttr.REG_READ_ONLY),
00124     gAttr.GattrReg('tem_v_02',                12,  2, gAttr.REG_READ_ONLY),
00125     gAttr.GattrReg('tem_t_08',                13,  2, gAttr.REG_READ_ONLY),
00126     gAttr.GattrReg('tem_t_12',                14,  2, gAttr.REG_READ_ONLY),
00127     gAttr.GattrReg('epu_t_2',                 15,  2, gAttr.REG_READ_ONLY),
00128     gAttr.GattrReg('epu_t_0',                 16,  2, gAttr.REG_READ_ONLY),
00129     gAttr.GattrReg('tem_t_06',                17,  2, gAttr.REG_READ_ONLY),
00130     gAttr.GattrReg('py_vchp_dshp_intf_t_4',   18,  2, gAttr.REG_READ_ONLY),
00131     gAttr.GattrReg('spare_rtd_0',             19,  2, gAttr.REG_READ_ONLY),
00132     gAttr.GattrReg('spare_rtd_1',             20,  2, gAttr.REG_READ_ONLY),
00133     gAttr.GattrReg('spare_rtd_2',             21,  2, gAttr.REG_READ_ONLY),
00134     gAttr.GattrReg('spare_rtd_3',             22,  2, gAttr.REG_READ_ONLY),
00135     gAttr.GattrReg('spare_t_1',               23,  2, gAttr.REG_READ_ONLY),
00136     gAttr.GattrReg('py_grid_rad_intf_t_0',    24,  2, gAttr.REG_READ_ONLY),
00137     gAttr.GattrReg('my_grid_rad_intf_t_0',    25,  2, gAttr.REG_READ_ONLY),
00138     gAttr.GattrReg('grid_t_00',               26,  2, gAttr.REG_READ_ONLY),
00139     gAttr.GattrReg('grid_t_03',               27,  2, gAttr.REG_READ_ONLY),
00140     gAttr.GattrReg('grid_t_06',               28,  2, gAttr.REG_READ_ONLY),
00141     gAttr.GattrReg('grid_t_09',               29,  2, gAttr.REG_READ_ONLY),
00142
00143     # group 1
00144     gAttr.GattrReg('spare_v_1',               30,  2, gAttr.REG_READ_ONLY),
00145     gAttr.GattrReg('tem_v_13',                31,  2, gAttr.REG_READ_ONLY),
00146     gAttr.GattrReg('tem_v_03',                32,  2, gAttr.REG_READ_ONLY),
00147     gAttr.GattrReg('tem_t_09',                33,  2, gAttr.REG_READ_ONLY),
00148     gAttr.GattrReg('tem_t_13',                34,  2, gAttr.REG_READ_ONLY),
00149     gAttr.GattrReg('spare_t_0',               35,  2, gAttr.REG_READ_ONLY),
00150     gAttr.GattrReg('epu_t_1',                 36,  2, gAttr.REG_READ_ONLY),
00151     gAttr.GattrReg('tem_t_07',                37,  2, gAttr.REG_READ_ONLY),
00152     gAttr.GattrReg('py_vchp_dshp_intf_t_5',   38,  2, gAttr.REG_READ_ONLY),
00153     gAttr.GattrReg('py_rad_antifrz_htr_t_00', 39,  2, gAttr.REG_READ_ONLY),
00154     gAttr.GattrReg('acd_shell_t_0',           40,  2, gAttr.REG_READ_ONLY),
00155     gAttr.GattrReg('my_rad_antifrz_htr_t_00', 41,  2, gAttr.REG_READ_ONLY),
00156     gAttr.GattrReg('acd_shell_t_1',           42,  2, gAttr.REG_READ_ONLY),
00157     gAttr.GattrReg('spare_t_2',               43,  2, gAttr.REG_READ_ONLY),
00158     gAttr.GattrReg('py_grid_rad_intf_t_1',    44,  2, gAttr.REG_READ_ONLY),
00159     gAttr.GattrReg('my_grid_rad_intf_t_1',    45,  2, gAttr.REG_READ_ONLY),
00160     gAttr.GattrReg('grid_t_01',               46,  2, gAttr.REG_READ_ONLY),
00161     gAttr.GattrReg('grid_t_04',               47,  2, gAttr.REG_READ_ONLY),
00162     gAttr.GattrReg('grid_t_07',               48,  2, gAttr.REG_READ_ONLY),
00163     gAttr.GattrReg('grid_t_10',               49,  2, gAttr.REG_READ_ONLY),
00164
00165     # group 2
00166     gAttr.GattrReg('spare_v_2',               50,  2, gAttr.REG_READ_ONLY),
00167     gAttr.GattrReg('tem_v_14',                51,  2, gAttr.REG_READ_ONLY),
00168     gAttr.GattrReg('tem_v_04',                52,  2, gAttr.REG_READ_ONLY),
00169     gAttr.GattrReg('tem_t_10',                53,  2, gAttr.REG_READ_ONLY),
00170     gAttr.GattrReg('tem_t_14',                54,  2, gAttr.REG_READ_ONLY),
00171     gAttr.GattrReg('tem_t_00',                55,  2, gAttr.REG_READ_ONLY),
00172     gAttr.GattrReg('tem_t_03',                56,  2, gAttr.REG_READ_ONLY),
00173     gAttr.GattrReg('tem_ps_t_06',             57,  2, gAttr.REG_READ_ONLY),
00174     gAttr.GattrReg('my_vchp_dshp_intf_t_0',   58,  2, gAttr.REG_READ_ONLY),
00175     gAttr.GattrReg('py_rad_t_0',              59,  2, gAttr.REG_READ_ONLY),
00176     gAttr.GattrReg('py_vchp_rsvr_htr_t_0',    60,  2, gAttr.REG_READ_ONLY),
00177     gAttr.GattrReg('my_rad_t_0',              61,  2, gAttr.REG_READ_ONLY),
00178     gAttr.GattrReg('my_vchp_rsvr_htr_t_0',    62,  2, gAttr.REG_READ_ONLY),
00179     gAttr.GattrReg('acd_pmt_rail_t_0',        63,  2, gAttr.REG_READ_ONLY),
00180     gAttr.GattrReg('py_vchp_xlhp_intf_t_0',   64,  2, gAttr.REG_READ_ONLY),
00181     gAttr.GattrReg('my_vchp_xlhp_intf_t_0',   65,  2, gAttr.REG_READ_ONLY),
00182     gAttr.GattrReg('grid_t_02',               66,  2, gAttr.REG_READ_ONLY),
00183     gAttr.GattrReg('grid_t_05',               67,  2, gAttr.REG_READ_ONLY),
00184     gAttr.GattrReg('grid_t_08',               68,  2, gAttr.REG_READ_ONLY),
00185     gAttr.GattrReg('grid_t_11',               69,  2, gAttr.REG_READ_ONLY),
00186
00187     # group 3
00188     gAttr.GattrReg('spare_v_3',               70,  2, gAttr.REG_READ_ONLY),
00189     gAttr.GattrReg('tem_v_15',                71,  2, gAttr.REG_READ_ONLY),
00190     gAttr.GattrReg('tem_v_05',                72,  2, gAttr.REG_READ_ONLY),
00191     gAttr.GattrReg('tem_t_11',                73,  2, gAttr.REG_READ_ONLY),
00192     gAttr.GattrReg('tem_t_15',                74,  2, gAttr.REG_READ_ONLY),
00193     gAttr.GattrReg('tem_t_01',                75,  2, gAttr.REG_READ_ONLY),
00194     gAttr.GattrReg('tem_t_04',                76,  2, gAttr.REG_READ_ONLY),
00195     gAttr.GattrReg('tem_ps_t_07',             77,  2, gAttr.REG_READ_ONLY),
00196     gAttr.GattrReg('my_vchp_dshp_intf_t_1',   78,  2, gAttr.REG_READ_ONLY),
00197     gAttr.GattrReg('py_rad_t_1',              79,  2, gAttr.REG_READ_ONLY),
00198     gAttr.GattrReg('py_vchp_rsvr_htr_t_1',    80,  2, gAttr.REG_READ_ONLY),
00199     gAttr.GattrReg('my_rad_t_1',              81,  2, gAttr.REG_READ_ONLY),
00200     gAttr.GattrReg('my_vchp_rsvr_htr_t_1',    82,  2, gAttr.REG_READ_ONLY),
00201     gAttr.GattrReg('acd_pmt_rail_t_1',        83,  2, gAttr.REG_READ_ONLY),
00202     gAttr.GattrReg('py_vchp_xlhp_intf_t_1',   84,  2, gAttr.REG_READ_ONLY),
00203     gAttr.GattrReg('my_vchp_xlhp_intf_t_1',   85,  2, gAttr.REG_READ_ONLY),
00204     gAttr.GattrReg('cal_baseplate_t_00',      86,  2, gAttr.REG_READ_ONLY),
00205     gAttr.GattrReg('cal_baseplate_t_04',      87,  2, gAttr.REG_READ_ONLY),
00206     gAttr.GattrReg('cal_baseplate_t_08',      88,  2, gAttr.REG_READ_ONLY),
00207     gAttr.GattrReg('cal_baseplate_t_12',      89,  2, gAttr.REG_READ_ONLY),
00208
00209     # group 4
00210     gAttr.GattrReg('tem_v_08',                90,  2, gAttr.REG_READ_ONLY),
00211     gAttr.GattrReg('epu_v_2',                 91,  2, gAttr.REG_READ_ONLY),
00212     gAttr.GattrReg('tem_v_06',                92,  2, gAttr.REG_READ_ONLY),
00213     gAttr.GattrReg('tem_ps_t_08',             93,  2, gAttr.REG_READ_ONLY),
00214     gAttr.GattrReg('tem_ps_t_12',             94,  2, gAttr.REG_READ_ONLY),
00215     gAttr.GattrReg('tem_t_02',                95,  2, gAttr.REG_READ_ONLY),
00216     gAttr.GattrReg('tem_t_05',                96,  2, gAttr.REG_READ_ONLY),
00217     gAttr.GattrReg('py_vchp_dshp_intf_t_0',   97,  2, gAttr.REG_READ_ONLY),
00218     gAttr.GattrReg('my_vchp_dshp_intf_t_2',   98,  2, gAttr.REG_READ_ONLY),
00219     gAttr.GattrReg('py_rad_t_2',              99,  2, gAttr.REG_READ_ONLY),
00220     gAttr.GattrReg('py_vchp_rsvr_htr_t_2',   100,  2, gAttr.REG_READ_ONLY),
00221     gAttr.GattrReg('my_rad_t_2',             101,  2, gAttr.REG_READ_ONLY),
00222     gAttr.GattrReg('my_vchp_rsvr_htr_t_2',   102,  2, gAttr.REG_READ_ONLY),
00223     gAttr.GattrReg('acd_pmt_rail_t_2',       103,  2, gAttr.REG_READ_ONLY),
00224     gAttr.GattrReg('py_vchp_xlhp_intf_t_2',  104,  2, gAttr.REG_READ_ONLY),
00225     gAttr.GattrReg('my_vchp_xlhp_intf_t_2',  105,  2, gAttr.REG_READ_ONLY),
00226     gAttr.GattrReg('cal_baseplate_t_01',     106,  2, gAttr.REG_READ_ONLY),
00227     gAttr.GattrReg('cal_baseplate_t_05',     107,  2, gAttr.REG_READ_ONLY),
00228     gAttr.GattrReg('cal_baseplate_t_09',     108,  2, gAttr.REG_READ_ONLY),
00229     gAttr.GattrReg('cal_baseplate_t_13',     109,  2, gAttr.REG_READ_ONLY),
00230
00231     # group 5
00232     gAttr.GattrReg('tem_v_09',                110,  2, gAttr.REG_READ_ONLY),
00233     gAttr.GattrReg('spare_v_04',              111,  2, gAttr.REG_READ_ONLY),
00234     gAttr.GattrReg('tem_v_07',                112,  2, gAttr.REG_READ_ONLY),
00235     gAttr.GattrReg('tem_ps_t_09',             113,  2, gAttr.REG_READ_ONLY),
00236     gAttr.GattrReg('tem_ps_t_13',             114,  2, gAttr.REG_READ_ONLY),
00237     gAttr.GattrReg('tem_ps_t_00',             115,  2, gAttr.REG_READ_ONLY),
00238     gAttr.GattrReg('tem_ps_t_03',             116,  2, gAttr.REG_READ_ONLY),
00239     gAttr.GattrReg('py_vchp_dshp_intf_t_1',   117,  2, gAttr.REG_READ_ONLY),
00240     gAttr.GattrReg('my_vchp_dshp_intf_t_3',   118,  2, gAttr.REG_READ_ONLY),
00241     gAttr.GattrReg('py_rad_t_3',              119,  2, gAttr.REG_READ_ONLY),
00242     gAttr.GattrReg('py_vchp_rsvr_htr_t_3',    120,  2, gAttr.REG_READ_ONLY),
00243     gAttr.GattrReg('my_rad_t_3',              121,  2, gAttr.REG_READ_ONLY),
00244     gAttr.GattrReg('my_vchp_rsvr_htr_t_3',    122,  2, gAttr.REG_READ_ONLY),
00245     gAttr.GattrReg('acd_pmt_rail_t_3',        123,  2, gAttr.REG_READ_ONLY),
00246     gAttr.GattrReg('py_vchp_xlhp_intf_t_3',   124,  2, gAttr.REG_READ_ONLY),
00247     gAttr.GattrReg('my_vchp_xlhp_intf_t_3',   125,  2, gAttr.REG_READ_ONLY),
00248     gAttr.GattrReg('cal_baseplate_t_02',      126,  2, gAttr.REG_READ_ONLY),
00249     gAttr.GattrReg('cal_baseplate_t_06',      127,  2, gAttr.REG_READ_ONLY),
00250     gAttr.GattrReg('cal_baseplate_t_10',      128,  2, gAttr.REG_READ_ONLY),
00251     gAttr.GattrReg('cal_baseplate_t_14',      129,  2, gAttr.REG_READ_ONLY),
00252
00253     # group 6
00254     gAttr.GattrReg('tem_v_10',                130,  2, gAttr.REG_READ_ONLY),
00255     gAttr.GattrReg('tem_v_00',                131,  2, gAttr.REG_READ_ONLY),
00256     gAttr.GattrReg('epu_v_0',                 132,  2, gAttr.REG_READ_ONLY),
00257     gAttr.GattrReg('tem_ps_t_10',             133,  2, gAttr.REG_READ_ONLY),
00258     gAttr.GattrReg('tem_ps_t_14',             134,  2, gAttr.REG_READ_ONLY),
00259     gAttr.GattrReg('temp_ps_t_01',            135,  2, gAttr.REG_READ_ONLY),
00260     gAttr.GattrReg('tem_ps_t_04',             136,  2, gAttr.REG_READ_ONLY),
00261     gAttr.GattrReg('py_vchp_dshp_intf_t_2',   137,  2, gAttr.REG_READ_ONLY),
00262     gAttr.GattrReg('my_vchp_dshp_intf_t_4',   138,  2, gAttr.REG_READ_ONLY),
00263     gAttr.GattrReg('py_rad_t_4',              139,  2, gAttr.REG_READ_ONLY),
00264     gAttr.GattrReg('py_vchp_rsvr_htr_t_4',    140,  2, gAttr.REG_READ_ONLY),
00265     gAttr.GattrReg('my_rad_t_4',              141,  2, gAttr.REG_READ_ONLY),
00266     gAttr.GattrReg('my_vchp_rsvr_htr_t_4',    142,  2, gAttr.REG_READ_ONLY),
00267     gAttr.GattrReg('acd_bea_grid_intf_t_0',   143,  2, gAttr.REG_READ_ONLY),
00268     gAttr.GattrReg('py_vchp_xlhp_intf_t_4',   144,  2, gAttr.REG_READ_ONLY),
00269     gAttr.GattrReg('my_vchp_xlhp_intf_t_4',   145,  2, gAttr.REG_READ_ONLY),
00270     gAttr.GattrReg('cal_baseplate_t_03',      146,  2, gAttr.REG_READ_ONLY),
00271     gAttr.GattrReg('cal_baseplate_t_07',      147,  2, gAttr.REG_READ_ONLY),
00272     gAttr.GattrReg('cal_baseplate_t_11',      148,  2, gAttr.REG_READ_ONLY),
00273     gAttr.GattrReg('cal_baseplate_t_15',      149,  2, gAttr.REG_READ_ONLY),
00274
00275     # group 7
00276     gAttr.GattrReg('tem_v_11',                150,  2, gAttr.REG_READ_ONLY),
00277     gAttr.GattrReg('tem_v_01',                151,  2, gAttr.REG_READ_ONLY),
00278     gAttr.GattrReg('epu_v_1',                 152,  2, gAttr.REG_READ_ONLY),
00279     gAttr.GattrReg('tem_ps_t_11',             153,  2, gAttr.REG_READ_ONLY),
00280     gAttr.GattrReg('tem_ps_t_15',             154,  2, gAttr.REG_READ_ONLY),
00281     gAttr.GattrReg('tem_ps_t_02',             155,  2, gAttr.REG_READ_ONLY),
00282     gAttr.GattrReg('tem_ps_t_05',             156,  2, gAttr.REG_READ_ONLY),
00283     gAttr.GattrReg('py_vchp_dshp_intf_t_3',   157,  2, gAttr.REG_READ_ONLY),
00284     gAttr.GattrReg('my_vchp_dshp_intf_t_5',   158,  2, gAttr.REG_READ_ONLY),
00285     gAttr.GattrReg('py_rad_t_5',              159,  2, gAttr.REG_READ_ONLY),
00286     gAttr.GattrReg('py_vchp_rsvr_htr_t_5',    160,  2, gAttr.REG_READ_ONLY),
00287     gAttr.GattrReg('my_rad_t_5',              161,  2, gAttr.REG_READ_ONLY),
00288     gAttr.GattrReg('my_vchp_rsvr_htr_t_5',    162,  2, gAttr.REG_READ_ONLY),
00289     gAttr.GattrReg('acd_bea_grid_intf_t_1',   163,  2, gAttr.REG_READ_ONLY),
00290     gAttr.GattrReg('py_vchp_xlhp_intf_t_5',   164,  2, gAttr.REG_READ_ONLY),
00291     gAttr.GattrReg('my_vchp_xlhp_intf_t_5',   165,  2, gAttr.REG_READ_ONLY),
00292     gAttr.GattrReg('spare_t_3',               166,  2, gAttr.REG_READ_ONLY),
00293     gAttr.GattrReg('spare_t_4',               167,  2, gAttr.REG_READ_ONLY),
00294     gAttr.GattrReg('spare_t_5',               168,  2, gAttr.REG_READ_ONLY),
00295     gAttr.GattrReg('spare_t_6',               169,  2, gAttr.REG_READ_ONLY),
00296     ]
00297
00298   __ADCS_BASE = 10
00299   __STALE_TMO = 1.0
00300
00301   def __init__(self, client, parent):
00302     """\brief Initialize valid registers as Gattrs.
00303
00304     Assign default values to members
00305     """
00306     self.__adcs = 8*[(None, None, None, 0)] # [gRegister.Register, time.time()]
00307     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00308
00309   def read(self, reg):
00310     if reg < GPEQ.__ADCS_BASE:
00311       rsp = self.cmdrsp('PDUenvReadSync', 'slh', self.up().addr(), reg, '!III')
00312       payloads = (rsp.payloads()[2], rsp.payloads()[1], rsp.payloads()[0])
00313       return gRegister.Register(rsp.timestamp(), rsp.status(), payloads, 'III')
00314     else:
00315       return self.__fetchReg(reg)
00316
00317   def load(self, reg, value):
00318     return self.cmdrsp('PDUenvLoadSync', 'slh', self.up().addr(), reg, value)
00319
00320   def __fetchReg(self, reg):
00321     group = (reg - GPEQ.__ADCS_BASE) / 20
00322     which = (reg - GPEQ.__ADCS_BASE) % 20
00323     now = time.time()
00324     rsp = [None, None, None]
00325     (rsp[0], rsp[1], rsp[2], rt) = self.__adcs[group]
00326     if ((rsp[0] is None) or (now - rt) > GPEQ.__STALE_TMO):
00327       # Set the group and cause the ADCs to convert
00328       self.cmdrsp('PDUconLoadSync', 'slh', self.up().addr(), GPDU._GPDU__MONITOR, group)
00329       for adc in range(3):                # Update all three registers
00330         rsp[adc] = self.cmdrsp('PDUenvReadSync', 'slh', self.up().addr(), adc, '!III')
00331       self.__adcs[group] = (rsp[0], rsp[1], rsp[2], now)
00332     rsp = self.__adcs[group][which/7]
00333     payloads = rsp.payloads()
00334     payload  = (long(payloads[0]) << 64) | (long(payloads[1]) << 32) | long(payloads[2])
00335     timestamp = rsp.timestamp()
00336     status    = rsp.status()
00337     payloads  = [int((payload >> (12 * (which % 7))) & 0x0fff)]
00338     return gRegister.Register(timestamp, status, payloads, 'H')
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! A template class */
template<class T> class Templ { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented
                  public Templ<int>
{
  private:
    Used *m_usedClass;
};
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled black box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
The arrows have the following meaning:
  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gRegister.py Source File

client

gRegister.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Register access class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:57:25 $").split(' ')[1]
00015 __version__  = "$Revision: 2.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020 import struct
00021
00022 class Register:
00023   def __init__(self, timestamp, status, payloads, format):
00024     self.__timestamp = timestamp
00025     self.__status    = status
00026     p = 0
00027     shift = 0
00028     value = 0
00029     for payload in payloads:
00030       f = format[p]
00031       value |= payload << shift
00032       p += 1
00033       shift += struct.calcsize(f) << 3
00034     self.__value = value
00035
00036   def timestamp(self):
00037     return self.__timestamp
00038
00039   def status(self):
00040     return self.__status
00041
00042   def value(self):
00043     return self.__value
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gResponse.py Source File

client

gResponse.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Response class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 22:57:25 $").split(' ')[1]
00015 __version__  = "$Revision: 2.5 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020 import struct
00021 import gException
00022
00023 class Response:
00024   def __init__(self, command, result):
00025     self.__timestamp = 0x0L
00026     self.__status    = 0
00027     self.__payloads  = []
00028     self.__formats  = command.payloadfmts()
00029
00030     fmt = '!IQI'
00031     for payloadfmt in self.__formats:
00032       fmt += payloadfmt
00033     if len(result) != struct.calcsize(fmt):
00034       print "*** gResponse: received %d bytes but expected %d bytes" \
00035             %(len(result), struct.calcsize(fmt))
00036       self.__status = gException.LATInterfaceStatus.status('OCS_BDRESP')
00037     else:
00038       rsp = struct.unpack(fmt, result)
00039       self.__timestamp = rsp[1]
00040       self.__status    = rsp[2] & 0x7fffffff
00041       self.__payloads  = rsp[3:]
00042
00043   def timestamp(self):
00044     return self.__timestamp
00045
00046   def status(self):
00047     return self.__status
00048
00049   def value(self):
00050     return self.__payloads[0]
00051
00052   def payloads(self):
00053     return self.__payloads
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gRule.py Source File

database

gRule.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Classes for defining rules"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/09/25 01:47:09 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020 import               gGroup
00021 import logging as    log
00022 import LATTE.dispatch.dispatcher as dispatcher
00023
00024 class GruleBase(object):
00025   """\brief Base rule class for use when no rule is appropriate.
00026
00027   """
00028   def __init__(self):
00029     pass
00030   def evaluate(self, value, attr, node=None):
00031     pass
00032
00033
00034 class Grule(GruleBase):
00035   """\brief Base class for describing rules.
00036
00037   """
00038   def __init__(self, name, subsystem, category, enabled, continuous = False):
00039     """Constructor.
00040       \param name       Rule name
00041       \param subsystem  Subsystem gGroup to which the rule belongs
00042       \param category   Category gGroup to which the rule belongs
00043       \param enabled    Flag indicating whether rule is enabled
00044       \param continuous Flag indicating whether rule can fire repeatedly
00045
00046     """
00047     self.__name       = name
00048     self.__subsystem  = subsystem
00049     self.__category   = category
00050     self.__enabled    = enabled
00051     self.__continuous = continuous
00052     self.__fired      = False
00053     self.__actions    = {}
00054
00055   def _eval_(self, value, attr, node):
00056     """Dummy evaluation method to be overridden through inheritance to implement
00057     the application specific rule evaluation
00058
00059     """
00060     return (value, False)
00061
00062   def evaluate(self, value, attr, node=None):
00063     """This method is called to evaluate the rule on 'value'
00064
00065     \param value Value to be evaluated.
00066     \param attr  Attribute object whose \a value is being evaluated.
00067
00068     \return Result of the evaluation, if any.
00069
00070     """
00071     if self.__subsystem.enabled() and \
00072        self.__category.enabled()  and \
00073        self.__enabled:
00074       return self._eval_(value, attr, node)
00075     else:
00076       return (value, False)
00077
00078   def name(self):
00079     """Method to retrieve the rule's name
00080
00081     \return Rule's name.
00082
00083     """
00084     return self.__name
00085
00086   def subsystem(self):
00087     """Method for discovering this rule's subsystem
00088
00089     \return Rule's subsystem.
00090
00091     """
00092     return self.__subsystem
00093
00094   def category(self):
00095     """Method for discovering this rule's category
00096
00097     \return Rule's category.
00098
00099     """
00100     return self.__category
00101
00102   def enabled(self):
00103     """Method for discovering whether this rule is enabled
00104
00105     \return Whether this rule is enabled or not.
00106
00107     """
00108     return self.__enabled
00109
00110   def enable(self):
00111     """Method used to enable evaluation of this rule
00112
00113     """
00114     self.__enabled = True
00115
00116   def disable(self):
00117     """Method used to disable evaluation of this rule
00118
00119     """
00120     self.__enabled = False
00121
00122   def reset(self):
00123     """Method used to reenable evaluation of this rule in the case of
00124     noncontinuous mode after it has been violated
00125
00126     """
00127     self.__fired = False
00128
00129   def registerAction(self, action, method, sender=dispatcher.Any):
00130     """Associate and action with a user \a method, optionally specifying a \a sender.
00131     If a \a sender is not specified, the rule \a action may be fired for all registers
00132     which declare its rule to be the rule of this \a action. If an attribute is
00133     specified as the \a sender then only if the evaluation of that specific attribute
00134     causes the \a action to be fired the \a method will be called.
00135
00136     \param action A string that represents the action to be taken.
00137                   This is specified under the <actions> tag in the schema/configuration.
00138     \param method A user method visible to the current context.
00139     \param sender Optional parameter that specifies the sender of the action registration.
00140                   If specifed, only the sendAction requests which specify the same sender
00141                   will be honored. Defaults to dispatcher.Any.
00142
00143     """
00144     if action not in self.__actions:
00145       log.error("Unable to register action %s, not specified in the configuration." % action)
00146     else:
00147       dispatcher.connect(method, signal=action, sender=sender)
00148
00149   def setActions(self, actions):
00150     """Convenience method that gets called from the rule constructor
00151     that defines the action names (which is read from the schema/configuration).
00152
00153     \param actions A list containing the action names.
00154
00155     """
00156     self.__actions = actions
00157
00158   def sendAction(self, action, sender, *arguments, **named):
00159     """Called from the rule evaluation method to fire the appropriate alarm action.
00160
00161     \param action     A string that represents the action to be taken.
00162                       This is specified under the <actions> tag in the schema/configuration.
00163     \param sender     The sender that made the rule firing request. This is usually the
00164                       attribute which is being evaluated.
00165     \param *arguments An optional list of arguments which gets passed to the action method.
00166
00167     \return A list of tuple pairs [(receiver, response), ... ]
00168     """
00169     return dispatcher.send(action, sender, *arguments, **named)
00170
00171   def clearAllActions(self):
00172     """
00173     Forces all registered actions to be cleared.
00174     If this is not done and the scripts re-register their
00175     actions there may be extraneous rule action firings.
00176     """
00177     dispatcher.connections = {}
00178
00179   def unregisterAction(self, action, method, sender=dispatcher.Any):
00180     """Reverse of registerAction, disassociates the action from the method.
00181
00182    \param action A string that represents the action to be taken.
00183                   This is specified under the <actions> tag in the schema/configuration.
00184     \param method A user method visible to the current context.
00185     \param sender Optional parameter that specifies the sender of the action registration.
00186                   If specifed, only the sendAction requests which specify the same sender
00187                   will be honored. Defaults to dispatcher.Any.
00188     """
00189     dispatcher.disconnect(method, action, sender)
00190
00191 class GruleLimit(Grule):
00192   """\brief Rule class that limits a passed in value to given limits.
00193
00194   """
00195   def __init__(self, name, subsystem, category, enabled, continuous,
00196                low, high):
00197     """Limit rule constructor.
00198
00199       \param name             Rule name
00200       \param subsystem        Subsystem gGroup to which the rule belongs
00201       \param category         Category gGroup to which the rule belongs
00202       \param enabled          Flag indicating whether rule is enabled
00203       \param continuous       Flag indicating whether rule can fire repeatedly
00204       \param low              Low limit
00205       \param high             High limit
00206
00207     """
00208     Grule.__init__(self, name, subsystem, category, enabled, continuous)
00209     self.__low  = low
00210     self.__high = high
00211
00212   def _eval_(self, value, attr, node):
00213     """Evaluate the rule.
00214     """
00215     if   value < self.__low:
00216       log.warning("%s rule: value is below low limit"  % self.name())
00217     elif value > self.__high:
00218       log.warning("%s rule: value is above high limit" % self.name())
00219
00220 class GruleAlarms(Grule):
00221   """\brief Alarm rule
00222
00223   If the value falls below the yellow or red lower limit or it exceeds
00224   the yellow or red upped limit the appropriate registered action is
00225   fired.
00226   """
00227   def __init__(self, name, subsystem, category, enabled, continuous,
00228                yellowUpperLimit, yellowLowerLimit,
00229                redUpperLimit, redLowerLimit, actions=[]):
00230     """Alarm rule constructor.
00231
00232       \param name             Rule name
00233       \param subsystem        Subsystem gGroup to which the rule belongs
00234       \param category         Category gGroup to which the rule belongs
00235       \param enabled          Flag indicating whether rule is enabled
00236       \param continuous       Flag indicating whether rule can fire repeatedly
00237       \param yellowUpperLimit Yellow alarm upper limit
00238       \param yellowLowerLimit Yellow alarm lower limit
00239       \param redUpperLimit    Red alarm upper limit
00240       \param redLowerLimit    Red alarm lower limit
00241     """
00242
00243     Grule.__init__(self, name, subsystem, category, enabled, continuous)
00244     self.__yellowLowerLimit = yellowLowerLimit
00245     self.__yellowUpperLimit = yellowUpperLimit
00246     self.__redLowerLimit = redLowerLimit
00247     self.__redUpperLimit = redUpperLimit
00248     self.setActions(actions)
00249
00250   def _eval_(self, value, attr, node):
00251     """Alarm rule evaluation method.
00252
00253     If the red alarm is fired then the yellow alarm does not get fired.
00254     """
00255     if value < self.__redLowerLimit or value > self.__redUpperLimit:
00256       self.sendAction("redAction", attr, value, node=node)
00257     elif value < self.__yellowLowerLimit or value > self.__yellowUpperLimit:
00258       self.sendAction("yellowAction", attr, value, node=node)
00259
Generated on Fri Jan 21 18:00:49 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gSchemaConfig.py Source File

database

gSchemaConfig.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = """Build the GLAST LAT database schema and configuration from
00012 an XML defintion.
00013 """
00014 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00015 __date__    = ("$Date: 2005/01/21 23:57:52 $").split(' ')[1]
00016 __version__ = "$Revision: 2.42.2.7 $"
00017 __release__ = "$Name: P04-06-05 $"
00018 __credits__ = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021
00022
00023 import os
00024 import sys
00025 import inspect
00026 import types
00027 import logging          as     log
00028
00029 #from xml.dom            import Node
00030 #from xml.dom.ext.reader import Sax2
00031 from xml.dom.NodeFilter import NodeFilter
00032 #from xml.dom.ext        import PrettyPrint
00033 #from xml.dom            import implementation
00034
00035 import xml.dom.minidom  as minidom
00036
00037 from ihooks             import BasicModuleLoader
00038
00039 from gGroup             import *
00040
00041 from LATTE.client import gLog
00042 from LATTE.client import gBits
00043 from LATTE.client import gException
00044
00045 # (tray, which) to layer map
00046 MAP_DETECTOR_TO_LAYER = {
00047                          (18, 'bot'): 'Y17',
00048                          (17, 'top'): 'X17',
00049                          (17, 'bot'): 'X16',
00050                          (16, 'top'): 'Y16',
00051                          (16, 'bot'): 'Y15',
00052                          (15, 'top'): 'X15',
00053                          (15, 'bot'): 'X14',
00054                          (14, 'top'): 'Y14',
00055                          (14, 'bot'): 'Y13',
00056                          (13, 'top'): 'X13',
00057                          (13, 'bot'): 'X12',
00058                          (12, 'top'): 'Y12',
00059                          (12, 'bot'): 'Y11',
00060                          (11, 'top'): 'X11',
00061                          (11, 'bot'): 'X10',
00062                          (10, 'top'): 'Y10',
00063                          (10, 'bot'): 'Y9',
00064                          ( 9, 'top'): 'X9',
00065                          ( 9, 'bot'): 'X8',
00066                          ( 8, 'top'): 'Y8',
00067                          ( 8, 'bot'): 'Y7',
00068                          ( 7, 'top'): 'X7',
00069                          ( 7, 'bot'): 'X6',
00070                          ( 6, 'top'): 'Y6',
00071                          ( 6, 'bot'): 'Y5',
00072                          ( 5, 'top'): 'X5',
00073                          ( 5, 'bot'): 'X4',
00074                          ( 4, 'top'): 'Y4',
00075                          ( 4, 'bot'): 'Y3',
00076                          ( 3, 'top'): 'X3',
00077                          ( 3, 'bot'): 'X2',
00078                          ( 2, 'top'): 'Y2',
00079                          ( 2, 'bot'): 'Y1',
00080                          ( 1, 'top'): 'X1',
00081                          ( 1, 'bot'): 'X0',
00082                          ( 0, 'top'): 'Y0'
00083                         }
00084
00085
00086 # layer to (cc lo, cc hi, rc) map
00087 MAP_LAYER_TO_CABLE = {
00088                         'Y17': (5,4,8),
00089                         'X17': (6,7,8),
00090                         'X16': (3,2,8),
00091                         'Y16': (0,1,8),
00092                         'Y15': (5,4,7),
00093                         'X15': (6,7,7),
00094                         'X14': (3,2,7),
00095                         'Y14': (0,1,7),
00096                         'Y13': (5,4,6),
00097                         'X13': (6,7,6),
00098                         'X12': (3,2,6),
00099                         'Y12': (0,1,6),
00100                         'Y11': (5,4,5),
00101                         'X11': (6,7,5),
00102                         'X10': (3,2,5),
00103                         'Y10': (0,1,5),
00104                         'Y9' : (5,4,4),
00105                         'X9' : (6,7,4),
00106                         'X8' : (3,2,4),
00107                         'Y8' : (0,1,4),
00108                         'Y7' : (5,4,3),
00109                         'X7' : (6,7,3),
00110                         'X6' : (3,2,3),
00111                         'Y6' : (0,1,3),
00112                         'Y5' : (5,4,2),
00113                         'X5' : (6,7,2),
00114                         'X4' : (3,2,2),
00115                         'Y4' : (0,1,2),
00116                         'Y3' : (5,4,1),
00117                         'X3' : (6,7,1),
00118                         'X2' : (3,2,1),
00119                         'Y2' : (0,1,1),
00120                         'Y1' : (5,4,0),
00121                         'X1' : (6,7,0),
00122                         'X0' : (3,2,0),
00123                         'Y0' : (0,1,0)
00124                      }
00125
00126 # Minitower configuration
00127 #MINITOWER_MAP_LAYER_TO_CABLE = {
00128 #                                  'Y3' : (6,7,1),
00129 #                                  'X3' : (4,5,1),
00130 #                                  'X2' : (0,1,1),
00131 #                                  'Y2' : (2,3,1),
00132 #                                  'Y1' : (6,7,0),
00133 #                                  'X1' : (4,5,0),
00134 #                                  'X0' : (0,1,0),
00135 #                                  'Y0' : (2,3,0)
00136 #                              }
00137
00138 MAP_TEM_TO_TOWER = {
00139                               #TEM_ID -> (row,col)
00140                               '0':(0,0),
00141                               '1':(1,0),
00142                               '2':(2,0),
00143                               '3':(3,0),
00144                               '4':(0,1),
00145                               '5':(1,1),
00146                               '6':(2,1),
00147                               '7':(3,1),
00148                               '8':(0,2),
00149                               '9':(1,2),
00150                               '10':(2,2),
00151                               '11':(3,2),
00152                               '12':(0,3),
00153                               '13':(1,3),
00154                               '14':(2,3),
00155                               '15':(3,3)
00156                    }
00157
00158
00159 def readSchema(glat, fileName):
00160   """Reads a LAT schema/config document from an XML file
00161   and returns the object model
00162
00163   Input ::
00164
00165     (1) Filename of the XML
00166     (2) Optional active (connected) command client reference.
00167         Not needed if the document does not contain a 'configuration' section
00168
00169   Output::
00170
00171     GLAT root of the object model
00172
00173   Usage::
00174
00175     lat = readSchema('testSchema.xml')"""
00176   #reader = PyExpat.Reader()
00177   #doc = reader.fromStream(file(fileName,'r'))
00178
00179   # Change the directory to the path of the schema file
00180   # in case the include files do not have absolute paths
00181   fn = "readSchema"
00182   curDir = os.getcwd()
00183   mainFilePath = os.path.dirname(fileName)
00184   mainFileName = os.path.basename(fileName)
00185   if mainFilePath != '': os.chdir(mainFilePath)
00186   try:
00187     #doc = Sax2.FromXmlFile(mainFileName)
00188     doc = minidom.parse(mainFileName)
00189   except Exception, e:
00190     os.chdir(curDir)
00191     log.exception("%s: Error parsing XML: %s" % (fn, mainFileName))
00192     raise e
00193
00194   comments = []
00195   for n in doc.childNodes:
00196     if n.nodeType == minidom.Node.COMMENT_NODE:
00197       comments.append(n.data)
00198   tagName = doc.documentElement.tagName.lower()
00199   if tagName != "latdoc":
00200     log.error("%s: Invalid LAT document tag: %s" % (fn,tagName))
00201     os.chdir(curDir)
00202     return None
00203
00204   includeFiles = []
00205   processIncludes(doc, doc.documentElement, includeFiles, mainFilePath)
00206   #PrettyPrint(doc, sys.stdout)
00207
00208   declarations =  { 'imports':{},
00209                     'groups':{},
00210                     'constraints':{},
00211                     'rules':{},
00212                     'egus':{},
00213                     'options':{'skiptemoverrides':0,
00214                                'explicitbroadcastnodes':0,
00215                                'ignorehardwaretimeouts':0
00216                                }
00217                   }
00218   deadChannels = {}
00219   noisyChannels = {}
00220   name = str(doc.documentElement.getAttribute('name'))
00221   pNodeClass = glat.__class__.__name__
00222   isSchema = None
00223   for n in getChildNodes(doc.documentElement):
00224     if n.nodeType == minidom.Node.ELEMENT_NODE:
00225       tagname = str(n.tagName).lower()
00226       if  tagname == 'declarations':
00227         processDeclarations(1, n, declarations)
00228       elif tagname == 'constraints':
00229         processConstraints(n, declarations['groups'], declarations['constraints'])
00230       elif tagname == 'rules':
00231         processRules(n, declarations['groups'], declarations['rules'])
00232       elif tagname == 'egus':
00233         processEGUs(n, declarations['egus'])
00234       elif tagname == 'schema':
00235         isSchema = 0
00236         for node in getChildNodes(n):
00237           if pNodeClass in gSCprocessRegistry.keys() and \
00238              pNodeClass.lower() == node.tagName.lower():
00239             isSchema = 1
00240             gSCprocessRegistry[pNodeClass](isSchema, glat, node, declarations)
00241             break
00242 #           if pNodeClass == 'GLAT' and node.tagName.lower() == 'glat':
00243 #             processGLAT(isSchema=1, glat=glat,
00244 #                         node=node, declarations=declarations)
00245 #             break
00246 #           elif pNodeClass == 'GXBRD' and node.tagName.lower() == 'gxbrd':
00247 #             processGXBRD(isSchema=1, gxbrd=glat,
00248 #                         node=node, declarations=declarations)
00249 #             break
00250           # Silently skip other root tags for now.
00251           #else:
00252           #  log.error("%s: Unexpected tag: %s for root: %s" % (fn, node.tagName, glat.__class__.__name__))
00253       elif tagname == 'configuration':
00254         configName = ''
00255         configVersion = ''
00256         if n.hasAttribute('name'):
00257           configName = str(n.getAttribute('name'))
00258         if n.hasAttribute('version'):
00259           configVersion = str(n.getAttribute('version'))
00260         configs = glat.getConfigurations()
00261         configSeq = len(configs)
00262         configs[configSeq] = (n, configName, configVersion)
00263       elif tagname == 'badstrips' and pNodeClass == 'GLAT':
00264         typ = str(n.getAttribute('badType'))
00265         if typ == 'dead':
00266           processBadChannels(n, deadChannels)
00267         elif typ == 'hot':
00268           processBadChannels(n, noisyChannels)
00269         else:
00270           log.error("%s: Unrecognized bad strip type: %s" % (fn, typ))
00271       elif tagname == 'opaque':
00272         addOpaque(glat, n)
00273       elif pNodeClass == 'GLAST':
00274         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00275         os.chdir(curDir)
00276         return None
00277
00278   # need to write some private attributes in the glat object, but there's no
00279   # guarantee of what the class's type actually is.  It doesn't matter if the
00280   # class doesn't have the attribute, this will create it.
00281   # Use the __dict__ and create the string on the fly.
00282   gname = glat.__class__.__name__
00283   gdict = glat.__dict__
00284   gdict["_" + gname + '__schemaName']        = name
00285   gdict["_" + gname + '__schemaComments']    = comments
00286   gdict["_" + gname + '__includeFiles']      = includeFiles
00287   gdict["_" + gname + '__declarations']      = declarations
00288   gdict["_" + gname + '__deadChannels']      = deadChannels
00289   gdict["_" + gname + '__noisyChannels']     = noisyChannels
00290
00291   os.chdir(curDir)
00292   if isSchema == 0:
00293     # A matching schema root tag (such as GLAT or GXBRD) was not found
00294     return None
00295   else:
00296     return glat
00297
00298 def addOpaque(gnode, xnode):
00299   name = str(xnode.getAttribute('name'))
00300   root = gnode.root()
00301   rname = root.__class__.__name__
00302   rdict = root.__dict__
00303   opaque = rdict["_" + rname + '__opaque']
00304   if gnode in opaque:
00305     opaqueDict = opaque[gnode]
00306   else:
00307     opaqueDict = opaque[gnode] = {}
00308   if name in opaqueDict:
00309     if xnode not in opaqueDict[name]:
00310       opaqueDict[name].append(xnode)
00311   else:
00312     opaqueDict[name] = [xnode]
00313
00314 def addSerialNos(gnode, snode):
00315   root = gnode.root()
00316   rname = root.__class__.__name__
00317   rdict = root.__dict__
00318   serialnos = rdict["_" + rname + '__serialnos']
00319   if gnode in serialnos:
00320     serialDict = serialnos[gnode]
00321   else:
00322     serialDict = serialnos[gnode] = {}
00323   for i in range(snode.attributes.length):
00324     name  = str(snode.attributes.item(i).name).lower()
00325     value = str(snode.attributes.item(i).value)
00326     serialDict[name] = value
00327
00328 def processIncludes(doc, node, includeFiles, mainFilePath):
00329   fn = "processIncludes"
00330   for n in getChildNodes(node):
00331     if n.nodeType == minidom.Node.ELEMENT_NODE and n.tagName.lower() == 'include':
00332       incFileName = os.path.expandvars(str(n.getAttribute('filename')))
00333       incFilePath = os.path.dirname(incFileName)
00334       if incFilePath == '' and mainFilePath != '':
00335         incFileName = os.path.join(mainFilePath, incFileName)
00336       if incFileName not in includeFiles:
00337         includeFiles.append(incFileName)
00338       #incDoc = Sax2.FromXmlFile(incFileName)
00339       try:
00340         incDoc = minidom.parse(incFileName)
00341       except Exception, e:
00342         log.exception("%s: Error parsing XML include: %s" % (fn, incFileName))
00343         raise e
00344       processIncludes(incDoc, incDoc.documentElement, includeFiles, mainFilePath)
00345       incDom = doc.importNode(incDoc.documentElement,1)
00346       node.replaceChild(incDom, n)
00347     else:
00348       processIncludes(doc, n, includeFiles, mainFilePath)
00349
00350 def processConfigProperties(node, declarations):
00351   fn = "processConfigProperties"
00352   if node.nodeType == minidom.Node.ELEMENT_NODE:
00353     cfgTagname = node.tagName.lower()
00354     if cfgTagname == 'declarations':
00355       processDeclarations(0, node, declarations)
00356     elif cfgTagname == 'constraints':
00357       processConstraints(node, declarations['groups'], declarations['constraints'])
00358     elif cfgTagname == 'rules':
00359       processRules(node, declarations['groups'], declarations['rules'])
00360     elif cfgTagname == 'egus':
00361       processEGUs(node, declarations['egus'])
00362     elif cfgTagname in ('glat', 'gglt', 'gxbrd'):
00363       pass
00364     else:
00365       log.error("%s: Unrecognized configuration tag: %s" % (fn, cfgTagname))
00366
00367
00368 def readConfig(glat, cfgFileName):
00369   """Read a configuration XML file and add its DOM
00370   to the dictionary of configurations.
00371
00372   \param  glat        Populated schema
00373   \param  cfgFileName Name of the configuration file in XML format
00374   \return             The numeric key value of the dictionary entry.
00375                       -1 if it fails to read the configuration file.
00376
00377   """
00378   fn = "readConfig"
00379   curDir = os.getcwd()
00380   mainFilePath = os.path.dirname(cfgFileName)
00381   mainFileName = os.path.basename(cfgFileName)
00382   if mainFilePath != '': os.chdir(mainFilePath)
00383
00384   try:
00385     #cfgDoc = Sax2.FromXmlFile(mainFileName)
00386     cfgDoc = minidom.parse(mainFileName)
00387   except:
00388     log.exception("%s: Error reading configuration file: %s" % (fn, cfgFileName))
00389     os.chdir(curDir)
00390     return -1
00391
00392   cfgNode = cfgDoc.documentElement
00393
00394   includeFiles = []
00395   processIncludes(cfgDoc, cfgNode, includeFiles, mainFilePath)
00396   glat._GLAT__includeFiles += includeFiles
00397   #cfgDom = cfgDoc.importNode(cfgDoc,1)
00398   cfgDict = glat.getConfigurations()
00399   configSeq = len(cfgDict)
00400   configName = ''
00401   configVersion = ''
00402   if cfgNode.hasAttribute('name'):
00403     configName = str(cfgNode.getAttribute('name'))
00404   if cfgNode.hasAttribute('version'):
00405     configVersion = str(cfgNode.getAttribute('version'))
00406
00407   cfgDict[configSeq] = (cfgNode, configName, configVersion)
00408   os.chdir(curDir)
00409   return configSeq
00410
00411 def applyConfig(glat, seq=None, gxbrd=None):
00412   """Applies the configuration that may have existed when the schema is read.
00413      The configuration portion of the schema is stored as a DOM reference
00414      in the GLAT node. This function accesses that DOM and sets the registers
00415      accordingly
00416
00417   Input ::
00418
00419     (1) GLAT root of the object model
00420     (2) Optional sequence number of the configuration
00421
00422   Output: None
00423
00424   Usage::
00425
00426     applyConfig(lat)"""
00427
00428   fn = "applyConfig"
00429   configs = []
00430   if seq is None:
00431     if len(glat.getConfigurations()) == 0:
00432       log.debug("%s: Nothing to do, no configuration exists" % fn)
00433       # Setup the GTEM and GCCCs just in case
00434       configureGTEM(glat, glat.TEM.keys(), None)
00435       return
00436     else:
00437       configSeqList = glat.getConfigurations().keys()
00438       configSeqList.sort()
00439       for seq in configSeqList:
00440         configs.append(glat.getConfigurations()[seq][0])
00441   elif type(seq) == types.IntType:
00442     if glat.getConfigurations().has_key(seq):
00443       configs.append(glat.getConfigurations()[seq][0])
00444     else:
00445       log.error("%s: Configuration with sequence %d could not be found" % (fn, seq))
00446       return
00447
00448   for config in configs:
00449     for n in getChildNodes(config):
00450       processConfigProperties(n, glat.getDeclarations())
00451       if n.nodeType == minidom.Node.ELEMENT_NODE:
00452         tagname = n.tagName.lower()
00453         if tagname == 'glat':
00454           if config.hasAttribute('name'):
00455             configName = config.getAttribute('name')
00456           else:
00457             configName = '(no name)'
00458           log.debug("%s: Applying LAT configuration: %s" % (fn, configName))
00459           processGLAT(isSchema=0, glat=glat,
00460                       node=n, declarations=glat.getDeclarations())
00461         elif tagname == 'gxbrd':
00462           if config.hasAttribute('name'):
00463             configName = config.getAttribute('name')
00464           else:
00465             configName = '(no name)'
00466           log.debug("%s: Applying XBRD configuration: %s" % (fn, configName))
00467           if gxbrd is not None:
00468             processGXBRD(isSchema=0, gxbrd=gxbrd,
00469                       node=n, declarations=glat.getDeclarations())
00470           # XBRD configuration should be optional -ST
00471           #else:
00472           #  log.warn("skipping XBRD configuration, no gXBRD given")
00473
00474 def processGLAT(isSchema, glat, node, declarations):
00475   fn = "processGLAT"
00476   node = checkForDuplicateNode(node)
00477   for n in getChildNodes(node):
00478     tagName = n.tagName.lower()
00479     if tagName == 'gtem':
00480       processGTEM(isSchema, glat, n, declarations)
00481     elif tagName == 'gaem':
00482       processGAEM(isSchema, glat, n, declarations)
00483     elif tagName == 'gpdu':
00484       processGPDU(isSchema, glat, n, declarations)
00485     elif tagName == 'gebm':
00486       processGEBM(isSchema, glat, n, declarations)
00487     elif tagName == 'ggem':
00488       processGGEM(isSchema, glat, n, declarations)
00489     elif tagName == 'gcru':
00490       processGCRU(isSchema, glat, n, declarations)
00491     elif tagName == 'opaque':
00492       addOpaque(glat, n)
00493     elif isSchema:
00494       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00495     elif tagName == 'serialnos':
00496       addSerialNos(glat, n)
00497     elif tagName in glat.regs:
00498       setRegister(glat.regs[tagName], n, declarations)
00499     else:
00500       log.error("%s: Configuration error processing GLAT...Invalid register %s" % (fn, n.tagName))
00501
00502   return glat
00503
00504 def setRegister(gattr, node, declarations):
00505   fn = "setRegister"
00506   constraints = declarations['constraints']
00507   rules = declarations['rules']
00508   egus = declarations['egus']
00509   if node.hasAttribute('constraint'):
00510     consName = str(node.getAttribute('constraint'))
00511     cons = constraints[consName]
00512     if cons is not None:
00513       gattr.setConstraint(cons)
00514   if node.hasAttribute('egu'):
00515     eguName = str(node.getAttribute('egu'))
00516     egu = egus[eguName]
00517     if egu is not None:
00518       gattr.setEGU(egu)
00519   if node.hasAttribute('rule'):
00520     ruleName = str(node.getAttribute('rule'))
00521     rule = rules[ruleName]
00522     if rule is not None:
00523       gattr.setRule(rule)
00524   if node.firstChild is not None and not gattr.isReadOnly():
00525     regVal = extractRegisterValue(node)
00526     try:
00527       gattr.set(regVal, bypass=1)
00528     except:
00529       log.error("%s: Error setting register %s.%s" % (fn, gattr.getNode().getName(), gattr.getName()))
00530       log.exception("")
00531
00532 def extractRegisterValue(node):
00533   regVal = node.firstChild.data.strip()
00534   if regVal.startswith('0x'):
00535     regVal = long(regVal,16)
00536   else:
00537     regVal = long(regVal)
00538   return regVal
00539
00540 def processGXBRD(isSchema, gxbrd, node, declarations):
00541   fn = "processGXBRD"
00542   node = checkForDuplicateNode(node)
00543   for n in getChildNodes(node):
00544     tagName = n.tagName.lower()
00545     if tagName == 'gtwr':
00546       processGTWR(isSchema, gxbrd, n, declarations)
00547     elif tagName == 'gglt':
00548       processGGLT(isSchema, gxbrd, n, declarations)
00549     elif isSchema:
00550       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00551     elif tagName in gxbrd.regs:
00552       setRegister(gxbrd.regs[tagName], n, declarations)
00553     else:
00554       log.error("%s: Configuration error processing GXBRD...Invalid register %s" % (fn, n.tagName))
00555   return gxbrd
00556
00557
00558 def processGTWR(isSchema, gxbrd, node, declarations):
00559   fn = "processGTWR"
00560   if node.hasAttribute('ID'):
00561     gtwrIdSeq = uncompressSequence(node.getAttribute('ID'))
00562   else:
00563     log.error("%s: Configuration error processing GTWR...Missing ID" % fn)
00564     return
00565   for gtwrId in gtwrIdSeq:
00566     if isSchema:
00567       gtwr = gxbrd._GXBRD__addTWR(gtwrId)
00568     elif gxbrd.existsTWR(gtwrId):
00569       gtwr = gxbrd.TWR[gtwrId]
00570     else:
00571       log.debug("%s: Configuration error processing GTWR # %d ...Not populated" % (fn, gtwrId))
00572       continue
00573     node = checkForDuplicateNode(node)
00574     for n in getChildNodes(node):
00575       tagName = n.tagName.lower()
00576       if tagName == 'opaque':
00577         addOpaque(gtwr, n)
00578       elif isSchema:
00579         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00580       elif tagName == 'serialnos':
00581         addSerialNos(gtwr, n)
00582       elif tagName in gtwr.regs:
00583         setRegister(gtwr.regs[tagName], n, declarations)
00584       else:
00585         log.error("%s: Configuration error processing GTWR # %d ...Invalid register %s" % (fn, gtwrId, n.tagName))
00586
00587 def processGGLT(isSchema, gxbrd, node, declarations):
00588   fn = "processGGLT"
00589   if isSchema:
00590     gglt = gxbrd._GXBRD__addGLT()
00591   elif gxbrd.downGLT() != None:
00592     gglt = gxbrd.downGLT()
00593   else:
00594     log.debug("%s: Configuration error processing GGLT...Not populated" % fn)
00595     return
00596   node = checkForDuplicateNode(node)
00597   for n in getChildNodes(node):
00598     tagName = n.tagName.lower()
00599     if tagName == 'opaque':
00600       addOpaque(gglt, n)
00601     elif isSchema:
00602       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00603     elif tagName == 'serialnos':
00604       addSerialNos(gglt, n)
00605     elif tagName in gglt.regs:
00606       setRegister(gglt.regs[tagName], n, declarations)
00607     else:
00608       log.error("%s: Configuration error processing GGLT...Invalid register %s" % (fn, n.tagName))
00609
00610 def processGPDU(isSchema, glat, node, declarations):
00611   fn = "processGPDU"
00612   if node.hasAttribute('ID'):
00613     gpduIdSeq = uncompressSequence(node.getAttribute('ID'))
00614   else:
00615     log.error("%s: Configuration error processing GPDU...Missing ID" % fn)
00616     return
00617
00618   for gpduId in gpduIdSeq:
00619     if isSchema:
00620       gpdu = glat._GLAT__addPDU(gpduId)
00621     elif glat.existsPDU(gpduId):
00622       gpdu = glat.downPDU(gpduId)
00623     else:
00624       log.debug("%s: Configuration error processing GPDU...Not populated" % fn)
00625       return
00626
00627     node = checkForDuplicateNode(node)
00628     for n in getChildNodes(node):
00629       tagName = n.tagName.lower()
00630       if tagName == 'gpeq':
00631         processGPEQ(isSchema, gpdu, n, declarations)
00632       elif tagName == 'opaque':
00633         addOpaque(gpdu, n)
00634       elif isSchema:
00635         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00636       elif tagName == 'serialnos':
00637         addSerialNos(gpdu, n)
00638       elif tagName in gpdu.regs:
00639         setRegister(gpdu.regs[tagName], n, declarations)
00640       else:
00641         log.error("%s: Configuration error processing GPDU...Invalid register %s" % (fn, n.tagName))
00642
00643
00644 def processGPEQ(isSchema, gpdu, node, declarations):
00645   fn = "processGPEQ"
00646   if isSchema:
00647     gpeq = gpdu._GPDU__addPEQ()
00648   elif gpdu.existsPEQ():
00649     gpeq = gpdu.downPEQ()
00650   else:
00651     log.debug("%s: Configuration error processing GPEQ...Not populated" % fn)
00652     return
00653   node = checkForDuplicateNode(node)
00654   for n in getChildNodes(node):
00655     tagName = n.tagName.lower()
00656     if tagName == 'opaque':
00657       addOpaque(gpeq, n)
00658     elif isSchema:
00659       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00660     elif tagName == 'serialnos':
00661       addSerialNos(gpeq, n)
00662     elif tagName in gpeq.regs:
00663       setRegister(gpeq.regs[tagName], n, declarations)
00664     else:
00665       log.error("%s: Configuration error processing GPEQ...Invalid register %s" % (fn, n.tagName))
00666
00667 def processGEBM(isSchema, glat, node, declarations):
00668   fn = "processGEBM"
00669   if isSchema:
00670     gebm = glat._GLAT__addEBM()
00671   elif glat.existsEBM():
00672     gebm = glat.downEBM()
00673   else:
00674     log.debug("%s: Configuration error processing GEBM...Not populated" % fn)
00675     return
00676   node = checkForDuplicateNode(node)
00677   for n in getChildNodes(node):
00678     tagName = n.tagName.lower()
00679     if tagName == 'gebmc':
00680       processGEBMC(isSchema, gebm, n, declarations)
00681     elif tagName == 'gebmst':
00682       processGEBMST(isSchema, gebm, n, declarations)
00683     elif tagName == 'opaque':
00684       addOpaque(gebm, n)
00685     elif isSchema:
00686       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00687     elif tagName == 'serialnos':
00688       addSerialNos(gebm, n)
00689     elif tagName in gebm.regs:
00690       setRegister(gebm.regs[tagName], n, declarations)
00691     else:
00692       log.error("%s: Configuration error processing GEBM...Invalid register %s" % (fn, n.tagName))
00693
00694 def processGEBMC(isSchema, gebm, node, declarations):
00695   fn = "processGEBMC"
00696   if isSchema:
00697     gebmc = gebm._GEBM__addEBMC()
00698   elif gebm.existsEBMC():
00699     gebmc = gebm.downEBMC()
00700   else:
00701     log.debug("%s: Configuration error processing GEBMC...Not populated" % fn)
00702     return
00703   node = checkForDuplicateNode(node)
00704   for n in getChildNodes(node):
00705     tagName = n.tagName.lower()
00706     if tagName == 'opaque':
00707       addOpaque(gebmc, n)
00708     elif isSchema:
00709       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00710     elif tagName == 'serialnos':
00711       addSerialNos(gebmc, n)
00712     elif tagName in gebmc.regs:
00713       setRegister(gebmc.regs[tagName], n, declarations)
00714     else:
00715       log.error("%s: Configuration error processing GEBMC...Invalid register %s" % (fn, n.tagName))
00716
00717 def processGEBMST(isSchema, gebm, node, declarations):
00718   fn = "processGEBMST"
00719   if isSchema:
00720     gebmst = gebm._GEBM__addEBMST()
00721   elif gebm.existsEBMST():
00722     gebmst = gebm.downEBMST()
00723   else:
00724     log.debug("%s: Configuration error processing GEBMST...Not populated" % fn)
00725     return
00726   node = checkForDuplicateNode(node)
00727   for n in getChildNodes(node):
00728     tagName = n.tagName.lower()
00729     if tagName == 'opaque':
00730       addOpaque(gebmst, n)
00731     elif isSchema:
00732       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00733     elif tagName == 'serialnos':
00734       addSerialNos(gebmst, n)
00735     elif tagName in gebmst.regs:
00736       setRegister(gebmst.regs[tagName], n, declarations)
00737     else:
00738       log.error("%s: Configuration error processing GEBMST...Invalid register %s" % (fn, n.tagName))
00739
00740 def processGGEM(isSchema, glat, node, declarations):
00741   fn = "processGGEM"
00742   if isSchema:
00743     ggem = glat._GLAT__addGEM()
00744   elif glat.existsGEM():
00745     ggem = glat.GEM
00746   else:
00747     log.debug("%s: Configuration error processing GGEM...Not populated" % fn)
00748     return
00749   node = checkForDuplicateNode(node)
00750   for n in getChildNodes(node):
00751     tagName = n.tagName.lower()
00752     if tagName == 'ggemc':
00753       processGGEMC(isSchema, ggem, n, declarations)
00754     elif tagName == 'ggemmg':
00755       processGGEMMG(isSchema, ggem, n, declarations)
00756     elif tagName == 'ggemst':
00757       processGGEMST(isSchema, ggem, n, declarations)
00758     elif tagName == 'ggemsc':
00759       processGGEMSC(isSchema, ggem, n, declarations)
00760     elif tagName == 'ggemvg':
00761       processGGEMVG(isSchema, ggem, n, declarations)
00762     elif tagName == 'ggemie':
00763       processGGEMIE(isSchema, ggem, n, declarations)
00764     elif tagName == 'ggemw':
00765       processGGEMW(isSchema, ggem, n, declarations)
00766     elif tagName == 'opaque':
00767       addOpaque(ggem, n)
00768     elif isSchema:
00769       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00770     elif tagName == 'serialnos':
00771       addSerialNos(ggem, n)
00772     elif tagName in ggem.regs:
00773       setRegister(ggem.regs[tagName], n, declarations)
00774     else:
00775       log.error("%s: Configuration error processing GGEM...Invalid register %s" % (fn, n.tagName))
00776
00777 def processGGEMC(isSchema, ggem, node, declarations):
00778   fn = "processGGEMC"
00779   if isSchema:
00780     ggemc = ggem._GGEM__addGEMC()
00781   elif ggem.existsGEMC():
00782     ggemc = ggem.downGEMC()
00783   else:
00784     log.debug("%s: Configuration error processing GGEMC...Not populated" % fn)
00785     return
00786   node = checkForDuplicateNode(node)
00787   for n in getChildNodes(node):
00788     tagName = n.tagName.lower()
00789     if tagName == 'opaque':
00790       addOpaque(ggemc, n)
00791     elif isSchema:
00792       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00793     elif tagName == 'serialnos':
00794       addSerialNos(ggemc, n)
00795     elif tagName in ggemc.regs:
00796       setRegister(ggemc.regs[tagName], n, declarations)
00797     else:
00798       log.error("%s: Configuration error processing GGEMC...Invalid register %s" % (fn, n.tagName))
00799
00800 def processGGEMMG(isSchema, ggem, node, declarations):
00801   fn = "processGGEMMG"
00802   if isSchema:
00803     ggemmg = ggem._GGEM__addGEMMG()
00804   elif ggem.existsGEMMG():
00805     ggemmg = ggem.downGEMMG()
00806   else:
00807     log.debug("%s: Configuration error processing GGEMMG...Not populated" % fn)
00808     return
00809   node = checkForDuplicateNode(node)
00810   for n in getChildNodes(node):
00811     tagName = n.tagName.lower()
00812     if tagName == 'opaque':
00813       addOpaque(ggemmg, n)
00814     elif isSchema:
00815       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00816     elif tagName == 'serialnos':
00817       addSerialNos(ggemmg, n)
00818     elif tagName in ggemmg.regs:
00819       setRegister(ggemmg.regs[tagName], n, declarations)
00820     else:
00821       log.error("%s: Configuration error processing GGEMMG...Invalid register %s" % (fn, n.tagName))
00822
00823 def processGGEMST(isSchema, ggem, node, declarations):
00824   fn = "processGGEMST"
00825   if isSchema:
00826     ggemst = ggem._GGEM__addGEMST()
00827   elif ggem.existsGEMST():
00828     ggemst = ggem.downGEMST()
00829   else:
00830     log.debug("%s: Configuration error processing GGEMST...Not populated" % fn)
00831     return
00832   node = checkForDuplicateNode(node)
00833   for n in getChildNodes(node):
00834     tagName = n.tagName.lower()
00835     if tagName == 'opaque':
00836       addOpaque(ggemst, n)
00837     elif isSchema:
00838       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00839     elif tagName == 'serialnos':
00840       addSerialNos(ggemst, n)
00841     elif tagName in ggemst.regs:
00842       setRegister(ggemst.regs[tagName], n, declarations)
00843     else:
00844       log.error("%s: Configuration error processing GGEMST...Invalid register %s" % (fn, n.tagName))
00845
00846 def processGGEMSC(isSchema, ggem, node, declarations):
00847   fn = "processGGEMSC"
00848   if isSchema:
00849     ggemsc = ggem._GGEM__addGEMSC()
00850   elif ggem.existsGEMSC():
00851     ggemsc = ggem.downGEMSC()
00852   else:
00853     log.debug("%s: Configuration error processing GGEMSC...Not populated" % fn)
00854     return
00855   node = checkForDuplicateNode(node)
00856   for n in getChildNodes(node):
00857     tagName = n.tagName.lower()
00858     if tagName == 'opaque':
00859       addOpaque(ggemsc, n)
00860     elif isSchema:
00861       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00862     elif tagName == 'serialnos':
00863       addSerialNos(ggemsc, n)
00864     elif tagName in ggemsc.regs:
00865       setRegister(ggemsc.regs[tagName], n, declarations)
00866     else:
00867       log.error("%s: Configuration error processing GGEMSC...Invalid register %s" % (fn, n.tagName))
00868
00869 def processGGEMVG(isSchema, ggem, node, declarations):
00870   fn = "processGGEMVG"
00871   if isSchema:
00872     ggemvg = ggem._GGEM__addGEMVG()
00873   elif ggem.existsGEMVG():
00874     ggemvg = ggem.downGEMVG()
00875   else:
00876     log.debug("%s: Configuration error processing GGEMVG...Not populated" % fn)
00877     return
00878   node = checkForDuplicateNode(node)
00879   for n in getChildNodes(node):
00880     tagName = n.tagName.lower()
00881     if tagName == 'opaque':
00882       addOpaque(ggemvg, n)
00883     elif isSchema:
00884       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00885     elif tagName == 'serialnos':
00886       addSerialNos(ggemvg, n)
00887     elif tagName in ggemvg.regs:
00888       setRegister(ggemvg.regs[tagName], n, declarations)
00889     else:
00890       log.error("%s: Configuration error processing GGEMVG...Invalid register %s" % (fn, n.tagName))
00891
00892 def processGGEMIE(isSchema, ggem, node, declarations):
00893   fn = "processGGEMIE"
00894   if isSchema:
00895     ggemie = ggem._GGEM__addGEMIE()
00896   elif ggem.existsGEMIE():
00897     ggemie = ggem.downGEMIE()
00898   else:
00899     log.debug("%s: Configuration error processing GGEMIE...Not populated" % fn)
00900     return
00901   node = checkForDuplicateNode(node)
00902   for n in getChildNodes(node):
00903     tagName = n.tagName.lower()
00904     if tagName == 'opaque':
00905       addOpaque(ggemie, n)
00906     elif isSchema:
00907       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00908     elif tagName == 'serialnos':
00909       addSerialNos(ggemie, n)
00910     elif tagName in ggemie.regs:
00911       setRegister(ggemie.regs[tagName], n, declarations)
00912     else:
00913       log.error("%s: Configuration error processing GGEMIE...Invalid register %s" % (fn, n.tagName))
00914
00915 def processGGEMW(isSchema, ggem, node, declarations):
00916   fn = "processGGEMW"
00917   if isSchema:
00918     ggemw = ggem._GGEM__addGEMW()
00919   elif ggem.existsGEMW():
00920     ggemw = ggem.downGEMW()
00921   else:
00922     log.debug("%s: Configuration error processing GGEMW...Not populated" % fn)
00923     return
00924   node = checkForDuplicateNode(node)
00925   for n in getChildNodes(node):
00926     tagName = n.tagName.lower()
00927     if tagName == 'opaque':
00928       addOpaque(ggemw, n)
00929     elif isSchema:
00930       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00931     elif tagName == 'serialnos':
00932       addSerialNos(ggemw, n)
00933     elif tagName in ggemw.regs:
00934       setRegister(ggemw.regs[tagName], n, declarations)
00935     else:
00936       log.error("%s: Configuration error processing GGEMW...Invalid register %s" % (fn, n.tagName))
00937
00938
00939 def processGCRU(isSchema, glat, node, declarations):
00940   fn = "processGCRU"
00941   if isSchema:
00942     gcru = glat._GLAT__addCRU()
00943   elif glat.existsCRU():
00944     gcru = glat.downCRU()
00945   else:
00946     log.debug("%s: Configuration error processing GCRU...Not populated" % fn)
00947     return
00948   node = checkForDuplicateNode(node)
00949   for n in getChildNodes(node):
00950     tagName = n.tagName.lower()
00951     if tagName == 'opaque':
00952       addOpaque(gcru, n)
00953     elif isSchema:
00954       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
00955     elif tagName == 'serialnos':
00956       addSerialNos(gcru, n)
00957     elif tagName in gcru.regs:
00958       setRegister(gcru.regs[tagName], n, declarations)
00959     else:
00960       log.error("%s: Configuration error processing GCRU...Invalid register %s" % (fn, n.tagName))
00961
00962
00963 def processGTEM(isSchema, glat, node, declarations):
00964   fn = "processGTEM"
00965   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
00966   skipTemOverrides = declarations['options']['skiptemoverrides']
00967   # LHM for multiple tem ancillary files, allow configurations embedded in TEM nodes.
00968   # this method will simply remove the configuration level similar to duplicate node.
00969   if not isSchema:
00970     node = checkForConfigurationNode(node)
00971   node = checkForDuplicateNode(node)
00972   if node.hasAttribute('ID'):
00973     gtemIdSeq = uncompressSequence(node.getAttribute('ID'))
00974     if isSchema and not explicitBroadcastNodes:
00975       gtemIdSeq += [255]
00976   else:
00977     if not explicitBroadcastNodes:
00978       gtemIdSeq = [255]
00979     else:
00980       log.error("%s: Missing ID attribute for GTEM tag" % fn)
00981       return
00982
00983   if not isSchema and not skipTemOverrides:
00984     configureGTEM(glat, gtemIdSeq, node)
00985
00986   for gtemId in gtemIdSeq:
00987     if isSchema:
00988       if gtemId == 255 and glat.existsTEM(255):
00989         gtem = glat.allTEM()
00990       else:
00991         gtem = glat._GLAT__addTEM(gtemId)
00992     elif glat.existsTEM(gtemId):
00993       gtem = glat.downTEM(gtemId)
00994     else:
00995       log.debug("%s: Configuration error processing GTEM # %d ...Not populated" % (fn, gtemId))
00996       continue
00997     for n in getChildNodes(node):
00998       tagName = str(n.tagName.lower())
00999       if tagName == 'gccc':
01000         processGCCC(isSchema, gtem, n, declarations)
01001       elif tagName == 'gtcc':
01002         processGTCC(isSchema, gtem, n, declarations)
01003       elif tagName == 'gtic':
01004         processGTIC(isSchema, gtem, n, declarations)
01005       elif tagName == 'opaque':
01006         addOpaque(gtem, n)
01007       elif isSchema:
01008         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01009       elif tagName == 'serialnos':
01010         addSerialNos(gtem, n)
01011       elif tagName == 'badstrips':
01012         gname = glat.__class__.__name__
01013         gdict = glat.__dict__
01014         deadChannels  = gdict["_" + gname + '__deadChannels']
01015         noisyChannels = gdict["_" + gname + '__noisyChannels']
01016         typ = str(n.getAttribute('badType'))
01017         if typ == 'dead':
01018           processBadChannels(n, deadChannels, temId=gtemId)
01019         elif typ == 'hot':
01020           processBadChannels(n, noisyChannels, temId=gtemId)
01021         else:
01022           log.error("%s: Unrecognized bad strip type: %s" % (fn, typ))
01023       elif tagName in gtem.regs:
01024         if tagName == "cmd_reset" and not skipTemOverrides:
01025           #Ignore any attempts to reset the TEM through the schema
01026           log.debug("%s: Ignoring TEM[%d].CMD_RESET coming from the schema" % (fn, gtemId))
01027         elif tagName == 'data_masks' and not skipTemOverrides:
01028           # Skip the DATA_MASKS since we already processed it above in configureGTEM
01029           continue
01030         else:
01031           setRegister(gtem.regs[tagName], n, declarations)
01032       else:
01033         log.error("%s: Configuration error processing GTEM # %d ...Invalid register %s" % (fn, gtemId, n.tagName))
01034
01035 def configureGTEM(glat, gtemIdSeq, node):
01036   fn = "configureGTEM"
01037   configDataMasksValue = None
01038   cccsToEnable = [0, 1, 2, 3] # just enabling GCCC 0 doesn't work
01039   maskCCCbits = 0x0
01040   for cc in cccsToEnable:
01041     maskCCCbits += (1 << (cc+8))
01042
01043   configuration = {}
01044   layerMask0 = {}
01045   layerMask1 = {}
01046   for cc in cccsToEnable:
01047     configuration[cc] = None
01048     layerMask0[cc] = None
01049     layerMask1[cc] = None
01050
01051   if node is None:
01052     # Special case, if no configuration exists
01053     pass
01054   else:
01055     for n in getChildNodes(node):
01056       tagName = str(n.tagName.lower())
01057       # Pre-scan the child nodes to see if there is a DATA_MASKS reference
01058       if tagName == 'data_masks':
01059         configDataMasksValue = extractRegisterValue(n)
01060         # Make sure the CCC inputs are enabled
01061         if configDataMasksValue & maskCCCbits != 0:
01062           configDataMasksValue &= ~maskCCCbits
01063       # Check if LAYER_MASK_x is specified under any of the <GCCC> tags
01064       elif tagName == 'gccc':
01065         if n.hasAttribute('ID'):
01066           gcccIdSeq = uncompressSequence(n.getAttribute('ID'))
01067         else:
01068           gcccIdSeq = [255]
01069         (newConfiguration, newLayerMask0, newLayerMask1) = configureGCCC(n)
01070         for gcccId in gcccIdSeq:
01071           if gcccId == 255:
01072             cccRange = cccsToEnable
01073           else:
01074             cccRange = [gcccId]
01075           for cc in cccRange:
01076             if newConfiguration is not None:
01077               configuration[cc] = newConfiguration
01078             if newLayerMask0 is not None:
01079               layerMask0[cc] = newLayerMask0
01080             if newLayerMask1 is not None:
01081               layerMask1[cc] = newLayerMask1
01082   for gtemId in gtemIdSeq:
01083     if gtemId == 255: continue
01084     gtem = glat.TEM[gtemId]
01085     try:
01086       dataMasksValue = gtem.DATA_MASKS
01087     except gException.LATInterfaceException:
01088       if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
01089           and glat.getDeclarations()['options']['ignorehardwaretimeouts']:
01090         continue
01091       else:
01092         raise gException.LATInterfaceException(sys.exc_info()[1].status)
01093     if configDataMasksValue is None:
01094       # The configuration has not mentioned DATA_MASKS so set it up if needed
01095       if dataMasksValue & maskCCCbits != 0:
01096         #log.debug("%s: Resetting TEM[%d]" % (fn, gtemId))
01097         #gtem.CMD_RESET = 1
01098         log.debug("%s: Overriding TEM[%d].DATA_MASKS register with value 0x%08x (oldvalue was 0x%08x)" % (fn, gtemId, (dataMasksValue & ~maskCCCbits), dataMasksValue))
01099         gtem.DATA_MASKS = dataMasksValue & ~maskCCCbits
01100     elif configDataMasksValue != dataMasksValue:
01101       #gtem.CMD_RESET = 1
01102       #log.debug("%s: Resetting TEM %d" % (fn, gtemId))
01103       gtem.DATA_MASKS = configDataMasksValue
01104       log.debug("%s: Overriding TEM[%d].DATA_MASKS register with value 0x%08x (oldvalue was 0x%08x)" % (fn, gtemId, configDataMasksValue, dataMasksValue))
01105
01106     for cc in cccsToEnable:
01107       if configuration[cc] is None:
01108         cccConfiguration = gtem.CCC[cc].CONFIGURATION
01109         if cccConfiguration & (1L << 31) == 0:
01110           log.debug("%s: Overriding TEM[%d].CCC[%d].CONFIGURATION register with value 0x%08x (oldvalue was 0x%08x)" % (fn, gtemId, cc, (cccConfiguration | (1L << 31)), cccConfiguration))
01111           gtem.CCC[cc].CONFIGURATION = cccConfiguration | (1L << 31)
01112       if layerMask0[cc] is None:
01113         layerMask = gtem.CCC[cc].LAYER_MASK_0
01114         if layerMask & 0x3FFF3FFFL != 0x3FFF3FFFL:
01115           log.debug("%s: Overriding TEM[%d].CCC[%d].LAYER_MASK_0 register with value 0x3FFF3FFF" % (fn, gtemId, cc))
01116           gtem.CCC[cc].LAYER_MASK_0 = 0x3FFF3FFFL
01117       if layerMask1[cc] is None:
01118         layerMask = gtem.CCC[cc].LAYER_MASK_1
01119         if layerMask & 0x3FFF3FFFL != 0x3FFF3FFFL:
01120           log.debug("%s: Overriding TEM[%d].CCC[%d].LAYER_MASK_1 register with value 0x3FFF3FFF" % (fn, gtemId, cc))
01121           gtem.CCC[cc].LAYER_MASK_1 = 0x3FFF3FFFL
01122
01123
01124 def configureGCCC(node):
01125   layerMask0 = None
01126   layerMask1 = None
01127   configuration = None
01128   for n in getChildNodes(node):
01129     tagName = str(n.tagName.lower())
01130     if tagName == 'layer_mask_0':
01131       if layerMask0 is None:
01132         layerMask0 = extractRegisterValue(n)
01133     elif tagName == 'layer_mask_1':
01134       if layerMask1 is None:
01135         layerMask1 = extractRegisterValue(n)
01136     elif tagName == 'configuration':
01137       if configuration is None:
01138         configuration = extractRegisterValue(n)
01139
01140   return (configuration, layerMask0, layerMask1)
01141
01142 def checkForDuplicateNode(node):
01143   #printNode("***", node)
01144
01145   for child in getChildNodes(node):
01146     #printNode("child:", child)
01147     checkForDuplicateNode(child)
01148
01149     if child.nodeType != minidom.Node.TEXT_NODE and str(node.tagName) == str(child.tagName):
01150       for n in getChildNodes(child):
01151         node.appendChild(n)
01152       if node.getAttribute("ID") == '' and child.getAttribute("ID") != '':
01153         node.setAttribute("ID", child.getAttribute("ID"))
01154       node.removeChild(child)
01155
01156   return node
01157
01158 def checkForConfigurationNode(node):
01159   # routine to allow including configuration node underneath
01160   # a gtem or other node. If a configuration child is found,
01161   # it finds a glat and appends glat's children
01162   for n in getChildNodes(node):
01163     if str(n.tagName.lower()) == 'configuration' and  n.hasAttribute('name'):
01164       for cn in getChildNodes(n):
01165         if str(cn.tagName.lower()) == 'glat':
01166           for cnlat in getChildNodes(cn):
01167             node.appendChild(cnlat)
01168       node.removeChild(n)
01169   return node
01170
01171 def processGCCC(isSchema, gtem, node, declarations):
01172   fn = "processGCCC"
01173   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01174   node = checkForDuplicateNode(node)
01175   if node.hasAttribute('ID'):
01176     gcccIdSeq = uncompressSequence(node.getAttribute('ID'))
01177     if isSchema and not explicitBroadcastNodes:
01178       gcccIdSeq += [255]
01179   else:
01180     if not explicitBroadcastNodes: gcccIdSeq = [255]
01181   for gcccId in gcccIdSeq:
01182     if isSchema:
01183       if gcccId == 255 and gtem.existsCCC(255):
01184         gccc = gtem.allCCC()
01185       elif gtem.id() == 255 and gtem.existsCCC(gcccId):
01186         continue
01187       else:
01188         gccc = gtem._GTEM__addCCC(gcccId)
01189     elif gtem.existsCCC(gcccId):
01190       gccc = gtem.downCCC(gcccId)
01191     else:
01192       log.debug("%s: Configuration error processing GCCC # %d ...Not populated" % (fn, gcccId))
01193       continue
01194     for n in getChildNodes(node):
01195       tagName = str(n.tagName.lower())
01196       if tagName == 'gcrc':
01197         processGCRC(isSchema, gccc, n, declarations)
01198       elif tagName == 'opaque':
01199         addOpaque(gccc, n)
01200       elif isSchema:
01201         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01202       elif tagName == 'serialnos':
01203         addSerialNos(gccc, n)
01204       elif tagName in gccc.regs:
01205         setRegister(gccc.regs[tagName], n, declarations)
01206       else:
01207         log.error("%s: Configuration error processing GCCC # %d ...Invalid register %s" % (fn, gcccId, n.tagName))
01208
01209 def processGTCC(isSchema, gtem, node, declarations):
01210   fn = "processGTCC"
01211   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01212   node = checkForDuplicateNode(node)
01213   if node.hasAttribute('ID'):
01214     gtccIdSeq = uncompressSequence(node.getAttribute('ID'))
01215     if isSchema and not explicitBroadcastNodes:
01216       gtccIdSeq += [255]
01217   else:
01218     if not explicitBroadcastNodes: gtccIdSeq = [255]
01219   for gtccId in gtccIdSeq:
01220     if isSchema:
01221       if gtccId == 255 and gtem.existsTCC(255):
01222         gtcc = gtem.allTCC()
01223       elif gtem.id() == 255 and gtem.existsTCC(gtccId):
01224         continue
01225       else:
01226         gtcc = gtem._GTEM__addTCC(gtccId)
01227     elif gtem.existsTCC(gtccId):
01228       gtcc = gtem.downTCC(gtccId)
01229     else:
01230       log.debug("%s: Configuration error processing GTCC # %d ...Not populated" % (fn, gtccId))
01231       continue
01232     for n in getChildNodes(node):
01233       tagName = n.tagName.lower()
01234       if tagName == 'gtrc':
01235         processGTRC(isSchema, gtcc, n, declarations)
01236       elif tagName == 'opaque':
01237         addOpaque(gtcc, n)
01238       elif isSchema:
01239         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01240       elif tagName == 'serialnos':
01241         addSerialNos(gtcc, n)
01242       elif tagName in gtcc.regs:
01243         setRegister(gtcc.regs[tagName], n, declarations)
01244       else:
01245         log.error("%s: Configuration error processing GTCC # %d ...Invalid register %s" % (fn, gtccId, n.tagName))
01246
01247 def processGTIC(isSchema, gtem, node, declarations):
01248   fn = "processGTIC"
01249   if isSchema:
01250     gtic = gtem._GTEM__addTIC()
01251   elif gtem.downTIC() != None:
01252     gtic = gtem.downTIC()
01253   else:
01254     log.debug("%s: Configuration error processing GTIC...Not populated" % fn)
01255     return
01256   node = checkForDuplicateNode(node)
01257   for n in getChildNodes(node):
01258     tagName = n.tagName.lower()
01259     if tagName == 'opaque':
01260       addOpaque(gtic, n)
01261     elif isSchema:
01262       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01263     elif tagName == 'serialnos':
01264       addSerialNos(gtic, n)
01265     elif tagName in gtic.regs:
01266       setRegister(gtic.regs[tagName], n, declarations)
01267     else:
01268       log.error("%s: Configuration error processing GTIC...Invalid register %s" % (fn, n.tagName))
01269
01270
01271 def processGCRC(isSchema, gccc, node, declarations):
01272   fn = "processGCRC"
01273   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01274   node = checkForDuplicateNode(node)
01275   if node.hasAttribute('ID'):
01276     gcrcIdSeq = uncompressSequence(node.getAttribute('ID'))
01277     if isSchema and not explicitBroadcastNodes:
01278       gcrcIdSeq += [255]
01279   else:
01280     if not explicitBroadcastNodes: gcrcIdSeq = [255]
01281   for gcrcId in gcrcIdSeq:
01282     if isSchema:
01283       if gcrcId == 255 and gccc.existsCRC(255):
01284         gcrc = gccc.allCRC()
01285       elif gccc.id() == 255 and gccc.existsCRC(gcrcId):
01286         continue
01287       else:
01288         gcrc = gccc._GCCC__addCRC(gcrcId)
01289     elif gccc.existsCRC(gcrcId):
01290       gcrc = gccc.downCRC(gcrcId)
01291     else:
01292       log.debug("%s: Configuration error processing GCRC # %d ...Not populated" % (fn, gcrcId))
01293       continue
01294     for n in getChildNodes(node):
01295       tagName = n.tagName.lower()
01296       if tagName == 'gcfe':
01297         processGCFE(isSchema, gcrc, n, declarations)
01298       elif tagName == 'opaque':
01299         addOpaque(gcrc, n)
01300       elif isSchema:
01301         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01302       elif tagName == 'serialnos':
01303         addSerialNos(gcrc, n)
01304       elif tagName in gcrc.regs:
01305         setRegister(gcrc.regs[tagName], n, declarations)
01306       else:
01307         log.error("%s: Configuration error processing GCRC # %d ...Invalid register %s" % (fn, gcrcId, n.tagName))
01308
01309 def processGTRC(isSchema, gtcc, node, declarations):
01310   fn = "processGTRC"
01311   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01312   node = checkForDuplicateNode(node)
01313   if node.hasAttribute('ID'):
01314     gtrcIdSeq = uncompressSequence(node.getAttribute('ID'))
01315     if isSchema and not explicitBroadcastNodes:
01316       gtrcIdSeq += [255]
01317   else:
01318     if not explicitBroadcastNodes: gtrcIdSeq = [255]
01319   for gtrcId in gtrcIdSeq:
01320     if isSchema:
01321       if gtrcId == 255 and gtcc.existsTRC(255):
01322         gtrc = gtcc.allTRC()
01323       elif gtcc.id() == 255 and gtcc.existsTRC(gtrcId):
01324         continue
01325       else:
01326         gtrc = gtcc._GTCC__addTRC(gtrcId)
01327     elif gtcc.existsTRC(gtrcId):
01328       gtrc = gtcc.downTRC(gtrcId)
01329     else:
01330       log.debug("%s: Configuration error processing GTRC # %d ...Not populated" % (fn, gtrcId))
01331       continue
01332     for n in getChildNodes(node):
01333       tagName = n.tagName.lower()
01334       if tagName == 'gtfe':
01335         processGTFE(isSchema, gtrc, n, declarations)
01336       elif tagName == 'opaque':
01337         addOpaque(gtrc, n)
01338       elif isSchema:
01339         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01340       elif tagName == 'serialnos':
01341         addSerialNos(gtrc, n)
01342       elif tagName in gtrc.regs:
01343         setRegister(gtrc.regs[tagName], n, declarations)
01344       else:
01345         log.error("%s: Configuration error processing GTRC # %d ...Invalid register %s" % (fn, gtrcId, n.tagName))
01346
01347
01348 def processGCFE(isSchema, gcrc, node, declarations):
01349   fn = "processGCFE"
01350   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01351   node = checkForDuplicateNode(node)
01352   if node.hasAttribute('ID'):
01353     gcfeIdSeq = uncompressSequence(node.getAttribute('ID'))
01354     if isSchema and not explicitBroadcastNodes:
01355       gcfeIdSeq += [255]
01356   else:
01357     if not explicitBroadcastNodes: gcfeIdSeq = [255]
01358   for gcfeId in gcfeIdSeq:
01359     if isSchema:
01360       if gcfeId == 255 and gcrc.existsCFE(255):
01361         gcfe = gcrc.allCFE()
01362       elif gcrc.id() == 255 and gcrc.existsCFE(gcfeId):
01363         continue
01364       else:
01365         gcfe = gcrc._GCRC__addCFE(gcfeId)
01366     elif gcrc.existsCFE(gcfeId):
01367       gcfe = gcrc.downCFE(gcfeId)
01368     else:
01369       log.debug("%s: Configuration error processing GCFE # %d ...Not populated" % (fn, gcfeId))
01370       continue
01371     for n in getChildNodes(node):
01372       tagName = n.tagName.lower()
01373       if tagName == 'opaque':
01374         addOpaque(gcfe, n)
01375       elif isSchema:
01376         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01377       elif tagName == 'serialnos':
01378         addSerialNos(gcfe, n)
01379       elif tagName in gcfe.regs:
01380         setRegister(gcfe.regs[tagName], n, declarations)
01381       else:
01382         log.error("%s: Configuration error processing GCFE # %d ...Invalid register %s" % (fn, gcfeId, n.tagName))
01383
01384
01385 def processGTFE(isSchema, gtrc, node, declarations):
01386   fn = "processGTFE"
01387   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01388   node = checkForDuplicateNode(node)
01389   if node.hasAttribute('ID'):
01390     gtfeIdSeq = uncompressSequence(node.getAttribute('ID'))
01391     if isSchema and not explicitBroadcastNodes:
01392       gtfeIdSeq += [255]
01393   else:
01394     if not explicitBroadcastNodes: gtfeIdSeq = [255]
01395   for gtfeId in gtfeIdSeq:
01396     if isSchema:
01397       if gtfeId == 255 and gtrc.existsTFE(255):
01398         gtfe = gtrc.allTFE()
01399       elif gtrc.id() == 255 and gtrc.existsTFE(gtfeId):
01400         continue
01401       else:
01402         gtfe = gtrc._GTRC__addTFE(gtfeId)
01403     elif gtrc.existsTFE(gtfeId):
01404       gtfe = gtrc.downTFE(gtfeId)
01405     else:
01406       log.debug("%s: Configuration error processing GTFE # %d ...Not populated" % (fn, gtfeId))
01407       continue
01408     for n in getChildNodes(node):
01409       tagName = n.tagName.lower()
01410       if tagName == 'opaque':
01411         addOpaque(gtfe, n)
01412       elif isSchema:
01413         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01414       elif tagName == 'serialnos':
01415         addSerialNos(gtfe, n)
01416       elif tagName in gtfe.regs:
01417         setRegister(gtfe.regs[tagName], n, declarations)
01418       else:
01419         log.error("%s: Configuration error processing GTFE # %d ...Invalid register %s" % (fn, gtfeId, n.tagName))
01420
01421
01422 def processGAEM(isSchema, glat, node, declarations):
01423   fn = "processGAEM"
01424   if isSchema:
01425     gaem = glat._GLAT__addAEM()
01426   elif glat.existsAEM():
01427     gaem = glat.downAEM()
01428   else:
01429     log.debug("%s: Configuration error processing GAEM ...Not populated" %(fn))
01430     return
01431
01432   node = checkForDuplicateNode(node)
01433   for n in getChildNodes(node):
01434     tagName = n.tagName.lower()
01435     if tagName == 'garc':
01436       processGARC(isSchema, gaem, n, declarations)
01437     elif tagName == 'gaeq':
01438       processGAEQ(isSchema, gaem, n, declarations)
01439     elif tagName == 'opaque':
01440       addOpaque(gaem, n)
01441     elif isSchema:
01442       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01443     elif tagName == 'serialnos':
01444       addSerialNos(gaem, n)
01445     elif tagName in gaem.regs:
01446       setRegister(gaem.regs[tagName], n, declarations)
01447     else:
01448       log.error("%s: Configuration error processing GAEM ...Invalid register %s" %(fn, n.tagName))
01449
01450
01451 def processGAEQ(isSchema, gaem, node, declarations):
01452   fn = "processGAEQ"
01453   if isSchema:
01454     gaeq = gaem._GAEM__addAEQ()
01455   elif gaem.downAEQ() != None:
01456     gaeq = gaem.downAEQ()
01457   else:
01458     log.debug("%s: Configuration error processing GAEQ...Not populated" % fn)
01459     return
01460   node = checkForDuplicateNode(node)
01461   for n in getChildNodes(node):
01462     tagName = n.tagName.lower()
01463     if tagName == 'opaque':
01464       addOpaque(gaeq, n)
01465     elif isSchema:
01466       log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01467     elif tagName == 'serialnos':
01468       addSerialNos(gaeq, n)
01469     elif tagName in gaeq.regs:
01470       setRegister(gaeq.regs[tagName], n, declarations)
01471     else:
01472       log.error("%s: Configuration error processing GAEQ...Invalid register %s" % (fn, n.tagName))
01473
01474
01475 def processGARC(isSchema, gaem, node, declarations):
01476   fn = "processGARC"
01477   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01478   node = checkForDuplicateNode(node)
01479   if node.hasAttribute('ID'):
01480     garcIdSeq = uncompressSequence(node.getAttribute('ID'))
01481     if isSchema and not explicitBroadcastNodes:
01482       garcIdSeq += [255]
01483   else:
01484     if not explicitBroadcastNodes: garcIdSeq = [255]
01485   for garcId in garcIdSeq:
01486     if isSchema:
01487       if garcId == 255 and gaem.existsARC(255):
01488         garc = gaem.allARC()
01489       else:
01490         garc = gaem._GAEM__addARC(garcId)
01491     elif gaem.existsARC(garcId):
01492       garc = gaem.downARC(garcId)
01493     else:
01494       log.debug("%s: Configuration error processing GARC # %d ...Not populated" % (fn, garcId))
01495       continue
01496     for n in getChildNodes(node):
01497       tagName = n.tagName.lower()
01498       if tagName == 'gafe':
01499         processGAFE(isSchema, garc, n, declarations)
01500       elif tagName == 'opaque':
01501         addOpaque(garc, n)
01502       elif isSchema:
01503         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01504       elif tagName == 'serialnos':
01505         addSerialNos(garc, n)
01506       elif tagName in garc.regs:
01507         setRegister(garc.regs[tagName], n, declarations)
01508       else:
01509         log.error("%s: Configuration error processing GARC # %d ...Invalid register %s" % (fn, garcId, n.tagName))
01510
01511
01512 def processGAFE(isSchema, garc, node, declarations):
01513   fn = "processGAFE"
01514   explicitBroadcastNodes = declarations['options']['explicitbroadcastnodes']
01515   node = checkForDuplicateNode(node)
01516   if node.hasAttribute('ID'):
01517     gafeIdSeq = uncompressSequence(node.getAttribute('ID'))
01518     if isSchema and not explicitBroadcastNodes:
01519       gafeIdSeq += [255]
01520   else:
01521     if not explicitBroadcastNodes: gafeIdSeq = [255]
01522   for gafeId in gafeIdSeq:
01523     if isSchema:
01524       if gafeId == 255 and garc.existsAFE(255):
01525         gafe = garc.allAFE()
01526       elif garc.id() == 255 and garc.existsAFE(gafeId):
01527         continue
01528       else:
01529         gafe = garc._GARC__addAFE(gafeId)
01530     elif garc.existsAFE(gafeId):
01531       gafe = garc.downAFE(gafeId)
01532     else:
01533       log.debug("%s: Configuration error processing GAFE # %d ...Not populated" % (fn, gafeId))
01534       continue
01535     if node.hasAttribute('TUBE'):
01536       gafe.setTube(node.getAttribute('TUBE'))
01537       aem = garc.up()
01538       garcId = garc.id()
01539       aem.tileMap[garcId, gafeId] = node.getAttribute('TUBE')
01540     for n in getChildNodes(node):
01541       tagName = n.tagName.lower()
01542       if tagName == 'opaque':
01543         addOpaque(gafe, n)
01544       elif isSchema:
01545         log.error("%s: Unexpected tag: %s" % (fn, n.tagName))
01546       elif tagName == 'serialnos':
01547         addSerialNos(gafe, n)
01548       elif tagName in gafe.regs:
01549         setRegister(gafe.regs[tagName], n, declarations)
01550       else:
01551         log.error("%s: Configuration error processing GAFE # %d ...Invalid register %s" % (fn, gafeId, n.tagName))
01552
01553
01554 def printTree(node):
01555   if node.nodeType == minidom.Node.TEXT_NODE and node.data[0] == '\n':
01556     pass
01557   else:
01558     print node
01559     if node.nodeType == minidom.Node.ELEMENT_NODE:
01560       tagName = node.tagName.lower()
01561       #print "Element:",tagName
01562       if tagName in ('schema', 'configuration', 'glat', 'gtem', 'gccc', 'gcrc', 'gcfe', 'gtic', \
01563                      'gtcc', 'gtrc', 'gtfe', 'gaem', 'gaeq', 'garc', 'gafe', \
01564                      'gpdu', 'gpduc', 'gpeq', 'gtwr','gebm','gebmc','gebmst', \
01565                      'ggem','ggemc','ggemmg', 'ggemst','ggemsc','ggemvg','ggemie','ggemw','gcru'):
01566         for n in node.childNodes:
01567           printTree(n)
01568
01569 def getChildNodes(node):
01570   childNodes = []
01571   for n in node.childNodes:
01572     if (n.nodeType == minidom.Node.TEXT_NODE and \
01573          (n.data[0] == '\n' or n.data[0].strip() == '')) \
01574         or n.nodeType == minidom.Node.COMMENT_NODE:
01575       pass
01576     else:
01577       childNodes.append(n)
01578   return childNodes
01579
01580 def isNumber(s):
01581   try:
01582     float(s)
01583     return 1
01584   except ValueError:
01585     return 0
01586
01587 def getParameterValue(parValue):
01588   if parValue.lower() in ('true', 'yes'):
01589     return 1
01590   elif parValue.lower() in ('false', 'no'):
01591     return 0
01592   elif parValue.lower() == 'none':
01593     return None
01594   elif parValue.startswith('0x'):
01595     return long(parValue,16)
01596   elif isNumber(parValue):
01597     return float(parValue)
01598   else:
01599     return parValue
01600
01601 def processConstraints(node, groups, constraints):
01602   fn = "processConstraints"
01603   for n in getChildNodes(node):
01604     tagName = n.tagName.lower()
01605     if tagName == 'constraint':
01606       if n.hasAttribute('name'):
01607         consName = str(n.getAttribute('name'))
01608         consParList = {}
01609         #if constraints.has_key(consName):
01610         #  consClassModStr = constraints[consName][0]
01611         #  consClassNameStr = constraints[consName][1]
01612         #  consParList = constraints[consName][2]
01613         for consPropNode in getChildNodes(n):
01614           tagName = consPropNode.tagName.lower()
01615           if tagName == 'class':
01616             classStr = str(consPropNode.firstChild.data).strip()
01617             lastDot = classStr.rfind('.')
01618             if lastDot == -1:
01619               consClassNameStr = classStr
01620               consClassModStr = ''
01621             else:
01622               consClassNameStr = classStr[lastDot+1:]
01623               consClassModStr = classStr[:lastDot]
01624           elif tagName == 'parameters':
01625             consParList['name'] = consName
01626             for consParNode in getChildNodes(consPropNode):
01627               parName = str(consParNode.tagName.lower())
01628               parValue = str(consParNode.firstChild.data).strip()
01629               if parName == 'subsystem':
01630                 if groups.has_key(parValue):
01631                   parValue = groups[parValue]
01632                 else:
01633                   log.error("%s: Constraint subsystem group %s not defined" % (fn, parValue))
01634                   parValue = None
01635               elif parName == 'category':
01636                 if groups.has_key(parValue):
01637                   parValue = groups[parValue]
01638                 else:
01639                   log.error("%s: Constraint category group %s not defined" % (fn, parValue))
01640                   parValue = None
01641               else:
01642                 parValue = getParameterValue(parValue)
01643               consParList[str(consParNode.tagName)] = parValue
01644         constraints[consName] = instantiateClass(consClassModStr,
01645                                                  consClassNameStr,
01646                                                  consParList)
01647       else:
01648         log.error("%s: Missing constraint name" % fn)
01649         return None
01650     else:
01651       log.error("%s: Invalid tag: %s ...skipping" % (fn, n.tagName))
01652
01653 def processRules(node, groups, rules):
01654   fn = "processRules"
01655   for n in getChildNodes(node):
01656     tagName = n.tagName.lower()
01657     if tagName == 'rule':
01658       if n.hasAttribute('name'):
01659         ruleName = str(n.getAttribute('name'))
01660         ruleParList = {}
01661         ruleActionList = []
01662         if rules.has_key(ruleName):
01663           log.error("%s: Rule %s already defined." % (fn, ruleName))
01664           continue
01665         for rulePropNode in getChildNodes(n):
01666           tagName = rulePropNode.tagName.lower()
01667           if tagName == 'class':
01668             classStr = str(rulePropNode.firstChild.data).strip()
01669             lastDot = classStr.rfind('.')
01670             if lastDot == -1:
01671               ruleClassNameStr = classStr
01672               ruleClassModStr = ''
01673             else:
01674               ruleClassNameStr = classStr[lastDot+1:]
01675               ruleClassModStr = classStr[:lastDot]
01676           elif tagName == 'parameters':
01677             ruleParList['name'] = ruleName
01678             for ruleParNode in getChildNodes(rulePropNode):
01679               parName = str(ruleParNode.tagName.lower())
01680               parValue = str(ruleParNode.firstChild.data).strip()
01681               if parName == 'subsystem':
01682                 if groups.has_key(parValue):
01683                   parValue = groups[parValue]
01684                 else:
01685                   log.error("%s: Rule subsystem group %s not defined" % (fn, parValue))
01686                   parValue = None
01687               elif parName == 'category':
01688                 if groups.has_key(parValue):
01689                   parValue = groups[parValue]
01690                 else:
01691                   log.error("%s: Rule category group %s not defined" % (fn, parValue))
01692                   parValue = None
01693               elif parName == 'actions':
01694                 for ruleActionNode in getChildNodes(ruleParNode):
01695                   actName = str(ruleActionNode.tagName)
01696                   if actName not in ruleActionList:
01697                     ruleActionList.append(actName)
01698                   else:
01699                     log.error("%s: Rule action %s already defined." % (fn, actName))
01700                 parValue = ruleActionList
01701               else:
01702                 parValue = getParameterValue(parValue)
01703               ruleParList[str(ruleParNode.tagName)] = parValue
01704         rules[ruleName] = instantiateClass(ruleClassModStr,
01705                                            ruleClassNameStr,
01706                                            ruleParList)
01707       else:
01708         log.error("%s: Missing rule name" % fn)
01709         return None
01710     else:
01711       log.error("%s: Invalid tag: %s ...skipping" % (fn, n.tagName))
01712
01713 def processEGUs(node, egus):
01714   fn = "processEGUs"
01715   for n in getChildNodes(node):
01716     tagName = n.tagName.lower()
01717     if tagName == 'egu':
01718       if n.hasAttribute('name'):
01719         eguName = str(n.getAttribute('name'))
01720         #if egus.has_key(eguName):
01721         #  eguClassModStr = egus[eguName][0]
01722         #  eguClassNameStr = egus[eguName][1]
01723         #  eguParList = egus[eguName][2]
01724         for eguPropNode in getChildNodes(n):
01725           tagName = eguPropNode.tagName.lower()
01726           if tagName == 'class':
01727             classStr = str(eguPropNode.firstChild.data).strip()
01728             lastDot = classStr.rfind('.')
01729             if lastDot == -1:
01730               eguClassNameStr = classStr
01731               eguClassModStr = ''
01732             else:
01733               eguClassNameStr = classStr[lastDot+1:]
01734               eguClassModStr = classStr[:lastDot]
01735           elif tagName == 'parameters':
01736             eguParList = {}
01737             for eguParNode in getChildNodes(eguPropNode):
01738               parValue = str(eguParNode.firstChild.data).strip()
01739               parValue = getParameterValue(parValue)
01740               eguParList[str(eguParNode.tagName)] = parValue
01741         egus[eguName] = instantiateClass(eguClassModStr,
01742                                          eguClassNameStr,
01743                                          eguParList)
01744       else:
01745         log.error("%s: Missing EGU name" % fn)
01746         return None
01747     else:
01748       log.error("%s: Invalid tag: %s ...skipping" % (fn, n.tagName))
01749
01750
01751 def processDeclarations(isSchema, node, declarations):
01752   fn = "processDeclarations"
01753   groups = declarations['groups']
01754   imports = declarations['imports']
01755   ml = BasicModuleLoader()
01756   for n in getChildNodes(node):
01757     tagName = n.tagName.lower()
01758     if tagName == 'import':
01759       if n.hasAttribute('name'):
01760         modName = str(n.getAttribute('name'))
01761         modPathSpec = str(n.firstChild.data.strip())
01762         imports[modName] = modPathSpec
01763         if modPathSpec.endswith('.py'):
01764           (modPath, modFile) = os.path.split(os.path.expandvars(modPathSpec))
01765           modstuff = ml.find_module(os.path.splitext(modFile)[0], (modPath,))
01766         elif modPathSpec.find('.') != -1:
01767           exec('import ' + modPathSpec + ' as ' + modName)
01768           modstuff = ''
01769           sys.modules[modName] = sys.modules[modPathSpec]
01770         else:
01771           modstuff = ml.find_module(modPathSpec, tuple(sys.path) + (os.getcwd(),))
01772         if modstuff is None:
01773           raise ImportError, "%s: Module not found: %s" % (fn, modPathSpec)
01774         if isinstance(modstuff, tuple):
01775           ml.load_module(modName, modstuff)
01776       else:
01777         log.error("%s: Missing module name" % fn)
01778         return None
01779     elif tagName == 'group':
01780       if n.hasAttribute('name'):
01781         groupName = str(n.getAttribute('name'))
01782       else:
01783         log.error("%s: Missing group name" % fn)
01784         return None
01785       if n.hasAttribute('enabled'):
01786         isGroupEnabled = str(n.getAttribute('enabled'))
01787         if isGroupEnabled.lower() in ('true', 'yes'):
01788           isGroupEnabled = 1
01789         elif isGroupEnabled.lower() in ('false', 'no'):
01790           isGroupEnabled = 0
01791         else:
01792           log.error("%s: Invalid enable flag value %d" % (fn, isGroupEnabled))
01793       else:
01794         log.error("%s: Missing enable flag for group %s" % (fn, groupName))
01795       groups[groupName] = Ggroup(groupName, isGroupEnabled)
01796     elif tagName == 'options':
01797       for on in getChildNodes(n):
01798         tagName = str(on.tagName).lower()
01799         if tagName == 'explicitbroadcastnodes':
01800           if not isSchema:
01801             log.error("%s: '%s' declaration option can not be used in a configuration block" % (fn, on.tagName))
01802           else:
01803             processBooleanDeclarationOption(on, declarations)
01804         elif tagName == 'skiptemoverrides':
01805           if isSchema:
01806             log.error("%s: '%s' declaration option can only be used in a configuration block" % (fn, on.tagName))
01807           else:
01808             processBooleanDeclarationOption(on, declarations)
01809         elif tagName == 'ignorehardwaretimeouts':
01810           if not isSchema:
01811             log.error("%s: '%s' declaration option can not be used in a configuration block" % (fn, on.tagName))
01812           else:
01813             processBooleanDeclarationOption(on, declarations)
01814         else:
01815           log.error("%s: Invalid declaration options tag: %s ...skipping" % (fn, on.tagName))
01816     else:
01817       log.error("%s: Invalid declaration tag: %s ...skipping" % (fn, n.tagName))
01818   return
01819
01820 def processBooleanDeclarationOption(on, declarations):
01821   tagName = str(on.tagName).lower()
01822   val = str(on.firstChild.data).strip().lower()
01823   if val == '1' or val == 'true':
01824     declarations['options'][tagName] = 1
01825   else:
01826     declarations['options'][tagName] = 0
01827
01828 def processBadChannels(node, badChannels, mapLayerToCable=None, mapDetectorToLayer=None, temId=None):
01829   fn = "processBadChannels"
01830   for badStripNode in getChildNodes(node):
01831     if badStripNode.tagName == 'tower':
01832       badStripTower = badStripNode
01833       if temId is None:
01834         row = int(badStripTower.getAttribute('row'))
01835         col = int(badStripTower.getAttribute('col'))
01836         temId = row*4 + col
01837       for uniplane in getChildNodes(badStripTower):
01838         if uniplane.tagName == 'uniplane':
01839           tray = int(uniplane.getAttribute('tray'))
01840           which = str(uniplane.getAttribute('which'))
01841           howBad = int(uniplane.getAttribute('howBad'))
01842           for stripListNode in getChildNodes(uniplane):
01843             if stripListNode.tagName == 'stripList':
01844               stripSeq = str(stripListNode.getAttribute('strips')).strip()
01845               stripList = uncompressSequence(stripSeq, sepChar=' ')
01846               stripBitField = gBits.bf(0)
01847               for strip in stripList:
01848                 stripBitField[strip] = 1
01849               if mapLayerToCable is not None and mapDetectorToLayer is not None:
01850                 ccpair_rc = mapLayerToCable[mapDetectorToLayer[(tray, which)]]
01851               else:
01852                 ccpair_rc = MAP_LAYER_TO_CABLE[MAP_DETECTOR_TO_LAYER[(tray, which)]]
01853               badChannels[(temId, ccpair_rc)] = stripBitField
01854
01855 def readBadChannels(fileName, mapLayerToCable=None, mapDetectorToLayer=None, temId=None):
01856   fn = "readBadChannels"
01857   #doc = Sax2.FromXmlFile(fileName)
01858   try:
01859     doc = minidom.parse(fileName)
01860   except Exception, e:
01861     log.exception("%s: Error parsing bad channels file: %s" % (fn, fileName))
01862     raise e
01863   root = doc.documentElement
01864   tagName = root.tagName.lower()
01865   if tagName != "badstrips":
01866     log.error("%s: Invalid bad strips document tag: %s" % (fn, tagName))
01867     return None
01868   badChannels = {}
01869   processBadChannels(root, badChannels, mapLayerToCable, mapDetectorToLayer, temId)
01870   return badChannels
01871
01872 def instantiateClass(classModStr, classNameStr, parList):
01873   fn = "instantiateClass"
01874   if sys.modules.has_key(classModStr):
01875     m = sys.modules[classModStr]
01876     try:
01877       return apply(getattr(m, classNameStr), (), parList)
01878     except:
01879       log.error("%s: Error: %s %s %s" % (fn, classModStr, classNameStr, sys.exc_value))
01880       log.error("%s: Class parameter list: %s" % (fn, parList))
01881       return None
01882   else:
01883     log.error("%s: Module %s for class %s not loaded" % (fn, classModStr, classNameStr))
01884     return None
01885
01886 def takeSnapshot(glat, stream=sys.stdout, fileName=None,
01887                  captureGTIC=1, captureGAEQ=1,
01888                  trigger=None,
01889                  configName='', configVersion=''):
01890   fn = "takeSnapshot"
01891   closeFlag=0
01892   if stream is None:
01893     try:
01894       stream = open(fileName,'w')
01895       closeFlag = 1
01896     except:
01897       log.error("%s: can't open snapshot file: %s" % (fn, fileName))
01898       return
01899   log.debug("%s: Generating snapshot: %s, configName= %s, configVersion= %s..." %
01900            (fn, fileName, configName, configVersion))
01901   result = writeSchema(glat, stream, snapshotMode=1,
01902               captureGTIC=captureGTIC, captureGAEQ=captureGAEQ,
01903               trigger=trigger,
01904               configName=configName, configVersion=configVersion)
01905   if closeFlag:
01906     stream.close()
01907   if result:
01908     log.debug("%s: Snapshot generation completed successfully" % fn)
01909   else:
01910     log.warning("%s: Snapshot generation completed with errors" % fn)
01911   return result
01912
01913 def writeConfig(glat, stream=sys.stdout, seq=None):
01914   fn = "writeConfig"
01915   configs = glat.getConfigurations()
01916   configSeqList = configs.keys()
01917   configSeqList.sort()
01918   for configSeq in configSeqList:
01919     if seq is None:
01920       #PrettyPrint(configs[configSeq][0], stream)
01921       toPrettyXML(configs[configSeq][0], stream, indent="  ", encoding="UTF-8")
01922     elif seq == configSeq:
01923       #PrettyPrint(configs[seq][0], stream)
01924       toPrettyXML(configs[seq][0], stream, indent="  ", encoding="UTF-8")
01925       return
01926   if seq is None:
01927     return
01928   else:
01929     log.error("%s: Configuration %d not found." % (fn, seq))
01930
01931 def writeRegisters(node, doc, xnode):
01932   fn = "writeRegisters"
01933   result = True
01934   for (reg, regObj) in node.regs.items():
01935     # Already writing the bit fields for the mask so skip it
01936     if node.__class__.__name__ == 'GGLT' and reg == 'mask':
01937       continue
01938     if not regObj.isCommand() and not regObj.isWriteOnly() and not regObj.isNoDirectAccess():
01939       try:
01940         regVal = regObj.get(bypass=1)
01941         #print regObj.getName(), node.__class__.__name__, regVal.__class__.__name__
01942         #log.error("Added register to the snapshot: %s %s %s %s" \
01943         #            % (node.getName(), node.getIdTuple(), regObj.getName(), regVal))
01944       except gException.LATInterfaceException:
01945         if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
01946             and node.root().getDeclarations()['options']['ignorehardwaretimeouts']:
01947           log.error("%s: Error adding register to the snapshot: %s %s %s %s" \
01948                     % (fn, sys.exc_info()[1].errstr(), node.getName(),
01949                       node.getIdTuple(), regObj.getName()))
01950           return False
01951         else:
01952           log.error("%s: Error adding register to the snapshot: %s %s %s %s" \
01953                     % (fn, sys.exc_info()[1].errstr(), node.getName(),
01954                       node.getIdTuple(), regObj.getName()))
01955           regVal = 0
01956           result = False
01957
01958       xreg = doc.createElement(reg)
01959       xreg.appendChild(doc.createTextNode('0x%x' % regVal))
01960       xnode.appendChild(xreg)
01961   return result
01962
01963
01964 def writeSchema(glat, stream=sys.stdout, snapshotMode=0,
01965                 captureGTIC=1, captureGAEQ=1,
01966                 trigger=None,
01967                 configName='', configVersion=''):
01968   """Writes a LAT object model to an XML schema
01969
01970   Inputs::
01971
01972     GLAT root of the object model
01973     Output stream (defaults to sys.stdout if omitted)
01974
01975   Output: None
01976
01977   Usage::
01978
01979     f = open('mySchema.xml', 'w')
01980     writeSchema(lat, f)
01981     f.close()
01982       or
01983     writeSchema(lat) to output to sys.stdout.
01984   """
01985   fn = "writeSchema"
01986   result = True # Return False if there are any errors during snapshot
01987   if configName == '': configName = glat._GLAT__configName
01988   if configVersion == '': configVersion = glat._GLAT__configVersion
01989   doc = minidom.getDOMImplementation().createDocument(None,None,None)
01990   if not snapshotMode:
01991     for c in glat._GLAT__schemaComments:
01992       doc.appendChild(doc.createComment(c))
01993     root = doc.createElement("LATdoc")
01994     root.setAttribute('name',glat._GLAT__schemaName)
01995     doc.appendChild(root)
01996   else:
01997     root = doc.createElement('configuration')
01998     root.setAttribute('name', configName)
01999     root.setAttribute('version', configVersion)
02000     doc.appendChild(root)
02001
02002   xdecl = doc.createElement("declarations")
02003   root.appendChild(xdecl)
02004   options = glat._GLAT__declarations['options']
02005   if len(options) > 0:
02006     xoptblk = doc.createElement('options')
02007     for (optName, optVal) in options.items():
02008       xopt = doc.createElement(optName)
02009       xopt.appendChild(doc.createTextNode(str(optVal)))
02010       xoptblk.appendChild(xopt)
02011     xdecl.appendChild(xoptblk)
02012   imports = glat._GLAT__declarations['imports']
02013   if len(imports) > 0:
02014     for (impName, impPath) in imports.items():
02015       ximp = doc.createElement('import')
02016       ximp.setAttribute('name', impName)
02017       ximp.appendChild(doc.createTextNode(impPath))
02018       xdecl.appendChild(ximp)
02019   groups = glat._GLAT__declarations['groups']
02020   if len(groups) > 0:
02021     for (groupName, group) in groups.items():
02022       xgrp = doc.createElement('group')
02023       if group.enabled():
02024         xgrp.setAttribute('enabled', 'true')
02025       else:
02026         xgrp.setAttribute('enabled', 'false')
02027       xgrp.setAttribute('name', groupName)
02028       xdecl.appendChild(xgrp)
02029
02030   constraints = glat._GLAT__declarations['constraints']
02031   if len(constraints) > 0:
02032     xconsblk = doc.createElement('constraints')
02033     for (consName, cons) in constraints.items():
02034       if cons is None: continue
02035       xcons = doc.createElement('constraint')
02036       xcons.setAttribute('name', consName)
02037       xclass = doc.createElement('class')
02038       xclass.appendChild(doc.createTextNode(cons.__class__.__module__ +
02039                                             '.' + cons.__class__.__name__)
02040                                           )
02041       xcons.appendChild(xclass)
02042       xparblk = doc.createElement('parameters')
02043       (args, varargs, varkw) = inspect.getargs(cons.__init__.func_code)
02044       for arg in args:
02045         if arg == 'self': continue
02046         val = None
02047         for (dictVar, dictVal) in cons.__dict__.items():
02048           if dictVar.endswith('__' + arg):
02049             val = dictVal
02050             break
02051         if val is None:
02052         #if cons.__dict__.has_key('_Gconstraint__' + arg):
02053         #  val = cons.__dict__['_Gconstraint__' + arg]
02054         #elif cons.__dict__.has_key('_' + cons.__class__.__name__ + '__' + arg):
02055         #  val = cons.__dict__['_' + cons.__class__.__name__ + '__' + arg]
02056         #else:
02057           log.error("%s: Can not locate instance variable for "
02058                     "constraint parameter: %s ...skipping" % (fn, arg))
02059           continue
02060         if hasattr(val, 'name'):
02061           val = val.name()
02062         xpar = doc.createElement(arg)
02063         xval = doc.createTextNode(str(val))
02064         xpar.appendChild(xval)
02065         xparblk.appendChild(xpar)
02066       xcons.appendChild(xparblk)
02067       xconsblk.appendChild(xcons)
02068     root.appendChild(xconsblk)
02069
02070   rules = glat._GLAT__declarations['rules']
02071   if len(rules) > 0:
02072     xruleblk = doc.createElement('rules')
02073     for (ruleName, rule) in rules.items():
02074       if rule is None: continue
02075       xrule = doc.createElement('rule')
02076       xrule.setAttribute('name', ruleName)
02077       xclass = doc.createElement('class')
02078       xclass.appendChild(doc.createTextNode(rule.__class__.__module__ +
02079                                             '.' + rule.__class__.__name__)
02080                                           )
02081       xrule.appendChild(xclass)
02082       xparblk = doc.createElement('parameters')
02083       (args, varargs, varkw) = inspect.getargs(rule.__init__.func_code)
02084       for arg in args:
02085         if arg == 'self': continue
02086         val = None
02087         for (dictVar, dictVal) in rule.__dict__.items():
02088           if dictVar.endswith('__' + arg):
02089             val = dictVal
02090             break
02091         if val is None:
02092         #if rule.__dict__.has_key('_Grule__' + arg):
02093         #  val = rule.__dict__['_Grule__' + arg]
02094         #elif rule.__dict__.has_key('_' + rule.__class__.__name__ + '__' + arg):
02095         #  val = rule.__dict__['_' + rule.__class__.__name__ + '__' + arg]
02096         #else:
02097           log.error("%s: Can not locate instance variable for "
02098                     "rule parameter: %s ...skipping" % (fn, arg))
02099           continue
02100         if hasattr(val, 'name'):
02101           val = val.name()
02102         xpar = doc.createElement(arg)
02103         xval = doc.createTextNode(str(val))
02104         xpar.appendChild(xval)
02105         xparblk.appendChild(xpar)
02106       xrule.appendChild(xparblk)
02107       xruleblk.appendChild(xrule)
02108     root.appendChild(xruleblk)
02109
02110   egus = glat._GLAT__declarations['egus']
02111   if len(egus) > 0:
02112     xegublk = doc.createElement('egus')
02113     for (eguName, egu) in egus.items():
02114       if egu is None: continue
02115       xegu = doc.createElement('egu')
02116       xegu.setAttribute('name', eguName)
02117       xclass = doc.createElement('class')
02118       xclass.appendChild(doc.createTextNode(egu.__class__.__module__ +
02119                                             '.' + egu.__class__.__name__)
02120                                           )
02121       xegu.appendChild(xclass)
02122       xparblk = doc.createElement('parameters')
02123       (args, varargs, varkw) = inspect.getargs(egu.__init__.func_code)
02124       for arg in args:
02125         if arg == 'self': continue
02126         val = None
02127         for (dictVar, dictVal) in egu.__dict__.items():
02128           if dictVar.endswith('__' + arg):
02129             val = dictVal
02130             break
02131         if val is None:
02132         #if egu.__dict__.has_key('_GEGU__' + arg):
02133         #  val = egu.__dict__['_GEGU__' + arg]
02134         #elif egu.__dict__.has_key('_' + egu.__class__.__name__ + '__' + arg):
02135         #  val = egu.__dict__['_' + egu.__class__.__name__ + '__' + arg]
02136         #else:
02137           log.error("%s: Can not locate instance variable for "
02138                     "EGU parameter: %s ...skipping" % (fn, arg))
02139           continue
02140         if hasattr(val, 'name'):
02141           val = val.name()
02142         xpar = doc.createElement(arg)
02143         xval = doc.createTextNode(str(val))
02144         xpar.appendChild(xval)
02145         xparblk.appendChild(xpar)
02146       xegu.appendChild(xparblk)
02147       xegublk.appendChild(xegu)
02148     root.appendChild(xegublk)
02149
02150   options = glat._GLAT__declarations['options']
02151   if not snapshotMode:
02152     explicitBroadcastNodes = options['explicitbroadcastnodes']
02153   else:
02154     explicitBroadcastNodes = 0
02155
02156   lat = getPath(glat, explicitBroadcastNodes)
02157   if not snapshotMode:
02158     xsch = doc.createElement('schema')
02159     root.appendChild(xsch)
02160     xlat = doc.createElement('GLAT')
02161     xsch.appendChild(xlat)
02162   else:
02163     gem = lat[2]                                  # Check for a GEM
02164     if gem is None and trigger is not None:       # No gem, use GLT
02165       glt = trigger.GLT()                         # get GLT from trigger obj
02166       gltMask = ~( trigger.conditions().value() ) # GLT uses ~ logic
02167       gMask = gBits.bf(gltMask)
02168       xglt = doc.createElement('GGLT')
02169       for (bitField, fromBit, toBit) in glt._GGLT__mask_BF:
02170         xreg = doc.createElement(bitField)
02171         xreg.appendChild(doc.createTextNode('0x%x' % gMask[fromBit:toBit]))
02172         xglt.appendChild(xreg)
02173       # Add the rest of the GLT
02174       for reg in ('mask','parity','tag','event_number',
02175                   'destination','marker','tack',
02176                   'zero_suppress','four_range_readout','cal_strobe'):
02177         xreg = doc.createElement(reg)
02178         xreg.appendChild(doc.createTextNode('0x%x' % glt.regs[reg].get()))
02179         xglt.appendChild(xreg)
02180       root.appendChild(xglt)
02181     xlat = doc.createElement('GLAT')
02182     root.appendChild(xlat)
02183
02184   pdus = lat[0]
02185   for pdu in pdus:
02186     pduIds = pdu[0]
02187     if snapshotMode:
02188       for pduId in pduIds:
02189         xpdu = doc.createElement('GPDU')
02190         xpdu.setAttribute('ID', "%d"%pduId)
02191         gpdu = glat.PDU[pduId]
02192         if not writeRegisters(gpdu, doc, xpdu):
02193           result = False
02194           continue
02195         xlat.appendChild(xpdu)
02196         peq = pdu[1]
02197         if peq:
02198           xpeq = doc.createElement('GPEQ')
02199           xpdu.appendChild(xpeq)
02200           result &= writeRegisters(gpdu.PEQ, doc, xpeq)
02201     else:
02202       xpdu = doc.createElement('GPDU')
02203       xpdu.setAttribute('ID', compressSequence(pduIds))
02204       xlat.appendChild(xpdu)
02205       peq = pdu[1]
02206       if peq:
02207         xpeq = doc.createElement('GPEQ')
02208         xpdu.appendChild(xpeq)
02209   ebm = lat[1]
02210   if ebm is not None:
02211     xebm = doc.createElement('GEBM')
02212     xlat.appendChild(xebm)
02213     if snapshotMode:
02214       gebm = glat.EBM
02215       result &= writeRegisters(gebm, doc, xebm)
02216     (ebmc, ebmst) = ebm
02217     if ebmc:
02218       xebmc = doc.createElement('GEBMC')
02219       xebm.appendChild(xebmc)
02220       if snapshotMode:
02221         result &= writeRegisters(gebm.EBMC, doc, xebmc)
02222     if ebmst:
02223       xebmst = doc.createElement('GEBMST')
02224       xebm.appendChild(xebmst)
02225       if snapshotMode:
02226         result &= writeRegisters(gebm.EBMST, doc, xebmst)
02227   gem = lat[2]
02228   if gem is not None:
02229     xgem = doc.createElement('GGEM')
02230     xlat.appendChild(xgem)
02231     if snapshotMode:
02232       ggem = glat.GEM
02233       result &= writeRegisters(ggem, doc, xgem)
02234     (gemc, gemmg, gemst, gemsc, gemvg, gemie, gemw) = gem
02235     if gemc:
02236       xgemc = doc.createElement('GGEMC')
02237       xgem.appendChild(xgemc)
02238       if snapshotMode:
02239         result &= writeRegisters(ggem.GEMC, doc, xgemc)
02240     if gemmg:
02241       xgemmg = doc.createElement('GGEMMG')
02242       xgem.appendChild(xgemmg)
02243       if snapshotMode:
02244         result &= writeRegisters(ggem.GEMMG, doc, xgemmg)
02245     if gemst:
02246       xgemst = doc.createElement('GGEMST')
02247       xgem.appendChild(xgemst)
02248       if snapshotMode:
02249         result &= writeRegisters(ggem.GEMST, doc, xgemst)
02250     if gemsc:
02251       xgemsc = doc.createElement('GGEMSC')
02252       xgem.appendChild(xgemsc)
02253       if snapshotMode:
02254         result &= writeRegisters(ggem.GEMSC, doc, xgemsc)
02255     if gemvg:
02256       xgemvg = doc.createElement('GGEMVG')
02257       xgem.appendChild(xgemvg)
02258       if snapshotMode:
02259         result &= writeRegisters(ggem.GEMVG, doc, xgemvg)
02260     if gemie:
02261       xgemie = doc.createElement('GGEMIE')
02262       xgem.appendChild(xgemie)
02263       if snapshotMode:
02264         result &= writeRegisters(ggem.GEMIE, doc, xgemie)
02265     if gemw:
02266        xgemw = doc.createElement('GGEMW')
02267        xgem.appendChild(xgemw)
02268        if snapshotMode:
02269          result &= writeRegisters(ggem.GEMW, doc, xgemw)
02270          if trigger is not None:
02271            for n in getChildNodes(xgemw):
02272              if str(n.tagName.lower()) == 'window_open_mask':
02273                old_wom = getChildNodes(n)[0]
02274                new_wom = doc.createTextNode('0x%x' % trigger.conditions().value())
02275                n.replaceChild(new_wom, old_wom)
02276                break
02277   cru = lat[3]
02278   if cru:
02279     xcru = doc.createElement('GCRU')
02280     xlat.appendChild(xcru)
02281     if snapshotMode:
02282       result &= writeRegisters(glat.CRU, doc, xcru)
02283   tems = lat[4]
02284   for tem in tems:
02285     temIds = tem[0]
02286     if snapshotMode:
02287       for temId in temIds:
02288         xtem = doc.createElement('GTEM')
02289         xtem.setAttribute('ID', "%d"%temId)
02290         gtem = glat.TEM[temId]
02291         if not writeRegisters(gtem, doc, xtem):
02292           result = False
02293           continue
02294         xlat.appendChild(xtem)
02295         ccs = tem[1]
02296         cccs = ccs[0]
02297         for ccc in cccs:
02298           cccIds = ccc[0]
02299           for cccId in cccIds:
02300             xccc = doc.createElement('GCCC')
02301             xccc.setAttribute('ID', "%d"%cccId)
02302             gccc = gtem.CCC[cccId]
02303             if not writeRegisters(gccc, doc, xccc):
02304               result = False
02305               continue
02306             xtem.appendChild(xccc)
02307             crcs = ccc[1]
02308             for crc in crcs:
02309               crcIds = crc[0]
02310               for crcId in crcIds:
02311                 xcrc = doc.createElement('GCRC')
02312                 xcrc.setAttribute('ID', "%d"%crcId)
02313                 gcrc = gccc.CRC[crcId]
02314                 if not writeRegisters(gcrc, doc, xcrc):
02315                   result = False
02316                   continue
02317                 xccc.appendChild(xcrc)
02318                 cfeIds = crc[1]
02319                 if cfeIds != ():
02320                   for cfeId in cfeIds:
02321                     xcfe = doc.createElement('GCFE')
02322                     xcfe.setAttribute('ID', "%d"%cfeId)
02323                     gcfe = gcrc.CFE[cfeId]
02324                     if not writeRegisters(gcfe, doc, xcfe):
02325                       result = False
02326                       continue
02327                     xcrc.appendChild(xcfe)
02328         tccs = ccs[1]
02329         for tcc in tccs:
02330           tccIds = tcc[0]
02331           for tccId in tccIds:
02332             xtcc = doc.createElement('GTCC')
02333             xtcc.setAttribute('ID', "%d"%tccId)
02334             gtcc = gtem.TCC[tccId]
02335             if not writeRegisters(gtcc, doc, xtcc):
02336               result = False
02337               continue
02338             xtem.appendChild(xtcc)
02339             trcs = tcc[1]
02340             for trc in trcs:
02341               trcIds = trc[0]
02342               for trcId in trcIds:
02343                 xtrc = doc.createElement('GTRC')
02344                 xtrc.setAttribute('ID', "%d"%trcId)
02345                 gtrc = gtcc.TRC[trcId]
02346                 if not writeRegisters(gtrc, doc, xtrc):
02347                   result = False
02348                   continue
02349                 xtcc.appendChild(xtrc)
02350                 tfeIds = trc[1]
02351                 if tfeIds != ():
02352                   for tfeId in tfeIds:
02353                     xtfe = doc.createElement('GTFE')
02354                     xtfe.setAttribute('ID', "%d"%tfeId)
02355                     gtfe = gtrc.TFE[tfeId]
02356                     if not writeRegisters(gtfe, doc, xtfe):
02357                       result = False
02358                       continue
02359                     xtrc.appendChild(xtfe)
02360         if captureGTIC:
02361           tic = ccs[2]
02362           if tic:
02363             xtic = doc.createElement('GTIC')
02364             gtic = gtem.TIC
02365             result &= writeRegisters(gtic, doc, xtic)
02366             xtem.appendChild(xtic)
02367     else:
02368       xtem = doc.createElement('GTEM')
02369       xtem.setAttribute('ID', compressSequence(temIds))
02370       xlat.appendChild(xtem)
02371       ccs = tem[1]
02372       cccs = ccs[0]
02373       for ccc in cccs:
02374         cccIds = ccc[0]
02375         xccc = doc.createElement('GCCC')
02376         xccc.setAttribute('ID', compressSequence(cccIds))
02377         xtem.appendChild(xccc)
02378         crcs = ccc[1]
02379         for crc in crcs:
02380           crcIds = crc[0]
02381           xcrc = doc.createElement('GCRC')
02382           xcrc.setAttribute('ID', compressSequence(crcIds))
02383           xccc.appendChild(xcrc)
02384           cfeIds = crc[1]
02385           if cfeIds != ():
02386             xcfe = doc.createElement('GCFE')
02387             xcfe.setAttribute('ID', compressSequence(cfeIds))
02388             xcrc.appendChild(xcfe)
02389       tccs = ccs[1]
02390       for tcc in tccs:
02391         tccIds = tcc[0]
02392         xtcc = doc.createElement('GTCC')
02393         xtcc.setAttribute('ID', compressSequence(tccIds))
02394         xtem.appendChild(xtcc)
02395         trcs = tcc[1]
02396         for trc in trcs:
02397           trcIds = trc[0]
02398           xtrc = doc.createElement('GTRC')
02399           xtrc.setAttribute('ID', compressSequence(trcIds))
02400           xtcc.appendChild(xtrc)
02401           tfeIds = trc[1]
02402           if tfeIds != ():
02403             xtfe = doc.createElement('GTFE')
02404             xtfe.setAttribute('ID', compressSequence(tfeIds))
02405             xtrc.appendChild(xtfe)
02406       tic = ccs[2]
02407       if tic:
02408         xtic = doc.createElement('GTIC')
02409         xtem.appendChild(xtic)
02410   aem = lat[5]
02411   if aem != None:
02412     xaem = doc.createElement('GAEM')
02413     if aem[0]:
02414       aemIds = (0,255)
02415       xaem.setAttribute('ID', compressSequence(aemIds))
02416     if snapshotMode:
02417       gaem = glat.AEM
02418       result &= writeRegisters(gaem, doc, xaem)
02419     xlat.appendChild(xaem)
02420     if snapshotMode:
02421       if captureGAEQ:
02422         aeq = aem[1]
02423         if aeq:
02424           xaeq = doc.createElement('GAEQ')
02425           gaeq = gaem.AEQ
02426           result &= writeRegisters(gaeq, doc, xaeq)
02427           xaem.appendChild(xaeq)
02428     else:
02429       aeq = aem[1]
02430       if aeq:
02431         xaeq = doc.createElement('GAEQ')
02432         xaem.appendChild(xaeq)
02433     for arc in aem[2]:
02434       arcIds = arc[0]
02435       if snapshotMode:
02436         for arcId in arcIds:
02437           xarc = doc.createElement('GARC')
02438           xarc.setAttribute('ID', "%d"%arcId)
02439           garc = gaem.ARC[arcId]
02440           result &= writeRegisters(garc, doc, xarc)
02441           xaem.appendChild(xarc)
02442           afeIds = arc[1]
02443           if afeIds != ():
02444             for afeId in afeIds:
02445               xafe = doc.createElement('GAFE')
02446               xafe.setAttribute('ID', "%d"%afeId)
02447               gafe = garc.AFE[afeId]
02448               result &= writeRegisters(gafe, doc, xafe)
02449               xarc.appendChild(xafe)
02450       else:
02451         xarc = doc.createElement('GARC')
02452         xarc.setAttribute('ID', compressSequence(arcIds))
02453         xaem.appendChild(xarc)
02454         afeIds = arc[1]
02455         if afeIds != ():
02456           xafe = doc.createElement('GAFE')
02457           xafe.setAttribute('ID', compressSequence(afeIds))
02458           xarc.appendChild(xafe)
02459
02460   if not snapshotMode:
02461     configSeqList = glat.getConfigurations().keys()
02462     configSeqList.sort()
02463     for seq in configSeqList:
02464       xcnf = doc.importNode(glat.getConfigurations()[seq][0],1)
02465       root.appendChild(xcnf)
02466   #PrettyPrint(doc, stream)
02467   toPrettyXML(doc, stream, indent="  ", encoding="UTF-8")
02468   return result
02469
02470
02471 def getPath(gnode, explicitBroadcastNodes):
02472   fn = 'getPath'
02473   if gnode.__class__.__name__ == 'GCRC':
02474     gcrcChildren = gnode.CFE.keys()
02475     gcrcChildren = tuple(gcrcChildren)
02476     return gcrcChildren
02477   elif gnode.__class__.__name__ == 'GCCC':
02478     gcrcSeqMap = {}
02479     for (gcrcId, gcrc) in gnode.CRC.items():
02480       if not explicitBroadcastNodes and gcrcId == 255: continue
02481       gcfeIdTuple = getPath(gcrc, explicitBroadcastNodes)
02482       if gcrcSeqMap.has_key(gcfeIdTuple):
02483         gcrcSeqMap[gcfeIdTuple] += (gcrcId,)
02484       else:
02485         gcrcSeqMap[gcfeIdTuple] = (gcrcId,)
02486     gcrcSeqTuple = ()
02487     for (gcfeIds, gcrcIds) in gcrcSeqMap.items():
02488       gcrcSeqTuple = ((gcrcIds, gcfeIds,),) + gcrcSeqTuple
02489     return gcrcSeqTuple
02490   if gnode.__class__.__name__ == 'GTRC':
02491     gtrcChildren = gnode.TFE.keys()
02492     gtrcChildren = tuple(gtrcChildren)
02493     return gtrcChildren
02494   elif gnode.__class__.__name__ == 'GTCC':
02495     gtrcSeqMap = {}
02496     for (gtrcId, gtrc) in gnode.TRC.items():
02497       if not explicitBroadcastNodes and gtrcId == 255: continue
02498       gtfeIdTuple = getPath(gtrc, explicitBroadcastNodes)
02499       if gtrcSeqMap.has_key(gtfeIdTuple):
02500         gtrcSeqMap[gtfeIdTuple] += (gtrcId,)
02501       else:
02502         gtrcSeqMap[gtfeIdTuple] = (gtrcId,)
02503     gtrcSeqTuple = ()
02504     for (gtfeIds, gtrcIds) in gtrcSeqMap.items():
02505       gtrcSeqTuple = ((gtrcIds, gtfeIds,),) + gtrcSeqTuple
02506     return gtrcSeqTuple
02507   elif gnode.__class__.__name__ == 'GTEM':
02508     gcccSeqMap = {}
02509     cccItems = gnode.CCC.items()
02510     if explicitBroadcastNodes and gnode.allCCC() is not None:
02511       cccItems.append((255,gnode.allCCC()))
02512     for (gcccId, gccc) in cccItems:
02513       gcrcIdTuple = getPath(gccc, explicitBroadcastNodes)
02514       if gcccSeqMap.has_key(gcrcIdTuple):
02515         gcccSeqMap[gcrcIdTuple] += (gcccId,)
02516       else:
02517         gcccSeqMap[gcrcIdTuple] = (gcccId,)
02518     gcccSeqTuple = ()
02519     for (gcrcIds, gcccIds) in gcccSeqMap.items():
02520       gcccSeqTuple = ((gcccIds, gcrcIds,),) + gcccSeqTuple
02521
02522     gtccSeqMap = {}
02523     tccItems = gnode.TCC.items()
02524     if explicitBroadcastNodes and gnode.allTCC() is not None:
02525       tccItems.append((255,gnode.allTCC()))
02526     for (gtccId, gtcc) in tccItems:
02527       gtrcIdTuple = getPath(gtcc, explicitBroadcastNodes)
02528       if gtccSeqMap.has_key(gtrcIdTuple):
02529         gtccSeqMap[gtrcIdTuple] += (gtccId,)
02530       else:
02531         gtccSeqMap[gtrcIdTuple] = (gtccId,)
02532     gtccSeqTuple = ()
02533     for (gtrcIds, gtccIds) in gtccSeqMap.items():
02534       gtccSeqTuple = ((gtccIds, gtrcIds,),) + gtccSeqTuple
02535     if gnode.downTIC() != None:
02536       return (gcccSeqTuple , gtccSeqTuple, 1)
02537     else:
02538       return (gcccSeqTuple , gtccSeqTuple, 0)
02539   elif gnode.__class__.__name__ == 'GLAT':
02540     gtemSeqMap = {}
02541     temItems = gnode.TEM.items()
02542     if explicitBroadcastNodes and gnode.allTEM() is not None:
02543       temItems.append((255,gnode.allTEM()))
02544     for (gtemId, gtem) in temItems:
02545       gcccIdTuple = getPath(gtem, explicitBroadcastNodes)
02546       if gtemSeqMap.has_key(gcccIdTuple):
02547         gtemSeqMap[gcccIdTuple] += (gtemId,)
02548       else:
02549         gtemSeqMap[gcccIdTuple] = (gtemId,)
02550     gtemSeqTuple = ()
02551     for (gcccIds, gtemIds) in gtemSeqMap.items():
02552       gtemSeqTuple = ((gtemIds, gcccIds,),) + gtemSeqTuple
02553     gpduSeqMap = {}
02554     for (gpduId, gpdu) in gnode.PDU.items():
02555
02556       gpduTuple = getPath(gpdu, explicitBroadcastNodes)
02557       if gpduTuple in gpduSeqMap:
02558         gpduSeqMap[gpduTuple] += (gpduId,)
02559       else:
02560         gpduSeqMap[gpduTuple] = (gpduId,)
02561     gpduSeqTuple = ()
02562     for (gpduTuple, gpduIds) in gpduSeqMap.items():
02563       gpduSeqTuple = ((gpduIds, gpduTuple,),) + gpduSeqTuple
02564
02565     if gnode.downAEM() == None:
02566       gaemTuple = None
02567     else:
02568       gaemTuple = getPath(gnode.downAEM(), explicitBroadcastNodes)
02569       gaemTuple = (0,) + gaemTuple
02570     ebm = gnode.downEBM()
02571     if ebm is not None:
02572       gebmTuple = ()
02573       ebmc = ebm.downEBMC()
02574       if ebmc is not None:
02575         gebmTuple += (1,)
02576       else:
02577         gebmTuple += (0,)
02578       ebmst = ebm.downEBMST()
02579       if ebmst is not None:
02580         gebmTuple += (1,)
02581       else:
02582         gebmTuple += (0,)
02583     else:
02584       gebmTuple = None
02585     gem = gnode.downGEM()
02586     if gem is not None:
02587       ggemTuple = ()
02588       gemc = gem.downGEMC()
02589       if gemc is not None:
02590         ggemTuple += (1,)
02591       else:
02592         ggemTuple += (0,)
02593       gemmg = gem.downGEMMG()
02594       if gemmg is not None:
02595         ggemTuple += (1,)
02596       else:
02597         ggemTuple += (0,)
02598       gemst = gem.downGEMST()
02599       if gemst is not None:
02600         ggemTuple += (1,)
02601       else:
02602         ggemTuple += (0,)
02603       gemsc = gem.downGEMSC()
02604       if gemsc is not None:
02605         ggemTuple += (1,)
02606       else:
02607         ggemTuple += (0,)
02608       gemvg = gem.downGEMVG()
02609       if gemvg is not None:
02610         ggemTuple += (1,)
02611       else:
02612         ggemTuple += (0,)
02613       gemie = gem.downGEMIE()
02614       if gemie is not None:
02615         ggemTuple += (1,)
02616       else:
02617         ggemTuple += (0,)
02618       gemw = gem.downGEMW()
02619       if gemw is not None:
02620         ggemTuple += (1,)
02621       else:
02622         ggemTuple += (0,)
02623     else:
02624       ggemTuple = None
02625     if gnode.existsCRU():
02626       gcru = 1
02627     else:
02628       gcru = 0
02629     return (gpduSeqTuple, gebmTuple, ggemTuple, gcru, gtemSeqTuple , gaemTuple)
02630   elif gnode.__class__.__name__ == 'GPDU':
02631     gpduChildren = ()
02632     peq = gnode.downPEQ()
02633     if peq is not None:
02634       gpduChildren += (1,)
02635     else:
02636       gpduChildren += (0,)
02637     return gpduChildren
02638   elif gnode.__class__.__name__ == 'GAEM':
02639     garcSeqMap = {}
02640     arcItems = gnode.ARC.items()
02641     if explicitBroadcastNodes and gnode.allARC() is not None:
02642       arcItems.append((255,gnode.allARC()))
02643     for (garcId, garc) in arcItems:
02644       gafeIdTuple = getPath(garc, explicitBroadcastNodes)
02645       if garcSeqMap.has_key(gafeIdTuple):
02646         garcSeqMap[gafeIdTuple] += (garcId,)
02647       else:
02648         garcSeqMap[gafeIdTuple] = (garcId,)
02649     garcSeqTuple = ()
02650     for (gafeIds, garcIds) in garcSeqMap.items():
02651       garcSeqTuple = ((garcIds, gafeIds,),) + garcSeqTuple
02652     if gnode.downAEQ() != None:
02653       return (1, garcSeqTuple)
02654     else:
02655       return (0, garcSeqTuple)
02656
02657   elif gnode.__class__.__name__ == 'GARC':
02658     garcChildren = gnode.AFE.keys()
02659     garcChildren = tuple(garcChildren)
02660     return garcChildren
02661   else:
02662     log.warn("%s: Unhandled node: %s" % (fn, gnode.__class__.__name__ ))
02663     return None
02664
02665 def uncompressSequence(seqStr, sepChar=','):
02666   l = []
02667   s = seqStr.split(sepChar)
02668   for x in s:
02669     x = x.strip()
02670     p = x.find('-')
02671     if p == -1:
02672       if x == '*':
02673         l.append(255)
02674       elif x != '':
02675         l.append(int(x))
02676     else:
02677       fNum = int(x[0:p])
02678       tNum = int(x[p+1:])
02679       l += range(fNum, tNum+1)
02680   return l
02681
02682 def compressSequence(idTuple, sepChar=','):
02683   fromId = -1
02684   toId = -1
02685   idStr = ''
02686   for idVal in idTuple:
02687     if fromId == -1:
02688       fromId = idVal
02689       toId = idVal
02690     elif (idVal - toId) == 1:
02691       toId = idVal
02692     else:
02693       if idStr != '':
02694         idStr += sepChar
02695       if fromId == toId:
02696         idStr += str(fromId)
02697       elif (toId - fromId) == 1:
02698         idStr += str(fromId) + sepChar + str(toId)
02699       else:
02700         idStr += str(fromId) + "-" + str(toId)
02701       fromId = idVal
02702       toId = idVal
02703   if idStr != '':
02704     idStr += sepChar
02705   if fromId == toId:
02706     if fromId == 255: fromId = '*'
02707     idStr += str(fromId)
02708   elif (toId - fromId) == 1:
02709     idStr += str(fromId) + sepChar + str(toId)
02710   else:
02711     idStr += str(fromId) + "-" + str(toId)
02712   return idStr
02713
02714 # copied and modified from Python/Lib/xml/dom/minidom.py
02715 # With the default routine the text nodes were being written
02716 # on a separate line. Now they are on the same line as their parent tags.
02717 def toPrettyXML(doc, writer, indent="\t", newl="\n", encoding = None):
02718   # indent = the indentation string to prepend, per level
02719   # newl = the newline string to append
02720   if encoding is not None:
02721     import codecs
02722     # Can't use codecs.getwriter to preserve 2.0 compatibility
02723     writer = codecs.lookup(encoding)[3](writer)
02724     writer.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
02725   else:
02726     writer.write('<?xml version="1.0" ?>\n')
02727   if doc.nodeType == minidom.Node.ELEMENT_NODE:
02728     writeXML(doc, writer, indent="",addindent="  ",newl="\n")
02729   else:
02730     for node in doc.childNodes:
02731       if (node.nodeType == minidom.Node.TEXT_NODE and \
02732         (node.data[0] == '\n' or node.data[0].strip() == '')):
02733         pass
02734       elif node.nodeType == minidom.Node.ELEMENT_NODE:
02735         writeXML(node, writer, indent="",addindent=indent,newl=newl)
02736       else:
02737         node.writexml(writer, indent="",addindent=indent,newl=newl)
02738
02739 # copied and modified from Python/Lib/xml/dom/minidom.py
02740 def writeXML(n, writer, indent="", addindent="", newl=""):
02741   # indent = current indentation
02742   # addindent = indentation to add to higher levels
02743   # newl = newline string
02744   writer.write(indent+"<" + n.tagName)
02745
02746   attrs = n._get_attributes()
02747   a_names = attrs.keys()
02748   a_names.sort()
02749
02750   for a_name in a_names:
02751     writer.write(" %s=\"" % a_name)
02752     _write_data(writer, attrs[a_name].value)
02753     writer.write("\"")
02754   if n.childNodes:
02755     if len(n.childNodes) == 1 and n.childNodes[0].nodeType == minidom.Node.TEXT_NODE:
02756       node = n.childNodes[0]
02757       writer.write(">")
02758       node.writexml(writer,"",addindent,"")
02759       writer.write("</%s>%s" % (n.tagName,newl))
02760     else:
02761       writer.write(">%s"%(newl))
02762       for node in n.childNodes:
02763         if (node.nodeType == minidom.Node.TEXT_NODE and \
02764            (node.data[0] == '\n' or node.data[0].strip() == '')):
02765           pass
02766         elif node.nodeType == minidom.Node.ELEMENT_NODE:
02767           writeXML(node,writer,indent+addindent,addindent,newl)
02768         else:
02769           node.writexml(writer,indent+addindent,addindent,newl)
02770       writer.write("%s</%s>%s" % (indent,n.tagName,newl))
02771   else:
02772       writer.write("/>%s"%(newl))
02773
02774 # copied from Python/Lib/xml/dom/minidom.py
02775 def _write_data(writer, data):
02776   "Writes datachars to writer."
02777   data = data.replace("&", "&amp;").replace("<", "&lt;")
02778   data = data.replace("\"", "&quot;").replace(">", "&gt;")
02779   writer.write(data)
02780
02781
02782 # Registry dictionary to allow readSchema to read non locally defined
02783 # objects.  (Example GHSK)
02784 # Usage:  gSCprocessRegistry['GHSK']=processGHSK
02785 gSCprocessRegistry = {
02786   'GLAT'   :    processGLAT,
02787   'GXBRD'  :    processGXBRD,
02788 }
02789
02790
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gSocket.py Source File

client

gSocket.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Socket class"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/11/02 00:34:36 $").split(' ')[1]
00015 __version__  = "$Revision: 2.8 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import socket
00022 import threading
00023
00024 class Socket(object):
00025   __TIMEOUT = 5
00026
00027   def __init__(self, portnumber):
00028     self.__port = portnumber
00029     self.__sock = None
00030     self.__host = None
00031     self.__lock = threading.Lock()
00032
00033   def connect(self, host):
00034     if host is None:
00035       raise RuntimeError, 'gSocket: host server name not specified'
00036     try:
00037       self.__sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00038       self.__sock.settimeout(Socket.__TIMEOUT)  # TMOs are not handled correctly
00039       self.__sock.connect((host, self.__port))
00040       self.__host = host
00041     except socket.error, msg:
00042       self.disconnect()
00043       raise RuntimeError, \
00044             'gSocket: unable to connect to %s on port %d: %s' \
00045             %(host, self.__port, str(msg))
00046     ss = self.__sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
00047     ss = 2*1024*1024
00048     self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, ss)
00049
00050   def disconnect(self):
00051     if self.isConnected():
00052       self.__sock.close()
00053       self.__sock = None
00054
00055   def isConnected(self):
00056     return (self.__sock is not None)
00057
00058   def socket(self):
00059     return self.__sock
00060
00061   def setSocket(self, sock):
00062     self.__sock = sock
00063
00064   def lock(self):
00065     self.__lock.acquire()
00066
00067   def release(self):
00068     self.__lock.release()
00069
00070 # Wrote, but commented the following out as I think it's taken care of by
00071 # the settimeout call at connect time.  - RiC
00072 #   def setRecvTmo(self, secs, uSecs = 0):
00073 #     return self.__setTmo(secs, uSecs, socket.SO_RCVTIMEO)
00074
00075 #   def setSendTmo(self, secs, uSecs = 0):
00076 #     return self.__setTmo(secs, uSecs, socket.SO_SNDTIMEO)
00077
00078 #   def __setTmo(self, secs, uSecs, kind):
00079 #     tmo = struct.pack('ll', secs, uSecs)
00080 #     l   = struct.calcsize('ll')
00081 #     tvalue = self.__sock.getsockopt(socket.SOL_SOCKET, kind, l)
00082 #     self.__sock.setsockopt(socket.SOL_SOCKET, kind, tmo)
00083 #     return struct.unpack('ll', tvalue)
00084
00085   def send(self, packet):
00086     return self.__sock.send(packet)
00087
00088   def recv(self, size):
00089     return self.__sock.recv(size)
00090
00091   def sendall(self, packet):
00092     return self.__sock.sendall(packet)
00093
00094   def recvall(self, size):
00095     # The following is not supported on Windows, at least.
00096     # return self.__sock.recv(size, socket.MSG_WAITALL)
00097
00098     data = ''
00099     remaining = size
00100     sock = self.__sock
00101     while remaining > 0:
00102       received = sock.recv(remaining)
00103       reclen = len(received)
00104       if reclen == 0: return received
00105       remaining -= reclen
00106       data += received
00107     return data
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gTEM.py Source File

database

gTEM.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST TEM functional block hierarchy"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/11/03 02:47:43 $").split(' ')[1]
00015 __version__ = "$Revision: 2.20 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import struct
00022 import time
00023 import gDb
00024 import gAttr
00025 import LATTE.client.gRegister  as gRegister
00026 import LATTE.client.gException as gException
00027
00028 #  TEM{}
00029 #   |
00030 #   |----------------
00031 #   |       |       |
00032 #  TIC     CCC{}   TCC{}
00033 #           |       |
00034 #          CRC{}   TRC{}
00035 #           |       |
00036 #          CFE{}   TFE{}
00037
00038
00039 class GTEM(gDb.Gdb):
00040   """\brief TEM node Record
00041
00042   Valid Registers:
00043   - \c configuration
00044   - \c data_masks
00045   - \c status
00046   - \c command_response
00047   - \c tkr_trgseq
00048   - \c cal_trgseq
00049   - \c address
00050
00051   Dataless Commands:
00052   - \c cmd_reset
00053   - \c cmd_look_at_me
00054
00055   """
00056   __attrs = [
00057     # Registers
00058     gAttr.GattrRaw('configuration',     0, 4),
00059     gAttr.GattrRaw('data_masks',        1, 4),
00060     gAttr.GattrRaw('status',            2, 4),
00061     gAttr.GattrRaw('command_response',  3, 4),
00062     gAttr.GattrRaw('tkr_trgseq',        4, 4),
00063     gAttr.GattrRaw('cal_trgseq',        5, 4),
00064     gAttr.GattrRaw('address',           6, 4),
00065     # Dataless Commands
00066     gAttr.GattrDlc('cmd_reset',         1),
00067     gAttr.GattrDlc('cmd_look_at_me',    9)
00068     ]
00069
00070   NTEMS = 16
00071
00072   def __init__(self, client, parent, id):
00073     """\brief Initialize valid registers as Gattrs.
00074
00075     Assign default values to members
00076     """
00077     if id < GTEM.NTEMS:
00078       addr = 'LADR_TEM_%d' %(id)
00079     elif id == gDb.Children.BCASTID:
00080       addr = 'LADR_SLV_BCAST'
00081     else:
00082       raise KeyError("*** gTEM: GTEM id %d is invalid" %(id))
00083     self.CCC = gDb.Children(self, GCCC)
00084     self.TCC = gDb.Children(self, GTCC)
00085     self.TIC = None
00086     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00087
00088   def read(self, reg):
00089     return self.cmdrsp('TEM_CC_read_sync', 'slh', self.addr(), reg, '!I')
00090
00091   def load(self, reg, value):
00092     return self.cmdrsp('TEM_CC_load_sync', 'slh', self.addr(), reg, value)
00093
00094   def send(self, cmd):
00095     if cmd == 9:
00096       return self.cmdrsp('LIOX_sync_LAM', 'slh', self.addr())
00097     else:
00098       return self.cmdrsp('TEM_CC_cmd_sync', 'slh', self.addr(), cmd)
00099
00100   def downCCC(self, childId):
00101     """\brief Navigate to the GCCC indicated by \a childId
00102
00103     \param  childId The id of the child GCCC
00104
00105     \return         A GCCC object instance
00106     """
00107     return self.CCC.down(childId)
00108
00109   def downTCC(self, childId):
00110     """\brief Navigate to the GTCC indicated by \a childId
00111
00112     \param  childId The id of the child GTCC
00113
00114     \return         A GTCC object instance
00115     """
00116     return self.TCC.down(childId)
00117
00118   def allCCC(self):
00119     """\brief Navigate to the broadcast GCCC
00120
00121     \return         The broadcast GCCC object instance
00122     """
00123     return self.CCC.all()
00124
00125   def allTCC(self):
00126     """\brief Navigate to the broadcast GTCC
00127
00128     \return         The broadcast GTCC object instance
00129     """
00130     return self.TCC.all()
00131
00132   def CCCcnt(self):
00133     """\brief Return the GCCC count
00134
00135     \return Current GCCC count
00136     """
00137     return len(self.CCC)
00138
00139   def TCCcnt(self):
00140     """\brief Return the GTCC count
00141
00142     \return Current GTCC count
00143     """
00144     return len(self.TCC)
00145
00146   def downTIC(self):
00147     """\brief Navigate to the GTIC node
00148
00149     \return         The GTIC object instance
00150     """
00151     return self.TIC
00152
00153   def existsTIC(self):
00154     """\brief Check if the GTIC instance exists in the schema.
00155
00156     \return       1 if it exists, 0 if it doesn't.
00157     """
00158     return self.TIC != None
00159
00160   def existsCCC(self, cccId):
00161     """\brief Check if the GCCC instance with the id
00162     \a cccId exists in the schema.
00163
00164     \param  cccId Calorimeter cable controller id
00165
00166     \return       1 if it exists, 0 if it doesn't.
00167     """
00168     return self.CCC.exists(cccId)
00169
00170   def existsTCC(self, tccId):
00171     """\brief Check if the GTCC instance with the id
00172     \a tccId exists in the schema.
00173
00174     \param  tccId Tracker cable controller id
00175
00176     \return       1 if it exists, 0 if it doesn't.
00177     """
00178     return self.TCC.exists(tccId)
00179
00180
00181 ## private:
00182   def __removeCCC(self, cccId):
00183     self.CCC.remove(cccId)
00184
00185   def __addCCC(self, cccId):
00186     return self.CCC.add(cccId)
00187
00188   def __removeTCC(self, tccId):
00189     self.TCC.remove(tccId)
00190
00191   def __addTCC(self, tccId):
00192     return self.TCC.add(tccId)
00193
00194   def __removeTIC(self):
00195     self.TIC = None
00196
00197   def __addTIC(self):
00198     self.TIC = GTIC(self.client(), self)
00199     return self.TIC
00200
00201
00202 class GCCC(gDb.Gdb):
00203   """\brief Calorimeter Cable Controller node Record.
00204
00205   Has GCCC specific registers and dataless commands.
00206
00207   Valid Registers:
00208   - \c configuration
00209   - \c layer_mask_0
00210   - \c layer_mask_1
00211   - \c fifo_status
00212   - \c latched_status
00213   - \c event_timeouts
00214   - \c trg_alignment
00215
00216   Dataless Commands:
00217   - \c cmd_nop
00218   - \c cmd_reset
00219
00220   """
00221   __attrs = [
00222     # Registers
00223     gAttr.GattrRaw('configuration',   0, 4),
00224     gAttr.GattrRaw('layer_mask_0',    1, 4),
00225     gAttr.GattrRaw('layer_mask_1',    2, 4),
00226     gAttr.GattrRaw('fifo_status',     3, 4),
00227     gAttr.GattrRaw('latched_status',  4, 4),
00228     gAttr.GattrRaw('event_timeouts',  5, 4),
00229     gAttr.GattrRaw('trg_alignment',   6, 4),
00230     # Dataless Commands
00231     gAttr.GattrDlc('cmd_nop',         0, 0),
00232     gAttr.GattrDlc('cmd_reset',       1, 0)
00233     ]
00234
00235   BCASTADDR = 0xFF
00236   NCCCS = 4
00237
00238   def __init__(self, client, parent, id):
00239     """\brief Initialize valid registers as Gattrs.
00240
00241     Assign default values to members
00242     """
00243     if id < GCCC.NCCCS:
00244       addr = id
00245     elif id == gDb.Children.BCASTID:
00246       addr = GCCC.BCASTADDR
00247     else:
00248       raise KeyError("*** gTEM: GCCC id %d is invalid" %(id))
00249     self.CRC = gDb.Children(self, GCRC)
00250     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00251
00252   def read(self, reg):
00253     return self.cmdrsp('TEM_GCCC_read_sync', 'slh', self.up().addr(), self.addr(), reg, '!I')
00254
00255   def load(self, reg, value):
00256     return self.cmdrsp('TEM_GCCC_load_sync', 'slh', self.up().addr(), self.addr(), reg, value)
00257
00258   def send(self, cmd):
00259     return self.cmdrsp('TEM_GCCC_cmd_sync', 'slh', self.up().addr(), self.addr(), cmd)
00260
00261   def downCRC(self, childId):
00262     """\brief Navigate to the GCRC indicated by \a childId
00263
00264     \param  childId The id of the child GCRC
00265
00266     \return         A GCRC object instance
00267     """
00268     return self.CRC.down(childId)
00269
00270   def allCRC(self):
00271     """\brief Navigate to the broadcast GCRC
00272
00273     \return The broadcast GCRC object instance
00274     """
00275     return self.CRC.all()
00276
00277   def existsCRC(self, crcId):
00278     """\brief Check if the GCRC instance with the id
00279     \a crcId exists in the schema.
00280
00281     \param  crcId Calorimeter readout controller id
00282
00283     \return       1 if it exists, 0 if it doesn't.
00284     """
00285     return self.CRC.exists(crcId)
00286
00287 ## private:
00288   def __removeCRC(self, rcrId):
00289     self.CRC.remove(rcrId)
00290
00291   def __addCRC(self, rcrId):
00292     return self.CRC.add(rcrId)
00293
00294
00295 class GCRC(gDb.Gdb):
00296   """\brief Calorimeter Readout Controller node Record.
00297
00298   Has GCRC specific registers and dataless commands.
00299
00300   Valid Registers:
00301   - \c csr
00302   - \c last_cmd
00303   - \c delay_1
00304   - \c delay_2
00305   - \c delay_3
00306   - \c dac
00307   - \c config
00308
00309   Dataless Commands:
00310   - \c cmd_nop
00311   - \c cmd_reset
00312   - \c cmd_calstrobe
00313                  ]
00314
00315   """
00316   __attrs = [
00317     # Registers
00318     gAttr.GattrRaw('csr',              0, 2),
00319     gAttr.GattrRaw('last_cmd',         1, 2),
00320     gAttr.GattrRaw('delay_1',          3, 2),
00321     gAttr.GattrRaw('delay_2',          4, 2),
00322     gAttr.GattrRaw('delay_3',          5, 2),
00323     gAttr.GattrRaw('dac',              6, 2),
00324     gAttr.GattrRaw('config',           7, 2),
00325     # Dataless Commands
00326     gAttr.GattrDlc('cmd_nop',          0, 0),
00327     gAttr.GattrDlc('cmd_reset',        1, 0),
00328     gAttr.GattrDlc('cmd_calstrobe',    3, 0)
00329     ]
00330
00331   BCASTADDR = 0xFF
00332   NCRCS = 4
00333
00334   def __init__(self, client, parent, id):
00335     """\brief Initialize valid registers as Gattrs.
00336
00337     Assign default values to members
00338     """
00339     if id < GCRC.NCRCS:
00340       addr = id
00341     elif id == gDb.Children.BCASTID:
00342       addr = GCRC.BCASTADDR
00343     else:
00344       raise KeyError("*** gTEM: GCRC id %d is invalid" %(id))
00345     self.CFE = gDb.Children(self, GCFE)
00346     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00347
00348   def read(self, reg):
00349     return self.cmdrsp('TEM_GCRC_read_sync', 'slh', self.up().up().addr(), self.up().addr(), self.addr(), reg, '!H')
00350
00351   def load(self, reg, value):
00352     return self.cmdrsp('TEM_GCRC_load_sync', 'slh', self.up().up().addr(), self.up().addr(), self.addr(), reg, value)
00353
00354   def send(self, cmd):
00355     return self.cmdrsp('TEM_GCRC_cmd_sync', 'slh', self.up().up().addr(), self.up().addr(), self.addr(), cmd)
00356
00357   def downCFE(self, childId):
00358     """\brief Navigate to the GCFE indicated by \a childId
00359
00360     \param  childId The id of the child GCFE
00361
00362     \return         A GCFE object instance
00363     """
00364     return self.CFE.down(childId)
00365
00366   def allCFE(self):
00367     """\brief Navigate to the broadcast GCFE
00368
00369     \return The broadcast GCFE object instance
00370     """
00371     return self.CFE.all()
00372
00373   def existsCFE(self, cfeId):
00374     """\brief Check if the GCFE instance with the id
00375     \a cfeId exists in the schema.
00376
00377     \param  cfeId Calorimeter front-end id
00378
00379     \return       1 if it exists, 0 if it doesn't.
00380     """
00381     return self.CFE.exists(cfeId)
00382
00383 ## private:
00384
00385   def __removeCFE(self, cfeId):
00386     self.CFE.remove(cfeId)
00387
00388   def __addCFE(self, cfeId):
00389     return self.CFE.add(cfeId)
00390
00391
00392 class GCFE(gDb.Gdb):
00393   """\brief Calorimeter Front End node Record.
00394
00395   Has GCFE specific registers and dataless commands.
00396
00397   Valid Registers:
00398   - \c config_0
00399   - \c config_1
00400   - \c fle_dac
00401   - \c fhe_dac
00402   - \c log_acpt
00403   - \c rng_uld_dac
00404   - \c ref_dac
00405
00406   Dataless Commands:
00407   - \c cmd_nop
00408
00409   """
00410   __attrs = [
00411     # Registers
00412     gAttr.GattrRaw('config_0',    0, 2),
00413     gAttr.GattrRaw('config_1',    1, 2),
00414     gAttr.GattrRaw('fle_dac',     2, 2),
00415     gAttr.GattrRaw('fhe_dac',     3, 2),
00416     gAttr.GattrRaw('log_acpt',    4, 2),
00417     gAttr.GattrRaw('rng_uld_dac', 5, 2),
00418     gAttr.GattrRaw('ref_dac',     6, 2),
00419     # Dataless Commands
00420     gAttr.GattrDlc('cmd_nop',     0, 0)
00421     ]
00422
00423   BCASTADDR = 0xFF
00424   NCFES = 12
00425
00426   def __init__(self, client, parent, id):
00427     """\brief Initialize valid registers as Gattrs
00428
00429     """
00430     if id < GCFE.NCFES:
00431       addr = id
00432     elif id == gDb.Children.BCASTID:
00433       addr = GCFE.BCASTADDR
00434     else:
00435       raise KeyError("*** gTEM: GCFE id %d is invalid" %(id))
00436     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00437
00438   def read(self, reg):
00439     return self.cmdrsp('TEM_GCFE_read_sync', 'slh', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), reg, '!H')
00440
00441   def load(self, reg, value):
00442     return self.cmdrsp('TEM_GCFE_load_sync', 'slh', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), reg, value)
00443
00444   def send(self, cmd):
00445     return self.cmdrsp('TEM_GCFE_cmd_sync', 'slh', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), cmd)
00446
00447 class GTCC(gDb.Gdb):
00448   """\brief Tracker Cable Controller node record.
00449
00450   Has GTCC specific registers and dataless commands.
00451
00452   Valid Registers:
00453   - \c configuration
00454   - \c input_mask
00455   - \c fifo_status
00456   - \c latched_status
00457   - \c event_timeouts
00458   - \c trg_alignment
00459
00460   Dataless Commands:
00461   - \c cmd_nop
00462   - \c cmd_reset
00463
00464   """
00465   __attrs = [
00466     # Registers
00467     gAttr.GattrRaw('configuration',   0, 4),
00468     gAttr.GattrRaw('input_mask',      1, 4),
00469     gAttr.GattrRaw('fifo_status',     2, 4),
00470     gAttr.GattrRaw('latched_status',  3, 4),
00471     gAttr.GattrRaw('event_timeouts',  4, 4),
00472     gAttr.GattrRaw('trg_alignment',   5, 4),
00473     # Dataless Commands
00474     gAttr.GattrDlc('cmd_nop',         0, 0, gAttr.REG_WRITE_ONLY),
00475     gAttr.GattrDlc('cmd_reset',       1, 0, gAttr.REG_WRITE_ONLY)
00476     ]
00477
00478   BCASTADDR = 0xFF
00479   NTCCS = 8
00480
00481   def __init__(self, client, parent, id):
00482     """\brief Initialize valid registers as Gattrs.
00483
00484     Assign default values to members
00485     """
00486     if id < GTCC.NTCCS:
00487       addr = id
00488     elif id == gDb.Children.BCASTID:
00489       addr = GTCC.BCASTADDR
00490     else:
00491       raise KeyError("*** gTEM: GTCC id %d is invalid" %(id))
00492     self.TRC = gDb.Children(self, GTRC)
00493     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00494
00495   def read(self, reg):
00496     return self.cmdrsp('TEM_GTCC_read_sync', 'slh', self.up().addr(), self.addr(), reg, '!I')
00497
00498   def load(self, reg, value):
00499     return self.cmdrsp('TEM_GTCC_load_sync', 'slh', self.up().addr(), self.addr(), reg, value)
00500
00501   def send(self, cmd):
00502     return self.cmdrsp('TEM_GTCC_cmd_sync', 'slh', self.up().addr(), self.addr(), cmd)
00503
00504   def downTRC(self, childId):
00505     """\brief Navigate to the GTRC indicated by \a childId
00506
00507     \param  childId The id of the child GTRC
00508
00509     \return         A GTRC object instance
00510     """
00511     return self.TRC.down(childId)
00512
00513   def allTRC(self):
00514     """\brief Navigate to the broadcast GTRC
00515
00516     \return The broadcast GTRC object instance
00517     """
00518     return self.TRC.all()
00519
00520   def existsTRC(self, trcId):
00521     """\brief Check if the GTRC instance with the id
00522     \a trcId exists in the schema.
00523
00524     \param  trcId Tracker readout controller id
00525
00526     \return       1 if it exists, 0 if it doesn't.
00527     """
00528     return self.TRC.exists(trcId)
00529
00530 ## private:
00531
00532   def __removeTRC(self, trcId):
00533     self.TRC.remove(trcId)
00534
00535   def __addTRC(self, trcId):
00536     return self.TRC.add(trcId)
00537
00538
00539 class GTRC(gDb.Gdb):
00540   """\brief Tracker Readout Controller node Record.
00541
00542   Has GTRC specific registers and dataless commands.
00543
00544   Valid Registers:
00545   - \c csr
00546   - \c sync
00547
00548   Dataless Commands:
00549   - \c cmd_nop
00550   - \c cmd_reset
00551
00552   """
00553   __attrs = [
00554     # Registers
00555     gAttr.GattrRaw('csr',       0, 8),
00556     gAttr.GattrRaw('sync',      1, 8),
00557     # Dataless Commands
00558     gAttr.GattrDlc('cmd_nop',   0, 0),
00559     gAttr.GattrDlc('cmd_reset', 1, 0)
00560     ]
00561
00562   BCASTADDR = 0xFF
00563   NTRCS = 9
00564
00565   def __init__(self, client, parent, id):
00566     """\brief Initialize valid registers as Gattrs.
00567
00568     Assign default values to members
00569     """
00570     if id < GTRC.NTRCS:
00571       addr = id
00572     elif id == gDb.Children.BCASTID:
00573       addr = GTRC.BCASTADDR
00574     else:
00575       raise KeyError("*** gTEM: GTRC id %d is invalid" %(id))
00576     self.TFE = gDb.Children(self, GTFE)
00577     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00578
00579   def read(self, reg):
00580     return self.cmdrsp('GTRC_read_ll', self.up().up().addr(), self.up().addr(), self.addr(), reg, '!Q')
00581
00582   def load(self, reg, value):
00583     [lower, upper] = struct.unpack('II', struct.pack('Q', value))
00584     return self.cmdrsp('GTRC_load_ll', self.up().up().addr(), self.up().addr(), self.addr(), reg, upper, lower)
00585
00586   def send(self, cmd):
00587     return self.cmdrsp('TEM_GTRC_cmd_sync', 'slh', self.up().up().addr(), self.up().addr(), self.addr(), cmd)
00588
00589   def downTFE(self, childId):
00590     """\brief Navigate to the GTFE indicated by \a childId
00591
00592     \param  childId The id of the child GTFE
00593
00594     \return         A GTFE object instance
00595     """
00596     return self.TFE.down(childId)
00597
00598   def allTFE(self):
00599     """\brief Navigate to the broadcast GTFE
00600
00601     \return The broadcast GTFE object instance
00602     """
00603     return self.TFE.all()
00604
00605   def existsTFE(self, tfeId):
00606     """\brief Check if the GTFE instance with the id
00607     \a tfeId exists in the schema.
00608
00609     \param  tfeId Tracker front-end id
00610
00611     \return       1 if it exists, 0 if it doesn't.
00612     """
00613     return self.TFE.exists(tfeId)
00614
00615   def getNoisyChannels(self, feId=None):
00616     """\brief Get the noisy channels for this RC or for a specific FE
00617     belonging to this RC.
00618
00619     \param  feId Front-end id.
00620
00621     \return      If \a feId is None return a list of noisy channels.
00622                  If \a feId is not None return a bitmap of noisy channels.
00623     """
00624     LAYER_CC_PAIRS = {0:(0,1), 1:(0,1), 2:(3,2), 3:(3,2), 4:(5,4),
00625                       5:(5,4), 6:(6,7), 7:(6,7)
00626                      }
00627     tcc = self.up()
00628     tem = tcc.up()
00629     lat = tem.up()
00630     key = (tem.id(),LAYER_CC_PAIRS[tcc.id()]+(self.id(),))
00631     if key in lat._GLAT__noisyChannels:
00632       chList = lat._GLAT__noisyChannels[key].getOnBits()
00633       if feId is not None:
00634         mask = 0L
00635         for ch in chList:
00636           chFE = ch / 64
00637           if chFE == feId:
00638             mask |= 1L << (ch % 64)
00639         return mask
00640       else:
00641         return chList
00642     else:
00643       if feId is not None:
00644         return 0L
00645       else:
00646         return []
00647
00648   def getDeadChannels(self, feId=None):
00649     """\brief Get the dead channels for this RC or for a specific FE
00650     belonging to this RC.
00651
00652     \param  feId Front-end id.
00653     \return      If \a feId is None return a list of dead channels.
00654                  If \a feId is not None return a bitmap of dead channels.
00655     """
00656     LAYER_CC_PAIRS = {0:(0,1), 1:(0,1), 2:(3,2), 3:(3,2), 4:(5,4),
00657                       5:(5,4), 6:(6,7), 7:(6,7)
00658                      }
00659     tcc = self.up()
00660     tem = tcc.up()
00661     lat = tem.up()
00662     key = (tem.id(),LAYER_CC_PAIRS[tcc.id()]+(self.id(),))
00663     if key in lat._GLAT__deadChannels:
00664       chList = lat._GLAT__deadChannels[key].getOnBits()
00665       if feId is not None:
00666         mask = 0L
00667         for ch in chList:
00668           chFE = ch / 64
00669           if chFE == feId:
00670             mask |= 1L << (ch % 64)
00671         return mask
00672       else:
00673         return chList
00674     else:
00675       if feId is not None:
00676         return 0L
00677       else:
00678         return []
00679
00680 ## private:
00681
00682   def __removeTFE(self, tfeId):
00683     self.TFE.remove(tfeId)
00684
00685   def __addTFE(self, tfeId):
00686     return self.TFE.add(tfeId)
00687
00688
00689 class GTFE(gDb.Gdb):
00690   """\brief Tracker Front-End node Record.
00691
00692   Has GTFE specific registers and dataless commands.
00693
00694   Valid Registers:
00695   - \c data_mask
00696   - \c calib_mask
00697   - \c trig_mask
00698   - \c dac
00699   - \c mode
00700
00701   Dataless Commands:
00702   - \c cmd_nop
00703   - \c cmd_reset
00704   - \c cmd_calstrobe
00705   - \c cmd_readevent
00706
00707   """
00708   __attrs = [# Registers
00709     gAttr.GattrRaw('data_mask',       0, 8),
00710     gAttr.GattrRaw('calib_mask',      1, 8),
00711     gAttr.GattrRaw('trig_mask',       2, 8),
00712     gAttr.GattrRaw('dac',             3, 8),
00713     gAttr.GattrRaw('mode',            4, 8),
00714     # Dataless Commands
00715     gAttr.GattrDlc('cmd_nop',         0, 0),
00716     gAttr.GattrDlc('cmd_reset',       2, 0),
00717     gAttr.GattrDlc('cmd_calstrobe',   3, 0),
00718     gAttr.GattrDlc('cmd_readevent',   4, 0)
00719     ]
00720
00721   BCASTADDR = 0xFF
00722   NTFES = 24
00723
00724   def __init__(self, client, parent, id):
00725     """\brief Initialize valid registers as Gattrs.
00726
00727     Assign default values to members
00728     """
00729     if id < GTFE.NTFES:
00730       addr = id
00731     elif id == gDb.Children.BCASTID:
00732       addr = GTFE.BCASTADDR
00733     else:
00734       raise KeyError("*** gTEM: GTFE id %d is invalid" %(id))
00735     gDb.Gdb.__init__(self, client, parent, id, self.__attrs, addr)
00736
00737   def read(self, reg):
00738     return self.cmdrsp('GTFE_read_ll', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), reg, '!Q')
00739
00740   def load(self, reg, value):
00741     [lower, upper] = struct.unpack('II', struct.pack('Q', value))
00742     return self.cmdrsp('GTFE_load_ll', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), reg, upper, lower)
00743
00744   def send(self, cmd):
00745     return self.cmdrsp('TEM_GTFE_cmd_sync', 'slh', self.up().up().up().addr(), self.up().up().addr(), self.up().addr(), self.addr(), cmd)
00746
00747
00748 class GTIC(gDb.Gdb):
00749   """\brief Trigger Interface Controller.
00750
00751   Has GTIC specific registers and dataless commands.
00752
00753   Valid Registers:
00754   - \c power_supply
00755   - \c status
00756   - \c cal_in_mask
00757   - \c cal_lrs_mask
00758   - \c cal_lrs_counters
00759   - \c tkr_layer_enable_0
00760   - \c tkr_layer_enable_1
00761   - \c tkr_out_mask
00762   - \c tkr_out_lrs_mask
00763   - \c tkr_lrs_counter_0
00764   - \c tkr_lrs_counter_1
00765   - \c busy_lrs_mask
00766   - \c busy_lrs_counter
00767   - \c adcs
00768   - \c mux_config
00769   - \c tkr_biasdac
00770   - \c cal_biasdac
00771   - \c adc_tkr_digital_2_5v
00772   - \c adc_tkr_digital_2_5i
00773   - \c adc_tkr_analog_a_1_5v
00774   - \c adc_tkr_analog_a_1_5i
00775   - \c adc_tkr_analog_b_2_5v
00776   - \c adc_tkr_analog_b_2_5i
00777   - \c adc_tkr_bias_v
00778   - \c adc_tkr_bias_v0
00779   - \c adc_tkr_bias_i
00780   - \c adc_cal_digital_3_3v
00781   - \c adc_cal_digital_3_3i
00782   - \c adc_tkr_bias_v1
00783   - \c adc_cal_analog_3_3v
00784   - \c adc_cal_analog_3_3i
00785   - \c adc_cal_bias_v1
00786   - \c adc_cal_bias_v
00787   - \c adc_cal_bias_v0
00788   - \c adc_cal_bias_i
00789   - \c adc_28_v0
00790   - \c adc_tem_digital_3_3v
00791   - \c adc_tem_digital_3_3i
00792   - \c adc_28_v1
00793   - \c adc_afee0_t0
00794   - \c adc_afee0_t1
00795   - \c adc_afee1_t0
00796   - \c adc_afee1_t1
00797   - \c adc_afee2_t0
00798   - \c adc_afee2_t1
00799   - \c adc_afee3_t0
00800   - \c adc_afee3_t1
00801   - \c adc_tkr_c0_t0
00802   - \c adc_tkr_c0_t1
00803   - \c adc_tkr_c1_t0
00804   - \c adc_tkr_c1_t1
00805   - \c adc_tkr_c2_t0
00806   - \c adc_tkr_c2_t1
00807   - \c adc_tkr_c3_t0
00808   - \c adc_tkr_c3_t1
00809   - \c adc_tkr_c4_t0
00810   - \c adc_tkr_c4_t1
00811   - \c adc_tkr_c5_t0
00812   - \c adc_tkr_c5_t1
00813   - \c adc_tkr_c6_t0
00814   - \c adc_tkr_c6_t1
00815   - \c adc_tkr_c7_t0
00816   - \c adc_tkr_c7_t1
00817
00818   Deadtime Counters:
00819   - \c sat_cal_lrs_ctr_0
00820   - \c sat_cal_lrs_ctr_1
00821   - \c sat_tkr_lrs_ctr_0
00822   - \c sat_tkr_lrs_ctr_1
00823   - \c sat_tkr_lrs_ctr_2
00824   - \c sat_tkr_lrs_ctr_3
00825   - \c sat_deadtime_lrs_ctr
00826
00827   Pseudo Registers:
00828   - \c psd_tkr_bias_i
00829   - \c psd_cal_bias_i
00830   - \c psd_tem_i
00831
00832   Dataless Commands:
00833   - \c cmd_nop
00834   - \c cmd_reset
00835
00836   """
00837   __attrs = [
00838     # Registers
00839     gAttr.GattrReg('power_supply',           0,  4),
00840     gAttr.GattrReg('status',                 1,  4),
00841     gAttr.GattrReg('cal_in_mask',            2,  4),
00842     gAttr.GattrReg('cal_lrs_mask',           3,  4),
00843     gAttr.GattrReg('cal_lrs_counters',       4,  4),
00844     gAttr.GattrReg('tkr_layer_enable_0',     5,  4),
00845     gAttr.GattrReg('tkr_layer_enable_1',     6,  4),
00846     gAttr.GattrReg('tkr_out_mask',           7,  2),
00847     gAttr.GattrReg('tkr_out_lrs_mask',       8,  2),
00848     gAttr.GattrReg('tkr_lrs_counter_0',     10,  4),
00849     gAttr.GattrReg('tkr_lrs_counter_1',     11,  4),
00850     gAttr.GattrReg('busy_lrs_mask',         12,  2),
00851     gAttr.GattrReg('busy_lrs_counter',      13,  4),
00852     gAttr.GattrReg('adcs',                  14, 16),
00853     gAttr.GattrReg('mux_config',            15,  4),
00854     gAttr.GattrReg('tkr_biasdac',           16,  4),
00855     gAttr.GattrReg('cal_biasdac',           17,  4),
00856     gAttr.GattrReg('adc_tkr_digital_2_5v',  18,  2, gAttr.REG_READ_ONLY),
00857     gAttr.GattrReg('adc_tkr_digital_2_5i',  19,  2, gAttr.REG_READ_ONLY),
00858     gAttr.GattrReg('adc_tkr_analog_a_1_5v', 20,  2, gAttr.REG_READ_ONLY),
00859     gAttr.GattrReg('adc_tkr_analog_a_1_5i', 21,  2, gAttr.REG_READ_ONLY),
00860     gAttr.GattrReg('adc_tkr_analog_b_2_5v', 22,  2, gAttr.REG_READ_ONLY),
00861     gAttr.GattrReg('adc_tkr_analog_b_2_5i', 23,  2, gAttr.REG_READ_ONLY),
00862     gAttr.GattrReg('adc_tkr_bias_v',        24,  2, gAttr.REG_READ_ONLY),
00863     gAttr.GattrReg('adc_tkr_bias_v0',       24,  2, gAttr.REG_READ_ONLY),
00864     gAttr.GattrReg('adc_tkr_bias_i',        25,  2, gAttr.REG_READ_ONLY),
00865     gAttr.GattrReg('adc_cal_digital_3_3v',  26,  2, gAttr.REG_READ_ONLY),
00866     gAttr.GattrReg('adc_cal_digital_3_3i',  27,  2, gAttr.REG_READ_ONLY),
00867     gAttr.GattrReg('adc_tkr_bias_v1',       27,  2, gAttr.REG_READ_ONLY),
00868     gAttr.GattrReg('adc_cal_analog_3_3v',   28,  2, gAttr.REG_READ_ONLY),
00869     gAttr.GattrReg('adc_cal_analog_3_3i',   29,  2, gAttr.REG_READ_ONLY),
00870     gAttr.GattrReg('adc_cal_bias_v1',       29,  2, gAttr.REG_READ_ONLY),
00871     gAttr.GattrReg('adc_cal_bias_v',        30,  2, gAttr.REG_READ_ONLY),
00872     gAttr.GattrReg('adc_cal_bias_v0',       30,  2, gAttr.REG_READ_ONLY),
00873     gAttr.GattrReg('adc_cal_bias_i',        31,  2, gAttr.REG_READ_ONLY),
00874     gAttr.GattrReg('adc_28_v0',             31,  2, gAttr.REG_READ_ONLY),
00875     gAttr.GattrReg('adc_tem_digital_3_3v',  32,  2, gAttr.REG_READ_ONLY),
00876     gAttr.GattrReg('adc_tem_digital_3_3i',  33,  2, gAttr.REG_READ_ONLY),
00877     gAttr.GattrReg('adc_28_v1',             33,  2, gAttr.REG_READ_ONLY),
00878     gAttr.GattrReg('adc_afee0_t0',          34,  2, gAttr.REG_READ_ONLY),
00879     gAttr.GattrReg('adc_afee0_t1',          35,  2, gAttr.REG_READ_ONLY),
00880     gAttr.GattrReg('adc_afee1_t0',          36,  2, gAttr.REG_READ_ONLY),
00881     gAttr.GattrReg('adc_afee1_t1',          37,  2, gAttr.REG_READ_ONLY),
00882     gAttr.GattrReg('adc_afee2_t0',          38,  2, gAttr.REG_READ_ONLY),
00883     gAttr.GattrReg('adc_afee2_t1',          39,  2, gAttr.REG_READ_ONLY),
00884     gAttr.GattrReg('adc_afee3_t0',          40,  2, gAttr.REG_READ_ONLY),
00885     gAttr.GattrReg('adc_afee3_t1',          41,  2, gAttr.REG_READ_ONLY),
00886     gAttr.GattrReg('adc_tkr_c0_t0',         42,  2, gAttr.REG_READ_ONLY),
00887     gAttr.GattrReg('adc_tkr_c0_t1',         43,  2, gAttr.REG_READ_ONLY),
00888     gAttr.GattrReg('adc_tkr_c1_t0',         44,  2, gAttr.REG_READ_ONLY),
00889     gAttr.GattrReg('adc_tkr_c1_t1',         45,  2, gAttr.REG_READ_ONLY),
00890     gAttr.GattrReg('adc_tkr_c2_t0',         46,  2, gAttr.REG_READ_ONLY),
00891     gAttr.GattrReg('adc_tkr_c2_t1',         47,  2, gAttr.REG_READ_ONLY),
00892     gAttr.GattrReg('adc_tkr_c3_t0',         48,  2, gAttr.REG_READ_ONLY),
00893     gAttr.GattrReg('adc_tkr_c3_t1',         49,  2, gAttr.REG_READ_ONLY),
00894     gAttr.GattrReg('adc_tkr_c4_t0',         50,  2, gAttr.REG_READ_ONLY),
00895     gAttr.GattrReg('adc_tkr_c4_t1',         51,  2, gAttr.REG_READ_ONLY),
00896     gAttr.GattrReg('adc_tkr_c5_t0',         52,  2, gAttr.REG_READ_ONLY),
00897     gAttr.GattrReg('adc_tkr_c5_t1',         53,  2, gAttr.REG_READ_ONLY),
00898     gAttr.GattrReg('adc_tkr_c6_t0',         54,  2, gAttr.REG_READ_ONLY),
00899     gAttr.GattrReg('adc_tkr_c6_t1',         55,  2, gAttr.REG_READ_ONLY),
00900     gAttr.GattrReg('adc_tkr_c7_t0',         56,  2, gAttr.REG_READ_ONLY),
00901     gAttr.GattrReg('adc_tkr_c7_t1',         57,  2, gAttr.REG_READ_ONLY),
00902     # Low Rate Science Counters
00903     gAttr.GattrReg('sat_cal_lrs_ctr_0',     58,  4, gAttr.REG_READ_ONLY),
00904     gAttr.GattrReg('sat_cal_lrs_ctr_1',     59,  4, gAttr.REG_READ_ONLY),
00905     gAttr.GattrReg('sat_tkr_lrs_ctr_0',     60,  4, gAttr.REG_READ_ONLY),
00906     gAttr.GattrReg('sat_tkr_lrs_ctr_1',     61,  4, gAttr.REG_READ_ONLY),
00907     gAttr.GattrReg('sat_tkr_lrs_ctr_2',     62,  4, gAttr.REG_READ_ONLY),
00908     gAttr.GattrReg('sat_tkr_lrs_ctr_3',     63,  4, gAttr.REG_READ_ONLY),
00909     gAttr.GattrReg('sat_deadtime_lrs_ctr',  64,  4, gAttr.REG_READ_ONLY),
00910     # Pseudo-registers
00911     gAttr.GattrReg('psd_tkr_bias_i',        65,  4, gAttr.REG_READ_ONLY),
00912     gAttr.GattrReg('psd_cal_bias_i',        66,  4, gAttr.REG_READ_ONLY),
00913     gAttr.GattrReg('psd_tem_i',             67,  4, gAttr.REG_READ_ONLY),
00914     # Dataless Commands
00915     gAttr.GattrDlc('cmd_nop',                0,  0),
00916     gAttr.GattrDlc('cmd_reset',              1,  0)
00917     ]
00918   __ADCS                 = 14
00919   __MUX_CONFIG           = 15
00920   __CAL_BIASDAC          = 17
00921   __ADC_TKR_DIGITAL_2_5V = 18
00922   __ADC_TKR_BIAS_V0      = 24
00923   __ADC_TKR_BIAS_V1      = 27
00924   __ADC_CAL_BIAS_V0      = 30
00925   __ADC_CAL_BIAS_V1      = 29
00926   __ADC_28_V0            = 31
00927   __ADC_28_V1            = 33
00928   __SAT_CAL_LRS_CTR_0    = 58
00929   __PSD_TKR_BIAS_I       = 65
00930   __PSD_CAL_BIAS_I       = 66
00931   __PSD_TEM_I            = 67
00932   __STALE_TMO = 1.0     # Timeout in seconds before considering adcs value stale
00933
00934   def __init__(self, client, parent):
00935     """\brief Initialize valid registers as Gattrs.
00936
00937     """
00938     self.__adcs = 5*[(None, 0)]           # [gRegister.Register, time.time()]
00939     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00940
00941   def satCtrEnable(self, reg):
00942     """\brief Enable the specified saturation counter.
00943     By default all saturation counters are disabled.
00944
00945     \param reg Register id of the saturation counter.
00946                Can be retrieved by calling tic.regs['regname'].id().
00947     \return A Response object
00948     """
00949     return self.cmdrsp('TEM_GTIC_sat_enable', self.up().addr(), reg)
00950
00951   def satCtrDisable(self, reg):
00952     """\brief Disable the specified saturation counter.
00953     By default all saturation counters are disabled.
00954
00955     \param reg Register id of the saturation counter.
00956                Can be retrieved by calling tic.regs['regname'].id().
00957     \return A Response object
00958     """
00959     return self.cmdrsp('TEM_GTIC_sat_disable', self.up().addr(), reg)
00960
00961   def satCtrLoopEnable(self):
00962     """\brief Enable the update loop that updates all
00963     saturation counter pseudoregisters.
00964
00965     \return A Response object
00966     """
00967     return self.cmdrsp('TEM_GTIC_sat_loop_enable')
00968
00969   def satCtrLoopDisable(self):
00970     """\brief Disable the update loop that updates all
00971     saturation counter pseudoregisters.
00972
00973     \return A Response object
00974     """
00975     return self.cmdrsp('TEM_GTIC_sat_loop_disable')
00976
00977   def satCtrSetLoopDelay(self, delay):
00978     """\brief Set the update loop interval for
00979     saturation counter pseudoregisters.
00980
00981     \param Set the saturation counter update loop delay
00982            in 1/60 second ticks. The default is 30 (2 Hz).
00983
00984     \return A Response object
00985     """
00986     return self.cmdrsp('TEM_GTIC_sat_loop_delay', delay)
00987
00988   def read(self, reg):
00989     if (reg != GTIC.__ADCS) and (reg <= GTIC.__CAL_BIASDAC):
00990       return self.cmdrsp('TEM_GTIC_read_sync', 'slh', self.up().addr(), reg, '!I')
00991     elif (reg == GTIC.__ADCS):
00992       rsp = self.cmdrsp('TEM_GTIC_readEnv_sync', 'slh', self.up().addr(), '!HHHHHHHH', '!H', '!H')
00993       payloads = rsp.payloads()
00994       payload = [ payloads[0]         +
00995                  (payloads[1] << 12L) +
00996                  (payloads[2] << 24L) +
00997                  (payloads[3] << 36L) +
00998                  (payloads[4] << 48L) +
00999                  (payloads[5] << 60L) +
01000                  (payloads[6] << 72L) +
01001                  (payloads[7] << 84L) +
01002                  (payloads[8] << 96L) +
01003                  (payloads[9] << 99L)
01004                 ]
01005       return gRegister.Register(rsp.timestamp(), rsp.status(), payload, 'H')
01006     elif (reg < GTIC.__SAT_CAL_LRS_CTR_0):
01007       return self.__fetchReg(reg)
01008     elif (reg < GTIC.__PSD_TKR_BIAS_I):
01009       return self.cmdrsp('TEM_GTIC_read_sat', self.up().addr(), reg, '!I', '!Q')
01010     elif (reg == GTIC.__PSD_TKR_BIAS_I):
01011       return self.__diffReg(GTIC.__ADC_TKR_BIAS_V0, GTIC.__ADC_TKR_BIAS_V1)
01012     elif (reg == GTIC.__PSD_CAL_BIAS_I):
01013       return self.__diffReg(GTIC.__ADC_CAL_BIAS_V0, GTIC.__ADC_CAL_BIAS_V1)
01014     elif (reg == GTIC.__PSD_TEM_I):
01015       return self.__diffReg(GTIC.__ADC_28_V0, GTIC.__ADC_28_V1)
01016     else:
01017       raise Exception, "Invalid GTIC register %d" % (reg)
01018
01019   def load(self, reg, value):
01020     if (reg < GTIC.__SAT_CAL_LRS_CTR_0):
01021       return self.cmdrsp('TEM_GTIC_load_sync', 'slh', self.up().addr(), reg, value)
01022     elif (reg < GTIC.__PSD_TKR_BIAS_I):
01023       return self.cmdrsp('TEM_GTIC_sat_clear', self.up().addr(), reg)
01024     else:
01025       raise Exception, "Invalid GTIC register %d" % (reg)
01026
01027   def send(self, cmd):
01028     return self.cmdrsp('TEM_GTIC_cmd_sync', 'slh', self.up().addr(), cmd)
01029
01030   def __fetchReg(self, reg):
01031     """\brief Fetch the value of an item from the ADC conversion data block,
01032     updating the block if it is deemed to be stale.
01033     \param reg - The item in the ADC conversion block to fetch
01034     \return A gRegister object containing the requested item
01035     """
01036     mux   = (reg - 18) / 8
01037     which = (reg - 18) % 8
01038     now = time.time()
01039     (rsp, rt) = self.__adcs[mux]
01040     if ((rsp is None) or (now - rt) > GTIC.__STALE_TMO):
01041       # Set the mux and cause the ADCs to convert
01042       self.cmdrsp('TEM_GTIC_load_sync', 'slh', self.up().addr(), GTIC.__MUX_CONFIG, mux)
01043       rsp = self.cmdrsp('TEM_GTIC_readEnv_sync', 'slh',
01044                         self.up().addr(), '!HHHHHHHH', '!H', '!H')
01045       channel = rsp.payloads()[8]
01046       valid   = rsp.payloads()[9]
01047       if (channel != mux or valid == 0):
01048         status = gException.LATInterfaceStatus.status('OCS_BDADC')
01049         raise gException.LATInterfaceException(status)
01050       self.__adcs[mux] = (rsp, now)
01051     timestamp = rsp.timestamp()
01052     status    = rsp.status()
01053     payloads  = rsp.payloads()[which:which+1]
01054     return gRegister.Register(timestamp, status, payloads, 'H')
01055
01056   def __diffReg(self, reg1, reg2):
01057     """\brief Calculate the difference between two registers to form a
01058     pseudo-register result.  Order is result = reg2 - reg1.
01059     \param reg1 - First register
01060     \param reg2 - Second register
01061     \return A gRegister object containing reg2 - reg1
01062     """
01063     rsp1 = self.__fetchReg(reg1)
01064     rsp2 = self.__fetchReg(reg2)
01065     timestamp = rsp2.timestamp()
01066     payloads  = [rsp2.value() - rsp1.value()]
01067     status    = rsp2.status()
01068     if status == 0:  status = rsp1.status()
01069     return gRegister.Register(timestamp, status, payloads, 'H')
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gTPG.py Source File

database

gTPG.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Trigger Pattern Generator node"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/09/07 18:37:21 $").split(' ')[1]
00015 __version__ = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gDb
00022
00023 class GTPG(gDb.Gdb):
00024   def __init__(self, client):
00025     gDb.Gdb.__init__(self, client, None, 0)
00026
00027   def clear(self):
00028     return self.cmdrsp('TPGclear', 'tpg')
00029
00030   def clearBuf(self, bufferId):
00031     return self.cmdrsp('TPGclearBuf', 'tpg', bufferId)
00032
00033   def start(self):
00034     return self.cmdrsp('TPGstart', 'tpg')
00035
00036   def load(self):
00037     return self.cmdrsp('TPGload', 'tpg', 'tpgdelays')
00038
00039   def setTEM(self, tem_id, trg, start, pattern, pat_len, repetitions):
00040     return self.cmdrsp('TPGsetTEM', 'tpg', tem_id, trg, start, pattern, pat_len, repetitions)
00041
00042   def setVETO(self, free_id, veto_id, start, pattern, pat_len, repetitions):
00043     return self.cmdrsp('TPGsetVETO', 'tpg', free_id, veto_id, start, pattern, pat_len, repetitions)
00044
00045   def setCNO(self, free_id, start, pattern, pat_len, repetitions):
00046     return self.cmdrsp('TPGsetCNO', 'tpg', free_id, start, pattern, pat_len, repetitions)
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: guiBridges.py Source File

tools

guiBridges.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Classes for launching Qt objects from non-GUI threads"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "12/19/2003"
00014 __version__  = "$Revision: 2.3.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import logging       as     log
00020 from   qt            import *
00021 from   Queue         import Queue
00022 import threading
00023 import traceback
00024 import sys
00025
00026
00027 class GUIbridge(object):
00028   """\brief Class for providing a bridge between the GUI thread and other threads.
00029
00030   This bridge is needed whenever a non-GUI thread needs to interact with the
00031   GUI.  The GUI is handled by the 'GUI thread'.  A 'GUI thread' is defined to
00032   be the one in which the Qt QApplication class's exec_loop() method is
00033   executed.  There can be only one GUI thread in a program.
00034
00035   The solution to the problem is handled by sending a message (an 'event', in
00036   Qt terms) from the non-GUI thread to the GUI thread.  The message contains
00037   information on how it is to be handled.  In some cases, this handling produces
00038   a result that must be sent back to the initiating non-GUI thread.  The
00039   requests and responses are passed around via queues.  Separate queues are
00040   maintained for the different non-GUI threads so that responses don't end up
00041   handed off to the wrong thread.
00042   """
00043   GUI_CMD_INST    = QEvent.User + 1
00044   GUI_CMD_FUNC    = QEvent.User + 2
00045   GUI_CMD_FUNC_NR = QEvent.User + 3
00046
00047   def __init__(self, guiThread):
00048     """\brief This is the constructor of the GUIbridge class.
00049
00050     It must be called from the GUI thread.
00051     """
00052     self.__guiThread  = guiThread
00053     self.__cmdQueue   = Queue()
00054     self.__respQueues = {}
00055     self.__qtBridge   = QtThreadBridge("QtBridge", self.__cmdQueue)
00056     self.__qtBridge.start()
00057     self.__pyBridge   = PyThreadBridge("PyBridge", self.__cmdQueue)
00058
00059   def shutdown(self):
00060     """\brief This method is used to shut the GUI bridge down.
00061     """
00062     self.__qtBridge.quit()
00063
00064   def isGUIthread(self):
00065     """\brief Returns True if this method is being called from the GUI thread.
00066     """
00067     return threading.currentThread() == self.__guiThread
00068
00069   def createGUI(self, qObject, obj, *args, **kwargs):
00070     """\brief Method used for instantiating a GUI from a non-GUI thread.
00071
00072     \param qObject - The Qt object that will receive the customEvent callback
00073     \param obj     - The GUI object class type to create
00074     \param args    - Arguments for the object class constructor
00075     \param kwargs  - Keyword arguments for the object class constructor
00076     \return An instance of the requested GUI object class
00077     """
00078     # Don't use the GUI bridge if we're being called from the GUI thread
00079     if self.isGUIthread():  return apply(obj, args, kwargs)
00080
00081     currentThread = threading.currentThread()
00082     if currentThread not in self.__respQueues:
00083       self.__respQueues[currentThread] = Queue()
00084
00085     respQ = self.__respQueues[currentThread]
00086     self.__pyBridge.pushEvent((GUIbridge.GUI_CMD_INST, qObject,
00087                                (obj,) + args + (kwargs, respQ)))
00088     return self.__pyBridge.pullResponse(respQ)
00089
00090   def execGUImethodNR(self, qObject, func, *args, **kwargs):
00091     """\brief Method used for executing a GUI function from a non-GUI thread.
00092
00093     Use this method when no (useful) response is expected or
00094     when waiting for one could cause a deadlock.  Any response from the
00095     function is lost.
00096     \param qObject - The Qt object that will receive the customEvent callback
00097     \param func    - The GUI function or method to call
00098     \param args    - Arguments for the function or method
00099     \param kwargs  - Keyword arguments for the function or method
00100     """
00101     if not self.isGUIthread():
00102       respQ = None                      # No response expected or required
00103       self.__pyBridge.pushEvent((GUIbridge.GUI_CMD_FUNC_NR, qObject,
00104                                  (func,) + args + (kwargs, respQ)))
00105     else:
00106       apply(func, args, kwargs)
00107
00108   def execGUImethod(self, qObject, func, *args, **kwargs):
00109     """\brief Method used for executing a GUI function from a non-GUI thread.
00110
00111     Use this method when a response is expected from the function and
00112     when it is appropriate to wait for it (no deadlock arises)
00113     \param qObject - The Qt object that will receive the customEvent callback
00114     \param func    - The GUI function or method to call
00115     \param args    - Arguments for the function or method
00116     \param kwargs  - Keyword arguments for the function or method
00117     \return The called GUI function's return value
00118     """
00119     # Don't use the GUI bridge if we're being called from the GUI thread
00120     if self.isGUIthread():  return apply(func, args, kwargs)
00121
00122     currentThread = threading.currentThread()
00123     if currentThread not in self.__respQueues:
00124       self.__respQueues[currentThread] = Queue()
00125
00126     respQ = self.__respQueues[currentThread]
00127     self.__pyBridge.pushEvent((GUIbridge.GUI_CMD_FUNC, qObject,
00128                                (func,) + args + (kwargs, respQ)))
00129     return self.__pyBridge.pullResponse(respQ)
00130
00131   if __name__ == "__main__":
00132     def execGUImethod2(self, qObject, func, *args, **kwargs):
00133       # Don't use the GUI bridge if we're being called from the GUI thread
00134       if self.isGUIthread():  return apply(func, args, kwargs)
00135
00136       currentThread = threading.currentThread()
00137       if currentThread not in self.__respQueues:
00138         if '_GUIbridge__respQueue' not in self.__dict__:
00139           self.__respQueue = Queue()
00140         self.__respQueues[currentThread] = self.__respQueue #Queue()
00141
00142       respQ = self.__respQueues[currentThread]
00143       self.__pyBridge.pushEvent((GUIbridge.GUI_CMD_FUNC, qObject,
00144                                  (func,) + args + (kwargs, respQ)))
00145       #time.sleep(0.01)                    # Delay to allow a task switch
00146       return self.__pyBridge.pullResponse(respQ)
00147
00148   def handleCustomEvent(self, e):
00149     try:
00150       # This method overrides the QObject base class's
00151       data = e.data()
00152       func     = data[0]
00153       args     = data[1:-3]
00154       kwargs   = data[-3]
00155       respQ    = data[-2]
00156       qtBridge = data[-1]
00157       if e.type() == GUIbridge.GUI_CMD_INST:
00158         qtBridge.pushResponse(respQ, func(*args, **kwargs))
00159       elif e.type() == GUIbridge.GUI_CMD_FUNC:
00160         qtBridge.pushResponse(respQ, func(*args, **kwargs))
00161       elif e.type() == GUIbridge.GUI_CMD_FUNC_NR:
00162         func(*args, **kwargs)
00163     except Exception, exc:
00164       log.exception("GUIbridge.handleCustomEvent(): Caught exception")
00165       if e.type() == GUIbridge.GUI_CMD_INST or \
00166          e.type() == GUIbridge.GUI_CMD_FUNC:
00167         qtBridge.pushResponse(respQ, None, exc)
00168
00169
00170 class QtThreadBridge(QThread):
00171   def __init__(self, name, cmdQueue):
00172     QThread.__init__(self)
00173     self._cmdQueue = cmdQueue
00174     self.__quit = False
00175
00176   def quit(self):
00177     self.__quit = True
00178     self._cmdQueue.put( (None) )
00179
00180   def pushResponse(self, respQueue, event, exception=None):
00181     respQueue.put((event, exception))
00182
00183   def run(self):
00184     while not self.__quit:
00185       try:
00186         tplEvent = self._cmdQueue.get(True)
00187         if tplEvent is None:  break     # Quit signal is None
00188         tplEventType = tplEvent[0]
00189         tplEventDest = tplEvent[1]
00190         tplEventData = tplEvent[2]
00191         evt = QCustomEvent(tplEventType)
00192         evt.setData(tplEventData + (self,))
00193         QApplication.postEvent(tplEventDest, evt)
00194         self.msleep(1)                  # RiC: Why's this here?
00195       except:
00196         traceback.print_exc(file=sys.stdout)
00197
00198       # Drop references to this object to allow it to be garbage collected
00199       tplEvent     = None
00200       tplEventType = None
00201       tplEventDest = None
00202       tplEventData = None
00203
00204     # logging already shut down?
00205     #log.info(self.__class__.__name__ + ": terminating")
00206
00207
00208 class PyThreadBridge(object):
00209   def __init__(self,name, cmdQueue):
00210     self._cmdQueue = cmdQueue
00211
00212   def pushEvent(self, event):
00213     try:
00214       self._cmdQueue.put(event)
00215     except Exception, e:
00216       traceback.print_exc(file=sys.stdout)
00217
00218   def pullResponse(self, respQueue, blnBlock = 1):
00219     try:
00220       response, exception = respQueue.get(blnBlock)
00221       if exception is None:  return response
00222       raise exception
00223     except Exception, e:
00224       traceback.print_exc(file=sys.stdout)
00225     #  raise e
00226
00227
00228 if __name__ == "__main__":
00229   import time
00230
00231   class GUIbridgeTest(threading.Thread):
00232     def __init__(self, qObject, guiBridge, id, label):
00233       threading.Thread.__init__(self)
00234
00235       self.__qObject   = qObject
00236       self.__guiBridge = guiBridge
00237       self.__id        = id
00238       self.__label     = label
00239       self.__quit      = False
00240
00241     def shutdown(self):
00242       self.__quit  = True
00243
00244     def run(self):
00245       qo = self.__qObject
00246       gb = self.__guiBridge
00247       tf = self.__label
00248       id = self.__id
00249       count = 0
00250       start = time.time()
00251       while not self.__quit:
00252         string = "Thread %d: %12d" % (id, count)
00253
00254         # Write value
00255         gb.execGUImethodNR(qo, tf.setText, string)
00256
00257         # Old method:
00258         #v = gb.execGUImethod2(qo, tf.text)
00259         # New method:
00260         v = gb.execGUImethod(qo, tf.text)
00261
00262         # Bypass GUI thread:
00263         #v = tf.text("Thread %d: %d" % (id, count)) # This doesn't reliably work
00264
00265         # Compare result
00266         if str(v) != string:  print "Thread %d: '%s' != '%s'" % (id, string, v)
00267
00268         #time.sleep(.001)
00269         if id == 1:
00270           count += 1
00271           time.sleep(0.123) # To get some beating betwee the two tasks
00272         else:        count -= 1
00273       end  = time.time()
00274       if id == 2:  count = -count
00275       rate = count / (end - start)
00276       print "Exiting thread %d, %d calls = %.1f setText()s per second" % \
00277             (self.__id, count, rate)
00278
00279
00280   class TestWindow(QMainWindow):
00281     def __init__(self, parent = None, name = None, fl = 0):
00282       QMainWindow.__init__(self, parent, name, fl)
00283
00284       self.setName("TestWindow")
00285
00286       self.mainWidget = QWidget(self) # dummy widget to containt the layout mgr
00287       self.setCentralWidget(self.mainWidget)
00288       layout = QVBoxLayout(self.centralWidget(), 11, 6, "Test_Window_Layout")
00289
00290       self.__label1 = QLabel("Thread 1:", self.mainWidget)
00291       self.__label2 = QLabel("Thread 2:", self.mainWidget)
00292       self.__quit   = QPushButton("Quit", self.mainWidget, "quit")
00293       self.connect(self.__quit, SIGNAL("clicked()"), self.quit)
00294
00295       layout.addWidget(self.__label1)
00296       layout.addWidget(self.__label2)
00297       layout.addWidget(self.__quit)
00298
00299       self.__guiBridge = GUIbridge(threading.currentThread())
00300
00301       self.__gbt1 = GUIbridgeTest(self, self.__guiBridge, 1, self.__label1)
00302       self.__gbt2 = GUIbridgeTest(self, self.__guiBridge, 2, self.__label2)
00303
00304       self.__gbt1.start()
00305       self.__gbt2.start()
00306
00307     def customEvent(self, e):
00308       self.__guiBridge.handleCustomEvent(e)
00309
00310     def quit(self):
00311       self.__gbt1.shutdown()
00312       self.__gbt2.shutdown()
00313       time.sleep(0.1) # Seems to be required to yield and allow things to exit
00314       self.__guiBridge.shutdown()
00315       self.close()
00316
00317   def startTest(args):
00318     app = QApplication(args)
00319     app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
00320
00321     win = TestWindow()
00322     app.setMainWidget(win)
00323     win.show()
00324
00325     app.exec_loop()
00326
00327
00328   # Start the test
00329   startTest(sys.argv)
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gVersions.py Source File

database

gVersions.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Version retrieval utility class
00011
00012 Contents:
00013
00014   Provides accessor methods to retrieve version information from
00015   both the software and hardware.
00016   Displays version info from loaded libraries.
00017   Used for troubleshooting problems.
00018
00019 Overview:
00020
00021   Each driver on VxWorks side and each module on the client side
00022   provides its version number through functions. When the function
00023   cmd.getVersions() is called the command server packetizes this
00024   information and sends it over the socket to the command client
00025   which gets decoded into a tuple. The getModuleVersions() function
00026   converts this tuple to a dictionary and adds the python module
00027   versions to it.
00028
00029 Usage:
00030
00031   To retrieve version information one can write::
00032
00033     python versions.py
00034
00035     or
00036
00037     import versions
00038     versions.Gversions.getModuleVersions()
00039 """
00040
00041 __facility__ = "Online"
00042 __abstract__ = "Version retrieval utility"
00043 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00044 __date__     = ("$Date: 2005/01/11 21:40:31 $").split(' ')[1]
00045 __version__  = "$Revision: 2.14.2.3 $"
00046 __release__  = "$Name: P04-06-05 $"
00047 __credits__  = "SLAC"
00048
00049 import LATTE.copyright_SLAC
00050
00051
00052 import sha
00053 import marshal
00054 import inspect
00055 import os
00056 import sys
00057 import logging as log
00058
00059 from LATTE.client   import gLog
00060
00061 ROOT_DIR_ENVS = ['LATTE_ROOT','LAT_ROOT','INT_ROOT','ACD_ROOT','CAL_ROOT','TKR_ROOT','ELX_ROOT']
00062
00063 class Gversions(object):
00064   def getModuleVersions(ocs):
00065     """Static class method which returns a dictionary of modules
00066        with their versions.
00067
00068     \param ocs GOCS node
00069
00070     \return Dictionary of modules with their versions
00071     """
00072     ignoreList =  [ 'scipy.gplt','ROOT'
00073                     #'__main__','_xmlplus','cPickle','pickle','sre','urllib',
00074                     #'xml','_xmlplus','xml.parsers.expat', 'xml.parsers.pyexpat',
00075                     #'pyexpat'
00076                   ]
00077     versions = {}
00078     (server_version, server_revision) = ocs.getVersion()
00079     versions['OCS (server)'] = '%d.%d' %(server_version, server_revision)
00080     mstrList = sys.modules.keys()
00081     mstrList.sort()
00082     for mStr in mstrList:
00083       if mStr in ignoreList: continue
00084       m = sys.modules[mStr]
00085       if hasattr(m, '__version__'):
00086         v = str(getattr(m, '__version__'))
00087         version = Gversions.extractVersion(v)
00088         if version != '':  versions[mStr] = version
00089     versions['Python'] = str(hex(sys.hexversion))
00090     try:
00091       import qt
00092       versions['Qt']     = qt.QT_VERSION_STR
00093     except: pass
00094     try:
00095       if 'PYQT_VERSION_STR' in dir(qt):
00096         versions['PyQt'] = qt.PYQT_VERSION_STR
00097       else:
00098         versions['PyQt']   = qt.PYQT_VERSION
00099     except: pass
00100     return versions
00101   getModuleVersions = staticmethod(getModuleVersions)
00102
00103   def extractVersion(verStr):
00104     """Static class method which extracts the version string from the CVS
00105     keyword string, if that's what it appears to be.  If it doesn't, just
00106     return the input."""
00107     colon  = verStr.rfind(':')
00108     dollar = verStr.rfind('$')
00109     if colon == -1 and dollar == -1:
00110       return verStr
00111     else:
00112       return verStr[colon+2:dollar-1]
00113   extractVersion = staticmethod(extractVersion)
00114
00115   def calcDigest(filePath):
00116     digest = sha.new()
00117     f = file(filePath, 'rb')
00118     data = f.read(65536)
00119     while len(data) != 0:
00120       digest.update(data)
00121       data = f.read(65536)
00122     f.close()
00123     #return digest.hexdigest()
00124     return digest.digest()
00125   calcDigest = staticmethod(calcDigest)
00126
00127
00128   def getModuleDigests():
00129     ignoreList = ['scipy.gplt','ROOT']
00130     digests = {}
00131     mstrList = sys.modules.keys()
00132     mstrList.sort()
00133     for mStr in mstrList:
00134       if mStr in ignoreList: continue
00135       m = sys.modules[mStr]
00136       if hasattr(m, '__version__') and hasattr(m, '__file__'):
00137         srcFile = inspect.getsourcefile(m)
00138         digest_value = Gversions.calcDigest(srcFile)
00139         if digest_value is not None:
00140           digests[mStr] = digest_value
00141     return digests
00142   getModuleDigests = staticmethod(getModuleDigests)
00143
00144   def getReleaseFromDigest(digestDataFile=None, rootDirEnv='LATTE_ROOT'):
00145     if os.environ.has_key(rootDirEnv):
00146       rootDir = os.environ[rootDirEnv].strip()
00147     else:
00148       rootDir = ''
00149     if digestDataFile == None and rootDir == '':
00150       raise RuntimeError, "Can not find the digest database file at the indicated location: $%s" % rootDirEnv
00151     elif digestDataFile == None:
00152       digestDataFile = os.path.join(rootDir, 'digestData')
00153     f = file(digestDataFile,'rb')
00154     try:
00155       dc = marshal.load(f)
00156     except ValueError:
00157       log.exception("")
00158       gLog.logStack()
00159       Gversions.logBadMarshalDataMessage()
00160       return
00161     exec(dc)
00162     return _digestData._release
00163   getReleaseFromDigest = staticmethod(getReleaseFromDigest)
00164
00165   def logBadMarshalDataMessage():
00166     log.error("If the above exception is a 'bad marshal data' error,")
00167     log.error("it is likely that you need to update one or more of the")
00168     log.error("digestData files pointed to by the XXX_ROOT environment")
00169     log.error("variables. To create the digestData file, enter the")
00170     log.error("following command for each of the XXX_ROOT that you have:")
00171     log.error("%%ONLINE_ROOT%%\LATTE\setup\createDigestData %%XXX_ROOT%% %s XXX_00_00_00" % sys.prefix)
00172   logBadMarshalDataMessage = staticmethod(logBadMarshalDataMessage)
00173
00174   def verifyModuleDigests(digestDataFile=None, rootDirEnv='LATTE_ROOT', additionalFilesToVerify=None):
00175     ignoreList = ['scipy.gplt','ROOT']
00176     failedModules = []
00177     rootDir = ''
00178     if os.environ.has_key(rootDirEnv):
00179       rootDir = os.environ[rootDirEnv].strip()
00180     if digestDataFile == None and rootDir == '':
00181       raise RuntimeError, "Can not find the digest database file at the indicated location: $%s" % rootDirEnv
00182     elif digestDataFile == None:
00183       digestDataFile = os.path.join(rootDir, 'digestData')
00184     f = file(digestDataFile,'rb')
00185     try:
00186       dc = marshal.load(f)
00187     except ValueError:
00188       log.exception("")
00189       gLog.logStack()
00190       Gversions.logBadMarshalDataMessage()
00191       return (None, [])
00192     exec(dc)
00193     mstrList = sys.modules.keys()
00194     mstrList.sort()
00195     for mStr in mstrList:
00196       if mStr in ignoreList: continue
00197       #raw_input("Entering %s}" % mStr)
00198       m = sys.modules[mStr]
00199       if hasattr(m, '__version__') and hasattr(m, '__file__'):
00200         srcFile = inspect.getsourcefile(m)
00201         if srcFile is not None:
00202           srcFile = os.path.normpath(os.path.normcase(srcFile))
00203           if srcFile.startswith(os.path.normpath(os.path.normcase(rootDir))):
00204             if srcFile in _digestData._digests:
00205               digest_value = Gversions.calcDigest(srcFile)
00206               if digest_value is None or _digestData._digests[srcFile] != digest_value:
00207                 failedModules.append(mStr)
00208             else:
00209               failedModules.append(mStr)
00210       #raw_input("Exiting %s}" % mStr)
00211     if additionalFilesToVerify is not None:
00212       for filePath in additionalFilesToVerify:
00213         filePath = os.path.normpath(os.path.normcase(filePath))
00214         if filePath.startswith(os.path.normpath(os.path.normcase(rootDir))):
00215           if filePath in _digestData._digests:
00216             digest_value = Gversions.calcDigest(filePath)
00217             if digest_value is None or _digestData._digests[filePath] != digest_value:
00218               failedModules.append(os.path.split(filePath)[1])
00219
00220
00221     return (_digestData._release, failedModules)
00222   verifyModuleDigests = staticmethod(verifyModuleDigests)
00223
00224   def verifyFileDigests(path=None, rootDirEnv='LATTE_ROOT', digestDataFile=None):
00225     failedFiles = []
00226     rootDir = ''
00227     if os.environ.has_key(rootDirEnv):
00228       rootDir = os.environ[rootDirEnv].strip()
00229     if path is None and rootDir == '':
00230       raise RuntimeError, "Can not determine which path to verify"
00231     elif path is None:
00232       path = rootDir
00233     digests = Gversions.collectDigests(path)
00234     if digestDataFile is None and rootDir == '':
00235       raise RuntimeError, "Can not find the digest database file at the indicated location: $%s" % rootDirEnv
00236     elif digestDataFile is None:
00237       digestDataFile = os.path.join(rootDir, 'digestData')
00238     f = file(digestDataFile,'rb')
00239     try:
00240       dc = marshal.load(f)
00241     except ValueError:
00242       log.exception("")
00243       gLog.logStack()
00244       Gversions.logBadMarshalDataMessage()
00245       return (None, [])
00246     exec(dc)
00247     for (filename, digest) in digests.items():
00248       if _digestData._digests.has_key(filename):
00249         if _digestData._digests[filename] != digest:
00250           failedFiles.append(filename)
00251     return (_digestData._release, failedFiles)
00252   verifyFileDigests = staticmethod(verifyFileDigests)
00253
00254   def collectDigests(path):
00255     def collectDigests2(digests, dir, files):
00256       ignoredDirs = ['CVS','VxWorks']
00257       validExtensions = ['.py','.exe','.xml']
00258       l = len(files)
00259       for i in range(l-1,-1,-1):
00260         if files[i] in ignoredDirs:
00261           del files[i]
00262         else:
00263           fullFilename = os.path.normpath(os.path.normcase(os.path.join(dir, files[i])))
00264           if not os.path.isdir(fullFilename) and not os.path.islink(fullFilename):
00265             if os.path.splitext(files[i])[1].lower() in validExtensions:
00266               digest = Gversions.calcDigest(fullFilename)
00267               if digest is not None:
00268                 if digests.has_key(fullFilename):
00269                   print "DUPLICATE ENTRY DETECTED:", fullFilename
00270                 else:
00271                   digests[fullFilename] = digest
00272               else:
00273                 print "NO DIGEST FOR", files[i]
00274     digests = {}
00275     path = os.path.normpath(path)
00276     if os.path.isdir(path):
00277       os.path.walk(path, collectDigests2, digests)
00278     #~ for (file, digest) in digests.items():
00279       #~ print file #, repr(digest)
00280     #~ x = digests.keys()
00281     #~ x.sort()
00282     #~ for f in x:
00283       #~ print f
00284       return digests
00285     else:
00286       return None
00287   collectDigests = staticmethod(collectDigests)
00288
00289
00290   def getHardwareVersions(lat, xbrd=None):
00291     """Static class method which retrieves
00292        hardware versions.
00293
00294     Keyword arguments:
00295
00296     cmd -- optional command client (default None)
00297
00298     """
00299     versions = {}
00300     glt = None
00301     if xbrd is not None: glt = xbrd.GLT
00302     if glt is not None:
00303       glt.initialize()
00304       # set trigger mask to allow commanding
00305       glt.disableMask()
00306       save_busy_disable = glt.busy_disable
00307       glt.busy_disable = 0x0
00308     gtemVersions = []
00309     gcrcVersions = []
00310     gtrcVersions = []
00311     for (temId, tem) in lat.TEM.items():
00312       try:
00313         temVer = int((tem.status >> 16) & 0x3F)
00314         if temVer not in gtemVersions:
00315           gtemVersions.append(temVer)
00316         for (cccId, ccc) in tem.CCC.items():
00317           for (crcId, crc) in ccc.CRC.items():
00318             try:
00319               crcVer = int((crc.config >> 12) & 7)
00320               if crcVer not in gcrcVersions:
00321                 gcrcVersions.append(crcVer)
00322             except: pass
00323         for (tccId, tcc) in tem.TCC.items():
00324           for (trcId, trc) in tcc.TRC.items():
00325             try:
00326               trcVer = int((trc.csr >> 34) & 0x0F)
00327               if trcVer not in gtrcVersions:
00328                 gtrcVersions.append(trcVer)
00329             except: pass
00330       except: pass
00331     if len(gtemVersions) > 1:
00332       versions['TEM'] = str(gtemVersions)
00333     elif len(gtemVersions) == 1:
00334       versions['TEM'] = str(gtemVersions[0])
00335     if len(gcrcVersions) > 1:
00336       versions['GCRC'] = str(gcrcVersions)
00337     elif len(gcrcVersions) == 1:
00338       versions['GCRC'] = str(gcrcVersions[0])
00339     if len(gtrcVersions) > 1:
00340       versions['GTRC'] = str(gtrcVersions)
00341     elif len(gtrcVersions) == 1:
00342       versions['GTRC'] = str(gtrcVersions[0])
00343     aem = lat.AEM
00344     if aem is not None:
00345       try:
00346         versions['AEM'] = str(aem.configuration & 0xFF)
00347         garcVersions = []
00348         gafeVersions = []
00349         for (arcId, arc) in aem.ARC.items():
00350           try:
00351             arcVer = str(arc.garc_version)
00352             if arcVer not in garcVersions:
00353               garcVersions.append(arcVer)
00354             for (afeId, afe) in arc.AFE.items():
00355               try:
00356                 afeVer = afe.vers_addr
00357                 if afeVer not in gafeVersions:
00358                   gafeVersions.append(afeVer)
00359               except: pass
00360           except: pass
00361         if len(garcVersions) > 1:
00362           versions['GARC'] = str(garcVersions)
00363         elif len(garcVersions) == 1:
00364           versions['GARC'] = str(garcVersions[0])
00365         if len(gafeVersions) > 1:
00366           versions['GAFE'] = str(gafeVersions)
00367         elif len(gafeVersions) == 1:
00368           versions['GAFE'] = str(gafeVersions[0])
00369       except: pass
00370     if glt is not None:
00371       glt = xbrd.GLT
00372       glt.enableMask()
00373       glt.busy_disable = save_busy_disable
00374     #except IOError:
00375     #  pass
00376     return versions
00377   getHardwareVersions = staticmethod(getHardwareVersions)
00378
00379   def printVersions(ocs, lat=None, xbrd=None):
00380     print "\nCurrent Release: %s\n" % Gversions.getReleaseFromDigest()
00381     print "%-30s %10.10s" % ("Module", "Version")
00382     print "%-30s %10.10s" % ("--------", "-------")
00383     versions = Gversions.getModuleVersions(ocs)
00384     modList = versions.keys()
00385     modList.sort()
00386     for module in modList:
00387       print "%-30s %10.10s" % (module, versions[module])
00388     if lat is not None:
00389       hw_versions = Gversions.getHardwareVersions(lat, xbrd)
00390       if hw_versions != {}:
00391         print
00392         print "%-30s %10.10s" % ("Component", "Version")
00393         print "%-30s %10.10s" % ("---------", "-------")
00394         for (hw_comp, version) in hw_versions.items():
00395           print "%-30s %10.10s" % (hw_comp, version)
00396   printVersions = staticmethod(printVersions)
00397
00398 if __name__ == '__main__':
00399   # Imports here are specified so that the versions for
00400   # all loaded modules can be retrieved. Add any additional
00401   # module imports here if they are to be reported in the
00402   # output of versions.bat
00403   from LATTE.client import *
00404   from LATTE.database import *
00405   import LDF
00406   import qt
00407   import sihippo
00408   import cfitsio
00409
00410   options = gOptions.Options(['server'], ['schema'])
00411   try:
00412     options.parse()
00413   except Exception, msg:
00414     options.usage(str(msg))
00415   else:
00416     cmd = gCmdCli.CmdCli()
00417     ocs = gOCS.GOCS(cmd)
00418     if options.schema is not None:
00419       lat = gLAT.GLAT(cmd)
00420       lat.readSchema(options.schema)
00421       xbrd = gXBR.GXBRD(cmd)
00422       xbrd.readSchema(options.schema)
00423     else:
00424       lat = None
00425       xbrd = None
00426     cmd.connect(options.server)
00427     Gversions.printVersions(ocs, lat, xbrd)
00428     cmd.disconnect()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: gXBR.py Source File

database

gXBR.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST XBR functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/10/22 21:18:16 $").split(' ')[1]
00015 __version__ = "$Revision: 2.15 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import gSchemaConfig
00022
00023 import gDb
00024 import gAttr
00025 import gGLT
00026 import logging as log
00027 from   LATTE.client import gLog
00028 from   LATTE.client import gRegister
00029
00030 class GXBRD(gDb.Gdb):
00031   """\brief Tower controller node Record
00032
00033   Valid Registers:
00034   - \c dac_tem_voltage
00035   - \c dac_tkr_analog_2_5
00036   - \c dac_tkr_digital_2_5
00037   - \c dac_tkr_cal_analog
00038   - \c dac_cal_digital_3_3
00039   - \c path_cmd_resp_reset
00040   - \c path_trigger
00041   - \c path_event
00042   - \c evt_flow_ctrl
00043
00044   Dataless commands:
00045   - \c cmd_tem_hw_reset
00046   """
00047   __regs = [
00048     # Registers
00049     gAttr.GattrReg('dac_tem_voltage',     0, 2),
00050     gAttr.GattrReg('dac_tkr_analog_2_5',  1, 2),
00051     gAttr.GattrReg('dac_tkr_digital_2_5', 2, 2),
00052     gAttr.GattrReg('dac_tkr_cal_analog',  3, 2),
00053     gAttr.GattrReg('dac_cal_digital_3_3', 4, 2),
00054     gAttr.GattrReg('path_cmd_resp_reset', 5, 2),
00055     gAttr.GattrReg('path_trigger',        6, 2),
00056     gAttr.GattrReg('path_event',          7, 2),
00057     gAttr.GattrReg('evt_flow_ctrl',       8, 2, gAttr.REG_WRITE_ONLY),
00058     # Dataless commands
00059     gAttr.GattrDlc('cmd_tem_hw_reset',    0, 0, gAttr.REG_WRITE_ONLY)
00060     ]
00061
00062   def __init__(self, client):
00063     """\brief Initialize valid registers as Gattrs.
00064
00065     Assign default values to members
00066     """
00067     self.GLT = None
00068     self.TWR = gDb.Children(self, GTWR)
00069     self.__schemaComments            = []
00070     self.__schemaName                = ''
00071     self.__configComments            = []
00072     self.__configName                = ''
00073     self.__configVersion             = ''
00074     self.__includeFiles              = []
00075     self.__declarations              = None
00076     self.__configurations            = {}
00077     self.__opaque                    = {}
00078     gDb.Gdb.__init__(self, client, None, 0, self.__regs)
00079
00080   def read(self, reg):
00081     if reg in (6,7,8):
00082       log.error("gXBRD.GXBRD:read(): Register no longer available")
00083       gLog.logStack()
00084       return gRegister.Register(0, 0, [0], 'H')
00085     else:
00086       return self.cmdrsp('ggXBRDread', reg, '!H')
00087
00088   def load(self, reg, value):
00089     if reg in (6,7,8):
00090       log.error("gXBRD.GXBRD:load(): Register no longer available")
00091       gLog.logStack()
00092       return gRegister.Register(0, 0, [0], 'H')
00093     else:
00094       return self.cmdrsp('ggXBRDload', reg, value)
00095
00096   def send(self, cmd):
00097     return self.cmdrsp('ggXBRDcmd', cmd)
00098
00099   def readSchema(self, name):
00100     self.GLT = None
00101     self.TWR = gDb.Children(self, GTWR)
00102     return gSchemaConfig.readSchema(self, name)
00103
00104   def readConfig(self, cfgFileName):
00105     return gSchemaConfig.readConfig(self, cfgFileName)
00106
00107   def applyConfig(self, seq=None):
00108     gSchemaConfig.applyConfig(self, seq)
00109
00110   def getConfigurations(self):
00111     """\brief Get list of configurations.
00112
00113     Return a list of configuration tuples where
00114     each tuple contains the configDOM, configName and configRelease.
00115
00116     \return Configuration tuple list.
00117     """
00118     return self.__configurations
00119
00120   def getDeclarations(self):
00121     """\brief Get list of declarations.
00122
00123     Return a list of declarations
00124
00125     \return Declarations.
00126     """
00127     return self.__declarations
00128
00129   def downGLT(self):
00130     """\brief Navigate to the GGLT
00131
00132     \return The GGLT object instance
00133     """
00134     return self.GLT
00135
00136   def existsGLT(self):
00137     """\brief Check if the GGLT instance exists in the schema.
00138
00139     \return  1 if it exists, 0 if it doesn't.
00140     """
00141     return self.GLT != None
00142
00143   def downTWR(self, twrId):
00144     """\brief Navigate to the GTWR indicated by \a childId
00145
00146     \param  childId The id of the child tower
00147     \return         A GTWR object instance
00148     """
00149     return self.TWR.down(twrId)
00150
00151   def existsTWR(self, twrId):
00152     """\brief Check if the GTWR instance with the id \a twrId
00153     exists in the schema.
00154
00155     \param  twrId Tower id
00156     \return       1 if it exists, 0 if it doesn't.
00157     """
00158     return self.TWR.exists(twrId)
00159
00160 ## private:
00161   def __removeGLT(self):
00162     self.GLT = None
00163
00164   def __addGLT(self):
00165     self.GLT = gGLT.GGLT(self.client(), self)
00166     return self.GLT
00167
00168   def __removeTWR(self, twrId):
00169     self.TWR.remove(twrId)
00170
00171   def __addTWR(self, twrId):
00172     return self.TWR.add(twrId)
00173
00174
00175 class GTWR(gDb.Gdb):
00176   """\brief Tower node Record
00177
00178   Valid Registers:
00179   - \c adc_ps_temp_0
00180   - \c adc_ps_temp_1
00181   - \c adc_tem_temp_0
00182   - \c adc_tem_temp_1
00183   - \c adc_tem_voltage_0
00184   - \c adc_tem_voltage_1
00185   """
00186   __regs = [
00187     # Registers
00188     gAttr.GattrReg('adc_ps_temp_0',     0, 4),
00189     gAttr.GattrReg('adc_ps_temp_1',     1, 4),
00190     gAttr.GattrReg('adc_tem_temp_0',    2, 4),
00191     gAttr.GattrReg('adc_tem_temp_1',    3, 4),
00192     gAttr.GattrReg('adc_tem_voltage_0', 4, 4),
00193     gAttr.GattrReg('adc_tem_voltage_1', 5, 4)
00194     ]
00195
00196   def __init__(self, client, parent, id):
00197     """\brief Initialize valid registers as Gattrs.
00198
00199     Assign default values to members
00200     """
00201     gDb.Gdb.__init__(self, client, parent, id, self.__regs)
00202
00203   def read(self, reg):
00204     return self.cmdrsp('ggTWRread', self.up().addr(), reg, '!I')
00205
00206   def load(self, reg, value):
00207     return self.cmdrsp('ggTWRload', self.up().addr(), reg, value)
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskAlarms.py Source File

monitoring

HskAlarms.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging as log
00020 import time
00021
00022 import LATTE.tools.MailAlert as MailAlert
00023
00024 def yellowPrintMessage(value, signal, sender, node):
00025   msg =  'Yellow Alarm: ' + NodeString(node) + sender.getName()
00026   msg += ' is almost out of range: ' + str(value)
00027   if sender.getEGU() is not None:
00028     msg += sender.getEGU().units()
00029   log.warning( msg)
00030
00031 def redPrintMessage(value, signal, sender, node):
00032   msg =  'Red Alarm: ' + NodeString(node) + sender.getName()
00033   msg += ' is out of range: ' + str(value)
00034   if sender.getEGU() is not None:
00035     msg += ' ' + sender.getEGU().units()
00036   log.error(msg)
00037
00038 class HskAlarm(object):
00039   def __init__(self):
00040     pass
00041
00042 class EmailAlarm(HskAlarm, MailAlert.Email):
00043   def __init__(self, recipient):
00044     HskAlarm.__init__(self)
00045     MailAlert.Email.__init__(self)
00046
00047     self.__server = MailAlert.SLACmail()
00048     self.sender('glast@slac.stanford.edu')
00049     self.recipient(recipient)
00050
00051   def yellow(self, value, signal, sender):
00052     self.subject( 'YELLOW' + self.__buildSubj(value, signal, sender) )
00053     self.body( self.__buildBody(value, signal, sender) )
00054
00055   def red(self, value, signal, sender):
00056     self.subject( 'RED' + self.__buildSubj(value, signal, sender) )
00057     self.body( self.__buildBody(value, signal, sender) )
00058
00059   def send(self):
00060     self.__server.sendmail(self)
00061
00062   def __buildSubj(self, value, signal, sender):
00063     msg  = ''
00064     msg += ' alarm: '
00065     msg += NodeString(sender.getNode()) + sender.getName()
00066     return msg
00067
00068   def __buildBody(self, value, signal, sender):
00069     now     = time.strftime('%a %b %d %H:%M:%S %Y')
00070     nodeStr = NodeString(sender.getNode()) + sender.getName()
00071     msg     = ''
00072     msg    += 'The node ' + nodeStr + 'has asserted an alarm of type '
00073     msg    += signal + ' with a value of ' + str(value) + '.\n'
00074     return msg
00075
00076 def NodeString(node):
00077   """Useful little recursive function to generate a string representation
00078   of a gDb-like object.
00079
00080   \param node  Any gDb-like object.  (i.e. GLAT, GHSK)
00081   Object must support getName(), up() and id() methods.
00082   """
00083   string = ''
00084   if node is not None:
00085     string += NodeString(node.up())
00086     string += node.getName()
00087     if node.id() is not None:
00088       string += '[' + str(node.id()) + ']'
00089     string += '.'
00090   return string
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCli.py Source File

monitoring

HskCli.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Housekeeping handler client"
00013 __author__   = "Jim Panetta SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/10/24 18:23:59 $").split(' ')[1]
00015 __created__  = "2004/08/27"
00016 __version__  = "$Revision: 1.2 $"
00017 __release__  = "$Name: P04-06-05 $"
00018 __credits__  = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021 import logging as log
00022 import select
00023 import struct
00024 import threading
00025 import time
00026
00027 import LATTE.client.gCommand      as gCommand
00028 import LATTE.client.gSocket       as gSocket
00029 import LATTE.client.gException    as gException
00030 import LATTE.client.gLog          as gLog
00031
00032
00033 CMD_RX_PORT    = 8000
00034 CMD_TX_PORT    = 8001
00035 TELEM_PORT     = 8002
00036
00037 CMD_RX_SIZE    = 62
00038 CMD_TX_SIZE    = 62
00039 TELEM_SIZE     = 842
00040 HSK_SIZE       = 116
00041
00042
00043 class HskCli(object):
00044   """\brief Housekeeping client input/output class
00045
00046   This class instantiates and controls the sockets for the housekeeping process.
00047   """
00048   def __init__(self, handler=None):
00049     self.__cmdRx = HskCmdRxSocket(handler)
00050     self.__cmdTx = HskCmdTxSocket(handler)
00051     self.__telem = HskTelemSocket(handler)
00052     self.readCmdRx = self.__cmdRx.read
00053     self.readCmdTx = self.__cmdTx.read
00054     self.readTelem = self.__telem.read
00055
00056   def connect(self, server):
00057     """\brief connect method
00058
00059     \param server  the hostname where the housekeeping server process runs
00060     connect the housekeeping system to the housekeeping server
00061     """
00062     self.__cmdRx.connect(server)
00063     self.__cmdTx.connect(server)
00064     self.__telem.connect(server)
00065
00066   def disconnect(self):
00067     """\brief disconnect method
00068
00069     disconnect the housekeeping system from housekeeping server
00070     """
00071     self.__cmdRx.disconnect()
00072     self.__cmdTx.disconnect()
00073     self.__telem.disconnect()
00074
00075   def handler(self, newhandler):
00076     self.__cmdRx.handler(newhandler)
00077     self.__cmdTx.handler(newhandler)
00078     self.__telem.handler(newhandler)
00079
00080 class ccsdsSocket(gSocket.Socket):
00081   UNPACK_ERROR   = -1001
00082
00083   def __init__(self, handler=None, debug=0, port=0):
00084     gSocket.Socket.__init__(self, port)
00085     self.__handler = handler
00086
00087     self.__timeout         = 3
00088     self.__timeoutEnabled  = False
00089     self.read              = None
00090
00091   def connect(self, host):
00092     gSocket.Socket.connect(self, host)
00093     self.read = self.readCCSDS
00094
00095   def disconnect(self):
00096     gSocket.Socket.disconnect(self)
00097     self.read = None
00098
00099   def handler(self, newhandler):
00100     self.__handler = newhandler
00101
00102   def readCCSDS(self):
00103     """\brief CCSDS read routine.
00104
00105     This routine does the minimal work of reading the raw CCSDS
00106     data from a socket.
00107
00108     \return socket buffer read
00109     """
00110     self.lock()
00111     try:
00112       # read CCSDS primary header...
00113       dat = sock.recvall(6)
00114       h = struct.unpack('!HHH',dat)
00115       # CCSDS packet length encoding:
00116       #   h[2] = 2ndary hdr (8) + payload (102) - 1
00117       #   total bytes left = h[2] + 1
00118       numLeft = h[2] + 1
00119       dat += sock.recvall(numLeft)
00120       self.release()
00121     except:
00122       self.release()
00123       if self.__handler is not None:
00124         self.__handler.timedout()
00125       status = gException.LATInterfaceStatus.status('OCS_TMO')
00126       raise gException.LATInterfaceException(status)
00127
00128     if len(dat) == 0:
00129       if self.__handler is not None:
00130         self.__handler.disconnected()
00131       status = gException.LATInterfaceStatus.status('OCS_NOSRV')
00132       raise gException.LATInterfaceException(status)
00133
00134     return (0, dat)
00135
00136   def setTimeoutEnabled(self, flag):
00137     """\brief Enable or disable event timeout
00138
00139     \param flag 1 = Enable event timeout
00140                 0 = Disable event timeout (default)
00141     """
00142     self.__timeoutEnabled = flag;
00143
00144   def isTimeoutEnabled(self):
00145     """\brief Checks the event timeout state
00146
00147     \return 1 = If event timeout is enabled
00148             0 = If event timeout is disabled
00149     """
00150     return self.__timeoutEnabled
00151
00152   def setTimeout(self, timeout):
00153     """\brief Set the timeout value.
00154
00155     \param timeout Event timeout value as a floating point number in seconds.
00156                    Default is 1 second.
00157     """
00158     self.__timeout = timeout
00159
00160   def getTimeout(self):
00161     """\brief Query the current timeout value.
00162
00163     \return Current event timeout value as a floating point number in seconds
00164     """
00165     return self.__timeout
00166
00167 class HskCmdRxSocket(ccsdsSocket):
00168   def __init__(self, handler=None, debug=0, port=CMD_RX_PORT):
00169     ccsdsSocket.__init__(self, handler, debug, port)
00170
00171 class HskCmdTxSocket(ccsdsSocket):
00172   def __init__(self, handler=None, debug=0, port=CMD_TX_PORT):
00173     ccsdsSocket.__init__(self, handler, debug, port)
00174
00175 class HskTelemSocket(ccsdsSocket):
00176   def __init__(self, handler=None, debug=0, port=TELEM_PORT):
00177     ccsdsSocket.__init__(self, handler, debug, port)
00178
00179
00180 class ConnectState:
00181   Disconnected = 0
00182   Waiting      = 1
00183   Connected    = 2
00184
00185 class HskHandler(object):
00186   """\brief HskHandler class
00187
00188   Defines connection protocol to hsk server.
00189   This class needs to define two calls:  disconnected and timeout.
00190
00191   Inherit from this to create GUI versions of HskSvr
00192   """
00193   def __init__(self, server, host):
00194     self.__server = server
00195     self.__host   = host
00196     server.handler(self)
00197     self.__connection_state = ConnectState.Disconnected    # disconnected at startup
00198     self.connect()
00199
00200   def connect(self):
00201     """\brief connect
00202
00203     Connect to the command/hsk server
00204     """
00205     self.__connection_state = ConnectState.Waiting
00206     self.__tries = 0
00207     self.__connect()
00208
00209   def disconnected(self):
00210     """\brief disconnected
00211
00212     """
00213     self.__disconnect()
00214
00215   def timedout(self):
00216     """\brief timedout
00217     """
00218     self.__disconnect()
00219
00220   def __disconnect(self):
00221     # disconnect from the server
00222     self.__server.disconnect()
00223     # deal with the outcome of disconnecting
00224     self.__connection_notthere()
00225
00226   def __connect(self):
00227     # spawn the connecting thread in the background
00228     connecthdlr = threading.Thread(None, self.__connection_handler, 'ConnectHandler',())
00229     connecthdlr.setDaemon(True)
00230     connecthdlr.start()
00231
00232   def __connection_handler(self):
00233     while (True):
00234       try:
00235         self.__server.connect(self.__host)
00236         log.info("HSK server is now connected")
00237         self.__connection_state = ConnectState.Connected
00238         self.__tries = 0
00239         break
00240       except RuntimeError, msg:
00241         if self.__tries == 0:
00242           log.error(msg)
00243         self.__tries += 1
00244         state = self.__connection_state
00245         if state == ConnectState.Disconnected: break
00246         time.sleep(3)
00247
00248   def __connection_notthere(self):
00249     # Do this once...
00250     if self.__connection_state == ConnectState.Connected:
00251       log.error("HSK server disconnected, trying to reconnect")
00252       self.__connection_state = ConnectState.Waiting
00253       self.__connect()
00254
00255
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskCollector.py Source File

monitoring

HskCollector.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "10/06/04"
00014 __version__  = "$Revision: 1.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # base classes
00021 from LATTE.monitoring.Collector    import Collector
00022 from ConfigParser                  import *
00023
00024 from LATTE.client.gCmdCli          import CmdCli
00025 from LATTE.database.gLAT           import GLAT
00026 from LATTE.database.gHSK           import GHSK
00027 from LATTE.monitoring.HskCli       import *
00028
00029
00030 class HskConfiguration(ConfigParser):
00031   """
00032   """
00033   def __init__(self):
00034     ConfigParser.__init__(self)
00035     self.__fileName = None
00036
00037   def read(self, fileName):
00038     self.__fileName = fileName
00039     ConfigParser.read(self, fileName)
00040
00041   def verify(self):
00042     # test the config for required parameters
00043     cSect    = self.sections()
00044     REQUIRED = ('core', 'database', 'inputs')
00045     for sect in REQUIRED:
00046       if sect not in cSect:
00047         msg = 'Config file %s is missing required section: %s' % ( self.__fileName, sect )
00048         raise KeyError, msg
00049
00050     # core check
00051     coItems  = self.options('core')
00052     REQUIRED = ()
00053     for item in REQUIRED:
00054       if item not in dbItems:
00055         msg = 'Config file %s is missing required key %s in core section' % ( self.__fileName, item )
00056         raise KeyError, msg
00057
00058     # database check
00059     dbItems  = self.options('database')
00060     REQUIRED = ('type',)
00061     for item in REQUIRED:
00062       if item not in dbItems:
00063         msg = 'Config file %s is missing required key %s in database section' % ( self.__fileName,item )
00064         raise KeyError, msg
00065
00066     # inputs check
00067     inItems  = self.options('inputs')
00068     REQUIRED = ('latschema', 'hskschema', 'server', 'packet')
00069     for item in REQUIRED:
00070       if item not in inItems:
00071         msg = 'Config file %s is missing required key %s in inputs section' % ( self.__fileName, item )
00072         raise KeyError, msg
00073
00074
00075 class HskCollector(Collector):
00076   """\brief Configurable housekeeping collector
00077
00078   Takes a HskConfiguration object as input.
00079   """
00080   def __init__(self, config):
00081     Collector.__init__(self)
00082
00083     # Required inputs.  Checked in setup of configuration
00084     latSchema = config.get('inputs', 'latSchema')
00085     hskSchema = config.get('inputs', 'hskSchema')
00086     cmdServer = config.get('inputs', 'server')
00087
00088
00089     # set up command client
00090     self.__cmdCli     = CmdCli()
00091     self.__cmdHandler = HskHandler(self.__cmdCli, cmdServer)
00092
00093     # set up LAT database (Needed for commanding)
00094     self.__latDB = GLAT(self.__cmdCli)
00095     self.__latDB.readSchema(latSchema)
00096
00097     # set up HSK database
00098     self.__hskDB      = GHSK(self.__cmdCli)
00099     self.__hskDB.readSchema(hskSchema)
00100     self.__hskDB.applyConfig(None)
00101
00102     # Delay setting is optional, default = 10 seconds
00103     try:
00104       self.setDelay(config.getint('core', 'delay'))
00105     except:
00106       pass
00107
00108     # set up retrievers
00109     if config.getboolean('inputs', 'packet'):
00110       # HskPacket reads
00111       from LATTE.monitoring.HskCli             import HskCli
00112       from LATTE.monitoring.HskPacketRetriever import HskPacketRetriever
00113       self.__hskCli     = HskCli()
00114       self.__hskHandler = HskHandler(self.__hskCli, cmdServer)
00115       self.addRetriever( "HSK", HskPacketRetriever(self.__hskCli) )
00116     else:
00117       # LAT single register reads
00118       from LATTE.monitoring.HskRetriever       import HskLatRetriever
00119       self.addRetriever( "HSK", HskLatRetriever(self.__latDB) )
00120
00121     # set up recorders:
00122     # Alarming system
00123     from LATTE.monitoring.HskRecorder          import HskAlarmRecorder
00124     self.addRecorder( HskAlarmRecorder(self.__hskDB) )
00125
00126     # Systems to write data out
00127     if config.get('database', 'type') == 'sql':
00128       # set up SQL recorder
00129       import MySQLdb
00130       from LATTE.monitoring.HskSqlInterface   import HskSqlRecorder
00131       host = config.get('database', 'host')
00132       user = config.get('database', 'user')
00133       src  = config.getint('database', 'machineid')
00134
00135       sqlDB = MySQLdb.connect(host=host, db='itosdb', user=user)
00136       self.addRecorder(HskSqlRecorder(self.__hskDB, sqlDB.cursor(), src))
00137     else:
00138       # text/flatfile database
00139       dataFile = config.get('database', 'datafile')
00140       from LATTE.monitoring.HskRecorder       import HskFileRecorder
00141       self.addRecorder(HskFileRecorder(self.__hskDB, dataFile))
00142
00143     # optional UDP broadcast
00144     if config.has_section('udp') & config.getboolean('udp', 'broadcast'):
00145       from LATTE.monitoring.Recorder          import UDPRecorder
00146       serverName = config.get('udp', 'serverName')
00147       serverAddr = config.get('udp', 'serverAddr')
00148
00149       udpR = UDPRecorder()
00150       udpR.startUDPServer(serverName,serverAddr)
00151       self.addRecorder(udpR)
00152
00153   def latDB(self): return self.__latDB
00154   def hskDB(self): return self.__hskDB
00155
00156
00157
00158
00159
00160
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskGuiReceiver.py Source File

monitoring

HskGuiReceiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.8 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.HskReceiver import HskCfgTextReceiver
00021 from LATTE.client.gOptions        import Options
00022
00023 import logging
00024 import gc,sys
00025 from   linecache import *
00026 import time
00027 import qt
00028 from sihippo import Observer
00029 import sihippo
00030
00031 second  = 1
00032 minute  = 60 * second
00033 hour    = minute * 60
00034 day     = hour * 24
00035 era     = 10**9
00036
00037 timeFmt      = '%H:%M:%S'
00038 dataFile     = None
00039 timeDepth    = 2*hour
00040
00041 class QtReceiver(qt.QObject,HskCfgTextReceiver):
00042
00043   class TrendUpdateEvent(qt.QCustomEvent):
00044     def __init__(self,trendMap):
00045       qt.QCustomEvent.__init__(self,qt.QEvent.MaxUser-20)
00046       self.trendMap = trendMap
00047
00048   def __init__(self, flatFile, startTime, trendList):
00049     HskCfgTextReceiver.__init__(self, flatFile, startTime, trendList)
00050     qt.QObject.__init__(self)
00051
00052   def process(self,trendMap):
00053     qt.QApplication.postEvent(self,QtReceiver.TrendUpdateEvent(trendMap))
00054
00055   def customEvent(self,event):
00056     self.emit(qt.PYSIGNAL('TrendUpdate(trendMap)'),(event.trendMap,))
00057
00058
00059
00060 class TrendPlotter(qt.QWidget):
00061   def __init__(self,keyList,*args):
00062     qt.QWidget.__init__(self,*args)
00063
00064     self.__ntuples       = {}
00065     self.__plots         = {}
00066     self.__views         = {}
00067     self.__gen           = {}
00068     self.__defaultDepth  = 500                 # assuming 1 hz data rate
00069     self.__defaultLabels = ['Time','']
00070
00071     self.__dynamic       = True
00072     self.__keyList       = keyList
00073
00074     self.grid            = qt.QGridLayout(self,3,2)
00075     self.grid.setAutoAdd(1)
00076     self.true            = True
00077
00078   def isDynamic(self):
00079     return self.__dynamic
00080   def setDynamic(self,bool):
00081     self.__dynamic==bool
00082
00083   def addPlot(self, key):
00084     labels  = self.__defaultLabels
00085     depth   = self.__defaultDepth
00086     name    = self.__keyList[key]
00087
00088     # Create the Circular buffer to store the data
00089     ntc     = sihippo.NTupleController.instance()
00090     nt      = ntc.createCircularBuffer(labels)
00091     nt.reserve(depth)
00092     nt.setTitle(name)
00093     nt.setName(name)
00094
00095     # Create the Plot
00096     dc      = sihippo.DisplayController.instance()
00097     plot=dc.createDisplay('XY Plot',nt,labels)
00098     # plot    = dc.createDisplay('Strip Chart',nt,labels)
00099
00100     # kludge so that the range is initialized, and autoscales when we need.
00101     plot.setRange('x',0,1)
00102     plot.setAutoRanging('x',True)
00103
00104     # Add the time axis observer
00105     gen     = TimeAxisGen()
00106     gen.setPlotter(plot, key)
00107     plot.addObserver(gen)
00108
00109     # Add the plot to the screen
00110     view    = sihippo.QtViewWidget(self)
00111     view.setPlotter(plot)
00112     view.setDoubleBuffering(1)
00113     view.resize(200,100)
00114     view.setMinimumSize(qt.QSize(100,50))
00115     # self.grid.addWidget(view)
00116     view.show()
00117
00118     # Maintain a reference to the created objects to prevent garbage collection
00119     self.__ntuples[key]  = nt
00120     self.__plots[key]    = plot
00121     self.__views[key]    = view
00122     self.__gen[key]      = gen
00123
00124   def update(self, trendMap):
00125     # if not self.true: return
00126     self.true=False
00127     # trendMap has timestamp, val1, val2, val3...
00128     timeStamp = trendMap['TimeStamp']
00129     for key in trendMap:
00130       if key == 'TimeStamp': continue
00131       if key not in self.__views.keys() and self.__dynamic:
00132         self.addPlot(key)
00133       if key not in self.__views.keys():
00134         return
00135       x=timeStamp
00136       y=trendMap[key]
00137       if y is None:
00138         continue
00139       self.__ntuples[key].addRow([x,y])
00140
00141 class TimeAxisGen ( Observer ) :
00142   __labelFmt   = '%Y/%m/%d'
00143   __tickFmt    = '%H:%M'
00144   __stepSet    = [ 1*second, 5*second, 10*second, 30*second,
00145                    1*minute, 2*minute, 5*minute, 10*minute, 15*minute, 20*minute, 30*minute,
00146                    1*hour, 2*hour, 6*hour, 12*hour,
00147                    1*day, 3*day, 7*day, 30*day, 90*day, 180*day, 364*day,
00148                    era]
00149
00150   def setPlotter ( self, plotter, name ) :
00151     self.plotter = plotter
00152     self.name    = name
00153     self.__goodStep = 0
00154
00155   def update ( self, obs ) :
00156     # return
00157     lowTime = self.plotter.getLowRangeOnX()
00158     highTime = self.plotter.getHighRangeOnX()
00159
00160     if ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep]) < 1:
00161       # print "reset of goodStep", self.name, self.__goodStep , highTime, lowTime,  ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep])
00162       self.__goodStep -= 1
00163     if ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep]) > 6:
00164       # print self.name, highTime, lowTime,  ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep])
00165       step = 0
00166       while ((highTime - lowTime)/TimeAxisGen.__stepSet[step]) > 5:
00167         # print "step:", step
00168         step += 1
00169       self.__goodStep = step
00170     step = TimeAxisGen.__stepSet[self.__goodStep]
00171
00172     lowTick = lowTime - (lowTime % step) + step
00173     values = []
00174     values.append( lowTick )
00175
00176     labels = []
00177     labels.append( time.strftime(TimeAxisGen.__tickFmt, time.localtime(lowTick)) )
00178     tick = lowTick
00179     tick += step
00180     while tick < highTime:
00181       values.append ( tick )
00182       labels.append ( time.strftime(TimeAxisGen.__tickFmt, time.localtime(tick)) )
00183       tick += step
00184
00185     self.plotter.setAutoTicksOnX( False )
00186     self.plotter.setTicksOnX( values, labels )
00187
00188     # REALLY REALLY don't do this:
00189     #   setLabel calls "notifyObservers", which brings us back here...
00190     # xlabel = time.strftime(TimeAxisGen.__labelFmt, time.localtime(highTime))
00191     # self.plotter.setLabel( 'x', xlabel )
00192
00193 def memget():
00194   import win32pdh
00195   hq = win32pdh.OpenQuery()
00196   # ch = win32pdh.AddCounter(hq, "\\\\gitow1\\Process(python)\\Private Bytes")
00197   ch = win32pdh.AddCounter(hq, "\\\\gitow1\\Process(python#1)\\Private Bytes")
00198   win32pdh.CollectQueryData(hq)
00199   type, val =win32pdh.GetFormattedCounterValue(ch,win32pdh.PDH_FMT_LONG)
00200   return val
00201
00202 def startup():
00203   # print memget()
00204   logging.basicConfig()
00205   logging.root.setLevel(logging.DEBUG)
00206   gc.set_debug(gc.DEBUG_LEAK)
00207   print "Garbage collection: ", gc.isenabled()#, gc.get_objects()
00208
00209 def startQT(dataFile, startTime, keyList):
00210   import sys
00211
00212   app=qt.QApplication(sys.argv)
00213   r=QtReceiver(dataFile, startTime, keyList.keys())
00214
00215   gui=TrendPlotter(keyList)
00216   gui.connect(r,qt.PYSIGNAL('TrendUpdate(trendMap)'),gui.update)
00217
00218   app.connect(app,qt.SIGNAL("lastWindowClosed()"),
00219               app,qt.SLOT("quit()"))
00220
00221   app.setMainWidget(gui)
00222   gui.show()
00223
00224   r.setReceiving(1)
00225   app.exec_loop()
00226   r.shutdown()
00227
00228 def usage():
00229   return """
00230
00231 HskGuiReceiver Usage:
00232
00233 Mandatory options:
00234 --dataFile  define the flat file that contains housekeeping data.
00235
00236 Optional options:
00237 --timeDepth define the time depth of the housekeeping plots.  Default is 2 hours.
00238             Units are in seconds
00239 --keyFile   define the file of variables to plot
00240             Note: keyFile format is "KEY  :  Plot title"
00241
00242 Example:
00243 $ HskGuiReceiver --dataFile c:\TEMP\lat-elf11.dat --timeDepth 3600 --keyFile keys.dat
00244
00245 """
00246
00247
00248 if __name__ == '__main__':
00249   startup()
00250
00251   # Options, first list mandatory, second list optional
00252   options = Options(['dataFile'], ['timeDepth', 'keyFile'])
00253   try:
00254     options.parse()
00255   except Exception, msg:
00256     options.usage()
00257     raise Exception, msg
00258
00259   dataFile = options.dataFile
00260   if options.timeDepth is not None:
00261     timeDepth = int(options.timeDepth)
00262   else:
00263     timeDepth = 2*hour
00264   startTime = time.time() - timeDepth
00265
00266   if options.keyFile is not None:
00267     keyFile = options.keyFile
00268     from HskReceiver import parseKeyFile
00269     keyList = parseKeyFile(keyFile)
00270   else:  # really really basic set of histos.
00271     keyList = {'LHKAEMDAQB33V':'AEM DAQ board 3.3 V',
00272                'LHKAEMFR11T'  :'AEM Free board 11 Temp',
00273                'LHKAEMDAQBT'  :'AEM DAQ board Temp',
00274                'LHKAEMFR11V1' :'AEM Free 11 HV 1',
00275                'LHKAEMFR11V2' :'AEM Free 11 HV 2',
00276                'LHKAEMFR11VD' :'AEM Free 11 VDD',
00277                }
00278
00279   startQT(dataFile, startTime, keyList)
00280
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskPacketDecoder.py Source File

monitoring

HskPacketDecoder.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Housekeeping handler client"
00013 __author__   = "Amedeo Perazzo <perazzo@slac.stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/10/06 20:50:21 $").split(' ')[1]
00015 __version__  = "$Revision: 1.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020 import logging as log
00021
00022 import struct
00023
00024 from LATTE.client.gBits import *
00025
00026 ccsdsFmt = "!LHLL"      # 14 byte header
00027
00028 # Note:  HSK packet length = 116 bytes --> HSK payload = 102 bytes
00029
00030 class ccsdsPacket(object):
00031   """\brief Interface to a generic CCSDS packet
00032
00033   \param ui The raw binary representation of the packet in big-endian byte order
00034
00035   Methods:
00036   apid()          return packet APID
00037   secHead()       return packet secondary header bit
00038   type()          return packet type bit
00039   version()       return packet version
00040   seqCnt()        return sequence count
00041   seqFlg()        return sequence flag
00042   length()        return packet length in bytes
00043   seconds()       return timestamp seconds
00044   subSeconds()    return timestamp sub seconds
00045   payload()       return packet payload (opaque)
00046
00047   """
00048   def __init__(self, ui):
00049     self.__ui      = ui
00050     self.__decode()
00051
00052   def __decode(self):
00053     # print "ccsdspacket:decode string=%d, fmt=%d" % (len(self.__ui[0:14]), struct.calcsize(ccsdsFmt))
00054     ( header, self.__length, self.__seconds, self.__subSeconds ) = \
00055       struct.unpack(ccsdsFmt, self.__ui[0:14])
00056     self.__header  = ccsdsHeader(header)
00057     self.__payload = self.__ui[14:]
00058
00059   def apid(self):        return self.__header.apid
00060   def secHead(self):     return self.__header.secHead
00061   def type(self):        return self.__header.type
00062   def version(self):     return self.__header.version
00063   def seqCnt(self):      return self.__header.seqCnt
00064   def seqFlg(self):      return self.__header.seqFlg
00065   def length(self):      return self.__length
00066   def seconds(self):     return self.__seconds
00067   def subSeconds(self):  return self.__subSeconds
00068   def payload(self):     return self.__payload
00069
00070
00071 class ccsdsHeader(BitField):
00072   """\brief CCSDS Header bitfield definition
00073   """
00074   cch_BF = [
00075              ( 'apid',     0, 11 ),
00076              ( 'secHead', 11, 12 ),
00077              ( 'type',    12, 13 ),
00078              ( 'version', 13, 16 ),
00079              ( 'seqCnt',  16, 30 ),
00080              ( 'seqFlg',  30, 32 )
00081            ]
00082   def __init__(self, ui):
00083     BitField.__init__(self, ui, self.cch_BF)
00084
00085
00086 class HskPacketBase(ccsdsPacket):
00087   def __init__(self, ui):
00088     ccsdsPacket.__init__(self, ui)
00089     self.__bitsRead = 0
00090     # print "HskPacketBase:decode string=%d, fmt=%d" % (len(self.payload()), struct.calcsize('!51H'))
00091     self.__longArray = struct.unpack('!51H', self.payload())
00092
00093   def __readBits(self, bits):
00094     # parse out n bits from the struct.
00095     # keep a count of the bits read
00096     if bits >= 16:
00097       return self.__readBitsBig(bits)
00098     mask = ( 1 << bits ) - 1
00099     retVal = ( self.__longArray[self.__bitsRead/16] >> (self.__bitsRead%16) ) & mask
00100     self.__bitsRead += bits
00101     return retVal
00102
00103   def __readBitsBig(self, bits):
00104     # more than 16 bits.  Build an n bit number.
00105     nChunk = bits/16 + ( bits%16 != 0 )   # True == 1
00106     chunk = 0
00107     br = self.__bitsRead/16
00108     for i in range(nChunk):
00109       chunk |= long(self.__longArray[br+i]) << ( 16 * (nChunk - i - 1) )
00110
00111     mask = (long(1) << bits) - 1
00112
00113     retVal = ( chunk >> (self.__bitsRead%16) ) & mask
00114     self.__bitsRead += bits
00115     return retVal
00116
00117   def read(self):
00118     for mnem,key in self.mnemList:
00119       self.__dict__[mnem] = self.__readBits(self.bitDict[key])
00120
00121 def packetFactory(packet):
00122   # create a hsk class from a packet and return it
00123   theShort = struct.unpack('!H', packet[0:2])
00124   apid = theShort[0] & 0x7ff
00125   classRet = "HskPacket%03x" % apid
00126   exec('from LATTE.monitoring.HskPacket import ' + classRet)
00127   classStr = classRet + '(packet)'
00128   return eval(classStr)
00129
00130
00131 # eof
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskPacketRetriever.py Source File

monitoring

HskPacketRetriever.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import time
00020
00021 from LATTE.monitoring.Retriever        import Retriever
00022 from LATTE.monitoring.Trendable        import Trendable
00023 from LATTE.monitoring.HskPacketDecoder import packetFactory
00024 import time
00025
00026 class HskPacketRetriever(Retriever):
00027   """Retrieve HSK ccsds packets from ethernet connection
00028   """
00029   def __init__(self, hskCli):
00030     Retriever.__init__(self)
00031     self.__client = hskCli
00032
00033   def retrievePacket(self):
00034     packet = []
00035     (err, payload) = self.__client.readTelem()
00036     if err == 0:
00037       hskClass = packetFactory(payload)
00038     else:
00039       print "got an error from readTelem: %d", err
00040       return None
00041
00042     # create the packet
00043
00044     # kludge up the timestamp, as the returned timestamp from HSK relative to VxWorks boot
00045     # timestamp = hskClass.seconds() + hskClass.subSeconds()/10000000
00046     timestamp = time.time()
00047
00048     for mnem, tag in hskClass.mnemList:
00049       value = hskClass.__dict__[mnem]
00050       packet.append( Trendable( mnem, timestamp, { 'Raw Value' : value } ) )
00051     return packet
00052
00053
00054
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskReceiver.py Source File

monitoring

HskReceiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.9 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.Receiver       import Receiver
00021 from LATTE.client.gOptions           import Options
00022
00023 import logging
00024 from linecache import *
00025 import time
00026
00027 second  = 1
00028 minute  = 60 * second
00029 hour    = minute * 60
00030 day     = hour * 24
00031 era     = 10**9
00032
00033 timeFmt = '%Y/%m/%d  %H:%M:%S'
00034 dataFile     = None
00035 timeDepth    = 2*hour / 5
00036
00037 class HskSimpleTextReceiver(Receiver):
00038   """
00039   """
00040   def __init__(self, flatFile, startTime):
00041     Receiver.__init__(self)
00042     self.log     = logging.getLogger('HskSimpleTextReceiver')
00043     self.__flatFile   = flatFile
00044     self.__keyList    = []
00045     self.__lineNumber = 1
00046     self.__startTime  = startTime
00047
00048   def shutdown(self):
00049     self.setReceiving(0)
00050
00051   def receive(self):
00052     if self.__lineNumber == 1:
00053       checkcache()
00054       keyList = getline(self.__flatFile, self.__lineNumber)
00055       if keyList == '': time.sleep(0.1); return
00056       # create a list of keys from whitespace separated text blobs
00057       self.__keyList = keyList.split()
00058       self.__lineNumber += 1
00059     while True:
00060       line = getline(self.__flatFile, self.__lineNumber)
00061       # print line
00062       if line == '':
00063         checkcache()
00064         break
00065       # if self.__lineNumber % 100 == 3:
00066         # from HskGuiReceiver import memget
00067         # print  memget()
00068       self.__lineNumber += 1
00069       trendMap = {}
00070       values = line.split()
00071       # first key is 'TimeStamp', so this is always safe:
00072       if float(values[0]) < self.__startTime:
00073         continue
00074       for key in self.__keyList:
00075         v = values[self.__keyList.index(key)]
00076         if v == 'None':    # No value in table.
00077           trendMap[key] = None
00078         else:
00079           trendMap[key] = float(values[self.__keyList.index(key)])
00080       self.dispatch(trendMap)
00081     time.sleep(10)
00082
00083   def dispatch(self, trendMap):
00084     if trendMap == {}: return
00085     print time.strftime(timeFmt, time.localtime(trendMap['TimeStamp'])), '    ' \
00086           'DAQ TEMP:', trendMap['LHKAEMDAQBT']
00087
00088 class HskCfgTextReceiver(HskSimpleTextReceiver):
00089   def __init__(self, flatFile, startTime, trendList):
00090     HskSimpleTextReceiver.__init__(self, flatFile, startTime)
00091     self.__trendList = trendList
00092
00093   def dispatch(self, trendMap):
00094     if trendMap == {}: return
00095     dispatchMap = {'TimeStamp':trendMap['TimeStamp']}
00096     for item in trendMap:
00097       if self.trendItem(item):
00098         dispatchMap[item] = trendMap[item]
00099     self.process(dispatchMap)
00100
00101   def process(self, dispatchMap):
00102     line = ''
00103     for item in dispatchMap:
00104       line += item + ":" + str(dispatchMap[item]) + "    "
00105     # print line
00106
00107   def trendItem(self, item):
00108     if item in self.__trendList:
00109       return True
00110     else:
00111       return False
00112
00113 def parseKeyFile(keyFile):
00114   keyList = {}
00115   f       = open(keyFile, 'r')
00116   for line in f.readlines():
00117     line.strip()
00118     if line[0] != '#' and line != '':
00119       (key,title)  = line.split(':', 1)
00120       keyList[key.strip()] = title.strip()
00121   f.close()
00122   return keyList
00123
00124 def startup():
00125   logging.basicConfig()
00126   logging.root.setLevel(logging.DEBUG)
00127
00128 def usage():
00129   pass
00130
00131 if __name__ == '__main__':
00132   startup()
00133
00134   # Options, first list mandatory, second list optional
00135   options = Options(['dataFile'], ['timeDepth', 'keyFile'])
00136   try:
00137     options.parse()
00138   except Exception, msg:
00139     options.usage(usage())
00140     raise Exception, msg
00141
00142   dataFile = options.dataFile
00143   if options.timeDepth is not None:
00144     timeDepth = int(options.timeDepth)
00145   else:
00146     timeDepth = 2*hour
00147   startTime = time.time() - timeDepth
00148
00149   if options.keyFile is not None:
00150     keyFile = options.keyFile
00151     keyList = parseKeyFile(keyFile)
00152   else:  # really really basic set of histos.
00153     keyList = {'LHKAEMDAQB33V':'AEM DAQ board 3.3 V',
00154                'LHKAEMFR11T'  :'AEM Free board 11 Temp',
00155                'LHKAEMDAQBT'  :'AEM DAQ board Temp',
00156                'LHKAEMFR11V1' :'AEM Free 11 HV 1',
00157                'LHKAEMFR11V2' :'AEM Free 11 HV 2',
00158                'LHKAEMFR11VD' :'AEM Free 11 VDD',
00159                }
00160
00161   # r = HskSimpleTextReceiver(dataFile, startTime)
00162   r = HskCfgTextReceiver(dataFile, startTime, keyList.keys())
00163
00164
00165   r.setReceiving(1)
00166
00167   try:
00168     while 1:
00169       time.sleep(1)
00170   except Exception, e:
00171     r.shutdown()
00172
00173
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRecorder.py Source File

monitoring

HskRecorder.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.Recorder     import Recorder
00021 from LATTE.database.gHSK           import GHSK
00022 from LATTE.monitoring.TrendMaps    import GHSKTrendMap
00023
00024 class HskAlarmRecorder(Recorder):
00025   """Applys the trends to the housekeeping node structure.
00026      As alarms are part of the node structure, we get those for
00027      free.
00028   """
00029   def __init__(self, ghsk):
00030     Recorder.__init__(self)
00031     self.__ghsk = ghsk
00032     self.__trendMap = GHSKTrendMap(ghsk)
00033
00034   def processTrends(self, trendables):
00035     if trendables is None: return
00036     for t in trendables:
00037       key   = t.name
00038       value = t.content['Raw Value']
00039       tuple = self.__trendMap.mapGet(key)
00040       if tuple is not None:
00041         node, attr = tuple
00042         if node is not None:
00043           if  attr != '' and attr is not None:
00044             node.regs[attr.lower()].set(value, bypass=True)
00045           elif isinstance(node, str):
00046             pass
00047
00048 class HskFileRecorder(Recorder):
00049   """Writes the Hsk EGUs to a flat file for later retrieval.
00050   """
00051   def __init__(self, ghsk, flatFile):
00052     Recorder.__init__(self)
00053     self.__ghsk = ghsk
00054     self.__trendMap = GHSKTrendMap(ghsk)
00055     self.__flatFile = open(flatFile, 'a+')
00056
00057     keyList         = self.__flatFile.readline()
00058     if keyList == '':  # No file,
00059       self.processTrends = self.__createFileHeader
00060     else:
00061       # create a list of keys from whitespace separated text blobs
00062       self.__keyList = keyList.split()
00063       self.processTrends = self.__processTrends
00064     self.__flatFile.seek(0,2)
00065     self.__pad = '   '
00066
00067   def __processTrends(self, trendables):
00068     if trendables is None: return
00069
00070     from TrendMaps import makeSimpleMap
00071     trendMap  = makeSimpleMap(trendables, self.__trendMap)
00072
00073     line = ''
00074     for k in self.__keyList:
00075       line += str(trendMap[k]) + self.__pad
00076     line += '\n'
00077     self.__flatFile.write(line)
00078     self.__flatFile.flush()
00079
00080   def __createFileHeader(self, trendables):
00081     if trendables is None: return
00082     # 1: reset function pointer to processTrends
00083     self.processTrends = self.__processTrends
00084     # 2: create the sorted key list
00085     self.__keyList     = []
00086     for t in trendables:
00087       self.__keyList.append(t.name)
00088     self.__keyList.sort()
00089     self.__keyList.insert(0, 'TimeStamp')
00090     line = ''
00091     # 3: write the index line of the file:
00092     for k in self.__keyList:
00093       line += (k + self.__pad)
00094     line += '\n'
00095     self.__flatFile.writelines([line])
00096     # 4: Profit!
00097     self.processTrends(trendables)
00098
00099 class HskPacketRecorder(Recorder):
00100   def __init__(self, ghsk, flatFile):
00101     Recorder.__init__(self)
00102     self.__ghsk = ghsk
00103     self.__trendMap = GHSKTrendMap(ghsk)
00104     self.__flatFile = open(flatFile, 'a+')
00105     self.__flatFile.seek(0,2)
00106     self.__pad = '   '
00107
00108   def processTrends(self, trendables):
00109     if trendables is None: return
00110     trendMap  = {}
00111     # Add the timestamp
00112     timeStamp = trendables[0].time
00113     trendMap['TimeStamp'] =timeStamp
00114     line = ''
00115
00116     line += 'TimeStamp' + ':' + str(timeStamp) + self.__pad
00117
00118     for t in trendables:
00119       key    = t.name
00120       tuple  = self.__trendMap.mapGet(key)
00121       if tuple is not None:
00122         node, attr = tuple
00123         if node is not None and attr != '':
00124           value = node.regs[attr.lower()].get(bypass=False)
00125           raw = node.regs[attr.lower()].get(bypass=True)
00126
00127           line += key + ':' + str(value) + self.__pad
00128     line += '\n'
00129     self.__flatFile.write(line)
00130     self.__flatFile.flush()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRegisters.py Source File

monitoring

HskRegisters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging
00020 from   LATTE.client.gException   import LATInterfaceException
00021
00022 class RegisterInterface(object):
00023   """Represents a LAT housekeeping register for reading.
00024   """
00025   def __init__(self, node, name):
00026     """\brief RegisterReader constructor
00027
00028     \param  node:        a gNode (like GAEQ)
00029     \param  name:        a name  (like env_free_1la)
00030     """
00031
00032     self.__readOnly = False
00033     try:
00034       node.regs.has_key(name)
00035     except AttributeError, e:
00036       self.__node = None
00037     else:
00038       self.__node = node
00039       if node.regs[name].isReadOnly():
00040         self.__readOnly = True
00041
00042     self.__name          = name
00043     self.__lastReadValue = None
00044     self.__log           = logging.getLogger()
00045
00046   def name(self): return self.__name
00047
00048   def read(self, cachedValue=False):
00049     """\brief read method
00050
00051     \return the raw value in the register or None
00052     """
00053     if cachedValue:
00054       return self.__lastReadValue
00055
00056     if self.__node:
00057       try:
00058         self.__lastReadValue = self.__node.regs[self.__name].get(bypass=1)
00059       except LATInterfaceException, e:
00060         self.__lastReadValue=None
00061         print e
00062         self.__log.error(e)
00063     else:
00064       self.__log.debug("There is no register %s to read.", self.__name)
00065
00066     return self.__lastReadValue
00067
00068   def write(self, value):
00069     """
00070     writes to the register
00071     """
00072     if self.__readOnly:
00073       self.log.error("Cannot write to a Read Only Register (%s)",
00074                      self.name)
00075     if self.__node:
00076       try:
00077         self.__node.regs[self.__name].set(value,bypass=1)
00078       except LATInterfaceException, e:
00079         #print e
00080         self.__log.error(e)
00081     else:
00082       # If we are running headless, I'll just put this
00083       # in the cached value variable
00084       self.__log.debug("There is no register %s to write 0x%x to.",
00085                      self.name, value)
00086       self.__lastReadValue=value
00087
00088
00089 class NodeRegisterList(object):
00090   """
00091   """
00092   def __init__(self, node):
00093     self.__node = node
00094
00095     self.__regMap = {}
00096     for regKey in node.regs.keys():
00097       self.__regMap[regKey] = RegisterInterface( node, regKey )
00098
00099   def map(self):
00100     return self.__regMap
00101
00102
00103 class AEQHskRegMap:
00104   """
00105   """
00106   regMap = {
00107     "env_free_1la" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00108     "env_free_1rb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00109     "env_free_2la" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00110     "env_free_2lb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00111     "env_free_2ra" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00112     "env_free_2rb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00113     "env_free_3la" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00114     "env_free_3rb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00115     "env_free_4la" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00116     "env_free_4lb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00117     "env_free_4ra" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00118     "env_free_4rb" : [ "Vdd", "Temperature", "HV1", "HV2" ],
00119     "env_daq" :      [ "FreeI", "Temperature", "HVI", "DAQV" ]
00120   }
00121   def __init__(self):
00122     pass
00123
00124   def decodeRegister(self, key, regValue):
00125     """
00126     decode an AEM register.  Each 16 bit section looks like:
00127     MBZ[3] Timeout[1] Val[12]
00128
00129     \return a map of parsed values
00130     """
00131     keyList = self.regMap[key]
00132     retMap  = {}
00133     if ( regValue >> 63 ) & 0x1: # not ready
00134       for i in range(4):
00135         retMap[keyList[i]] = None
00136     else:
00137       for i in range(4):
00138         word    = ( regValue >> (16*i) ) & 0xffff
00139         timeout = word >> 15 & 0x1
00140         if timeout:
00141           value = None
00142         else:
00143           value = word & 0x7fff
00144         retMap[keyList[i]] = value
00145     return retMap
00146
00147
00148
00149
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskRetriever.py Source File

monitoring

HskRetriever.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.8 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import time
00020
00021 from LATTE.monitoring.Retriever    import Retriever
00022 from LATTE.monitoring.Trendable    import Trendable
00023 from LATTE.database.gLAT           import GLAT
00024
00025 class HskLatRetriever(Retriever):
00026   """Fully populated LAT retriever.
00027      Should get all available LAT housekeeping quantities and trend them.
00028   """
00029   def __init__(self, glat):
00030     Retriever.__init__(self)
00031     from LATTE.monitoring.TrendMaps    import GLATTrendMap
00032     self.__trendMap = GLATTrendMap(glat)
00033     # Deal with GEBM TEM multiplexer...
00034     self.__mux = []
00035     for i in range(16):
00036       self.__mux.append('LHKETEM%XRS'%i)
00037
00038   def retrievePacket(self):
00039     packet = []
00040     timestamp = time.time()
00041     for key in self.__trendMap.mapKeys():
00042       atuple = self.__trendMap.mapGet(key)
00043       if atuple is not None:
00044         node, attr = atuple
00045         if node is not None and attr != '':
00046           try:
00047             if key in self.__mux:   # have a GEBM TEM multiplexer...
00048               muxes = node.downEBMC().tem_statistics
00049               mux0 = ( muxes      ) & 0xf
00050               mux1 = ( muxes >> 4 ) & 0xf
00051               tem = self.__mux.index(key)
00052               if tem == mux0:
00053                 value = node.downEBMST().regs['receive_tem_mux0'].get(bypass=1)
00054               elif tem == mux1:
00055                 value = node.downEBMST().regs['receive_tem_mux1'].get(bypass=1)
00056               else:
00057                 value = 0
00058             else:
00059               value = node.regs[attr.lower()].get(bypass=1)
00060           except Exception, e:
00061             # print e
00062             value = None
00063           packet.append( Trendable( key, timestamp, { 'Raw Value' : value } ) )
00064     return packet
00065
00066 class HskTestRetriever(Retriever):
00067   """ Test HskRetriever
00068   """
00069   def __init__(self, glat):
00070     self.__monitorList={}
00071     from HskRegisters import NodeRegisterList
00072
00073     AEQ = glat.downAEM().downAEQ()
00074     self.__monitorList["AEQ"] = NodeRegisterList(AEQ)
00075     from LATTE.monitoring.HskRegisters import AEQHskRegMap
00076     self.__hskMap = AEQHskRegMap()
00077
00078   def retrievePacket(self):
00079     packet=[]
00080     timestamp = time.time()
00081
00082     for reg in self.__monitorList["AEQ"].map().values():
00083       reg.write(self.aeqBuildDummy(timestamp))
00084       parsed = self.__hskMap.decodeRegister(reg.name(), reg.read())
00085       for key in parsed:
00086         tName = reg.name() + ":" + key
00087         packet.append( Trendable(tName, timestamp, {'Raw Value' : parsed[key]}) )
00088
00089     return packet
00090
00091   def aeqBuildDummy(self,timestamp):
00092     import math
00093     ret = 0L
00094     for i in range(2):
00095       word = long( math.fabs(math.sin( (timestamp*math.pi)/(i*12+12) )) * 0xfff)
00096       ret |= word << (16*i)
00097     return ret
00098
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlGuiReceiver.py Source File

monitoring

HskSqlGuiReceiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # from LATTE.monitoring.HskReceiver import HskCfgTextReceiver
00021 from LATTE.client.gOptions        import Options
00022 from LATTE.monitoring.HskSqlInterface import HskSqlReceiver
00023
00024 import logging
00025 import gc,sys
00026 from   linecache import *
00027 import time
00028 import qt
00029 from sihippo import Observer
00030 import sihippo
00031
00032 second  = 1
00033 minute  = 60 * second
00034 hour    = minute * 60
00035 day     = hour * 24
00036 era     = 10**9
00037
00038 timeFmt      = '%H:%M:%S'
00039 dataFile     = None
00040 timeDepth    = 2*hour
00041
00042 class QtReceiver(qt.QObject, HskSqlReceiver):
00043
00044   class TrendUpdateEvent(qt.QCustomEvent):
00045     def __init__(self,trendMap):
00046       qt.QCustomEvent.__init__(self,qt.QEvent.MaxUser-20)
00047       self.trendMap = trendMap
00048
00049   def __init__(self, sqlDB, timeDepth, trendList):
00050     HskSqlReceiver.__init__(self, sqlDB, timeDepth, trendList)
00051     qt.QObject.__init__(self)
00052
00053   def process(self,trendMap):
00054     qt.QApplication.postEvent(self,QtReceiver.TrendUpdateEvent(trendMap))
00055
00056   def customEvent(self,event):
00057     self.emit(qt.PYSIGNAL('TrendUpdate(trendMap)'),(event.trendMap,))
00058
00059
00060
00061 class TrendPlotter(qt.QWidget):
00062   def __init__(self, keyList, depth, *args):
00063     qt.QWidget.__init__(self,*args)
00064
00065     self.__ntuples       = {}
00066     self.__plots         = {}
00067     self.__views         = {}
00068     self.__gen           = {}
00069     self.__defaultDepth  = depth                 # assuming 1 hz data rate
00070     self.__defaultLabels = ['Time','']
00071
00072     self.__dynamic       = True
00073     self.__keyList       = keyList
00074
00075     self.grid            = qt.QGridLayout(self,3,2)
00076     self.grid.setAutoAdd(1)
00077     self.true            = True
00078
00079   def isDynamic(self):
00080     return self.__dynamic
00081   def setDynamic(self,bool):
00082     self.__dynamic==bool
00083
00084   def addPlot(self, key):
00085     labels  = self.__defaultLabels
00086     depth   = self.__defaultDepth
00087     name    = self.__keyList[key]
00088
00089     # Create the Circular buffer to store the data
00090     ntc     = sihippo.NTupleController.instance()
00091     nt      = ntc.createCircularBuffer(labels)
00092     nt.reserve(depth)
00093     nt.setTitle(name)
00094     nt.setName(name)
00095
00096     # Create the Plot
00097     dc      = sihippo.DisplayController.instance()
00098     plot    = dc.createDisplay('XY Plot', nt, labels)
00099     # plot    = dc.createDisplay('Strip Chart',nt,labels)
00100
00101     # kludge so that the range is initialized, and autoscales when we need.
00102     plot.setRange('x',0,1)
00103     plot.setAutoRanging('x',True)
00104
00105     # Add the time axis observer
00106     gen     = TimeAxisGen()
00107     gen.setPlotter(plot, key)
00108     plot.addObserver(gen)
00109
00110     # Add the plot to the screen
00111     view    = sihippo.QtViewWidget(self)
00112     view.setPlotter(plot)
00113     view.setDoubleBuffering(1)
00114     view.resize(200,100)
00115     view.setMinimumSize(qt.QSize(100,50))
00116     # self.grid.addWidget(view)
00117     view.show()
00118
00119     # Maintain a reference to the created objects to prevent garbage collection
00120     self.__ntuples[key]  = nt
00121     self.__plots[key]    = plot
00122     self.__views[key]    = view
00123     self.__gen[key]      = gen
00124
00125   def update(self, trendMap):
00126     # if not self.true: return
00127     self.true=False
00128     # trendMap has timestamp, val1, val2, val3...
00129     timeStamp = trendMap['TimeStamp']
00130     for key in trendMap:
00131       if key == 'TimeStamp': continue
00132       if key not in self.__views.keys() and self.__dynamic:
00133         self.addPlot(key)
00134       if key not in self.__views.keys():
00135         return
00136       x=timeStamp
00137       y=trendMap[key]
00138       if y is None:
00139         continue
00140       self.__ntuples[key].addRow([x,y])
00141
00142 class TimeAxisGen ( Observer ) :
00143   __labelFmt   = '%Y/%m/%d'
00144   __tickFmt    = '%H:%M'
00145   __dayFmt     = '%m/%d %H:%M'
00146   __stepSet    = [ 1*second, 5*second, 10*second, 30*second,
00147                    1*minute, 2*minute, 5*minute, 10*minute, 15*minute, 20*minute, 30*minute,
00148                    1*hour, 2*hour, 6*hour, 12*hour,
00149                    1*day, 2*day, 7*day, 30*day, 90*day, 180*day, 364*day,
00150                    era]
00151
00152   def setPlotter ( self, plotter, name ) :
00153     self.plotter = plotter
00154     self.name    = name
00155     self.__goodStep = 0
00156
00157   def update ( self, obs ) :
00158     # return
00159     lowTime = self.plotter.getLowRangeOnX()
00160     highTime = self.plotter.getHighRangeOnX()
00161
00162     if ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep]) < 1:
00163       # print "reset of goodStep", self.name, self.__goodStep , highTime, lowTime,  ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep])
00164       self.__goodStep -= 1
00165     if ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep]) > 6:
00166       # print self.name, highTime, lowTime,  ((highTime - lowTime)/TimeAxisGen.__stepSet[self.__goodStep])
00167       step = 0
00168       while ((highTime - lowTime)/TimeAxisGen.__stepSet[step]) > 5:
00169         # print "step:", step
00170         step += 1
00171       self.__goodStep = step
00172     step = TimeAxisGen.__stepSet[self.__goodStep]
00173     if step < 1*day:
00174       tickFmt = TimeAxisGen.__tickFmt
00175     else:
00176       tickFmt = TimeAxisGen.__dayFmt
00177
00178     lowTick = lowTime - (lowTime % step) + step
00179     values = []
00180     values.append( lowTick )
00181
00182     labels = []
00183     labels.append( time.strftime(tickFmt, time.localtime(lowTick)) )
00184     tick = lowTick
00185     tick += step
00186     while tick < highTime:
00187       values.append ( tick )
00188       labels.append ( time.strftime(tickFmt, time.localtime(tick)) )
00189       tick += step
00190
00191     self.plotter.setAutoTicksOnX( False )
00192     self.plotter.setTicksOnX( values, labels )
00193
00194     # REALLY REALLY don't do this:
00195     #   setLabel calls "notifyObservers", which brings us back here...
00196     # xlabel = time.strftime(TimeAxisGen.__labelFmt, time.localtime(highTime))
00197     # self.plotter.setLabel( 'x', xlabel )
00198
00199 def memget():
00200   import win32pdh
00201   hq = win32pdh.OpenQuery()
00202   # ch = win32pdh.AddCounter(hq, "\\\\gitow1\\Process(python)\\Private Bytes")
00203   ch = win32pdh.AddCounter(hq, "\\\\gitow1\\Process(python#1)\\Private Bytes")
00204   win32pdh.CollectQueryData(hq)
00205   type, val =win32pdh.GetFormattedCounterValue(ch,win32pdh.PDH_FMT_LONG)
00206   return val
00207
00208 def startup():
00209   # print memget()
00210   logging.basicConfig()
00211   logging.root.setLevel(logging.DEBUG)
00212
00213 def startQT(sqlDB, timeDepth, keyList, source):
00214   import sys
00215
00216   app=qt.QApplication(sys.argv)
00217   r=QtReceiver(sqlDB, timeDepth, keyList.keys())
00218   r.setSource(source)
00219
00220   gui=TrendPlotter(keyList, timeDepth/5)
00221   gui.connect(r,qt.PYSIGNAL('TrendUpdate(trendMap)'),gui.update)
00222
00223   app.connect(app,qt.SIGNAL("lastWindowClosed()"),
00224               app,qt.SLOT("quit()"))
00225
00226   app.setMainWidget(gui)
00227   gui.show()
00228
00229   r.setReceiving(1)
00230   app.exec_loop()
00231   r.shutdown()
00232
00233 def usage():
00234   return """
00235
00236 HskGuiReceiver Usage:
00237
00238 Mandatory options:
00239 --sqlDB  Database name that contains hsk data (Probably 'itosdb')
00240 --host   Host on which the sqlDB lives
00241 --source machine id whose data will be displayed.  (Same as in runid.cfg)
00242
00243 Optional options:
00244 --timeDepth define the time depth of the housekeeping plots.  Default is 2 hours.
00245             Units are in seconds
00246 --keyFile   define the file of variables to plot
00247             Note: keyFile format is "KEY  :  Plot title"
00248
00249 Example:
00250 $ HskGuiReceiver --dataFile c:\TEMP\lat-elf11.dat --timeDepth 3600 --keyFile keys.dat
00251
00252 """
00253
00254
00255 if __name__ == '__main__':
00256   startup()
00257
00258   # Options, first list mandatory, second list optional
00259   options = Options(['sqlDB', 'host', 'source'], ['timeDepth', 'keyFile'])
00260   try:
00261     options.parse()
00262   except Exception, msg:
00263     options.usage()
00264     raise Exception, msg
00265
00266   if options.timeDepth is not None:
00267     timeDepth = int(options.timeDepth)
00268   else:
00269     timeDepth = 2*hour
00270
00271   if options.keyFile is not None:
00272     keyFile = options.keyFile
00273     from HskReceiver import parseKeyFile
00274     keyList = parseKeyFile(keyFile)
00275   else:  # really really basic set of histos.
00276     keyList = {'LHKADAB33V'   :'AEM DAQ board 3.3 V',
00277                'LHKAEMFR11T'  :'AEM Free board 11 Temp',
00278                'LHKADABTEMP'  :'AEM DAQ board Temp',
00279                'LHKAEMFR11V1' :'AEM Free 11 HV 1',
00280                'LHKAEMFR11V2' :'AEM Free 11 HV 2',
00281                'LHKAEMFR11VD' :'AEM Free 11 VDD',
00282                }
00283
00284   import MySQLdb
00285   sqlDb = MySQLdb.connect(db=options.sqlDB, user='itosdb', host=options.host)
00286
00287   startQT(sqlDb.cursor(), timeDepth, keyList, int(options.source))
00288
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlInterface.py Source File

monitoring

HskSqlInterface.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "10/07/04"
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import MySQLdb
00020 import logging
00021 import time
00022
00023 from LATTE.monitoring.Recorder     import Recorder
00024 from LATTE.monitoring.Receiver     import Receiver
00025 from LATTE.database.gHSK           import GHSK
00026 from LATTE.monitoring.TrendMaps    import GHSKTrendMap, makeSimpleMap
00027
00028 class HskSqlRecorder(Recorder):
00029   def __init__(self, ghsk, sqlCursor, source):
00030     Recorder.__init__(self)
00031     self.__ghsk     = ghsk
00032     self.__trendMap = GHSKTrendMap(ghsk)
00033     self.__database = sqlCursor
00034     self.__pad      = '   '
00035     self.log        = logging.getLogger('HskSqlRecorder')
00036     self.__mnemMap  = {}
00037     self.__makeMmap()
00038     self.__source   = source
00039
00040   def processTrends(self, trendables):
00041     if trendables is None: return
00042
00043     trendMap  = makeSimpleMap(trendables, self.__trendMap)
00044
00045     sqlCmd = ''
00046     sqlCmd += 'insert ignore into VALfields (MNEMID,USECS,SOURCE,VALUE) VALUES '
00047     dTime = trendMap['TimeStamp']
00048     for mnem in trendMap.keys():
00049       if mnem == 'TimeStamp': continue
00050       mnemid = self.__mnemMap[mnem]
00051       value  = trendMap[mnem]
00052       if value == None: # No value, insert Null into database
00053         sqlCmd += '(%d, %f, %d, NULL),' % (mnemid, dTime, self.__source)
00054       else:
00055         sqlCmd += '(%d, %f, %d, %f),' % (mnemid, dTime, self.__source, value)
00056
00057     sqlCmd = sqlCmd.strip(',')
00058     sqlCmd += ';'
00059     self.__database.execute(sqlCmd)
00060
00061   def __makeMmap(self):
00062     sqlCmd = 'select t.mnemid, t.mnem from tlmfields t;'
00063     self.__database.execute(sqlCmd)
00064     m = self.__database.fetchall()
00065     for mnemid, mnem in m:
00066       self.__mnemMap[mnem] = int(mnemid)
00067     # for k in self.__mnemMap.keys():
00068       # print k, self.__mnemMap[k]
00069
00070 class HskSqlReceiver(Receiver):
00071   def __init__(self, sqlCursor, timeDepth, trendList):
00072     Receiver.__init__(self)
00073     self.log     = logging.getLogger('HskSqlReceiver')
00074     self.__trendList = trendList
00075     self.__database  = sqlCursor
00076     self.__lastTime  = time.time() - timeDepth
00077     # self.__lastTime  = 1794 - timeDepth
00078     # self.__lastTime = 0
00079     self.__mnemMap  = {}
00080     self.__makeMmap()
00081     self.__source   = 000
00082
00083   def setSource(self, source):
00084     self.__source = source
00085
00086   def __makeMmap(self):
00087     sqlCmd = 'select t.mnemid, t.mnem from tlmfields t;'
00088     self.__database.execute(sqlCmd)
00089     m = self.__database.fetchall()
00090     for mnemid, mnem in m:
00091       self.__mnemMap[mnem] = int(mnemid)
00092     # for k in self.__mnemMap.keys():
00093       # print k, self.__mnemMap[k]
00094
00095   def receive(self):
00096     while True:
00097       alist = {}
00098       # loop once, getting the full set from the DB
00099       for mnem in self.__trendList:
00100         msg = "select v.usecs, v.value from valfields v where v.mnemid='%s' and v.usecs>%f and v.source=%d;" % (self.__mnemMap[mnem], self.__lastTime, self.__source)
00101         self.__database.execute(msg)
00102         alist[mnem] = self.__database.fetchall()
00103         # print len(alist[mnem]), alist[mnem], self.__lastTime
00104       # loop over the set and dispatch
00105       lt = 1E12
00106       timestamp = lt
00107       for mnem in self.__trendList:
00108         for i in range(len(alist[mnem])):
00109           # create a two item dict: timestamp, mnemonic
00110           timestamp, value = alist[mnem][i]
00111           # print timeValPair
00112           dispatchMap = {'TimeStamp':timestamp, mnem:value}
00113           # print "dispatching: ", i, mnem, dispatchMap
00114           self.dispatch(dispatchMap)
00115         if lt > timestamp: lt = timestamp
00116       if lt != 1E12: self.__lastTime = lt
00117       break
00118     # print "waiting for godot", self.__lastTime
00119     time.sleep(10)
00120
00121   def dispatch(self, trendMap):
00122     self.process(trendMap)
00123
00124   def process(self, dispatchMap):
00125     line = ''
00126     for item in dispatchMap:
00127       line += item + ":" + str(dispatchMap[item]) + "    "
00128     print line
00129
00130   def trendItem(self, item):
00131     if item in self.__trendList:
00132       return True
00133     else:
00134       return False
00135
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSqlSvr.py Source File

monitoring

HskSqlSvr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging as log
00020 import MySQLdb
00021
00022 # Hsk core code
00023 from LATTE.monitoring.HskRetriever import *
00024 from LATTE.monitoring.HskCollector import *
00025 from LATTE.monitoring.HskCli       import HskCli, HskHandler
00026
00027 # LATTE infrastructure
00028 from LATTE.client.gCmdCli          import CmdCli
00029 from LATTE.database.gLAT           import GLAT
00030 from LATTE.database.gHSK           import GHSK
00031 from LATTE.client.gOptions         import Options
00032
00033 latSchema = None
00034 hskSchema = None
00035 comSchema = None
00036 cmdServer = None
00037
00038 def startup():
00039   log.basicConfig()
00040   log.root.setLevel(log.DEBUG)
00041
00042
00043 def testCollector(sqlDB):
00044
00045   # set up command/housekeeping clients
00046   cmdCli = CmdCli()
00047   # hskCli = HskCli()
00048   # set up command/hsk connection handlers
00049   cmdHandler = HskHandler(cmdCli, cmdServer)
00050   # hskHandler = HskHandler(hskCli, cmdServer)
00051
00052   # set up LAT schema
00053   latDB = GLAT(cmdCli)
00054   latDB.readSchema(latSchema)
00055
00056   # set up HSK schema
00057   hskDB = GHSK(cmdCli)
00058   hskDB.readSchema(hskSchema)
00059   hskDB.applyConfig(None)
00060
00061   # set up CMD schema
00062   cmdDB = GLAT(cmdCli)
00063   cmdDB.readSchema(cmdSchema)
00064
00065   alarmSetup(hskDB, cmdDB)
00066
00067   collector = HskCollector(cmdCli)
00068   collector.setDelay(501)           # 5 second delay
00069
00070   from HskRetriever import HskLatRetriever
00071   firstRetriever = HskLatRetriever(latDB)
00072   collector.addRetriever("HSK", firstRetriever)
00073
00074   from LATTE.monitoring.HskRecorder import HskAlarmRecorder
00075   firstRecorder = HskAlarmRecorder(hskDB)
00076   collector.addRecorder(firstRecorder)
00077
00078   from LATTE.monitoring.HskSqlInterface import HskSqlRecorder
00079   secondRecorder = HskSqlRecorder(hskDB, sqlDB, source=1)
00080   collector.addRecorder(secondRecorder)
00081
00082
00083   log.info( "Collector delay: " + str(collector.getDelay()/10) + " seconds" )
00084   collector.setAcquiring(True)
00085
00086   from time import sleep
00087   try:
00088     while 1:
00089       sleep(.1)
00090   except Exception, e:
00091     collector.shutdown()
00092
00093   cmdHandler.disconnect()
00094   hskHandler.disconnect()
00095
00096
00097 def alarmSetup(hskDB, cmdDB):
00098   # Retrieve the global rule list for HSK
00099   ruleSet = hskDB.getRules()
00100   # print ruleSet
00101   # Access any of the rule objects and call clearAllActions() to clear actions.
00102   ruleSet.values()[0].clearAllActions()
00103
00104   # add some trivial yellow/red alarms
00105   from HskAlarms import yellowPrintMessage, redPrintMessage
00106   ruleSet['tempMonitor'].registerAction('yellowAction', yellowPrintMessage)
00107   # ruleSet['tempMonitor'].registerAction('redAction',    redPrintMessage)
00108
00109 def usage():
00110   return """
00111
00112 HskSvr Usage:
00113
00114 Mandatory options:
00115 --server    specify the hostname or the IP address of the teststand crate
00116             to connect to.
00117 --latSchema specify the LAT schema file that defines the detector.
00118 --hskSchema specify the Housekeeping schema file to load.
00119
00120 Optional options:
00121 --cmdSchema specify the LAT schema file to be used for commanding.
00122             Default is to use latSchema
00123
00124 Example:
00125 $ HskSvr --server lat-elf1 --latSchema LAT.xml  --hskSchema HSK.xml  --cmdSchema LAT.xml
00126
00127 """
00128
00129 if __name__ == '__main__':
00130
00131   startup()
00132
00133   # Options, first list mandatory, second list optional
00134   options = Options(['server', 'latSchema', 'hskSchema', 'sqlHost'],
00135                     ['cmdSchema',])
00136   try:
00137     options.parse()
00138   except Exception, msg:
00139     options.usage(usage())
00140     raise Exception, msg
00141
00142   cmdServer = options.server
00143   latSchema = options.latSchema
00144   hskSchema = options.hskSchema
00145   if options.cmdSchema is not None:
00146     cmdSchema = options.cmdSchema
00147   else:
00148     cmdSchema = latSchema
00149
00150   sqlDb = MySQLdb.connect(host=options.sqlHost, db='itosdb', user='itosdb')
00151
00152   testCollector(sqlDb.cursor())
00153
00154
00155
00156
00157
00158
00159
00160
00161
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskSvr.py Source File

monitoring

HskSvr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.9 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging as log
00020
00021 # Hsk core code
00022 from LATTE.monitoring.HskCollector import *
00023 from LATTE.client.gOptions         import Options
00024
00025 def HskStartup(cfgFile):
00026   log.basicConfig()
00027   log.root.setLevel(log.DEBUG)
00028
00029   # get the configuration and verify that it's consistent
00030   config = HskConfiguration()
00031   config.read(cfgFile)
00032   config.verify()
00033
00034   return config
00035
00036 def alarmSetup(hskDB, cmdDB):
00037   # Retrieve the global rule list for HSK
00038   ruleSet = hskDB.getRules()
00039   # print ruleSet
00040   # Access any of the rule objects and call clearAllActions() to clear actions.
00041   ruleSet.values()[0].clearAllActions()
00042
00043   # add some trivial yellow/red alarms
00044   from HskAlarms import yellowPrintMessage, redPrintMessage
00045   ruleSet['tempMonitor'].registerAction('yellowAction', yellowPrintMessage)
00046   # ruleSet['tempMonitor'].registerAction('redAction',    redPrintMessage)
00047
00048 def usage():
00049   return """
00050
00051 HskSvr Usage:
00052
00053 Mandatory options:
00054 --config    specify the configuration file to read
00055
00056 Example:
00057 $ HskSvr --config hskConfig.cfg
00058
00059 """
00060
00061 if __name__ == '__main__':
00062
00063   # Options, first list mandatory, second list optional
00064   options = Options(['config'])
00065   try:
00066     options.parse()
00067   except Exception, msg:
00068     options.usage(usage())
00069     raise Exception, msg
00070
00071   # parse config file
00072   config = HskStartup(options.config)
00073
00074   # build the collector from the config
00075   collector = HskCollector(config)
00076   alarmSetup(collector.hskDB(), collector.latDB())
00077
00078   # turn it on
00079   collector.setAcquiring(True)
00080
00081   # wait for control-c
00082   from time import sleep
00083   try:
00084     while 1:
00085       sleep(.1)
00086   except Exception, e:
00087     collector.shutdown()
00088
00089
00090
00091
00092
00093
00094
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: HskTestSvr.py Source File

monitoring

HskTestSvr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging
00020
00021 from LATTE.monitoring              import *
00022 from LATTE.client.gCmdCli          import CmdCli
00023 from LATTE.database.gLAT           import GLAT
00024 from LATTE.database.gHSK           import GHSK
00025 from HskCollector import *
00026 from HskRetriever import *
00027
00028
00029 latSchema = "c:/panetta/LATTE/repos/hskAEM.xml"
00030 hskSchema = "c:/panetta/LATTE/repos/hskTestSchema.xml"
00031 dataFile  = "c:/TEMP/database.txt"
00032 udpServerName='testTrendingServer'
00033 udpServerAddr='54320@239.255.1.14'
00034
00035
00036 def testCollector():
00037   logging.basicConfig()
00038   logging.root.setLevel(logging.DEBUG)
00039
00040   cmdCli = CmdCli()
00041   cmdCli.connect("localhost")
00042
00043   collector = HskCollector(cmdCli)
00044
00045   # set up LAT schema
00046   latDB = GLAT(cmdCli)
00047   latDB.readSchema(latSchema)
00048
00049   # set up HSK schema
00050   hskDB = GHSK(cmdCli)
00051   hskDB.readSchema(hskSchema)
00052   hskDB.applyConfig(None)
00053
00054   from HskRetriever import HskLatRetriever
00055   firstRetriever = HskLatRetriever(latDB)
00056   collector.addRetriever("HSK", firstRetriever)
00057
00058   from LATTE.monitoring.HskRecorder import HskAlarmRecorder
00059   firstRecorder = HskAlarmRecorder(hskDB)
00060   collector.addRecorder(firstRecorder)
00061
00062   from LATTE.monitoring.HskRecorder import HskFileRecorder
00063   secondRecorder = HskFileRecorder(hskDB, dataFile)
00064   collector.addRecorder(secondRecorder)
00065
00066   from LATTE.monitoring.Recorder import UDPRecorder
00067   thirdRecorder=UDPRecorder()
00068   thirdRecorder.startUDPServer(udpServerName,udpServerAddr)
00069   collector.addRecorder(thirdRecorder)
00070
00071   # from LATTE.monitoring.HskRecorder import HskAlarmRecorder
00072   # thirdRecorder = HskAlarmRecorder(hskDB)
00073   # collector.addRecorder(thirdRecorder)
00074
00075   print "Collector delay: ", collector.getDelay()/10, " seconds"
00076   collector.setAcquiring(True)
00077
00078   from time import sleep
00079   try:
00080     while 1:
00081       sleep(.1)
00082   except Exception, e:
00083     collector.shutdown()
00084
00085
00086
00087
00088
00089
00090
00091
00092 if __name__ == '__main__':
00093   testCollector()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestAppEvt.py Source File

tests / apps

hTestAppEvt.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example TKR test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 import threading
00022 import sys
00023
00024 from   LATTE.runcontrol.rcTransitions import rcTransitions
00025 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00026
00027 from   sihippo       import *
00028 import logging       as     log
00029 import                      time
00030
00031 import LDF
00032
00033 from support.SimpleGasuExample   import *
00034 from support.MiniGLTExample      import *
00035
00036
00037 def _unsigned(arg):
00038   """\brief Convert an unsigned int argument to an unsigned long
00039
00040   This funtion exists to help format unsigned ints greater than 0x7fffffff,
00041   which in Python 2.4 and up will be displayed as signed strings.
00042   """
00043   return arg & (2L * sys.maxint + 1)
00044
00045
00046 class myTKRcontributionIterator(LDF.TKRcontributionIterator):
00047   def __init__(self, hists):
00048     LDF.TKRcontributionIterator.__init__(self)
00049     self.__hists = hists
00050
00051   def strip(self, tower, layerEnd, hit):
00052     self.__hists[0].addRow([hit])
00053
00054   def TOT(self, tower, layerEnd, tot):
00055     self.__hists[1].addRow([tot])
00056
00057 class myLATcomponentIterator(LDF.LATcomponentIterator):
00058   def __init__(self, hists):
00059     LDF.LATcomponentIterator.__init__(self)
00060     self.__tkrIterator = myTKRcontributionIterator(hists)
00061
00062   def CALcomponent(self, event, calContribution):
00063     return 0
00064
00065   def TKRcomponent(self, event, contribution):
00066     self.__tkrIterator.iterateStrips(event, contribution)
00067     self.__tkrIterator.iterateTOTs(contribution)
00068
00069     return 0
00070
00071
00072 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00073 #  the userApplication example to get the number of self triggers to take.
00074 class userArgument(ArgumentImpl):
00075   "GUI for getting the user to input some sort of value."
00076   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00077     ArgumentImpl.__init__(self, parent, name, modal, fl)
00078     self.__value = 0
00079     self.setCaption("Hello world!")
00080
00081   def OKButtonClicked(self):
00082     self.__value = int(self.ArgumentList.text().latin1())
00083     self.close()
00084
00085   def getValue(self, caption):
00086     self.setCaption(caption)
00087     self.show()
00088     self.exec_loop()
00089     return self.__value
00090
00091 class userArgText(object):
00092   "Text user interface for getting the user to input some sort of value"
00093   def __init__(self):
00094     pass
00095
00096   def getValue(self, caption):
00097     return int(raw_input("%s: " % (caption)))
00098
00099
00100 #  Example application implementation.
00101 #  Note that the name of the class must be userApplication.
00102 #  Look at rcTransitions for names of other transition methods that can be used.
00103 class userApplication(rcTransitions):
00104   "Implmentation class for a user application"
00105   def __init__(self, gui, userId, debug):
00106     rcTransitions.__init__(self, gui, userId, debug)
00107     print "userApplication.__init__()"
00108     self.__eventSem    = threading.Semaphore(0)
00109     self.__cmdSynchSem = threading.Semaphore(0)
00110
00111     self.gui.execGUImethod(self.__initHippo)
00112
00113     self.__lci         = myLATcomponentIterator(self.__hists)
00114     self.__ldbi        = LDF.LATdataBufferIterator(self.__lci)
00115
00116
00117   def getName(self):
00118     return "hTestAppEvt"
00119
00120   def setup(self):
00121     print "userApplication.setup()"
00122
00123     if self.rc is None:
00124       self.__arg = userArgText()
00125     else:
00126       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00127
00128     tem = self.lat.downTEM(0)
00129
00130     # reset the TEM since we are going to modify DATA_MASKS
00131     #tem.CMD_RESET = 1
00132
00133     #
00134     # Configure TEM
00135     #
00136     # TEM config reg # set TEM timeout
00137     tem.CONFIGURATION = 0
00138
00139     # enable TKR, no diag #  0x1F00 for diag
00140     # enable GTCC 2 and 3
00141     tem.DATA_MASKS = 0x00F3
00142
00143     ccc = tem.allCCC()
00144     # enable output in our GCCCs
00145     # broadcast load of GCCC_REG_CONFIGURATION
00146     ccc.CONFIGURATION = 0x80000000L
00147
00148     #  disable all GCRCs in all GCCCs via broadcast
00149     ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00150     ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00151
00152     # config TEM TKR calstrobe delay for ~ 5usec
00153     tem.TKR_TRGSEQ = 0x3C
00154
00155     tcc = tem.allTCC()
00156
00157     # broadcast load of GTCC_REG_CONFIGURATION
00158     # enable controller output and set cable length to 1
00159     # 0xC0000000 is for one layer
00160     # 0x80000000 is for two layers
00161     tcc.CONFIGURATION = 0xC0000000L
00162     x_tcc = tem.downTCC(0)
00163     # enable all masks
00164     tcc.INPUT_MASK = 0x0
00165
00166     # set maximum event timeout
00167     tcc.EVENT_TIMEOUTS = 0x0003FFF
00168
00169     #
00170     # Configure GTRCs
00171     #
00172
00173     # our board is connected CC = 2, RC = 0 and CC = 3, RC = 0
00174     # reset GTRC # required before all triggers
00175
00176     trc = tcc.allTRC()
00177
00178     trc.CMD_RESET = 1
00179
00180     # number of GTFE to readout left
00181     nGTFEsLeft  = 7
00182     nGTFEsRight = 0
00183
00184     # max hits per GTRC # 31 max
00185     maxHits = 31
00186
00187     enMask  = 0x6
00188
00189     dLO = (enMask << 28) | ((nGTFEsRight << 7)& 0xF80) | (maxHits & 0x7F);
00190     print "dLO=", dLO, hex(dLO)
00191
00192     # cable controller 2, readout controller 0
00193     tcc = tem.downTCC(2)
00194     trc = tcc.downTRC(0)
00195
00196     trc.CSR = dLO
00197
00198     dLO = (enMask << 28) | ((nGTFEsLeft << 7)& 0xF80) | (maxHits & 0x7F);
00199     print "dLO=", dLO, hex(dLO)
00200
00201     # cable controller 3, readout controller 0
00202     tcc = tem.downTCC(3)
00203     trc = tcc.downTRC(0)
00204
00205     trc.CSR = dLO
00206
00207     #
00208     # Configure GTFEs
00209     #
00210
00211     tfe = trc.allTFE()
00212     tfe.TRIG_MASK = 0x0
00213     tfe.DATA_MASK = 0x0
00214     tfe.CALIB_MASK = 0x0
00215     tfe.DAC = 0x00001902
00216     # configure front ends # all listen to left
00217     tfe.MODE = 0
00218     #tfe = trc.downTFE(0)
00219
00220     # configure default DACs for threshold and calibration
00221     # Calibration DAC Range and Resolution
00222     # Low Range (B6=0):  DAC output voltage in mV = 1.57 + 1.53*DAC_Value
00223     # High Range (B6=1): DAC output voltage in mV = 15.0 + 14.6*DAC_Value
00224     # Discriminator Threshold DAC Range and Resolution
00225     # Low Range (B6=0):  DAC output voltage in mV = 4.5 + 4.5*DAC_Value
00226     # High Range (B6=1): DAC output voltage in mV = 12.9 + 12.9*DAC_Value
00227
00228
00229     # calRng = 1
00230     # thrRng = 0
00231     # calDAC = 60
00232     # thrDAC = 10
00233
00234     tfe.DAC = 0x00001952  # based on the above Rng and DAC values
00235
00236     # enable GTFE for data taking # all channels
00237     tfe.TRIG_MASK = 0xffffffffffffffff
00238     tfe.DATA_MASK = 0xffffffffffffffff
00239
00240     # Cal strobe channels 4 and 48 only
00241     tfe.CALIB_MASK = 0x0001000000000010
00242
00243     #~ #Mask of the following Registers
00244     #~ tfe = trc.downTFE(13)
00245     #~ tfe.DATA_MASK = 0x0L
00246     #~ tfe.CALIB_MASK = 0x0L
00247     #~ tfe.TRIG_MASK = 0x0L
00248
00249     #~ tfe = trc.downTFE(14)
00250     #~ tfe.DATA_MASK = 0x0L
00251     #~ tfe.CALIB_MASK = 0x0L
00252     #~ tfe.TRIG_MASK = 0x0L
00253
00254     #~ tfe = trc.downTFE(19)
00255     #~ #tfe.DATA_MASK = 0x0L
00256     #~ tfe.CALIB_MASK = 0x0L
00257     #~ tfe.TRIG_MASK = 0x0L
00258
00259     #~ tfe = trc.downTFE(20)
00260     #~ #tfe.DATA_MASK = 0x0L
00261     #~ tfe.CALIB_MASK = 0x0L
00262     #~ tfe.TRIG_MASK = 0x0L
00263
00264     # Two choices for the trigger, GEM and MiniGLT
00265     if self.lat.existsGEM():
00266       self.trigger( SimpleGasuExample() )
00267     else:
00268       self.trigger( MiniGLTExample() )
00269
00270     # A state transition can be rejected by not returning None
00271     return None
00272
00273   def startRun(self):
00274     log.debug("userApplication.startRun()")
00275
00276     caption = "Enter number of triggers to take"
00277     if self.gui is None:
00278       cnt = self.__arg.getValue(caption)
00279     else:
00280       cnt = self.gui.execGUImethod(self.__arg.getValue, caption)
00281       # Allow the C++ object to be deleted
00282       self.__arg.deleteLater()
00283
00284     # The user pressed 'Cancel'
00285     if cnt is None:  return -1
00286     self.__cnt = cnt
00287
00288     self.gui.execGUImethod(self.__initPlots)
00289     self.__cmdSynchQuit = False
00290
00291     # A state transition can be rejected by not returning None
00292     return None
00293
00294   def stopRun(self):
00295     self.setCompletionStatus(self.COMPL_STATUS_SUCCESS)
00296     self.__cmdSynchQuit = True
00297     self.__eventSem.release()
00298
00299     # The STOP_RUN transition can not be rejected
00300
00301   def resume(self):
00302     # Issue self trigger to make up for the one that was lost during PAUSE
00303     self.trigger().solicit()
00304
00305     return None
00306
00307   def stop (self):
00308     return self.stopRun()
00309
00310   def process(self, (status, buffer)):
00311     "Method called back for each data event taken"
00312     ##log.debug("userApplication.process()")
00313
00314     evtCli = self.evtCli
00315
00316     if status != 0:
00317       if evtCli.isGGLTStatus():
00318         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00319       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00320         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00321       self.__eventSem.release()
00322       return
00323     try:
00324       # In the future this event may contain additional data
00325       if evtCli.isSweepEvent(): return
00326     except:
00327       # Event summary word inaccessible, handle the bad event here
00328       log.exception("")
00329       return
00330
00331     self.__ldbi.iterate(buffer, len(buffer))
00332
00333     self.__hists[2].addRow([evtCli.getEvtSize()])  #event.length()])
00334
00335     # Get next event triggered
00336     self.__eventSem.release()
00337
00338
00339   def commandSynch(self):
00340     "Method called by the command synchronization task"
00341     trigger  = self.trigger()
00342     eventSem = self.__eventSem
00343     t0  = time.time()
00344     cnt = 0
00345     count = self.__cnt
00346
00347     # Wait for START_RUN to enable triggers
00348     trigger.waitForMaskEnable()
00349
00350     while cnt < count and not self.__cmdSynchQuit:
00351       cnt = cnt + 1
00352       trigger.solicit()                 # Issue an internal trigger
00353       eventSem.acquire()                # Wait for the event to be processed
00354       time.sleep(.001)
00355
00356     wc = WindowController.instance()
00357     canvas = wc.currentCanvas()
00358     canvas.setIntervalEnabled ( 0 )
00359     dT = time.time() - t0
00360     if dT == 0.0:  dT = 0.000001
00361     print "%s processed %d events in %.3f seconds = %.1f events/second" % \
00362           (self.getName(), cnt, dT, self.evtCnt/dT)
00363
00364     # Get out of waiting when in suite or standalone mode
00365     self.sync()
00366
00367     # execute the GUI functions for stopRun, just in case
00368     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00369       if self.rc is not None:
00370         self.rc.doStop()
00371
00372   def wait(self):
00373     self.__cmdSynchSem.acquire()
00374
00375   def sync(self):
00376     if __name__ == "__main__" or self.isRunFromSuite():
00377       self.__cmdSynchSem.release()
00378
00379   def __initHippo(self):
00380     self.__label  = [0, 0, 0]
00381     self.__label[0] = ['Strip Hits']
00382     self.__label[1] = ['TOTs']
00383     self.__label[2] = ['Event Size']
00384     ntc = NTupleController.instance()
00385     self.__hists  = [0, 0, 0]
00386     self.__hists[0] = ntc.createNTuple(1)
00387     self.__hists[1] = ntc.createNTuple(1)
00388     self.__hists[2] = ntc.createNTuple(1)
00389     self.__hists[0].setTitle('TKR Event Strip Readout')
00390     self.__hists[1].setTitle('TKR Event TOT Readout')
00391     self.__hists[2].setTitle('Event length')
00392     self.__hists[0].setLabels(self.__label[0])
00393     self.__hists[1].setLabels(self.__label[1])
00394     self.__hists[2].setLabels(self.__label[2])
00395     if __name__ == "__main__":
00396 ##       app = HDApp()
00397 ##       canvas = app.canvas()
00398       app = QApplication ( sys.argv )
00399       canvas = CanvasWindow()
00400       canvas.show()
00401     else:
00402       wc = WindowController.instance()
00403       canvas = wc.currentCanvas()
00404 ##  already done by main applicaton:    canvas.show()
00405 ##     ntuple_list = [0.0]
00406 ##     self.__nt.addRow(ntuple_list)
00407 ##    self.__nt2.addRow(ntuple_list)
00408
00409 ## see new way below
00410 ##     hist = Display('Histogram',self.__nt,'Strip Hits')
00411 ##     hist2 = Display('Histogram',self.__nt2,'Event
00412
00413   def __initPlots(self):
00414     wc = WindowController.instance()
00415     canvas = wc.currentCanvas()
00416     canvas.clear()
00417     self.__hists[0].clear()
00418     self.__hists[1].clear()
00419     self.__hists[2].clear()
00420     dc = DisplayController.instance()
00421     hist1 = dc.createDisplay ( 'Histogram', self.__hists[0], self.__label[0] )
00422     hist2 = dc.createDisplay ( 'Histogram', self.__hists[1], self.__label[1] )
00423     hist3 = dc.createDisplay ( 'Histogram', self.__hists[2], self.__label[2] )
00424     canvas.addDisplay(hist1)
00425     canvas.addDisplay(hist2)
00426     canvas.addDisplay(hist3)
00427     self.__hists[0].setIntervalCount ( 2000 )
00428     self.__hists[1].setIntervalCount ( 1000 )
00429     self.__hists[2].setIntervalCount ( 400 )
00430     canvas.setIntervalEnabled ( 0 )
00431     canvas.show()
00432     canvas.setIntervalEnabled ( 1 )
00433
00434 #Standalone mode:
00435 if __name__ == "__main__":
00436   import sys
00437   from qt import *
00438   from sihippo import *
00439
00440   ua = userApplication(None, 321, 0)
00441   ua.rcSetup('../repos/simpleTemSchema.xml')
00442   ua.rcStartRun()
00443   ua.wait()
00444   ua.rcStopRun()
00445   ua.rcTeardown()
00446   raw_input("Press any key to end")
00447
00448 # History:
00449 #     $Log: hTestAppEvt.py,v $
00450 #     Revision 1.3.2.1  2005/01/22 01:10:59  stuvi
00451 #     Commented out the TEM reset.
00452 #
00453 #     Revision 1.3  2004/10/22 20:32:48  stuvi
00454 #     Fixed log.exception()
00455 #
00456 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00457 #     Updated for LATTE 4.
00458 #     All hippo functions go through the Qt GUI bridge now.
00459 #
00460 #     Revision 1.1  2004/08/07 02:14:33  stuvi
00461 #     no message
00462 #
00463 #     Revision 1.8  2004/07/15 22:58:35  stuvi
00464 #     Added waitForMaskEnable
00465 #
00466 #     Revision 1.7  2004/05/03 21:19:46  stuvi
00467 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00468 #
00469 #     Revision 1.6  2004/04/17 02:22:17  stuvi
00470 #     Various Hippo related fixes
00471 #     Added teardown() to delete the C++ object for the userArgument
00472 #
00473 #     Revision 1.5  2004/04/08 03:16:44  stuvi
00474 #     Added canvas clearing.
00475 #
00476 #     Revision 1.4  2004/04/08 01:48:42  claus
00477 #     Reworked to work with LDF.
00478 #
00479 #     Revision 1.3  2004/04/07 22:20:51  stuvi
00480 #     no message
00481 #
00482 #     Revision 1.2  2004/03/10 22:24:50  panetta
00483 #     Upgraded trigger interface.
00484 #     Removed dependencies on self.glt.
00485 #
00486 #     Revision 1.1  2004/01/30 04:39:53  claus
00487 #     Test application to histogram data from EBF events.
00488 #     This is not yet working.
00489 #
00490 #     Revision 1.9  2003/01/12 19:45:41  pfkeb
00491 #     Move interval counting to ntuple
00492 #
00493 #     Revision 1.8  2003/01/08 00:22:21  pfkeb
00494 #     New interface to NTupleController
00495 #
00496 #     Revision 1.7  2003/01/06 23:57:21  claus
00497 #     Merged Ric's changes with Paul's
00498 #
00499 #     Revision 1.6  2003/01/05 00:18:50  pfkeb
00500 #     Make use of new HippoDraw features
00501 #
00502 #     Revision 1.5  2002/12/23 19:00:25  pfkeb
00503 #     Add HippoDraw to RunControl
00504 #
00505 #     Revision 1.4  2002/12/19 19:59:52  claus
00506 #     Mods for Hippo
00507 #
00508 #     Revision 1.3  2002/12/11 21:18:07  stuvi
00509 #     Changed glt register assignments to bit field assignments
00510 #
00511 #     Revision 1.2  2002/12/10 02:42:03  stuvi
00512 #     Put the event size plotting outside the tracker strip look
00513 #
00514 #     Revision 1.1  2002/12/10 00:59:16  stuvi
00515 #     Runcontrol example that uses Hippo. Currently it doesn't work in GUI mode.
00516 #
00517 #     Revision 1.4  2002/12/02 17:17:09  claus
00518 #     Added provision to allow application to run stand-alone
00519 #
00520 #     Revision 1.3  2002/11/28 02:02:04  claus
00521 #     Shuffled constructor arguments
00522 #
00523 #     Revision 1.2  2002/11/27 23:49:27  claus
00524 #     Initialize semaphore with zero count
00525 #
00526 #     Revision 1.1  2002/11/27 05:02:48  claus
00527 #     Initial version of Run Control
00528 #
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestAppTkr.py Source File

tests / apps

hTestAppTkr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example TKR test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import threading
00021 import sys
00022
00023 from   LATTE.runcontrol.rcTransitions import rcTransitions
00024 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00025
00026 from   sihippo       import *
00027 from   time          import sleep
00028 import logging       as     log
00029
00030 from support.SimpleGasuExample   import *
00031 from support.MiniGLTExample      import *
00032
00033 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00034 #  the userApplication example to get the number of self triggers to take.
00035 class userArgument(ArgumentImpl):
00036   "GUI for getting the user to input some sort of value."
00037   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00038     ArgumentImpl.__init__(self, parent, name, modal, fl)
00039     self.__value = 0
00040     self.setCaption("Hello world!")
00041
00042   def OKButtonClicked(self):
00043     self.__value = int(self.ArgumentList.text().latin1())
00044     self.close()
00045
00046   def CancelButtonClicked(self):
00047     self.__value = None
00048     self.close()
00049
00050   def getValue(self, caption):
00051     self.setCaption(caption)
00052     self.show()
00053     self.exec_loop()
00054     return self.__value
00055
00056 class userArgText(object):
00057   "Text user interface for getting the user to input some sort of value"
00058   def __init__(self):
00059     pass
00060
00061   def getValue(self, caption):
00062     return int(raw_input("%s: " % (caption)))
00063
00064
00065 #  Example application implementation.
00066 #  Note that the name of the class must be userApplication.
00067 #  Look at rcTransitions for names of other transition methods that can be used.
00068 class userApplication(rcTransitions):
00069   "Implmentation class for a user application"
00070   def __init__(self, gui, userId, debug):
00071     rcTransitions.__init__(self, gui, userId, debug)
00072     log.debug("userApplication.__init__()")
00073     self.__eventSem    = threading.Semaphore(0)
00074     self.__cmdSynchSem = threading.Semaphore(0)
00075
00076   def getName(self):
00077     return __name__
00078
00079   def setup(self):
00080     log.debug("userApplication.setup()")
00081
00082     if self.gui is None:
00083       self.__arg = userArgText()
00084     else:
00085       self.__arg = self.gui.createGUI(userArgument, self.gui, 'test1', 1)
00086
00087     self.gui.execGUImethod(self.__initHippo)
00088
00089     tem = self.lat.downTEM(0)
00090
00091     # reset the TEM since we are going to modify DATA_MASKS
00092     #tem.CMD_RESET = 1
00093
00094     # Configure TEM
00095     #
00096     # TEM config reg # set TEM timeout
00097     tem.CONFIGURATION = 0
00098
00099     # enable TKR, no diag #  0x1FF3 for diag
00100     # enable GTCC 2 and 3
00101     tem.DATA_MASKS = 0x00F3
00102
00103     ccc = tem.allCCC()
00104     # enable output in our GCCCs
00105     # broadcast load of GCCC_REG_CONFIGURATION
00106     ccc.CONFIGURATION = 0x80000000L
00107
00108     #  disable all GCRCs in all GCCCs via broadcast
00109     ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00110     ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00111
00112     # config TEM TKR calstrobe delay for ~ 5usec
00113     tem.TKR_TRGSEQ = 0x3C
00114
00115     tcc = tem.allTCC()
00116
00117     # broadcast load of GTCC_REG_CONFIGURATION
00118     # enable controller output and set cable length to 1
00119     # 0xC0000000 is for one layer
00120     # 0x80000000 is for two layers
00121     tcc.CONFIGURATION = 0xC0000000L
00122
00123     # enable all masks
00124     tcc.INPUT_MASK = 0x0
00125
00126     # set maximum event timeout
00127     tcc.EVENT_TIMEOUTS = 0x03F
00128
00129     #
00130     # Configure GTRCs
00131     #
00132
00133     # our board is connected CC = 2, RC = 0 and CC = 3, RC = 0
00134     # reset GTRC # required before all triggers
00135
00136     trc = tcc.allTRC()
00137
00138     trc.CMD_RESET = 1
00139
00140     # number of GTFE to readout left
00141     nGTFEsLeft  = 7
00142     nGTFEsRight = 0
00143
00144     # max hits per GTRC # 31 max
00145     maxHits = 31
00146
00147     enMask  = 0x6
00148
00149     dLO = (enMask << 28) | ((nGTFEsRight << 7)& 0xF80) | (maxHits & 0x7F);
00150     log.debug("dLO= %d %s" % (dLO, hex(dLO)))
00151
00152     # cable controller 2, readout controller 0
00153     tcc = tem.downTCC(2)
00154     trc = tcc.downTRC(0)
00155
00156     trc.CSR = dLO
00157
00158     dLO = (enMask << 28) | ((nGTFEsLeft << 7)& 0xF80) | (maxHits & 0x7F);
00159     log.debug("dLO= %d %s" % (dLO, hex(dLO)))
00160
00161     # cable controller 3, readout controller 0
00162     tcc = tem.downTCC(3)
00163     trc = tcc.downTRC(0)
00164
00165     trc.CSR = dLO
00166
00167     #
00168     # Configure GTFEs
00169     #
00170
00171     tfe = trc.allTFE()
00172     tfe.TRIG_MASK = 0x0
00173     tfe.DATA_MASK = 0x0
00174     tfe.CALIB_MASK = 0x0
00175     #tfe.DAC = 0x00001902
00176     tfe.DAC = 0x00000000
00177     # configure front ends # all listen to left
00178     tfe.MODE = 0
00179     #tfe = trc.downTFE(0)
00180
00181     # configure default DACs for threshold and calibration
00182     # Calibration DAC Range and Resolution
00183     # Low Range (B6=0):  DAC output voltage in mV = 1.57 + 1.53*DAC_Value
00184     # High Range (B6=1): DAC output voltage in mV = 15.0 + 14.6*DAC_Value
00185     # Discriminator Threshold DAC Range and Resolution
00186     # Low Range (B6=0):  DAC output voltage in mV = 4.5 + 4.5*DAC_Value
00187     # High Range (B6=1): DAC output voltage in mV = 12.9 + 12.9*DAC_Value
00188
00189
00190     # calRng = 1
00191     # thrRng = 0
00192     # calDAC = 60
00193     # thrDAC = 10
00194
00195     #tfe.DAC = 0x00001952  # based on the above Rng and DAC values
00196     tfe.DAC = 0x00000000
00197
00198     # enable GTFE for data taking # all channels
00199     tfe.TRIG_MASK = 0xffffffffffffffff
00200     tfe.DATA_MASK = 0xffffffffffffffff
00201
00202     # Cal strobe channels 4 and 48 only
00203     tfe.CALIB_MASK = 0x0001000000000010
00204
00205     #~ #Mask of the following Registers
00206     #~ tfe = trc.downTFE(13)
00207     #~ tfe.DATA_MASK = 0x0L
00208     #~ tfe.CALIB_MASK = 0x0L
00209     #~ tfe.TRIG_MASK = 0x0L
00210
00211     #~ tfe = trc.downTFE(14)
00212     #~ tfe.DATA_MASK = 0x0L
00213     #~ tfe.CALIB_MASK = 0x0L
00214     #~ tfe.TRIG_MASK = 0x0L
00215
00216     #~ tfe = trc.downTFE(19)
00217     #~ #tfe.DATA_MASK = 0x0L
00218     #~ tfe.CALIB_MASK = 0x0L
00219     #~ tfe.TRIG_MASK = 0x0L
00220
00221     #~ tfe = trc.downTFE(20)
00222     #~ #tfe.DATA_MASK = 0x0L
00223     #~ tfe.CALIB_MASK = 0x0L
00224     #~ tfe.TRIG_MASK = 0x0L
00225
00226     # Two choices for the trigger, GEM and MiniGLT
00227     if self.lat.existsGEM():
00228       self.trigger( SimpleGasuExample() )
00229     else:
00230       self.trigger( MiniGLTExample() )
00231
00232     # A state transition can be rejected by not returning None
00233     return None
00234
00235   def startRun(self):
00236     log.debug("userApplication.startRun()")
00237
00238     caption = "Enter number of triggers to take"
00239     if self.gui is None:
00240       cnt = self.__arg.getValue(caption)
00241     else:
00242       cnt = self.gui.execGUImethod(self.__arg.getValue, caption)
00243
00244     # The user pressed 'Cancel'
00245     if cnt is None:  return -1
00246     self.__cnt = cnt
00247     self.gui.execGUImethod(self.__initPlots)
00248
00249     # Spawn a thread to synchronize commands with events
00250     self.__cmdSynchQuit = False
00251
00252     # A state transition can be rejected by not returning None
00253     return None
00254
00255   def stopRun(self):
00256     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00257     self.__cmdSynchQuit = True
00258     self.__eventSem.release()
00259     # The STOP_RUN transition can not be rejected
00260
00261   def resume(self):
00262     # Issue self trigger to make up for the one that was lost during PAUSE
00263     self.trigger().solicit()
00264     return None
00265
00266   def stop (self):
00267     return self.stopRun()
00268
00269   def teardown(self):
00270     log.debug("userApplication.teardown()")
00271     # Allow the C++ object to be deleted
00272     if self.gui is not None and self.__arg is not None:
00273       self.__arg.deleteLater()
00274
00275   def process(self, (status, buffer)):
00276     "Method called back for each data event taken"
00277     ###print "userApplication.process()"
00278
00279     evtCli = self.evtCli
00280
00281     if status != 0:
00282       if evtCli.isGGLTStatus():
00283         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00284       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00285         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00286       self.__eventSem.release()
00287       return
00288     try:
00289       # In the future this event may contain additional data
00290       if evtCli.isSweepEvent(): return
00291     except:
00292       # Event summary word inaccessible, handle the bad event here
00293       log.exception("")
00294       return
00295
00296     evtCli.evDumpTKR()
00297     for stripData in evtCli.evt.TKRstrips:
00298       self.__nt.addRow([stripData.strip.ui])
00299     self.__nt2.addRow([evtCli.getEvtSize()])
00300
00301     # Get next event triggered
00302     self.__eventSem.release()
00303
00304   def commandSynch(self):
00305     "Method called by the command synchronization task"
00306     import time
00307     trigger  = self.trigger()
00308     eventSem = self.__eventSem
00309     # Drain the semaphore release count
00310     # Handles the case when the stop run release collided with a trigger release
00311     while eventSem.acquire(0):  pass
00312
00313     t0  = time.time()
00314
00315     # Compensate for the extra CMD_SELF_TRIGGER below
00316     cnt = 1
00317     count = self.__cnt
00318
00319     # Wait for START_RUN to enable triggers
00320     trigger.waitForMaskEnable()
00321
00322     trigger.solicit()                   # Issue an internal trigger
00323     eventSem.acquire()                  # Wait for the event to be processed
00324
00325     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00326
00327     while cnt < count and not self.__cmdSynchQuit:
00328       cnt += 1
00329       trigger.solicit()                 # Issue an internal trigger
00330       eventSem.acquire()                # Wait for the event to be processed
00331       #trigger.disable()                # Disable GLT triggers
00332       # Do stuff
00333       #trigger.enable()                 # Enable GLT triggers
00334
00335     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00336     # When we get here the triggers should still be enabled.
00337     # If the glt.MASK needs to be set through any other means
00338     # then it needs to be restored to its SETUP value here.
00339
00340     if t1 is None:
00341       t1 = t0
00342     if t2 is None:
00343       t2 = time.time()
00344     dT = t2 - t1
00345     if dT == 0.0:  dT = 0.000001
00346     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00347              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00348
00349     # Get out of waiting when in standalone mode
00350     self.sync()
00351
00352     # execute the GUI functions for stopRun, just in case
00353     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00354       if self.gui is not None:
00355         self.gui.doStop()
00356
00357   def wait(self):
00358     self.__cmdSynchSem.acquire()
00359
00360   def sync(self):
00361     if __name__ == "__main__":
00362       self.__cmdSynchSem.release()
00363
00364
00365   def __initHippo(self):
00366     label1 = ['Strip Hits']
00367     label2 = ['Event Size']
00368     ntc = NTupleController.instance()
00369     self.__nt = ntc.createNTuple(1)
00370     self.__nt2 = ntc.createNTuple ( label2 )
00371     self.__nt.setTitle('Event Readout #1')
00372     self.__nt2.setTitle('Event Readout #2')
00373     self.__nt.setLabels(label1)
00374 #    self.__nt2.setLabels(label2)
00375     self.__nt.reserve ( 512 )
00376     self.__nt2.reserve ( 512 )
00377     if __name__ == "__main__":
00378 ##       app = HDApp()
00379 ##       canvas = app.canvas()
00380       self.__canvas = CanvasWindow()
00381       self.__canvas.show()
00382     else:
00383       wc = WindowController.instance()
00384       self.__canvas = wc.currentCanvas()
00385 ##  already done by main applicaton:    canvas.show()
00386 ##     ntuple_list = [0.0]
00387 ##     self.__nt.addRow(ntuple_list)
00388 ##    self.__nt2.addRow(ntuple_list)
00389
00390 ## see new way below
00391 ##     hist = Display('Histogram',self.__nt,'Strip Hits')
00392 ##     hist2 = Display('Histogram',self.__nt2,'Event
00393
00394   def __initPlots(self):
00395     label1 = ['Strip Hits']
00396     label2 = ['Event Size']
00397     self.__canvas.clear()
00398     self.__nt.clear()
00399     self.__nt2.clear()
00400     self.__nt.setIntervalCount ( 500 )
00401     self.__nt2.setIntervalCount ( 100 )
00402     dc = DisplayController.instance()
00403     self.__hist = dc.createDisplay ( 'Histogram', self.__nt, label1 )
00404     self.__hist2 = dc.createDisplay ( 'Histogram', self.__nt2, label2 )
00405     self.__canvas.addDisplay(self.__hist)
00406     self.__canvas.addDisplay(self.__hist2)
00407     self.__canvas.setIntervalEnabled ( 1 )
00408     self.__canvas.show()
00409
00410 # Standalone mode:
00411 if __name__ == "__main__":
00412   from qt import *
00413   app = QApplication ( sys.argv )
00414   ua = userApplication(None, 321, 0)
00415   ua.rcSetup('../repos/simpleTemSchema.xml')
00416   ua.rcStartRun()
00417   ua.wait()
00418   ua.rcStopRun()
00419   ua.rcTeardown()
00420   app.exec_loop()
00421
00422 # History:
00423 #     $Log: hTestAppTkr.py,v $
00424 #     Revision 1.3.2.1  2005/01/22 01:10:59  stuvi
00425 #     Commented out the TEM reset.
00426 #
00427 #     Revision 1.3  2004/10/22 20:32:48  stuvi
00428 #     Fixed log.exception()
00429 #
00430 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00431 #     Updated for LATTE 4.
00432 #     All hippo functions go through the Qt GUI bridge now.
00433 #
00434 #     Revision 1.1  2004/08/07 02:14:33  stuvi
00435 #     no message
00436 #
00437 #     Revision 1.16  2004/07/09 23:14:17  stuvi
00438 #     Added "operatorobj" preference that contains the rcUser object and left the "operator" preference to contain the user name.
00439 #
00440 #     Revision 1.15  2004/05/03 21:19:47  stuvi
00441 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00442 #
00443 #     Revision 1.14  2004/04/17 02:22:17  stuvi
00444 #     Various Hippo related fixes
00445 #     Added teardown() to delete the C++ object for the userArgument
00446 #
00447 #     Revision 1.13  2004/03/19 00:17:31  stuvi
00448 #     The plots are now cleared every time the test is run.
00449 #
00450 #     Revision 1.12  2004/03/10 22:24:50  panetta
00451 #     Upgraded trigger interface.
00452 #     Removed dependencies on self.glt.
00453 #
00454 #     Revision 1.11  2004/02/24 02:13:34  stuvi
00455 #     Changes for long transition support.
00456 #
00457 #     Revision 1.10  2003/11/04 18:30:52  panetta
00458 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00459 #
00460 #     Revision 1.9  2003/10/31 01:09:37  panetta
00461 #     1)  Moved register writes from startRun to setup
00462 #     2)  Added GLT enabling logic to __commandSynch
00463 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00464 #
00465 #     Revision 1.8  2003/07/17 00:01:35  stuvi
00466 #     no message
00467 #
00468 #     Revision 1.7  2003/06/13 23:26:24  stuvi
00469 #     Added TEM reset
00470 #
00471 #     Revision 1.6  2003/04/09 00:45:15  stuvi
00472 #     Commented out references to DATA_MASKS register which should not be touched during script execution.
00473 #
00474 #     Revision 1.5  2003/04/01 21:04:59  stuvi
00475 #     Fixed event count discrepancy when the run is stopped in the middle.
00476 #
00477 #     Revision 1.4  2003/03/31 19:28:53  stuvi
00478 #     Fixed name
00479 #
00480 #     Revision 1.3  2003/03/26 21:59:36  stuvi
00481 #     Fixed standalone mode
00482 #
00483 #     Revision 1.2  2003/03/25 04:52:40  stuvi
00484 #     Reduced event timeout value.
00485 #     Changed to no diags.
00486 #     Made sure the semaphores are drained
00487 #
00488 #     Revision 1.1  2003/03/11 21:20:54  stuvi
00489 #     Moved from RunControl directory
00490 #
00491 #     Revision 1.12  2003/02/06 05:23:15  claus
00492 #     Added resume; StopRun bug fix
00493 #
00494 #     Revision 1.11  2003/02/06 01:31:23  stuvi
00495 #     Added a delay in commandsnyc
00496 #
00497 #     Revision 1.10  2003/01/15 16:47:56  stuvi
00498 #     Delay the showing of canvas until the test app starts
00499 #
00500 #     Revision 1.9  2003/01/12 19:45:41  pfkeb
00501 #     Move interval counting to ntuple
00502 #
00503 #     Revision 1.8  2003/01/08 00:22:21  pfkeb
00504 #     New interface to NTupleController
00505 #
00506 #     Revision 1.7  2003/01/06 23:57:21  claus
00507 #     Merged Ric's changes with Paul's
00508 #
00509 #     Revision 1.6  2003/01/05 00:18:50  pfkeb
00510 #     Make use of new HippoDraw features
00511 #
00512 #     Revision 1.5  2002/12/23 19:00:25  pfkeb
00513 #     Add HippoDraw to RunControl
00514 #
00515 #     Revision 1.4  2002/12/19 19:59:52  claus
00516 #     Mods for Hippo
00517 #
00518 #     Revision 1.3  2002/12/11 21:18:07  stuvi
00519 #     Changed glt register assignments to bit field assignments
00520 #
00521 #     Revision 1.2  2002/12/10 02:42:03  stuvi
00522 #     Put the event size plotting outside the tracker strip look
00523 #
00524 #     Revision 1.1  2002/12/10 00:59:16  stuvi
00525 #     Runcontrol example that uses Hippo. Currently it doesn't work in GUI mode.
00526 #
00527 #     Revision 1.4  2002/12/02 17:17:09  claus
00528 #     Added provision to allow application to run stand-alone
00529 #
00530 #     Revision 1.3  2002/11/28 02:02:04  claus
00531 #     Shuffled constructor arguments
00532 #
00533 #     Revision 1.2  2002/11/27 23:49:27  claus
00534 #     Initialize semaphore with zero count
00535 #
00536 #     Revision 1.1  2002/11/27 05:02:48  claus
00537 #     Initial version of Run Control
00538 #
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestEnv.py Source File

tests / apps

hTestEnv.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example TKR test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 from   sihippo       import *
00021 from   time          import sleep, time
00022 import logging       as     log
00023
00024 from   LATTE.runcontrol.rcTransitions import rcTransitions
00025 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00026
00027 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00028 #  the userApplication example to get the number of self triggers to take.
00029 class userArgument(ArgumentImpl):
00030   "GUI for getting the user to input some sort of value."
00031   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00032     ArgumentImpl.__init__(self, parent, name, modal, fl)
00033     self.__value = 0
00034     self.setCaption("Hello world!")
00035
00036   def OKButtonClicked(self):
00037     self.__value = int(self.ArgumentList.text().latin1())
00038     self.close()
00039
00040   def CancelButtonClicked(self):
00041     self.__value = None
00042     self.close()
00043
00044   def getValue(self, caption):
00045     self.setCaption(caption)
00046     self.show()
00047     self.exec_loop()
00048     return self.__value
00049
00050 class userArgText(object):
00051   "Text user interface for getting the user to input some sort of value"
00052   def __init__(self):
00053     pass
00054
00055   def getValue(self, caption):
00056     return int(raw_input("%s: " % (caption)))
00057
00058
00059 #  Example application implementation.
00060 #  Note that the name of the class must be userApplication.
00061 #  Look at rcTransitions for names of other transition methods that can be used.
00062 class userApplication(rcTransitions):
00063   "Implmentation class for a user application"
00064   def __init__(self, gui, userId, debug):
00065     rcTransitions.__init__(self, gui, userId, debug)
00066     log.debug("userApplication.__init__()")
00067     self.__cmdSynchSem = threading.Semaphore(0)
00068
00069   def getName(self):
00070     return __name__
00071
00072   def setup(self):
00073     log.debug("userApplication.setup()")
00074     if self.gui is None:
00075       self.__arg = userArgText()
00076     else:
00077       self.__arg = self.gui.createGUI(userArgument, self.gui, 'test1', 1)
00078
00079     self.gui.execGUImethod(self.__initHippo)
00080
00081     # A state transition can be rejected by not returning None
00082     return None
00083
00084
00085   def startRun(self):
00086     log.debug("userApplication.startRun()")
00087     self.__cmdSynchQuit = False
00088     caption = "Enter number of data groups to read"
00089     if self.gui is None:
00090       cnt = self.__arg.getValue(caption)
00091     else:
00092       cnt = self.gui.execGUImethod(self.__arg.getValue, caption)
00093
00094     # The user pressed 'Cancel'
00095     if cnt is None:  return -1
00096     self.__cnt = cnt
00097
00098     self.gui.execGUImethod(self.__initPlots)
00099
00100     # A state transition can be rejected by not returning None
00101     return None
00102
00103   def stopRun(self):
00104     self.__cmdSynchQuit = True
00105
00106     # The STOP_RUN transition can not be rejected
00107
00108   def stop (self):
00109     return self.stopRun()
00110
00111   def teardown(self):
00112     log.debug("userApplication.teardown()")
00113     # Allow the C++ object to be deleted
00114     if self.gui is not None and self.__arg is not None:
00115       self.__arg.deleteLater()
00116
00117   def process(self, (status, buffer)):
00118     "Method called back for each data event taken"
00119     ###print "userApplication.process()"
00120
00121   #def __commandSynch(self, count):
00122   def commandSynch(self):
00123     "Method called by the command synchronization task"
00124     cnt = 0
00125     count = self.__cnt
00126     tic = self.lat.TEM[0].TIC
00127     while cnt < count and not self.__cmdSynchQuit:
00128       cnt = cnt + 1
00129       volts = tic.adc_tem_digital_3_3v
00130       amps = tic.adc_tem_digital_3_3i
00131       self.__nt.addRow([cnt, volts])
00132       self.__nt2.addRow([cnt, amps])
00133       sleep(.1)
00134
00135     # Get out of waiting when in standalone mode
00136     self.sync()
00137
00138     # execute the GUI functions for stopRun, just in case
00139     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00140       if self.rc is not None:
00141         self.rc.doStop()
00142
00143
00144   def wait(self):
00145     self.__cmdSynchSem.acquire()
00146
00147   def sync(self):
00148     if __name__ == "__main__":
00149       self.__cmdSynchSem.release()
00150
00151   def __initHippo(self):
00152     label1 = ['Time', 'TEM Voltage']
00153     label2 = ['Time', 'TEM Current']
00154     ntc = NTupleController.instance()
00155     self.__nt = ntc.createCircularBuffer(2)
00156     self.__nt2 = ntc.createCircularBuffer(2)
00157     self.__nt.setLabels(label1)
00158     self.__nt2.setLabels(label2)
00159     self.__nt.setTitle('GTIC Test')
00160     self.__nt2.setTitle('GTIC Test2')
00161     self.__nt.reserve(100)
00162     self.__nt2.reserve(100)
00163     if __name__ == "__main__":
00164       app = QApplication ( sys.argv )
00165       self.__canvas = CanvasWindow()
00166       self.__canvas.show()
00167     else:
00168       wc = WindowController.instance()
00169       self.__canvas = wc.currentCanvas()
00170
00171     dc = DisplayController.instance()
00172
00173   def __initPlots(self):
00174     self.__canvas.clear()
00175
00176     self.__nt.clear()
00177     self.__nt2.clear()
00178
00179     #self.__nt.setIntervalCount ( 500 )
00180     #self.__nt2.setIntervalCount ( 100 )
00181     dc = DisplayController.instance()
00182     self.__hist = dc.createDisplay('Strip Chart',self.__nt,['Time', 'TEM Voltage'])
00183     self.__hist2 = dc.createDisplay('Strip Chart',self.__nt2,['Time', 'TEM Current'])
00184     self.__canvas.addDisplay(self.__hist)
00185     self.__canvas.addDisplay(self.__hist2)
00186     self.__hist.setRange ( 'y', 2660, 2680 )
00187     self.__hist2.setRange ( 'y', 200, 300 )
00188     #self.__canvas.setIntervalEnabled ( 1 )
00189     self.__canvas.show()
00190
00191 if __name__ == "__main__":
00192   ua = userApplication(None, 321, 0)
00193   ua.rcSetup('../repos/simpleTEMSchema.xml')
00194   ua.rcStartRun()
00195   ua.wait()
00196   ua.rcStopRun()
00197   ua.rcTeardown()
00198   raw_input("Press any key to end")
00199
00200 # History:
00201 #     $Log: hTestEnv.py,v $
00202 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00203 #     Updated for LATTE 4.
00204 #     All hippo functions go through the Qt GUI bridge now.
00205 #
00206 #     Revision 1.1  2004/08/07 02:14:33  stuvi
00207 #     no message
00208 #
00209 #     Revision 1.8  2004/04/17 02:22:17  stuvi
00210 #     Various Hippo related fixes
00211 #     Added teardown() to delete the C++ object for the userArgument
00212 #
00213 #     Revision 1.7  2004/04/08 00:32:39  stuvi
00214 #     Modularized hippodraw code.
00215 #     Changed tuples to circular buffer.
00216 #
00217 #     Revision 1.6  2004/03/10 22:24:50  panetta
00218 #     Upgraded trigger interface.
00219 #     Removed dependencies on self.glt.
00220 #
00221 #     Revision 1.5  2004/02/24 02:13:34  stuvi
00222 #     Changes for long transition support.
00223 #
00224 #     Revision 1.4  2003/07/17 00:01:35  stuvi
00225 #     no message
00226 #
00227 #     Revision 1.3  2003/03/31 19:28:53  stuvi
00228 #     Fixed name
00229 #
00230 #     Revision 1.2  2003/03/26 21:59:36  stuvi
00231 #     Fixed standalone mode
00232 #
00233 #     Revision 1.1  2003/03/11 21:20:54  stuvi
00234 #     Moved from RunControl directory
00235 #
00236 #     Revision 1.3  2003/02/06 05:20:22  claus
00237 #     Added resume; StopRun bug fix
00238 #
00239 #     Revision 1.2  2003/01/16 02:38:25  stuvi
00240 #     Removed extra stuff
00241 #
00242 #     Revision 1.1  2002/12/10 00:59:16  stuvi
00243 #     Runcontrol example that uses Hippo. Currently it doesn't work in GUI mode.
00244 #
00245 #     Revision 1.4  2002/12/02 17:17:09  claus
00246 #     Added provision to allow application to run stand-alone
00247 #
00248 #     Revision 1.3  2002/11/28 02:02:04  claus
00249 #     Shuffled constructor arguments
00250 #
00251 #     Revision 1.2  2002/11/27 23:49:27  claus
00252 #     Initialize semaphore with zero count
00253 #
00254 #     Revision 1.1  2002/11/27 05:02:48  claus
00255 #     Initial version of Run Control
00256 #
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: hTestStrip.py Source File

tests / apps

hTestStrip.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example TKR test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 from   sihippo       import *
00021 from   time          import sleep, time
00022 import random
00023 import math
00024 import logging       as     log
00025
00026 from   LATTE.runcontrol.rcTransitions import rcTransitions
00027 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00028
00029 from support.MiniGLTExample      import *
00030
00031 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00032 #  the userApplication example to get the number of self triggers to take.
00033 class userArgument(ArgumentImpl):
00034   "GUI for getting the user to input some sort of value."
00035   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00036     ArgumentImpl.__init__(self, parent, name, modal, fl)
00037     self._value = 0
00038     self.setCaption("Hello world!")
00039
00040   def OKButtonClicked(self):
00041     self._value = int(self.ArgumentList.text().latin1())
00042     self.close()
00043
00044   def CancelButtonClicked(self):
00045     self.__value = None
00046     self.close()
00047
00048   def getValue(self, caption):
00049     self.setCaption(caption)
00050     self.show()
00051     self.exec_loop()
00052     return self._value
00053
00054 class userArgText(object):
00055   "Text user interface for getting the user to input some sort of value"
00056   def __init__(self):
00057     pass
00058
00059   def getValue(self, caption):
00060     return int(raw_input("%s: " % (caption)))
00061
00062
00063 #  Example application implementation.
00064 #  Note that the name of the class must be userApplication.
00065 #  Look at rcTransitions for names of other transition methods that can be used.
00066 class userApplication(rcTransitions):
00067   "Implmentation class for a user application"
00068   def __init__(self, gui, userId, debug):
00069     rcTransitions.__init__(self, gui, userId, debug)
00070     log.debug("userApplication.__init__()")
00071     self.phase = 0.0
00072
00073   def getName(self):
00074     return __name__
00075
00076   def setup(self):
00077     log.debug("userApplication.setup()")
00078
00079     if self.gui is None:
00080       self.__arg = userArgText()
00081     else:
00082       self.__arg = self.gui.createGUI(userArgument, self.gui, 'test1', 1)
00083
00084     self.gui.execGUImethod(self.__initHippo)
00085
00086     # A state transition can be rejected by not returning None
00087     return None
00088
00089
00090   def startRun(self):
00091     log.debug("userApplication.startRun()")
00092     self._cmdSynchQuit = False
00093     caption = "Enter number of data groups to read"
00094     if self.gui is None:
00095       cnt = self.__arg.getValue(caption)
00096     else:
00097       cnt = self.gui.execGUImethod(self.__arg.getValue, caption)
00098
00099     # The user pressed 'Cancel'
00100     if cnt is None:  return -1
00101     self.__cnt = cnt
00102
00103     self.gui.execGUImethod(self.__initPlots)
00104
00105     #self.hippoDisplay = threading.Thread(None, self.initHippo, 'HippoDisplay', ())
00106     #self.hippoDisplay.start()
00107
00108     # A state transition can be rejected by not returning None
00109     return None
00110
00111   def stopRun(self):
00112     self._cmdSynchQuit = True
00113     #self.__canvas.savePlotAsImage(self.__hist, "c:/temp/plot.jpg")
00114     #self.__canvas.savePlotAsImage(self.__hist2, "c:/temp/plot2.jpg")
00115
00116     # The STOP_RUN transition can not be rejected
00117
00118   def stop (self):
00119     return self.stopRun()
00120
00121   def teardown(self):
00122     log.debug("userApplication.teardown()")
00123     # Allow the C++ object to be deleted
00124     if self.gui is not None and self.__arg is not None:
00125       self.__arg.deleteLater()
00126
00127   def process(self, (status, buffer)):
00128     "Method called back for each data event taken"
00129     ###print "userApplication.process()"
00130
00131   def commandSynch(self):
00132     "Method called by the command synchronization task"
00133     count = self.__cnt
00134     cnt = 0
00135     while cnt < count and not self._cmdSynchQuit:
00136       if self.phase > math.pi - 0.0001: self.phase = 0.0
00137       cnt = cnt + 1
00138       volts = math.sin(self.phase) * (-1.0 +2.0*random.random())
00139       amps  = 0.8 - (2.0 * self.phase/math.pi) +0.4*random.random()
00140       self.__nt.addRow([cnt, volts])
00141       self.__nt2.addRow([cnt, amps])
00142       sleep(.1)
00143       self.phase += math.pi*0.02
00144
00145   def wait(self):
00146     pass
00147
00148   def __initHippo(self):
00149     label1 = ['Time', 'TEM Voltage']
00150     label2 = ['Time', 'TEM Current']
00151     ntc = NTupleController.instance()
00152     self.__nt = ntc.createCircularBuffer(2)
00153     self.__nt2 = ntc.createCircularBuffer(2)
00154     self.__nt.setLabels(label1)
00155     self.__nt2.setLabels(label2)
00156     self.__nt.setTitle('GTIC Test')
00157     self.__nt2.setTitle('GTIC Test2')
00158     self.__nt.reserve(100)
00159     self.__nt2.reserve(100)
00160     if __name__ == "__main__":
00161       app = QApplication ( sys.argv )
00162       self.__canvas = CanvasWindow()
00163     else:
00164       wc = WindowController.instance()
00165       self.__canvas = wc.currentCanvas()
00166
00167     #hist.setRange ( 'y', 2660, 2680 )
00168     #hist2.setRange ( 'y', 200, 300 )
00169
00170   def __initPlots(self):
00171     self.__canvas.clear()
00172     self.__nt.clear()
00173     self.__nt2.clear()
00174     #self.__nt.setIntervalCount ( 500 )
00175     #self.__nt2.setIntervalCount ( 100 )
00176     dc = DisplayController.instance()
00177     self.__hist = dc.createDisplay('Strip Chart',self.__nt,['Time', 'TEM Voltage'])
00178     self.__hist2 = dc.createDisplay('Strip Chart',self.__nt2,['Time', 'TEM Current'])
00179     self.__canvas.addDisplay(self.__hist)
00180     self.__canvas.addDisplay(self.__hist2)
00181     #self.__canvas.setIntervalEnabled ( 1 )
00182     self.__canvas.show()
00183
00184
00185 if __name__ == "__main__":
00186   ua = userApplication(None, 321, 0)
00187   ua.rcSetup('../repos/simpleTEMSchema.xml')
00188   ua.rcStartRun()
00189   ua.wait()
00190   ua.rcStopRun()
00191   ua.rcTeardown()
00192   raw_input("Press any key to end")
00193
00194 # History:
00195 #     $Log: hTestStrip.py,v $
00196 #     Revision 1.1  2004/08/18 18:00:15  stuvi
00197 #     Updated for LATTE 4.
00198 #     All hippo functions go through the Qt GUI bridge now.
00199 #
00200 #     Revision 1.9  2004/05/03 21:19:47  stuvi
00201 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00202 #
00203 #     Revision 1.8  2004/04/17 02:22:17  stuvi
00204 #     Various Hippo related fixes
00205 #     Added teardown() to delete the C++ object for the userArgument
00206 #
00207 #     Revision 1.7  2004/04/07 23:28:29  stuvi
00208 #     Modularized hippodraw code.
00209 #
00210 #     Revision 1.6  2004/03/31 01:03:21  stuvi
00211 #     Fixed so that it works with the new trigger interface.
00212 #
00213 #     Revision 1.5  2004/03/10 22:24:50  panetta
00214 #     Upgraded trigger interface.
00215 #     Removed dependencies on self.glt.
00216 #
00217 #     Revision 1.4  2004/02/24 02:13:34  stuvi
00218 #     Changes for long transition support.
00219 #
00220 #     Revision 1.3  2003/07/17 00:01:35  stuvi
00221 #     no message
00222 #
00223 #     Revision 1.2  2003/03/31 19:28:53  stuvi
00224 #     Fixed name
00225 #
00226 #     Revision 1.1  2003/03/11 21:20:54  stuvi
00227 #     Moved from RunControl directory
00228 #
00229 #     Revision 1.2  2003/02/06 05:20:22  claus
00230 #     Added resume; StopRun bug fix
00231 #
00232 #     Revision 1.1  2003/01/10 01:41:52  stuvi
00233 #     Example strip chart example for hippo
00234 #
00235 #     Revision 1.1  2002/12/10 00:59:16  stuvi
00236 #     Runcontrol example that uses Hippo. Currently it doesn't work in GUI mode.
00237 #
00238 #     Revision 1.4  2002/12/02 17:17:09  claus
00239 #     Added provision to allow application to run stand-alone
00240 #
00241 #     Revision 1.3  2002/11/28 02:02:04  claus
00242 #     Shuffled constructor arguments
00243 #
00244 #     Revision 1.2  2002/11/27 23:49:27  claus
00245 #     Initialize semaphore with zero count
00246 #
00247 #     Revision 1.1  2002/11/27 05:02:48  claus
00248 #     Initial version of Run Control
00249 #
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: LATsweep.py Source File

runcontrol

LATsweep.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Sweep handler class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/05 00:37:41 $").split(' ')[1]
00014 __version__  = "$Revision: 2.12 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import sys
00021
00022 from LATTE.database import gLAT
00023 from LATTE.client   import gException
00024
00025 class LATsweep(object):
00026   """Saves the current values of the registers, sets the TEM to a
00027   valid and known state for reliable event data taking. Triggers the event and
00028   then restores the registers to their prior values. This is done to make sure
00029   the sweep events that are retrieved from the TEM are good events.
00030
00031   \param lat        The LAT object hierarchy
00032   \param trigger    The trigger object
00033   \param sweepEvent Event() object passed to the trigger
00034
00035   """
00036
00037   def __init__(self, lat, trigger, shut):
00038     self.__lat = lat
00039     self.__trigger = trigger
00040     self.__shut    = shut
00041
00042   def shut(self, sweepEvent, progress = None):
00043     # Disable the trigger since we are going to access registers
00044     self.__trigger.disable()
00045
00046     # Use a temporary LAT hierarchy in case the current lat
00047     # doesn't define what we need to access.
00048     tempLAT = gLAT.GLAT(self.__lat.client())
00049     tkrTimeouts = {}
00050     tkrConfig = {}
00051     calConfig = {}
00052     for (temId, tem) in self.__lat.TEM.items():
00053       try:
00054         tem.configuration # Check to see if this TEM really exists
00055         tempTEM = tempLAT._GLAT__addTEM(temId)
00056       except gException.LATInterfaceException:
00057         if sys.exc_info()[1].errstr()[0] in ('LCB_RTOERR', 'LCBD_RTOERR') \
00058             and self.__lat.getDeclarations()['options']['ignorehardwaretimeouts']:
00059           continue
00060         else:
00061           raise gException.LATInterfaceException(sys.exc_info()[1].status)
00062
00063       # Save the configuration register values of the CCCs and TCCCs
00064       # that are defined in the schema
00065       tkrConfig[temId] = {}
00066       tkrTimeouts[temId] = {}
00067       for cc in range(8):
00068         tempTCC = tempTEM._GTEM__addTCC(cc)
00069         timeouts = tempTCC.event_timeouts
00070         if timeouts != 0:
00071           tkrTimeouts[temId][cc] = timeouts
00072         tkrConfig[temId][cc] = tempTCC.configuration
00073       calConfig[temId] = {}
00074       for cc in range(4):
00075         tempCCC = tempTEM._GTEM__addCCC(cc)
00076         calConfig[temId][cc] = tempCCC.configuration
00077     # Broadcast to all TEMS
00078     if self.__lat.TEMcnt() > 0:
00079       tempTEMall = tempLAT._GLAT__addTEM(255)
00080       allTCC = tempTEMall._GTEM__addTCC(255)
00081       allTCC.event_timeouts = (1L << 14) - 1
00082       allTCC.configuration = (1L << 31)
00083       tempTEMall._GTEM__addCCC(255).configuration = (1L << 31)
00084       # Put back the timeouts that werent zero.
00085       for temId in tkrTimeouts.keys():
00086         for cc in tkrTimeouts[temId]:
00087           tempLAT.TEM[temId].TCC[cc].event_timeouts = tkrTimeouts[temId][cc]
00088       # Put back the configuration values that we saved ORing with (1<<31)
00089       for temId in tkrConfig.keys():
00090         tempTEM = tempLAT.TEM[temId]
00091         for cc in tkrConfig[temId]:
00092           tempTEM.TCC[cc].configuration = (tkrConfig[temId][cc] | (1L << 31))
00093         for cc in calConfig[temId]:
00094           tempTEM.CCC[cc].configuration = (calConfig[temId][cc] | (1L << 31))
00095
00096     #self.__trigger._shut(sweepEvent, progress)
00097     self.__shut(sweepEvent, progress)
00098
00099     # Finally restore the configuration register values to their initial settings.
00100     for temId in tkrConfig.keys():
00101       tempTEM = tempLAT.TEM[temId]
00102       for cc in tkrConfig[temId].keys():
00103         tempTEM.TCC[cc].configuration = tkrConfig[temId][cc]
00104       for cc in calConfig[temId].keys():
00105         tempTEM.CCC[cc].configuration = calConfig[temId][cc]
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ldf2fits.py Source File

runcontrol

ldf2fits.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Archive to FITS converter"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "02/27/2003"
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import sys
00020 import getopt
00021
00022 def __usage():
00023   print "\n%s Usage:" % (sys.argv[0])
00024   print "\t-h or --help for Help"
00025   print "\t-a or --archive to specify an input archive file (*.ldf)"
00026   print "\t-f or --fits to specify the output FITS file (append .gz to the filename for compression)"
00027   print "\t-r or --runreport to specify an input run report filename (ie. rcReport.out)"
00028   print "\t-v or --verbose to specify progress messages during the conversion"
00029
00030
00031 if __name__ == '__main__':
00032   archiveFile=''
00033   fitsFile=''
00034   verbose=0
00035   runReportFile=''
00036   try:
00037     opts, args = getopt.getopt(sys.argv[1:], "ha:f:vr:",
00038                                ["help", "archive=", "fits=", "verbose", "runreport="])
00039   except getopt.GetoptError:
00040     # print help information and exit:
00041     __usage()
00042     sys.exit(2)
00043   for o, a in opts:
00044     if o in ("-h", "--help"):
00045       __usage()
00046       sys.exit()
00047     if o in ("-a", "--archive"):
00048       archiveFile = a
00049     if o in ("-f", "--fits"):
00050       fitsFile = a
00051     if o in ("-v", "--verbose"):
00052       verbose = 1
00053     if o in ("-r", "--runreport"):
00054       runReportFile = a
00055
00056   if archiveFile == '':
00057     print "\nERROR: Missing archive file parameter"
00058     __usage()
00059     sys.exit(2)
00060
00061   if fitsFile == '':
00062     print "\nERROR: Missing FITS file parameter"
00063     __usage()
00064     sys.exit(2)
00065
00066   if runReportFile == '':
00067     print "\nERROR: Missing Run Report file parameter"
00068     __usage()
00069     sys.exit(2)
00070
00071   import rcArchiver
00072   arch = rcArchiver.rcArchiver(fileName=archiveFile, mode=rcArchiver.MODE_READONLY)
00073
00074   import rcReportGen
00075   reportGen = rcReportGen.rcReportGen(fileName=runReportFile)
00076   reportGen.initialize()
00077   reportGen.readReportXML()
00078
00079   import rcFitsWriter
00080   fits = rcFitsWriter.rcFitsWriter(fileName=fitsFile, format=rcFitsWriter.FORMAT_BYTE, reportGen=reportGen)
00081
00082   cnt=0
00083   while(True):
00084     dat = arch.read()
00085     if dat == None: break
00086     cnt+=1
00087     if verbose and (cnt % 100) == 0: print "Progress line:", cnt
00088     fits.write(dat)
00089   if verbose and (cnt % 100) != 0: print "Progress line:", cnt
00090
00091   arch.close()
00092   fits.close()
00093
00094   if verbose: print "Conversion completed successfully!"
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MailAlert.py Source File

tools

MailAlert.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT alert email tool"
00012 __author__   = "Jim Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "09/03/2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 # import LATTE.copyright_SLAC
00018
00019
00020 import sys, smtplib
00021 from email.MIMEText import MIMEText
00022
00023 class MailAlert(object):
00024   def __init__(self, smtpServer):
00025     self.__smtp = smtpServer
00026
00027   def sendMail(self, email):
00028     smtp = smtplib.SMTP( self.__smtp )
00029     smtp.sendmail( email.sender(), email.recipient(), email.body() )
00030     smtp.quit()
00031
00032 class SLACmail(MailAlert):
00033   # Define the SLAC mail server
00034   def __init__(self):
00035     MailAlert.__init__(self, 'mailgate01.slac.stanford.edu')
00036
00037 class Email(MIMEText):
00038   def __init__(self):
00039     MIMEText.__init__(self, '')
00040
00041   def sender(self, s=None):
00042     if s is not None:
00043       self['From'] = s
00044     return self['From']
00045
00046   def recipient(self, r=None):
00047     if r is not None:
00048       self['To'] = r
00049     return self['To']
00050
00051   def subject(self, s=None):
00052     if s is not None:
00053       self['Subject'] = s
00054     return self['Subject']
00055
00056   def body(self, b=None):
00057     if b is not None:
00058       self.set_payload(b)
00059     return self.get_payload()
00060
00061
00062
00063
00064
00065
00066
00067
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MiniGLTExample.py Source File

tests / apps / support

MiniGLTExample.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009 #
00010
00011 __facility__ = "Online"
00012 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00013 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00014 __date__     = "2/14/04"
00015 __version__  = "$Revision: 1.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 # This class uses
00022 from LATTE.trigger.TrgUsingTiles      import TrgUsingTiles
00023 from LATTE.trigger.NullObjects        import NoInputsEnabled
00024 from LATTE.trigger.rcTrgFunctions     import rcTrgEngines
00025 from LATTE.trigger.TrgEngines         import *
00026 from LATTE.trigger.rcTrgMiniGLT       import rcTrgMiniGLT
00027 from LATTE.trigger.TrgMiniGLT         import MiniGLTTrgConditionsValue
00028
00029 """\brief Interface for Coincidence based Trigger System"""
00030
00031 class MiniGLTExample(rcTrgMiniGLT):
00032   """\brief MiniTower example interface to MiniGLT
00033   """
00034   def __init__(self):
00035     """\brief AcdTriggerExample constructor
00036     """
00037     rcTrgMiniGLT.__init__(self)
00038     self.__engines      = MiniGLTTrgEngines()
00039     self.__conditions   = MiniGLTSolicitedCondition()
00040
00041   def engines(self):
00042     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00043     """
00044     return self.__engines
00045
00046   def conditions(self):
00047     """\brief Implementation of conditions 'pure virtual' method from TrgAbstract
00048     """
00049     return self.__conditions
00050
00051 # implementaions of user-level trigger classes
00052 class MiniGLTTrgEngines(rcTrgEngines):
00053   def __init__(self):
00054     rcTrgEngines.__init__(self)
00055     # There are two engines in the MiniGLT.
00056     # 0) User defined engine
00057     # 15) Marker engine
00058
00059     eng = MiniGLTSolicitedEngine()
00060     self.replaceEngine(0,eng)
00061
00062 class MiniGLTSolicitedEngine(TrgEngine):
00063   """This class defines an engine which reads out the detector
00064      whenever there is a solicited trigger.
00065      This engine is not prescaled.
00066   """
00067   def __init__(self):
00068     TrgEngine.__init__(self)
00069     self.__request = ZsupTrgReadout()
00070   def participate(self,conditionsValue):
00071     # This function relies on the programmer's knowledge that the
00072     # conditionsValue is a bitfield.
00073     cond = MiniGLTSolicitedCondition()
00074     condValue = cond.value()
00075     if conditionsValue & condValue:
00076       return True
00077     return False
00078   def prescale(self):
00079     return 0
00080   def request(self):
00081     return self.__request
00082
00083 class MiniGLTSolicitedCondition(MiniGLTTrgConditionsValue):
00084   """ Define a condition where only the CNO trigger is asserted
00085   """
00086   def __init__(self):
00087     MiniGLTTrgConditionsValue.__init__(self)
00088   def solicited(self):
00089     return True
00090
00091 class ZsupTrgReadout(TrgReadout):
00092   """\brief ZsupTrgReadout class definition
00093
00094   Directs a module to send to its Front-End Electronics a command sequence
00095   which is composed only of the TACK command. This command will trigger
00096   a readout of the module's Front-End Electronics.
00097   Zero suppression is turned on.
00098   """
00099   def __init__(self):
00100     """\brief TrgReadout constructor
00101     """
00102     TrgReadout.__init__(self)
00103
00104   def zeroSuppress(self):
00105     return True
00106
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: MSGLogGUIImpl.py Source File

logger

MSGLogGUIImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Message Logger GUI"
00012 __author__   = """A. Kavelaars <AliciaK@SLAC.Stanford.edu>
00013                                SLAC - GLAST LAT I&T/Online"""
00014 __date__     = "12/3/2002"
00015 __version__  = "$Revision: 2.7 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from qt import *
00022 from MSGLogGUI import MSGLogGUI
00023 from select import select
00024 import sys, string, struct, types, cPickle, socket
00025 import logging, logging.handlers, logging.config
00026 logging.raiseExceptions = 1
00027 import threading
00028 import atexit
00029
00030 #~ #
00031 #~ # Levels
00032
00033 #~ CRITICAL = 50
00034 #~ FATAL = CRITICAL
00035 #~ ERROR = 40
00036 #~ WARN = 30
00037 #~ INFO = 20
00038 #~ DEBUG = 10
00039 #~ NOTSET = 0
00040
00041 #~ import RunControlCommon
00042 #~ from RunControlCommon import RunControlCommon
00043
00044 imageInfo_data = [
00045 "20 18 3 1",
00046 "# c #000080",
00047 "a c #808080",
00048 ". c #ffffff",
00049 ".......######.......",
00050 ".....##########.....",
00051 "....############....",
00052 "...######..######...",
00053 "..#######..#######..",
00054 "..################..",
00055 ".##################.",
00056 ".########..########.",
00057 ".########..########.",
00058 ".########..########.",
00059 ".########..########.",
00060 "..#######..#######a.",
00061 "..#######..#######..",
00062 "..a######..######a..",
00063 "...a############a...",
00064 "....a##########a....",
00065 ".....aa######aa.....",
00066 ".......aaaaaa......."
00067 ]
00068
00069 imageFatal_data = [
00070 "20 18 19 1",
00071 "p c #004040",
00072 "b c #484242",
00073 "d c #5e4f4f",
00074 "j c #675656",
00075 "m c #685151",
00076 "g c #695555",
00077 "a c #808080",
00078 "h c #cddcdc",
00079 "e c #cedcdc",
00080 "k c #d4e1e1",
00081 "n c #e1eded",
00082 "q c #ebefef",
00083 "i c #ecf6f6",
00084 "f c #edf7f7",
00085 "l c #f1fafa",
00086 "o c #f2f6f6",
00087 "c c #f3fcfc",
00088 "# c #ff0000",
00089 ". c #ffffff",
00090 "......########......",
00091 ".....##########.....",
00092 "....############....",
00093 "...#####....#####...",
00094 "..#####......#####..",
00095 ".#####........#####.",
00096 ".####..aa..aa..####.",
00097 ".####...a..a...####.",
00098 ".####..........####.",
00099 ".#####...aa...#####.",
00100 ".######......######.",
00101 ".a######.aa.######a.",
00102 ".ba#####....#####aa.",
00103 ".cda####....####aae.",
00104 "..fga##########aah..",
00105 "...ija########aak...",
00106 "....lmaaaaaaaaan....",
00107 ".....oppppppppq....."
00108 ]
00109
00110 imageWarn_data = [
00111 "20 18 4 1",
00112 "a c #004040",
00113 "b c #808080",
00114 "# c #ffff00",
00115 ". c #ffffff",
00116 ".........##.........",
00117 "........####........",
00118 "........####........",
00119 ".......######.......",
00120 ".......##aa##.......",
00121 "......###aa###......",
00122 "......###aa###......",
00123 ".....####aa####.....",
00124 ".....####aa####.....",
00125 "....#####aa#####....",
00126 "....#####aa#####....",
00127 "...######aa######...",
00128 "...##############...",
00129 "..################..",
00130 "..#######aa#######..",
00131 ".########aa########.",
00132 ".##################.",
00133 "..bbbbbbbbbbbbbbbbb."
00134 ]
00135
00136 imageError_data = [
00137 "20 18 3 1",
00138 "a c #808080",
00139 "# c #ff0000",
00140 ". c #ffffff",
00141 ".......######.......",
00142 ".....##########.....",
00143 "....############....",
00144 "...##############...",
00145 "..###..#####..####..",
00146 "..###...###...####..",
00147 ".#####...#...######.",
00148 ".######.....#######.",
00149 ".#######...########.",
00150 ".######.....#######.",
00151 ".#####...#...######.",
00152 ".a###...###...####a.",
00153 "..###..#####..####..",
00154 "..a##############a..",
00155 "...a############a...",
00156 "....a##########a....",
00157 ".....aa######aa.....",
00158 ".......aaaaaa......."
00159 ]
00160
00161 imageNotset_data = [
00162 "20 18 19 1",
00163 "p c #004040",
00164 "# c #008000",
00165 "b c #484242",
00166 "d c #5e4f4f",
00167 "j c #675656",
00168 "m c #685151",
00169 "g c #695555",
00170 "a c #808080",
00171 "h c #cddcdc",
00172 "e c #cedcdc",
00173 "k c #d4e1e1",
00174 "n c #e1eded",
00175 "q c #ebefef",
00176 "i c #ecf6f6",
00177 "f c #edf7f7",
00178 "l c #f1fafa",
00179 "o c #f2f6f6",
00180 "c c #f3fcfc",
00181 ". c #ffffff",
00182 "......########......",
00183 ".....##########.....",
00184 "....#####..#####....",
00185 "...######..######...",
00186 "..#######..#######..",
00187 ".########..########.",
00188 ".########..########.",
00189 ".########..########.",
00190 ".########..########.",
00191 ".########..########.",
00192 ".##################.",
00193 ".a################a.",
00194 ".ba######..######aa.",
00195 ".cda#####..#####aae.",
00196 "..fga##########aah..",
00197 "...ija########aak...",
00198 "....lmaaaaaaaaan....",
00199 ".....oppppppppq....."
00200 ]
00201
00202 imageDebug_data = [
00203 "20 18 19 1",
00204 "p c #004040",
00205 "b c #484242",
00206 "d c #5e4f4f",
00207 "j c #675656",
00208 "m c #685151",
00209 "g c #695555",
00210 "a c #808080",
00211 "h c #cddcdc",
00212 "e c #cedcdc",
00213 "k c #d4e1e1",
00214 "n c #e1eded",
00215 "q c #ebefef",
00216 "i c #ecf6f6",
00217 "f c #edf7f7",
00218 "l c #f1fafa",
00219 "o c #f2f6f6",
00220 "c c #f3fcfc",
00221 "# c #ff0000",
00222 ". c #ffffff",
00223 "......########......",
00224 ".....##########.....",
00225 "....#####..#####....",
00226 "...######..######...",
00227 "..#######..#######..",
00228 ".########..########.",
00229 ".########..########.",
00230 ".########..########.",
00231 ".########..########.",
00232 ".########..########.",
00233 ".##################.",
00234 ".a################a.",
00235 ".ba######..######aa.",
00236 ".cda#####..#####aae.",
00237 "..fga##########aah..",
00238 "...ija########aak...",
00239 "....lmaaaaaaaaan....",
00240 ".....oppppppppq....."
00241 ]
00242
00243 #~##
00244 from SocketServer import ThreadingTCPServer, StreamRequestHandler
00245 import errno
00246 import select
00247
00248
00249 MAX_ENTRIES    = 9000
00250 DELETE_ENTRIES = 100
00251
00252 class LogRecordStreamHandler(StreamRequestHandler):
00253     """
00254     Handler for a streaming logging request. It basically logs the record
00255     using whatever logging policy is configured locally.
00256     """
00257
00258     def handle(self):
00259         """
00260         Handle multiple requests - each expected to be a 4-byte length,
00261         followed by the LogRecord in pickle format. Logs the record
00262         according to whatever policy is configured locally.
00263         """
00264         while 1:
00265             try:
00266                 chunk = self.connection.recv(4)
00267                 if len(chunk) < 4:
00268                     break
00269                 slen = struct.unpack(">L", chunk)[0]
00270                 #print slen
00271                 chunk = self.connection.recv(slen)
00272                 while len(chunk) < slen:
00273                     chunk = chunk + self.connection.recv(slen - len(chunk))
00274                 obj = self.unPickle(chunk)
00275                 record = logging.makeLogRecord(obj)
00276                 #record = logging.LogRecord(None, None, "", 0, "", (), None)
00277                 #record.__dict__.update(obj)
00278                 self.handleLogRecord(record)
00279             except socket.error, e:
00280                 if type(e.args) != types.TupleType:
00281                     raise e
00282                 else:
00283                     errcode = e.args[0]
00284                     if errcode != errno.ECONNRESET:
00285                         raise e
00286                     break
00287
00288     def unPickle(self, data):
00289         return cPickle.loads(data)
00290
00291     def handleLogRecord(self, record):
00292         #if a name is specified, we use the named logger rather than the one
00293         #implied by the record. This is so test harnesses don't get into
00294         #endless loops (particularly log_test.py, which has this code and the
00295         #client code in the same Python instance)
00296         if self.server.logname is not None:
00297             name = self.server.logname
00298         else:
00299             name = record.name
00300         logger = logging.getLogger(name)
00301         #logger.handle(record)
00302         #print logger.handlers[0].format(record)
00303
00304         #~ self.__actualData = logger.handlers[0].format(record)
00305
00306         self.server.gui.appendLogData(logger.handlers[0].format(record))
00307
00308
00309 class MSGLogSocketReceiver(ThreadingTCPServer):
00310   allow_reuse_address = 1
00311
00312   def __init__(self, gui, host='', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
00313       handler=LogRecordStreamHandler):
00314     ThreadingTCPServer.__init__(self, (host, port), handler)
00315     self.__abort = 0
00316     self.timeout = 1
00317     self.logname = None
00318     self.gui = gui
00319     self.handler = handler
00320
00321   def abort(self):
00322     self.__abort = 1
00323
00324   def serve_until_stopped(self):
00325     while not self.__abort:
00326       rd, wr, ex = select.select([self.socket.fileno()],
00327                                  [], [],
00328                                  self.timeout)
00329       if rd:
00330         self.handle_request()
00331
00332 class MSGLogGUIImpl(MSGLogGUI):
00333
00334   def __init__(self, updateInterval=100, parent = None,name = None,fl = 0):
00335     MSGLogGUI.__init__(self,parent,name,fl)
00336     #self.setCentralWidget( self.Logger )
00337     self.__secure = 0
00338     self.__timer = QTimer(self)
00339     QObject.connect(self.__timer, SIGNAL("timeout()"), self.addLogDataToView)
00340     self.__updateInterval = updateInterval
00341     self.__timer.start(self.__updateInterval)
00342
00343     self.__level = 0
00344     self.__filename = None
00345     self.printer = QPrinter()
00346     self.filename = QString.null
00347     self.tcpserver = None
00348     self.__logname = "MSGLogger"
00349     self.__logData = []
00350     self.__logList = []
00351     self.__count = 0
00352     self.__previousMSG = ["","","",""]
00353     self.__previousMSGcut = ["",""]
00354
00355     self.imageFatal = QPixmap(imageFatal_data)
00356     self.imageError = QPixmap(imageError_data)
00357     self.imageWarn = QPixmap(imageWarn_data)
00358     self.imageInfo = QPixmap(imageInfo_data)
00359     self.imageDebug = QPixmap(imageDebug_data)
00360     self.imageNotset = QPixmap(imageNotset_data)
00361
00362     self.connect(self.filterbyCritical,SIGNAL("activated()"),self.levelCritical)
00363     self.connect(self.filterbyFatal,SIGNAL("activated()"),self.levelFatal)
00364     self.connect(self.filterbyError,SIGNAL("activated()"),self.levelError)
00365     self.connect(self.filterbyWarn,SIGNAL("activated()"),self.levelWarn)
00366     self.connect(self.filterbyInfo,SIGNAL("activated()"),self.levelInfo)
00367     self.connect(self.filterbyDebug,SIGNAL("activated()"),self.levelDebug)
00368     self.connect(self.filterbyNotset,SIGNAL("activated()"),self.levelNotset)
00369     self.connect(self.noFilter,SIGNAL("activated()"),self.levelNoFilter)
00370
00371     #~ self.connect(self.Logger,SIGNAL("currentChanged(QListViewItem*)"),self.preventSaturation)
00372     self.connect(self.Logger,SIGNAL("currentChanged(QListViewItem*)"),self.showEntries)
00373     self.connect(self.Logger, SIGNAL('clicked(QListViewItem*)'), self.preventCheck)
00374     self.connect(self.RunningLogButton,SIGNAL("clicked()"),self.switchToRunningLog)
00375     self.connect(self.FileLogButton,SIGNAL("clicked()"),self.fileOpen)
00376
00377     #atexit.register(logging.shutdown)
00378     atexit.register(self.__shutdown)
00379
00380     self.__hdlr = logging.StreamHandler()
00381     fmt = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d %(levelname)-5s - %(message)s")
00382     self.__hdlr.setFormatter(fmt)
00383     logger = logging.getLogger(self.__logname)
00384     logger.addHandler(self.__hdlr)
00385     #logger.propagate = 0
00386
00387     self.Logger.setColumnAlignment(0, Qt.AlignCenter)
00388     self.Logger.header().setMovingEnabled(0)
00389
00390     self.Logger.setSorting(-1,1)
00391
00392     self.Logger.setColumnWidth(0,0)
00393     #~ self.Logger.setColumnWidth(1,40)
00394     #~ self.Logger.setColumnWidth(2,20)
00395     #~ self.Logger.setColumnWidth(3,80)
00396     #~ self.Logger.setColumnWidth(4,30)
00397
00398     #~ self.noFilter.setOn(1)
00399
00400   def preventSaturation(self):
00401     if self.Logger.childCount() >= MAX_ENTRIES:
00402       #print "too many entries"
00403       self.__timer.stop()
00404       item = self.Logger.firstChild()
00405       count = 0
00406       while (count < DELETE_ENTRIES):
00407         if QString.compare(item.text(1),'CRITICAL') != 0 and QString.compare(item.text(1),'FATAL') != 0 :
00408           count += 1
00409           if count >= self.Logger.childCount(): break
00410           saveItem = item.nextSibling()
00411           self.Logger.takeItem(item)
00412           item = saveItem
00413         else:
00414           item = item.nextSibling()
00415
00416         #~ item = item.nextSibling()
00417       self.__timer.start(self.__updateInterval)
00418
00419   def showEntries(self):
00420       self.statusBar().message('Number of entries: ' + str(self.Logger.childCount()))
00421
00422   def preventCheck(self):
00423     item = self.Logger.currentItem()
00424
00425     if item.isOn():
00426       if QString.compare(item.text(1),'CRITICAL') == 0 or QString.compare(item.text(1),'FATAL') == 0 :
00427         self.statusBar().message('CRITICAL or FATAL error: Uncheck to Acknowledge',2000)
00428       else:
00429         self.statusBar().message('CRITICAL and FATAL errors check boxes ONLY are enabled to be acknowledged',2500)
00430         item.setOn(0)
00431
00432   def appendLogData(self, data):
00433     self.__logData.append(data)
00434 #    if len(self.__logList) > 10000:
00435 #      rc = QMessageBox.information(self,'GLAT Online Message Logger',
00436 #                  'The Active Logger has reached the maximum of 10000 entries and will now close. Would you like to keep listening in a new log?',
00437 #                  'Yes','No')
00438 #      if rc == 0:
00439 #        # Fill in here what to do
00440 #        e.ignore()
00441 #      else:
00442 #        e.accept()
00443 #    else:
00444 #      self.__logList.append(data)
00445
00446   def switchToRunningLog(self):
00447     self.LogType.setText("Active Run Control Log")
00448     self.Logger.clear()
00449     #~ print "Data: ", self.__logData
00450     self.addLogDataToView()
00451     if not self.runTCPThread.isAlive():
00452       self.startListenerThread()
00453
00454     #~ for data in self.__logData:
00455
00456
00457   def abortListenerThread(self):
00458     if self.runTCPThread.isAlive():
00459       self.tcpserver.abort()
00460       self.runTCPThread.join()
00461
00462
00463   def startListenerThread(self):
00464     self.Logger.clear()
00465     self.LogType.setText("Active Run Control Log")
00466     self.LogType.setAlignment(QLineEdit.AlignLeft)
00467
00468     self.tcpserver = MSGLogSocketReceiver(self)
00469     self.tcpserver.logname = self.__logname
00470     self.runTCPThread = threading.Thread(target=self.runTCP, name=self.__logname, args=(self.tcpserver,))
00471     self.runTCPThread.start()
00472
00473
00474   def runTCP(self, tcpserver):
00475     tcpserver.serve_until_stopped()
00476
00477
00478   def clearLevels(self):
00479     self.filterbyCritical.setOn(0)
00480     self.filterbyError.setOn(0)
00481     self.filterbyInfo.setOn(0)
00482     self.filterbyDebug.setOn(0)
00483     self.filterbyNotset.setOn(0)
00484     self.filterbyFatal.setOn(0)
00485     self.filterbyWarn.setOn(0)
00486     self.noFilter.setOn(0)
00487
00488   def levelCritical(self):
00489     self.clearLevels()
00490     self.filterbyCritical.setOn(1)
00491     self.__level = logging.CRITICAL
00492     #~ for i in range(self.Logger.childCount()-1):
00493     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00494       self.switchToRunningLog()
00495     else:
00496       self.load( )
00497
00498   def levelFatal(self):
00499     self.clearLevels()
00500     self.filterbyFatal.setOn(1)
00501     self.__level = logging.CRITICAL
00502     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00503       self.switchToRunningLog()
00504     else:
00505       self.load( )
00506
00507   def levelError(self):
00508     self.clearLevels()
00509     self.filterbyError.setOn(1)
00510     self.__level = logging.ERROR
00511     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00512       self.switchToRunningLog()
00513     else:
00514       self.load( )
00515
00516   def levelWarn(self):
00517     self.clearLevels()
00518     self.filterbyWarn.setOn(1)
00519     self.__level = logging.WARN
00520     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00521       self.switchToRunningLog()
00522     else:
00523       self.load( )
00524
00525   def levelInfo(self):
00526     self.clearLevels()
00527     self.filterbyInfo.setOn(1)
00528     self.__level = logging.INFO
00529     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00530       self.switchToRunningLog()
00531     else:
00532       self.load( )
00533
00534   def levelDebug(self):
00535     self.clearLevels()
00536     self.filterbyDebug.setOn(1)
00537     self.__level = logging.DEBUG
00538     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00539       self.switchToRunningLog()
00540     else:
00541       self.load( )
00542
00543   def levelNotset(self):
00544     self.clearLevels()
00545     self.filterbyNotset.setOn(1)
00546     self.__level = logging.NOTSET
00547     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00548       self.switchToRunningLog()
00549     else:
00550       self.load(  )
00551
00552   def levelNoFilter(self):
00553     self.clearLevels()
00554     self.noFilter.setOn(1)
00555     self.__level = logging.NOTSET
00556     if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00557       #~ self.addLogDataToView()
00558       self.switchToRunningLog()
00559     else:
00560       self.load(  )
00561
00562   def setListViewItem(self, data):
00563     #~ imageFatal = QPixmap(imageFatal_data)
00564     #~ imageError = QPixmap(imageError_data)
00565     #~ imageWarn = QPixmap(imageWarn_data)
00566     #~ imageInfo = QPixmap(imageInfo_data)
00567     #~ imageDebug = QPixmap(imageDebug_data)
00568     #~ imageNotset = QPixmap(imageNotset_data)
00569
00570     level = self.__level
00571
00572     p = data.rstrip()
00573
00574     s = string.splitfields(p)
00575     temps = string.splitfields(p)
00576     r = string.splitfields(p, ' - ')
00577
00578     #Corrects the fact that FATAL is not included in the defs of
00579     # __init__.py for logging in python22
00580
00581     if temps[3] == 'FATAL':
00582       temps[3] = 'CRITICAL'
00583
00584     if logging._levelNames[temps[3]] >= level:
00585       if s[2] == self.__previousMSG[2] and s[3] == self.__previousMSG[3] \
00586           and r[1] == self.__previousMSGcut:
00587         #print s[2], s[3], r[1], self.__count
00588         self.__count += 1
00589
00590       else:
00591         if self.__count >= 3:
00592           messageItem = QCheckListItem( self.Logger,self.Logger.lastItem(), "", QCheckListItem.CheckBox )
00593
00594           messageItem.setText( 1, self.__previousMSG[3])
00595           messageItem.setText( 2, self.__previousMSG[0])
00596           messageItem.setText( 3, self.__previousMSG[1])
00597           messageItem.setText( 4, self.__previousMSG[2])
00598           #~ for i in range (0, 4):
00599             #~ messageItem.setText( i, self.__previousMSG[i])
00600           self.__countMSG = "The previous message was repeated " + str(self.__count) + " time(s)."
00601           messageItem.setText(5, self.__countMSG)
00602
00603           if self.__previousMSG[3] == 'CRITICAL' or self.__previousMSG[3] == 'FATAL':
00604             messageItem.setPixmap(1, self.imageFatal)
00605             messageItem.setOn(1)
00606
00607           elif self.__previousMSG[3] == 'ERROR':
00608             messageItem.setPixmap(1, self.imageError)
00609
00610           elif self.__previousMSG[3] == 'WARNING':
00611             messageItem.setPixmap(1, self.imageWarn)
00612
00613           elif self.__previousMSG[3] == 'INFO':
00614             messageItem.setPixmap(1, self.imageInfo)
00615
00616           elif self.__previousMSG[3] == 'DEBUG':
00617             messageItem.setPixmap(1, self.imageDebug)
00618
00619           elif self.__previousMSG[3] == 'NOTSET':
00620             messageItem.setPixmap(1, self.imageNotset)
00621           self.__count = 0
00622
00623         item = QCheckListItem( self.Logger, self.Logger.lastItem(), "", QCheckListItem.CheckBox)
00624
00625         item.setText( 1, s[3])
00626         item.setText( 2, s[0])
00627         item.setText( 3, s[1])
00628         item.setText( 4, s[2])
00629         #~ for i in range (0, 4):
00630           #~ item
00631           #~ item.setText( i, s[i])
00632         item.setText(5, r[1])
00633
00634         if s[3] == 'CRITICAL' or s[3] == 'FATAL':
00635           item.setPixmap(1, self.imageFatal)
00636           item.setOn(1)
00637
00638         elif s[3] == 'ERROR':
00639           item.setPixmap(1, self.imageError)
00640
00641         elif s[3] == 'WARNING':
00642           item.setPixmap(1, self.imageWarn)
00643
00644         elif s[3] == 'INFO':
00645           item.setPixmap(1, self.imageInfo)
00646
00647         elif s[3] == 'DEBUG':
00648           item.setPixmap(1, self.imageDebug)
00649
00650         elif s[3] == 'NOTSET':
00651           item.setPixmap(1, self.imageNotset)
00652
00653         self.__previousMSG = s
00654         self.__previousMSGcut = r[1]
00655
00656       self.preventSaturation()
00657
00658   def addLogDataToView(self):
00659   #~ list = []
00660   #~ list.append(data)
00661     self.Logger.blockSignals(1)
00662     while len(self.__logData) > 0:
00663       data = self.__logData.pop(0)
00664       self.setListViewItem(data)
00665
00666     vScroll = self.Logger.verticalScrollBar()
00667     #~ print vScroll.value(), vScroll.maxValue()
00668     if not self.PauseLogButton.isOn() and not vScroll.draggingSlider() :
00669       vScroll.setValue(vScroll.maxValue())
00670
00671     self.Logger.blockSignals(0)
00672     self.showEntries()
00673
00674   #~ def switchToRunningLog(self):
00675     #~ self.Logger.clear()
00676     #~ for data in self.__logList:
00677       #~ self.setListViewItem(data)
00678
00679   def load( self ):
00680
00681     if self.tcpserver is not None:
00682       self.abortListenerThread()
00683     self.Logger.clear()
00684
00685     f = file( str(self.__filename), 'r' )
00686
00687     #~ if not f.open( IO_ReadOnly ):
00688         #~ return
00689
00690     #self.__filename = filename
00691     #~ t = QTextStream( f )
00692
00693     #~ self.noFilter.setOn(1)
00694     multi_line = 0
00695     while 1:
00696       data = f.readline()
00697       data = data[:len(data)-1]
00698       if data == "":
00699         break
00700       if multi_line == 0:
00701         (data1, data2) = data.split(" - ",1)
00702         if data2.startswith("<//") > 0 and multi_line == 0:
00703           datax = data1 + " - " + data2[3:]
00704           multi_line = 1
00705           continue
00706       if multi_line:
00707         if data.endswith("//>"):
00708           datax += "\n" + data[:-3]
00709           multi_line = 0
00710         else:
00711           datax += "\n" + data
00712           continue
00713       else:
00714         datax = data
00715       self.setListViewItem(datax)
00716
00717     f.close()
00718
00719   def filePrint(self):
00720     Margin = 50
00721     pageNo = 1
00722     column = [0, 50, 110, 180, 260, 400]#, 325] # Magic numbers
00723
00724     # If there are no items, don't try to print
00725     if not self.Logger.firstChild():
00726       return
00727
00728     if self.printer.setup(self):
00729       self.statusBar().message('Printing...')
00730
00731       p = QPainter()
00732       p.begin(self.printer)
00733       p.setFont(self.Logger.font())
00734       yPos = 0
00735       fm = p.fontMetrics()
00736       metrics = QPaintDeviceMetrics(self.printer)
00737
00738       if QString.compare(self.LogType.text(), "Active Run Control Log") == 0 :
00739         header = "Message Logger Source: Active Run Control Log"
00740       else:
00741         header = "Message Logger Source: " + str(self.__filename)
00742
00743       page = "Page: 1"
00744       p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, header)
00745       yPos = yPos + fm.lineSpacing()
00746       p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, page)
00747       yPos = yPos + 2*fm.lineSpacing()
00748
00749       columnHeader = ['','Severity','Date','Time','Source','Message']
00750
00751       for i in range (0,6):
00752           p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00753                     Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00754       yPos = yPos + fm.lineSpacing()
00755
00756       item = self.Logger.firstChild()
00757       for j in range(self.Logger.childCount()):
00758         if Margin + yPos > metrics.height() - Margin:
00759           pageNo = pageNo + 1
00760           page = "Page: " + str(pageNo)
00761           self.statusBar().message('Printing (page %d)...' % (pageNo))
00762           self.printer.newPage()
00763           yPos = 0
00764           p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, header)
00765           yPos = yPos + fm.lineSpacing()
00766           p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip, page)
00767           yPos = yPos + 2*fm.lineSpacing()
00768
00769           for i in range (0,6):
00770             p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00771                       Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00772           yPos = yPos + fm.lineSpacing()
00773
00774         for i in range (0,6):
00775           p.drawText(column[i],Margin + yPos,metrics.width(),fm.lineSpacing(),
00776                     Qt.ExpandTabs | Qt.DontClip,item.text(i))
00777         yPos = yPos + fm.lineSpacing()
00778         item = item.nextSibling()
00779
00780       p.end()
00781       self.statusBar().message('Printing completed',2000)
00782     else:
00783       self.statusBar().message('Printing aborted',2000)
00784
00785   def Help(self):
00786     pass
00787
00788   def fileNew(self):
00789     print "MSGLogGUIImpl.fileNew(): Not implemented yet"
00790
00791   def fileOpen(self):
00792     fn = QFileDialog.getOpenFileName( QString.null, "(*.log)", self, "Log file dialog",
00793                                             "Choose a Log File" )
00794     if not fn.isEmpty():
00795       self.__filename = fn
00796       self.LogType.setText(str(self.__filename))
00797       self.LogType.setAlignment(QLineEdit.AlignRight)
00798       self.load( )
00799
00800   def fileSave(self):
00801     if self.__filename.isEmpty():
00802       self.fileSaveAs()
00803       return
00804
00805     self.Logger.save( self.__filename )
00806
00807   def fileSaveAs(self):
00808     fn = QFileDialog.getSaveFileName( QString.null, QString.null, self )
00809     if not fn.isEmpty():
00810       self.__filename = fn
00811       self.fileSave()
00812
00813   def fileExit(self):
00814     self.close()
00815
00816   def closeEvent(self, e):
00817     if self.__secure:
00818       e.ignore()
00819       return
00820     if self.Logger.childCount() == 0:
00821       e.accept()
00822     item = self.Logger.firstChild()
00823     for i in range(self.Logger.childCount()-1):
00824       if item.isOn() :#and item.text(3) == "CRITICAL":# or item.text(3) == 'FATAL':
00825         rc = QMessageBox.information(self,'GLAT Online Message Logger',
00826                   'Please acknowledge all CRITICAL and FATAL errors before exit by unchecking the box at the beginning of the entry',
00827                   'OK','Exit Anyway')
00828         if rc == 0:
00829           e.ignore()
00830           break
00831         else:
00832           e.accept()
00833           break
00834
00835       item = item.nextSibling()
00836       e.accept()
00837
00838   def __shutdown(self):
00839     self.abortListenerThread()
00840
00841   def setSecure(self, secure):
00842     self.__secure = secure
00843
00844
00845 if __name__ == "__main__":
00846   a = QApplication(sys.argv)
00847   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00848   w = MSGLogGUIImpl()
00849   w.startListenerThread()
00850   a.setMainWidget(w)
00851   w.show()
00852   a.exec_loop()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Namespace Members - Functions

All | Functions
_ | a | c | d | f | g | h | i | l | n | p | r | s | w

- _ -

  • _cleanupConnections() : dispatcher
  • _removeReceiver() : dispatcher
  • _removeSender() : dispatcher
  • _unsigned() : testSAppEvt, testAppEvt, hTestAppEvt
  • _write_data() : gSchemaConfig

- a -

  • applyConfig() : gSchemaConfig
  • applyHskConfig() : gHSK

- c -

  • colorScale() : colorScale
  • connect() : dispatcher
  • convert() : pythfilter

- d -

  • disconnect() : dispatcher

- f -

  • FreeSpace() : FreeSpace
  • function() : robustapply

- g -

  • gather_comment() : pythfilter
  • getAllReceivers() : dispatcher
  • getReceivers() : dispatcher

- h -

  • hexConvert() : gBits

- i -

  • importModule() : rcUtil
  • isNewer() : pythfilter

- l -

  • liveReceivers() : dispatcher

- n -

  • NodeString() : HskAlarms

- p -

  • preparePath() : pythfilter
  • print_comment() : pythfilter

- r -

  • readConfig() : gSchemaConfig
  • readHskConfig() : gHSK
  • readSchema() : gSchemaConfig
  • receiver() : DataDistributor
  • robustApply() : robustapply

- s -

  • safeRef() : saferef
  • send() : dispatcher
  • sendExact() : dispatcher
  • startupMainGui() : startupMainGUI

- w -

  • writeSchema() : gSchemaConfig
Generated on Fri Jan 21 18:01:40 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: nullApp.py Source File

tests / apps

nullApp.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Null application for testing"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "August 18, 2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00021
00022
00023 #  Null application implementation.
00024 class userApplication(rcTransitions):
00025   "Implmentation class for Null application"
00026   def __init__(self, rc, userId, debug):
00027     rcTransitions.__init__(self, rc, userId, debug)
00028
00029   def getName(self):
00030     return __name__
00031
00032   def setup(self):
00033     # A state transition can be rejected by not returning None
00034     return None
00035
00036   def startRun(self):
00037     # A state transition can be rejected by not returning None
00038     return None
00039
00040   def stopRun(self):
00041     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00042
00043     # The STOP_RUN transition can not be rejected
00044
00045   def stop(self):
00046     return self.stopRun()
00047
00048   def process(self, (status, buffer)):
00049     "Method called back for each data event taken"
00050     pass
00051
00052   def wait(self):
00053     pass
00054
00055
00056 # Standalone mode:
00057 if __name__ == "__main__":
00058   import os
00059   import logging as log
00060   log.basicConfig()
00061   log.getLogger("").setLevel(log.DEBUG)
00062   ua = userApplication(None, 321, 0)
00063   prefs = {'datasave': 1, 'datadir':os.path.join(os.environ['ONLINE_ROOT'],'temp')}
00064   ua.setPrefs(prefs)
00065   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00066   ua.rcStartRun()
00067   ua.wait()
00068   ua.rcStopRun()
00069   ua.rcTeardown()
00070
00071 # History:
00072 #     $Log: nullApp.py,v $
00073 #     Revision 1.2  2004/08/25 04:00:39  stuvi
00074 #     no message
00075 #
00076 #     Revision 1.1  2004/08/19 01:55:50  claus
00077 #     Null application used for testing.
00078 #
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: NullObjects.py Source File

trigger

NullObjects.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Tower Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgTower           import TrgTower
00022 from TrgTower           import TrgCalorimeter
00023 from TrgTower           import TrgTracker
00024
00025 from TrgInputEnables    import TrgInputEnables
00026 from TrgInputEnables    import TrgTowerEnables
00027 from TrgInputEnables    import TrgTileEnables
00028 from TrgInputEnables    import TrgCnoEnables
00029
00030 from TrgCoincidences    import TrgRoi
00031 from TrgCoincidences    import TrgCoincidence
00032
00033 from TrgEngines         import TrgEngine
00034 from TrgEngines         import TrgEngineRequest
00035 from TrgEngines         import TrgReadout
00036
00037 """NullObjects: Interfaces for when there are no objects in the system"""
00038
00039 ### Tower system
00040
00041 class NullTower(TrgTower):
00042   """NullTower class:
00043      Class defines a tower with no calorimeter active and no tracker active.
00044   """
00045   def __init__(self):
00046     TrgTower.__init__(self)
00047     self.__cal = NullCal()
00048     self.__tkr = NullTkr()
00049   def calorimeter(self):
00050     return self.__cal
00051   def tracker(self):
00052     return self.__tkr
00053
00054 class NullCal(TrgCalorimeter):
00055   """NullCal class:
00056      Class defines a calorimeter which is inactive.
00057      Used by NullTower
00058   """
00059   def __init__(self):
00060     TrgCalorimeter.__init__(self)
00061   def useHighEnergy(self):
00062     return False
00063   def useLowEnergy(self):
00064     return False
00065
00066 class NullTkr(TrgTracker):
00067   """NullTkr class:
00068      Class defines a tracker which is inactive.
00069      Used by NullTower
00070   """
00071   def __init__(self):
00072     TrgTracker.__init__(self)
00073   def use(self):
00074     return False
00075
00076
00077 ###  Input Enables
00078
00079 class NoTowersEnabled(TrgTowerEnables):
00080   def __init__(self):
00081     TrgTowerEnables.__init__(self)
00082     self.__null = NullTower()
00083   def tower(self,towerNumber):
00084     return self.__null
00085
00086 class NoTilesEnabled(TrgTileEnables):
00087   """NoTilesEnabled class:
00088      Class defining a system where no tiles are enabled.
00089   """
00090   def __init__(self):
00091     TrgTileEnables.__init__(self)
00092   def tile(self,tileNumber):
00093     return 0
00094
00095 class NoCnoEnabled(TrgCnoEnables):
00096   """NoCnoEnabled class:
00097   Class defining a system where all CNO inputs are disabled.
00098   """
00099   def __init__(self):
00100     TrgCnoEnables.__init__(self)
00101     #Do nothing else.  Default is all disabled.
00102
00103 class NoInputsEnabled(TrgInputEnables):
00104   """NoInputsEnabled class:
00105   Class defining a system where no inputs are enabled.
00106   """
00107   def __init__(self):
00108     TrgInputEnables.__init__(self)
00109     self.__towers = NoTowersEnabled()
00110     self.__tiles  = NoTilesEnabled()
00111     self.__cno    = NoCnoEnabled()
00112   def towers(self): return self.__towers
00113   def tiles(self):  return self.__tiles
00114   def cno(self):    return self.__cno
00115
00116 ### Coincidence system
00117
00118 class NullRoi(TrgRoi):
00119   """NullRoi class:
00120      Class defining a system where the ROI contains no tiles.
00121   """
00122   def __init__(self):
00123     TrgRoi.__init__(self)
00124   def tile(self, tileNumber):
00125     return False
00126
00127 class NullCoincidence(TrgCoincidence):
00128   """NullCoincidence class:
00129   Class defining a coincidence set that is all null.
00130   """
00131   def __init__(self):
00132     TrgCoincidence.__init__(self)
00133
00134   def inCoincidence(self,tileNumber):
00135     return -1  # Tile not in coincidence List
00136
00137 # TrgEngines
00138
00139 class NullEngine(TrgEngine):
00140   """NullEngine class:
00141   This class defines an engine doesn't do anything.
00142   Prescale is set to -1 to prevent engine from firing.
00143   """
00144   def __init__(self):
00145     TrgEngine.__init__(self)
00146     self.__request = NullRequest()
00147   def participate(self,conditionsValue):
00148     return False
00149   def prescale(self):
00150     return -1
00151   def request(self):
00152     return self.__request
00153
00154 class NullRequest(TrgEngineRequest):
00155   """NullRequest class:
00156      This class defines an engineRequest that doesn't do anything
00157      However sequence must be set, so the detector will be read out.
00158   """
00159   def __init__(self):
00160     """\brief constructor
00161     """
00162     TrgEngineRequest.__init__(self)
00163   def sequence(self):
00164     return 2
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: parseFswHsk.py Source File

monitoring / tools

parseFswHsk.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Housekeeping trending tester module"
00012 __author__   = "J. Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "7/20/2004"
00014 __version__  = "$Revision: 1.1 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 import os, sys
00021 import xml.dom.minidom             as minidom
00022 from LATTE.client.gOptions         import Options
00023 from LATTE.database.gSchemaConfig  import getChildNodes
00024
00025 class HskPacketWriter(object):
00026   def __init__(self, codeFile=sys.stdout, sqlFile=sys.stdout):
00027     self.__name      = None
00028     self.__apid      = None
00029     self.__length    = None
00030     self.__brief     = None
00031     self.__descr     = None
00032     self.__payload   = []
00033     self.codeFile    = codeFile
00034     self.sqlFile     = sqlFile
00035     pass
00036
00037   def dump(self):
00038     prefix = '  '
00039     # print "HSK telemetry packet: "
00040     # print "%sHeader:"              % ( prefix )
00041     # print "%s%sapid    = 0x%04x"   % ( prefix, prefix, self.apid()   )
00042     # print "%s%slength  = 0x%04x"   % ( prefix, prefix, self.length() )
00043     # print "%s%sbrief   = %s"       % ( prefix, prefix, self.brief()  )
00044     # print "%s%sdescr   = %s"       % ( prefix, prefix, self.descr()  )
00045     # print "%sPayload: "            % ( prefix )
00046     # print self.payload()
00047     # print ""
00048
00049   def writeCode(self):
00050     className = "HskPacket%03x" % self.apid()
00051     t         = '  '
00052
00053     msg = ""
00054     msg += "class %s(HskPacket):\n" % className
00055     # insert readList here.
00056     msg += t + "mnemList = [\n"
00057     for tag,bitkey,brief in self.payload():
00058       msg += t + t + '(\'' + tag + '\', \'' + bitkey + '\'),\n'
00059     msg += t + t + "]\n"
00060
00061     msg += t + "def __init__(self, ui):\n"
00062     msg += t + t + "HskPacket.__init__(self, ui)\n"
00063     msg += t + t + "self.name  = \"%s\"\n" % self.name()
00064     msg += t + t + "self.brief = \"%s\"\n" % self.brief()
00065     msg += t + t + "self.descr = \"%s\"\n" % self.descr()
00066     msg += t + t + "self.read()\n"
00067     print >> self.codeFile, msg
00068     print >> self.codeFile, ""
00069
00070   def writeSQL(self):
00071     for tag,bitkey,brief in self.payload():
00072       msg = ''
00073       msg += 'INSERT INTO TLMfields (MNEM,DESCRIP) VALUES'
00074       msg += '(\'' + tag + '\', \'' + brief + '\');'
00075       print >> self.sqlFile, msg
00076
00077   def name(self, a=None):
00078     if a is not None:
00079       self.__name = str(a)
00080     return self.__name
00081
00082   def apid(self, a=None):
00083     if a is not None:
00084       self.__apid = int(a)
00085     return self.__apid
00086
00087   def length(self, a=None):
00088     if a is not None:
00089       self.__length = int(a)/8
00090     return self.__length
00091
00092   def brief(self, a=None):
00093     if a is not None:
00094       self.__brief = a
00095     return self.__brief
00096
00097   def descr(self, a=None):
00098     if a is not None:
00099       self.__descr = a
00100     return self.__descr
00101
00102   def payload(self):
00103     return self.__payload
00104
00105   def addPayload(self, item):
00106     self.__payload.append(item)
00107
00108
00109
00110 def readCATH(fileName, codeFile, sqlFile):
00111   fn = "readCATH"
00112   curDir = os.getcwd()
00113   mainFilePath = os.path.dirname(fileName)
00114   mainFileName = os.path.basename(fileName)
00115   if mainFilePath != '': os.chdir(mainFilePath)
00116   try:
00117     doc = minidom.parse(mainFileName)
00118   except Exception, e:
00119     os.chdir(curDir)
00120     raise e
00121
00122   comments = []
00123   for n in doc.childNodes:
00124     if n.nodeType == minidom.Node.COMMENT_NODE:
00125       comments.append(n.data)
00126
00127   for n in getChildNodes(doc.documentElement):
00128     if n.nodeType == minidom.Node.ELEMENT_NODE:
00129       tagName = n.tagName.lower()
00130       if tagName == "tlm_pkt":
00131         processTlmPkt(n, codeFile, sqlFile)
00132       if tagName == "tlm_fld":
00133         processTlmFld(n, codeFile)
00134
00135 def processTlmFld(node, codeFile):
00136   nodeID = node.getAttribute('id')
00137   t = '  '
00138   for n in getChildNodes(node):
00139     tagName = n.tagName.lower()
00140     if tagName == 'length':
00141       length = n.firstChild.data.strip()
00142
00143   msg = t + t + '\'' + nodeID + '\': ' + length + ','
00144   print >> codeFile, msg
00145
00146 def processTlmPkt(node, codeFile, sqlFile):
00147   nodeID = node.getAttribute('id')
00148   packetCode = HskPacketWriter(codeFile, sqlFile)
00149   packetCode.name(nodeID)
00150   for n in getChildNodes(node):
00151     tagName = n.tagName.lower()
00152     if   tagName == 'apid':
00153       apid = n.firstChild.data.strip()
00154       packetCode.apid(apid)
00155     elif tagName == 'length':
00156       length = n.firstChild.data.strip()
00157       packetCode.length(length)
00158     elif tagName == 'brief':
00159       brief = n.firstChild.data.strip()
00160       packetCode.brief(brief)
00161     elif tagName == 'descr':
00162       descr = n.firstChild.data.strip()
00163       packetCode.descr(descr)
00164     elif tagName == 'tlm_payload':
00165       processTlmPayload(n, packetCode)
00166     else:
00167       pass
00168   packetCode.writeSQL()
00169   packetCode.writeCode()
00170
00171 def processTlmPayload(node, packetCode):
00172   for n in getChildNodes(node):
00173     tagName = n.tagName.lower()
00174     if   tagName == 'tlm_itos':
00175       processTlmITOS(n, packetCode)
00176     else:
00177       pass
00178
00179 def processTlmITOS(node, packetCode):
00180   for n in getChildNodes(node):
00181     tagName = n.tagName.lower()
00182     if   tagName == 'tlm_mne':
00183       processMnemonic(n, packetCode)
00184     else:
00185       raise KeyError, 'unrecognized node= ', tagName
00186
00187 def processMnemonic(node, packetCode):
00188   nodeID     = str(node.getAttribute('id'))
00189   nodeField  = str(node.getAttribute('tlm_fld'))
00190   for n in getChildNodes(node):
00191     tagName = n.tagName.lower()
00192     if   tagName == 'brief':
00193       brief = n.firstChild.data.strip()
00194     else:
00195       pass
00196   packetCode.addPayload( (nodeID, nodeField, brief) )
00197
00198
00199
00200
00201 def startHeader(codeFile):
00202   t = '  '
00203   msg = ''
00204   msg += "from LATTE.monitoring.HskPacketDecoder import HskPacketBase\n"
00205   msg += "\n"
00206   msg += "class HskPacket(HskPacketBase):\n"
00207   msg += t + 'bitDict = {'
00208   print >> codeFile, msg
00209
00210
00211 def endHeader(codeFile):
00212   t = '  '
00213   msg = ''
00214   msg += t + '}\n'
00215   msg += t + "def __init__(self, ui):\n"
00216   msg += t + t + "HskPacketBase.__init__(self, ui)\n"
00217   print >> codeFile, msg
00218   # print >> codeFile, "\n"
00219
00220 if __name__ == '__main__':
00221
00222   # Options, first list mandatory, second list optional
00223   options = Options(['field','packet'],
00224                     [])
00225   try:
00226     options.parse()
00227   except Exception, msg:
00228     # options.usage(usage())
00229     raise Exception, msg
00230
00231   field  = options.field
00232   packet = options.packet
00233
00234   online = os.environ['ONLINE_ROOT']
00235
00236   codeFile = open(os.path.join(online, 'LATTE/monitoring/HskPacket.py'), 'w')
00237   sqlFile  = open(os.path.join(online, 'LATTE/monitoring/HskSql.sql'),   'w')
00238   print >> sqlFile, "use itosDB;"
00239   startHeader(codeFile)
00240   readCATH(field,  codeFile, sqlFile)
00241   endHeader(codeFile)
00242   readCATH(packet, codeFile, sqlFile)
00243
00244
00245
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: PowerPanelImpl.py Source File

runcontrol

PowerPanelImpl.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "RunControl Power Panel Implementation"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "10/11/2002"
00014 __version__  = "$Revision: 2.6.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from qt import SIGNAL, QCursor, Qt, QAction, QKeySequence, QPixmap
00021
00022 import PowerPanel
00023 import FEpowerUp
00024
00025 class PowerPanelImpl(PowerPanel.PowerPanel):
00026
00027   image_green_off = \
00028     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00029     "\x49\x48\x44\x52\x00\x00\x00\x0e\x00\x00\x00\x0e" \
00030     "\x08\x06\x00\x00\x00\x1f\x48\x2d\xd1\x00\x00\x01" \
00031     "\x46\x49\x44\x41\x54\x78\x9c\x85\x92\x2d\x92\xc2" \
00032     "\x30\x1c\xc5\x7f\xed\x44\x44\x20\x10\x08\x44\x05" \
00033     "\x02\x51\x81\xac\xa8\x40\x70\x00\x04\xb2\x07\xe8" \
00034     "\x01\x2a\x57\x54\x56\xac\x40\x70\x00\xe4\x8a\x4a" \
00035     "\x04\x07\x58\x81\x40\x44\x20\x10\x08\x44\x45\x45" \
00036     "\x04\x02\x51\x81\xe8\x4c\x56\xf4\x63\xda\xa1\xcc" \
00037     "\xbe\x99\x4c\xbe\xde\xcb\x7b\x49\xfe\x16\x03\x38" \
00038     "\xe7\x37\xd3\x8c\x7d\xc7\xb5\x86\x38\x3d\x68\xad" \
00039     "\x8d\xd6\xda\x74\x85\x00\x87\xc3\xc1\x7c\xd2\xd0" \
00040     "\x15\x84\xdf\xa1\x59\x46\x4b\x13\xc6\xa1\xf9\x24" \
00041     "\xb6\x1a\x51\x56\x3e\x39\xe7\x17\xd2\x74\xc7\xf3" \
00042     "\x55\xb6\x84\xb1\x14\x04\x41\xc4\x4c\x4b\x94\x52" \
00043     "\x24\x49\x62\x01\xd8\xdd\xbb\xa4\xe9\x8e\xeb\xa3" \
00044     "\x64\x22\x25\x79\x01\x79\x01\xd7\x47\x49\x9a\xee" \
00045     "\xde\x12\x5a\x4d\xbc\xfd\xcf\x96\x53\x76\x61\xe6" \
00046     "\x7a\x00\x9c\x94\x6a\x49\xce\x08\x26\x52\xb2\x1a" \
00047     "\xad\x00\x48\x92\xc4\xb2\x1b\xb7\x86\x94\xdd\x14" \
00048     "\xd9\x4d\xe1\x8c\x68\x1b\x40\x59\x96\x68\x74\x7b" \
00049     "\x98\xed\x3b\x6e\xe5\x5a\xc0\x58\x88\xe1\x26\x05" \
00050     "\x42\x88\x5e\x54\xd1\x75\xf4\x23\xdf\x50\x32\x08" \
00051     "\x77\xea\xc2\x1d\xf4\xb4\x72\xb5\xbb\x4f\x1d\x04" \
00052     "\x51\x7d\x54\x1f\x02\x01\x45\x3d\xa9\xa3\xb7\x77" \
00053     "\xeb\xfe\xd3\xf6\x77\xcb\xe3\xf5\x62\x2c\x05\x8b" \
00054     "\xe9\xa2\x5a\xbc\xd7\x9b\x73\xd8\x7f\xed\xad\x5e" \
00055     "\x39\xc5\x71\x6c\x00\x3c\xcf\xe3\xa8\x8e\xd5\xa2" \
00056     "\xee\x10\xe6\x55\xf7\x26\xec\x3a\xab\xfa\x3b\x34" \
00057     "\xba\x8d\x07\xb0\x76\xd7\x6c\x36\x9b\xff\xeb\xf7" \
00058     "\x13\xfe\x00\xbe\x37\x89\x8a\x88\xac\xe1\x96\x00" \
00059     "\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
00060   image_green_on = \
00061     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00062     "\x49\x48\x44\x52\x00\x00\x00\x0e\x00\x00\x00\x0e" \
00063     "\x08\x06\x00\x00\x00\x1f\x48\x2d\xd1\x00\x00\x01" \
00064     "\x16\x49\x44\x41\x54\x78\x9c\x8d\x92\x2b\xb2\xc2" \
00065     "\x30\x14\x86\xbf\x32\x15\x88\x2b\x2b\x10\x08\x04" \
00066     "\x02\x81\xa8\xcc\x22\x10\x91\x5d\x08\x0b\xc8\x02" \
00067     "\x58\x02\xa2\xb2\x12\xc1\x22\x22\x2b\x2a\x2a\x2a" \
00068     "\x22\x22\x22\x90\x15\x88\xcc\xe4\x8a\xd2\xde\xe6" \
00069     "\x52\x66\x38\x2a\xe7\xf1\xcd\x7f\x1e\x49\x58\x30" \
00070     "\xad\x75\x18\xdf\x42\x88\x64\xa9\x66\x35\x77\x9c" \
00071     "\x73\xc1\x39\x17\xfe\x17\xdd\x6e\xb7\xb7\x58\x04" \
00072     "\x8d\x4a\xb2\x95\x41\x78\x11\x64\x2b\xc3\x27\x38" \
00073     "\x19\x21\x63\x0c\x7a\xad\xa9\x8e\x15\x0f\x9e\x53" \
00074     "\x41\xc6\x9a\xa2\x29\xd8\x99\x1d\x75\x57\xa3\xce" \
00075     "\x2a\x89\x5a\x15\x42\x24\x23\x94\xb2\x99\xc0\x07" \
00076     "\x4f\xaa\x63\x35\x38\xfd\x6c\x46\xad\x75\x30\xc6" \
00077     "\x20\x5b\x19\x3c\x3e\x82\x46\xf3\x78\xca\x43\x09" \
00078     "\x3f\xa0\x2e\x2a\xbc\x2d\x67\x28\x72\x78\xdc\x1b" \
00079     "\x6c\xf7\x16\xdb\xdb\xc9\x4f\xe7\xc9\x94\x94\x2c" \
00080     "\x0e\x4d\xb6\xe9\xe2\x4e\xd2\xf9\x9d\x84\x17\x1f" \
00081     "\xd7\x9e\x55\x19\x58\xb0\xdb\x41\x75\x05\x7f\xab" \
00082     "\x2e\x9a\xe2\x2b\x35\x78\x9d\x63\x0e\x03\x94\x87" \
00083     "\x92\x66\x6f\x38\x76\xbb\x41\x09\x60\x1c\x6f\x0b" \
00084     "\x57\x75\x4d\xa2\xef\xa4\x2e\x2a\xd0\x43\x9e\xe7" \
00085     "\xdc\xeb\x7b\x0c\xbc\x20\x58\x00\xe7\xca\x75\x57" \
00086     "\x0f\x5c\x6f\xa3\xfc\x29\x3f\x21\xa5\x5c\xfc\xbf" \
00087     "\x5f\xd9\x2f\x41\x44\x7e\xe4\x06\x4c\xc7\x96\x00" \
00088     "\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
00089
00090
00091   image_green_off_old = \
00092     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00093     "\x49\x48\x44\x52\x00\x00\x00\x1c\x00\x00\x00\x1c" \
00094     "\x08\x06\x00\x00\x00\x72\x0d\xdf\x94\x00\x00\x02" \
00095     "\xc9\x49\x44\x41\x54\x78\x9c\xbd\x96\x21\x73\xdb" \
00096     "\x30\x14\xc7\xff\xee\x09\x04\x04\x14\x14\x08\x04" \
00097     "\x14\x06\x18\x14\x08\x04\x04\x14\x0c\x06\x04\x14" \
00098     "\xf8\x43\x14\x04\x04\x0c\x14\x0c\x04\x04\x04\x18" \
00099     "\x0c\xf6\x03\x18\x0c\x08\x04\x0c\x14\x18\x0c\x18" \
00100     "\x08\x0c\x18\x14\x0c\x14\x04\x18\x14\x04\x18\x04" \
00101     "\xe8\xce\x03\xce\x93\x25\x5b\x76\x9b\xbb\xdd\x5e" \
00102     "\xce\x97\x44\x92\xdf\xef\xfd\x9f\xf4\x24\x01\xff" \
00103     "\xd9\x82\x4b\x06\x67\x87\xd7\xaa\xdd\x36\x9b\x4c" \
00104     "\x2f\xf2\xc1\x3e\x03\xb9\x65\xd7\x9d\xf6\x37\x7d" \
00105     "\xbc\x84\x63\xac\x37\x3a\x1f\x88\x20\x7d\xaa\xa4" \
00106     "\x94\x15\x00\x2c\x97\xcb\x5e\xbf\xde\x8e\xa2\x28" \
00107     "\x9c\xd4\x71\xce\x3f\x95\x36\x02\x0e\x41\x3b\x8d" \
00108     "\x36\xec\x4d\x1f\x8d\x9a\x38\x4b\xaa\x3c\x7d\x41" \
00109     "\x5e\xe4\x60\x60\x98\xf2\x29\x50\x02\x0b\xb1\x70" \
00110     "\x9c\x7f\x04\x75\x1a\xec\x34\x92\x2a\x29\x65\xb5" \
00111     "\x4b\x77\x00\x00\x0d\xed\x55\xc6\xc0\xb0\xbe\x5f" \
00112     "\x1b\x80\x94\xb2\x52\x4a\x41\x08\xd1\x81\x5e\xd9" \
00113     "\x7f\x08\x46\x73\x15\x67\x49\xb5\x4d\xb7\xd0\xe7" \
00114     "\xcf\xf1\xd4\x7d\x28\x90\x6d\xba\x45\x9c\x25\xce" \
00115     "\x54\x28\xa5\x3a\xc1\x19\xa0\xbd\xe4\x67\x93\x69" \
00116     "\x10\x67\x49\x95\x24\x31\x00\xe0\x78\xd2\xc8\xdf" \
00117     "\x35\x0e\x25\x3a\x4f\xfe\xde\x80\x93\x24\x86\x94" \
00118     "\xb2\xea\x4b\xb1\x03\x6c\xab\xcb\xf7\x2f\x06\x76" \
00119     "\x28\x81\xb9\x10\xb8\xbb\x19\x79\x53\x7a\x28\x61" \
00120     "\xa0\xbb\x74\x07\x29\x65\xb5\xd9\x6c\x02\x9f\xca" \
00121     "\xab\xf6\xcb\xa4\x2e\x2f\x73\xe3\x6c\x2e\x04\xbe" \
00122     "\x3d\xac\xf0\x10\x3d\x62\x32\xf6\x32\x71\x28\xeb" \
00123     "\x6f\x0d\x0d\xa5\x94\xa3\xcc\xfe\xcd\x80\x26\x9d" \
00124     "\x46\x5d\xda\xa8\x23\xcb\x0e\xbf\xf1\x33\x4b\x8d" \
00125     "\x63\x9f\x1d\x4f\x1a\xd7\x23\x86\xb4\x4c\x01\x4b" \
00126     "\x98\xad\xd2\xbb\xd3\xe4\x45\xee\xfc\xff\xa5\x14" \
00127     "\xde\x5e\xd5\x20\xac\x6d\xc5\xb8\xc0\x62\xba\xc0" \
00128     "\x7e\xbf\x07\xe7\xdc\x0f\xa4\x9a\x0b\x79\x68\xa0" \
00129     "\x76\x0a\xfb\xd2\xd9\x36\xad\xeb\xcc\xec\xd5\xbe" \
00130     "\xd3\x67\x80\xf6\xde\x48\xb0\xeb\xd1\xc0\x56\xeb" \
00131     "\x2f\xc9\xda\x29\xeb\x7f\xef\x0a\x68\x94\xd1\x5c" \
00132     "\x86\xe3\xb0\x71\xda\xf7\x78\x49\xfd\x41\x74\x86" \
00133     "\xd8\x1b\x32\x07\x47\x8e\xbc\xee\x1d\x50\xe2\x33" \
00134     "\x7d\xd2\x60\x94\x99\x82\xbe\x0a\xd3\xdf\x29\x0b" \
00135     "\x00\xd8\x6c\x36\x01\xa3\x58\x3e\x11\xb5\x3d\xae" \
00136     "\x04\xea\x7d\xb6\x65\x54\x1a\x1d\x20\x75\x3c\x44" \
00137     "\x8f\x1d\x67\x83\x30\x5d\x97\xc5\xfc\xf6\xae\x6e" \
00138     "\xfb\xe3\x0e\xa1\xd2\x70\x80\x76\x81\xae\x66\x51" \
00139     "\x10\x45\xab\x8f\xa1\x04\xd3\x1a\x37\xa3\xf3\x4e" \
00140     "\xd4\x2e\x9f\xb1\x3b\xbc\x63\xe6\x20\x9d\x2d\x83" \
00141     "\x38\x4b\xaa\x1f\xc9\xf7\xfa\xa4\xf0\x8d\x3e\xcf" \
00142     "\xb1\x51\x56\x02\xd6\x94\x01\xe7\x12\x2c\xc6\x75" \
00143     "\xa3\xa3\xb0\x7d\x94\x48\x29\xab\xd5\x2c\x0a\xd6" \
00144     "\xf7\x6b\x84\x3c\x04\x03\x33\xa9\xa3\x39\x66\x8c" \
00145     "\x21\x9c\x84\xcd\x4b\x36\xac\xa5\x0e\xe8\x39\xf1" \
00146     "\xe9\x3c\x03\x00\x21\x84\x09\x86\x0e\x61\xaf\xb5" \
00147     "\x95\x91\x3a\x0b\xf8\xfc\xf5\x39\x18\xbc\x3a\x3c" \
00148     "\x3d\x3d\x39\x47\x8b\x10\x02\x4a\x29\x67\x99\x03" \
00149     "\x1e\x90\x07\x16\xde\x7f\xc1\x6a\x16\x05\x83\xeb" \
00150     "\x8f\xd4\x91\x5a\xa5\x14\x8a\xc2\xe7\xbd\x1f\x44" \
00151     "\x76\x5b\xd4\x0b\xea\xe2\xcb\x91\x1d\x00\x99\x51" \
00152     "\xdc\xb3\xd7\x2e\xa6\xcd\xbd\xe7\xa2\x4b\xec\x50" \
00153     "\x40\x4a\x29\xb3\x12\xc9\x78\xc9\xbd\xf7\x9a\x7f" \
00154     "\x6a\xed\x6c\xb4\xed\x2f\x6a\x02\x7f\xd3\xbb\x1f" \
00155     "\xcf\x2c\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42" \
00156     "\x60\x82"
00157
00158   image_green_on_old = \
00159     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00160     "\x49\x48\x44\x52\x00\x00\x00\x1c\x00\x00\x00\x1c" \
00161     "\x08\x06\x00\x00\x00\x72\x0d\xdf\x94\x00\x00\x02" \
00162     "\x71\x49\x44\x41\x54\x78\x9c\xbd\x96\xaf\x92\xdb" \
00163     "\x30\x10\xc6\x3f\x67\x0c\x0e\x04\x14\x04\x18\x18" \
00164     "\x04\x18\x14\x04\x08\x14\x1c\x34\x28\x0c\x30\x0c" \
00165     "\xbc\x47\x30\xb8\x07\x30\x38\x10\x70\x20\x0f\x51" \
00166     "\x10\x28\x10\x50\x70\x20\xa0\xc0\x50\xe0\x40\x81" \
00167     "\x81\x81\x81\x41\x40\x40\x80\x81\x67\x5c\xe0\xac" \
00168     "\xa2\x7f\xb1\x93\xb4\xd3\x9d\xc9\x64\x2c\xad\xf7" \
00169     "\xa7\x6f\x77\x25\x19\xf8\xcf\xe6\xdd\xea\x98\xe7" \
00170     "\x79\x77\x6d\xee\xf9\xf9\xf9\xe6\x38\x83\x8e\x04" \
00171     "\x99\xcf\xe7\xd6\x5c\x59\x96\x0f\x41\xaf\x3a\xe5" \
00172     "\x79\xde\x99\x20\x13\x62\xc2\x38\xe7\x1d\x00\x24" \
00173     "\x49\x72\x35\xae\x73\xa2\xae\x6b\x2d\x7d\x41\x10" \
00174     "\xdc\xb4\x7a\x02\x0e\x41\xad\x41\x15\x56\x96\xa5" \
00175     "\x5c\xfd\x46\x6c\xba\xfd\xd3\x1e\x75\x54\xf7\x8b" \
00176     "\x28\x02\x00\x40\xdc\xc4\x48\x59\x2a\xe3\x8c\x41" \
00177     "\xb5\x01\x35\x8d\xa4\x6a\x23\x36\xdd\x76\xb1\x1d" \
00178     "\x55\xb7\xfa\x5c\x49\x30\xe7\xbc\x13\x85\x00\x8b" \
00179     "\x98\x05\x9d\xb8\x60\x54\x2b\x13\x76\x40\x63\xfd" \
00180     "\xc8\xb6\x8b\x2d\x36\x62\xa3\x95\x42\x14\xc2\x5a" \
00181     "\xd8\xc4\x1a\x41\xdf\x04\x2a\xac\x45\xab\x05\x57" \
00182     "\xed\x80\x06\x2d\x5a\x09\xe5\x9c\x77\xaa\x2a\x35" \
00183     "\xc5\x1a\xd0\x54\xb7\x7f\xda\xcb\x80\x47\xb4\xf0" \
00184     "\x11\xc0\x47\xe0\x84\x1e\xd1\x4a\xe8\x7a\xb9\x06" \
00185     "\xe7\xbc\xcb\x5e\x33\x0f\x27\x40\x08\x5d\xe5\x04" \
00186     "\xd0\x37\x35\xa9\xa3\xe6\x00\x00\x1f\x01\xd6\xc7" \
00187     "\x0c\x71\xfb\xdd\x09\x24\x28\x99\x28\x44\xaf\x6c" \
00188     "\x6a\xab\xf4\xd5\x97\x4c\x75\xad\x12\xe4\xe7\xf4" \
00189     "\x17\xf6\xfe\xc7\x55\x20\xf9\xfb\xf0\x21\x96\x02" \
00190     "\xd8\x5d\xc6\xd5\x5a\x3a\x6b\x48\xea\x68\xd5\x2d" \
00191     "\x6a\x7c\xf8\x3f\xd0\xa2\x76\xb9\x4b\x23\xff\x3a" \
00192     "\xaa\x51\x9d\x2a\xb0\x88\xa1\xaa\x2a\xcd\xc7\x09" \
00193     "\xa4\x3d\xf6\x45\x4f\xc0\xa8\x91\x3f\x65\x66\x27" \
00194     "\x76\x96\x8f\x8c\xa8\x1e\x5b\xa4\xd0\x87\x8f\xd9" \
00195     "\x9d\x50\x7a\xef\x9a\x0d\x2a\x7c\xd4\x86\xde\x77" \
00196     "\x02\xe3\x26\xfe\x2b\xa0\xb4\x73\xf9\xaa\xd3\xa5" \
00197     "\x8e\x13\xe0\x72\xda\xd3\xbf\x7a\x36\xde\x6b\x07" \
00198     "\x34\x98\x6d\x67\xd6\x38\x6d\x0d\xa9\xd0\xbc\x62" \
00199     "\x56\x9f\xab\x87\x60\xf1\xdb\xb7\xfe\x41\x6f\x4e" \
00200     "\xb9\x35\xb4\x94\xaa\x1b\x34\x65\xa9\x77\x0f\xf4" \
00201     "\x80\x06\x8b\x62\x3e\xea\xe7\x6c\x27\x79\x91\xb2" \
00202     "\xc4\x33\xaf\x25\x97\xb5\x68\x2f\xca\x00\x5d\x5d" \
00203     "\x78\x1e\x3a\xd7\x51\x53\x68\x5e\x25\x9c\xf3\x2e" \
00204     "\x65\xa9\xf7\xf2\xfb\x05\x41\x11\xc8\xee\xa3\x83" \
00205     "\x9c\xc6\xd8\x1b\x73\xc3\x1c\x66\x29\x4c\x92\xc4" \
00206     "\xa3\xfb\x4c\x55\xcb\xbf\x72\x2f\x7b\xcf\x3a\xb5" \
00207     "\xe3\x2c\x33\xa7\x42\xdb\x65\xb0\x1b\xb3\xf7\xac" \
00208     "\xaf\xe9\x09\xc0\x14\x60\x11\x83\x28\x04\x2c\xa8" \
00209     "\x6b\x0d\x06\x2c\x9c\x86\xc8\x5e\x33\x6f\xf0\x18" \
00210     "\x61\x51\x9f\x2a\x21\x04\xe8\xaa\x31\xcf\xc6\x31" \
00211     "\x90\x19\xeb\xee\x8f\x23\xc0\xb8\xc9\x4f\x40\x35" \
00212     "\x52\xb8\x25\x5b\xca\xfe\x78\x78\x83\x9b\x0b\x72" \
00213     "\xa5\x3a\x9c\x86\xce\xef\x9a\x7f\x6a\x66\x36\x4c" \
00214     "\xfb\x03\xae\x8f\x50\xbe\x7d\x72\xee\xdd\x00\x00" \
00215     "\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
00216
00217   image_yellow_on = \
00218     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00219     "\x49\x48\x44\x52\x00\x00\x00\x1c\x00\x00\x00\x1c" \
00220     "\x08\x06\x00\x00\x00\x72\x0d\xdf\x94\x00\x00\x02" \
00221     "\x38\x49\x44\x41\x54\x78\x9c\xbd\x96\xaf\x72\xab" \
00222     "\x40\x14\xc6\x3f\x3a\x88\x8a\x88\x48\x44\x05\x22" \
00223     "\x02\x11\x11\x51\x81\x88\x40\xf4\x01\xf6\x21\x22" \
00224     "\xf2\x00\x57\x54\x44\x46\x44\x56\x22\x10\x7d\x04" \
00225     "\x44\xc5\x15\x11\x88\x08\x44\x05\x22\x02\x81\x40" \
00226     "\x54\x20\x22\x10\x2b\x22\x76\x66\xaf\x60\x96\x2e" \
00227     "\xbb\x0b\xdd\xb4\x73\x7b\x0c\x19\xce\xe6\xfc\xce" \
00228     "\xf7\xed\x3f\x80\x5f\x0e\xc7\x76\x60\x9e\xe7\x7c" \
00229     "\x2c\x17\x86\xa1\x75\x9d\xc9\x81\x02\x12\x04\xbe" \
00230     "\x96\x2b\xcb\xfa\x5b\xd0\xd1\x41\x79\x9e\x73\x15" \
00231     "\xa4\x42\x54\x58\x9a\xa6\x1c\x00\x08\x21\xa3\x75" \
00232     "\x8d\x89\xb6\x6d\x06\xf6\xcd\xe7\x9e\x55\xf7\x02" \
00233     "\x38\x05\xbd\x9b\x82\x95\x65\xdd\xc3\xb2\x2c\xe1" \
00234     "\x55\xb9\xe5\x8c\x85\x9c\xb1\xb0\xff\x9d\x65\x89" \
00235     "\x11\x22\xc3\xe5\x18\x74\x21\xdb\x28\x83\xd6\xeb" \
00236     "\xe4\x4b\x75\xa7\xd3\x06\x51\xb4\xe9\xad\x6d\xca" \
00237     "\x33\xbc\x60\xa9\x29\xed\x15\xca\x30\x31\x57\xb6" \
00238     "\x30\x00\x58\xaf\x13\xc8\x6a\x01\xa0\x29\xcf\xda" \
00239     "\x38\xcd\x52\xa0\x5b\x04\xb7\xc0\x64\x28\xf0\x69" \
00240     "\x6d\x73\xbd\x6a\xd6\xf6\x40\x55\xdd\xad\x30\x11" \
00241     "\x8c\x85\x3c\x4d\x53\xbe\x7d\xde\x39\x00\x50\x14" \
00242     "\xef\x83\xfc\x1d\x30\xdc\xd4\x42\x9d\x5a\x88\xd2" \
00243     "\x14\x8c\x3d\x59\x41\x55\x2b\x65\x95\xae\x9c\x10" \
00244     "\xea\x1e\xbc\x61\x57\x5d\xe7\x99\x15\x0c\x00\x9e" \
00245     "\xc8\x07\x62\xec\x39\xd0\xd9\x2a\x37\x60\x9c\x43" \
00246     "\x7f\x51\x68\xef\xe6\xf3\x17\xb8\xee\xd1\x0a\xe8" \
00247     "\x2f\x0a\xd0\xba\x86\x17\x2c\x71\xb9\xb4\x68\xae" \
00248     "\xd7\x69\x60\x5d\xad\xac\x0a\x8f\x07\x03\x00\x54" \
00249     "\x7f\xdf\xb4\x4c\x0f\x94\x8f\x2d\x93\xc2\xdb\xc2" \
00250     "\x1d\xcd\x18\x15\xfe\x34\xa6\x1c\xfa\x2f\x96\x1e" \
00251     "\x5f\x69\x57\xc7\xbd\x07\x00\x5c\x2e\xed\x10\x28" \
00252     "\x4e\x7b\xf1\x5c\x04\xb1\xf5\xfd\xa6\x07\x05\x6d" \
00253     "\xef\xb5\xb7\xf1\xa1\x5b\xb5\xbd\x42\xf5\x8a\x39" \
00254     "\x9d\x36\xdf\x82\x25\xbb\xce\x1d\xa1\x0e\x00\x7c" \
00255     "\x36\xb2\x4a\xe5\x0d\x1a\x45\x1b\xe7\x36\x68\x07" \
00256     "\x33\xa9\x93\xc3\xb8\x9c\x04\x38\x8a\x88\xe5\x99" \
00257     "\xca\x06\x30\x93\x3a\x5a\xd7\x00\x0c\x17\xb0\x7a" \
00258     "\xd8\x8a\x83\xb8\x2a\xb7\x1c\x10\x5b\x86\x02\x98" \
00259     "\xa1\xae\x56\x38\xbe\x0e\xe7\x4c\x86\xc9\x40\x00" \
00260     "\xf8\x13\x27\x8e\xa6\x90\x10\xe2\x88\xfb\x4c\x6e" \
00261     "\x60\x11\x10\x27\x3e\xec\x39\xad\xd9\x40\x19\x60" \
00262     "\x07\x13\x31\xb9\x1a\xe3\xc3\x9e\xcb\xc7\xd2\x6a" \
00263     "\xf5\x88\xa6\x3c\xf7\xf6\x98\x20\x63\xb0\x99\xef" \
00264     "\x63\xfb\xbc\xd3\x15\xca\xe1\x05\x4b\x78\xf8\xbc" \
00265     "\x62\x8a\xe2\xbd\xdb\x53\x23\x90\x31\x98\xa8\x05" \
00266     "\x58\x7e\x97\xaa\xf3\xaa\xde\x71\xb3\xa6\x99\xfc" \
00267     "\xbf\x50\x67\x0d\xb4\x69\x48\xb5\x5a\x80\x4c\xdf" \
00268     "\x35\xbf\x1a\xff\x00\xb3\xe3\x40\xd9\xc1\x60\x1b" \
00269     "\x94\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" \
00270     "\x82"
00271
00272   image_yellow_off = \
00273     "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \
00274     "\x49\x48\x44\x52\x00\x00\x00\x1c\x00\x00\x00\x1c" \
00275     "\x08\x06\x00\x00\x00\x72\x0d\xdf\x94\x00\x00\x02" \
00276     "\xc0\x49\x44\x41\x54\x78\x9c\xbd\x96\x21\x77\xa3" \
00277     "\x40\x10\xc7\xff\xf4\xad\x40\x44\x20\x10\x08\x04" \
00278     "\x22\x12\x81\xa8\x88\xa8\xbc\x0f\x80\x88\x38\x71" \
00279     "\xf2\x44\xc4\x89\x7e\x80\x8a\xca\xca\x48\xc4\x89" \
00280     "\x13\x11\x15\x88\xfd\x00\x15\x27\x2a\x10\x27\x22" \
00281     "\x10\x15\x11\x08\x04\x62\x05\x02\xb1\x62\xde\xe3" \
00282     "\x04\x6f\xc9\x2e\x2c\x69\x5a\xd1\x79\x8f\x17\xb2" \
00283     "\xbb\xec\x6f\xfe\xb3\xcc\x0c\xc0\x17\x9b\x73\xed" \
00284     "\xc2\xa2\x28\xfa\xa5\xb9\xcd\x66\x73\xf5\x3e\x17" \
00285     "\x17\x2a\x48\x14\x86\xb3\xb9\xaa\xae\x3f\x05\x5d" \
00286     "\x5c\x54\x14\x45\x3f\x05\x4d\x21\x53\x18\xe7\xbc" \
00287     "\x07\x80\x34\x4d\x17\xf7\xb5\x4e\x34\x75\x6d\x84" \
00288     "\x2f\x08\xc3\xab\xbc\x57\xc0\x4b\xd0\xd9\xa0\x0e" \
00289     "\xab\xea\x7a\xf4\x3e\xcf\xf6\xbd\x38\x96\x70\x45" \
00290     "\x09\x5a\x85\x20\xd7\x03\x93\x2d\xfc\xf4\x87\xb1" \
00291     "\x39\xe7\xbc\xa7\xa6\x02\x0b\x22\x2b\xd4\x18\xd0" \
00292     "\xc3\xa8\x54\x71\xce\x7b\xc1\x0f\x60\x9d\x3d\x9c" \
00293     "\x00\x40\xab\xd0\x00\xe7\xd9\xbe\x07\x60\x85\xde" \
00294     "\xd8\x60\xea\xac\xf2\x6c\xdf\xb7\x87\xa7\x11\xd6" \
00295     "\x4a\x39\xbb\x00\x80\x75\x35\xda\xc3\x93\x01\x2a" \
00296     "\x1b\x01\x6a\xaa\x99\x73\x37\xb3\x11\x0c\x2f\x41" \
00297     "\x9e\xed\xfb\xee\xe5\x79\x50\x40\x84\xb7\x96\xd0" \
00298     "\x48\x36\xbb\xde\x5a\x02\x11\x01\x00\xba\x97\x67" \
00299     "\x70\xce\xfb\x34\x4d\x9d\x38\xf0\x51\x36\xc2\x38" \
00300     "\x57\x03\x38\x55\xd7\x16\xaf\xa3\xaa\x53\x07\x44" \
00301     "\xeb\x04\xeb\x30\xb2\x86\xf4\xd4\x61\x84\x0a\x7e" \
00302     "\x00\xe7\xbc\xdf\xee\xee\x1d\x00\x38\x1e\xff\xcd" \
00303     "\x15\xea\x49\xad\xd4\xa9\x30\x36\x92\x21\x5a\x27" \
00304     "\x48\x1f\x1e\x71\xb7\xfd\x6e\x05\x2a\x28\x30\x84" \
00305     "\x77\x1a\x4a\x5d\xa5\x11\x52\xa5\x4e\x1c\x4b\x00" \
00306     "\x67\xaf\xd5\x5c\xb9\x90\x87\xca\xd4\xfa\xb6\x78" \
00307     "\x45\x9e\xed\xfb\x38\xf0\x87\x71\xcd\x01\x66\x7b" \
00308     "\xd0\x15\xa5\xe1\x75\x75\x3a\xa2\x7a\xf8\x75\x11" \
00309     "\x06\x00\x1d\x11\x3c\xc6\xc0\xba\x1a\xe2\x58\xc2" \
00310     "\x4f\x62\x08\xd1\xa2\xd4\xd6\x58\x5f\x1a\xe9\xc7" \
00311     "\x00\x80\xf5\x0a\x08\xdc\xb3\xca\xc0\x25\xe3\xd2" \
00312     "\x4d\xff\x4f\x72\xb8\xff\x5b\x9e\x66\x7b\x8f\x0a" \
00313     "\xf5\xb2\xa5\x14\x32\xc6\xe0\x31\x06\xcf\x9d\x2d" \
00314     "\x07\x00\x6d\xdc\x9c\x63\x2e\x83\xe9\xce\xd9\xac" \
00315     "\x0a\x69\x35\x2f\xd6\x1f\x31\xfd\xec\xaf\x02\x7a" \
00316     "\x9b\xbb\xcf\xc3\x24\x01\x5e\x64\x8c\x09\xd1\x9a" \
00317     "\x40\x55\x2f\xd5\xef\x76\x77\xef\x7c\x56\x65\x07" \
00318     "\x02\xb9\xde\x6c\x5c\x55\xa1\x51\xe1\xb4\xc5\x7c" \
00319     "\x54\x25\x49\x42\x2b\x25\xdc\xf0\x16\x00\x50\x32" \
00320     "\xe3\x80\x51\x36\x02\x06\x50\x87\x01\x83\xca\xd5" \
00321     "\xb7\xe5\x44\x9f\xc2\x3a\x10\x56\xfe\xda\x0a\x8b" \
00322     "\x49\x8e\xf7\xd6\x3c\xd4\x1b\x69\x9e\xed\xfb\xb6" \
00323     "\x78\x5d\xec\x16\x0a\xe6\x86\xb7\x20\x0b\x4c\x59" \
00324     "\xd0\x34\x00\x26\x0a\x55\x2b\xa1\xa6\x02\x35\xd5" \
00325     "\x58\x13\x7f\xfe\xc9\x1d\xe9\xc7\x20\x22\x90\xa4" \
00326     "\x31\xcf\x5a\x29\x01\x3f\x1a\xc3\x68\x33\x5d\x1d" \
00327     "\xb0\xd0\xf1\x55\x13\x05\x86\x56\xa3\xab\x55\x65" \
00328     "\x6f\x6a\x4b\xca\x74\xe0\x2e\xfb\xed\x5c\xfc\x74" \
00329     "\x78\x7c\x7c\x30\x5a\x8b\xaa\x8d\xb6\x0a\xf2\x1e" \
00330     "\xcc\x4f\x62\x6c\x77\xf7\x8e\xf5\x0c\x95\x25\xc9" \
00331     "\x2d\xa8\xa9\xc6\x37\xac\x6c\x84\x91\x53\xd7\x80" \
00332     "\x94\xa9\x48\x7d\xf8\xe3\x48\x77\x40\x99\x72\xc2" \
00333     "\x06\x02\xce\xea\xae\x06\xbe\x67\x2a\xa9\xa7\xe7" \
00334     "\xeb\x27\xf1\xe2\xc7\xd4\x97\xd9\x7f\xcc\x73\xa6" \
00335     "\x1e\xf4\x37\xb0\x0e\x00\x00\x00\x00\x49\x45\x4e" \
00336     "\x44\xae\x42\x60\x82"
00337
00338   def __init__(self, rc, common, parent = None, name = None, fl = 0):
00339     PowerPanel.PowerPanel.__init__(self, parent, name, fl)
00340     self.__rc     = rc
00341     self.__common = common
00342     self.__parent = parent
00343     self.__fePowerUp = FEpowerUp.FEpowerUp()
00344     if self.chkCALTKR.isChecked():
00345       self.__bothCALandTKR = 1
00346     else:
00347       self.__bothCALandTKR = 0
00348     # Hide the warning message
00349     self.TextLabel.hide()
00350     # Hide the schema button
00351     self.cmdSelectSchema.hide()
00352
00353     self.connect(self.PwrUpButton,SIGNAL("clicked()"), self.powerUp)
00354     self.connect(self.PwrDownButton,SIGNAL("clicked()"), self.powerDown)
00355     self.connect(self.cmdRefresh,SIGNAL("clicked()"),self.refreshPowerStatus)
00356     self.connect(self.cmdSelectAllACD,SIGNAL("clicked()"),self.selectAllACD)
00357     self.connect(self.cmdSelectAllCAL,SIGNAL("clicked()"),self.selectAllCAL)
00358     self.connect(self.cmdSelectAllTKR,SIGNAL("clicked()"),self.selectAllTKR)
00359     self.connect(self.cmdDeselectAllACD,SIGNAL("clicked()"),self.deSelectAllACD)
00360     self.connect(self.cmdDeselectAllCAL,SIGNAL("clicked()"),self.deSelectAllCAL)
00361     self.connect(self.cmdDeselectAllTKR,SIGNAL("clicked()"),self.deSelectAllTKR)
00362     self.connect(self.chkCALTKR,SIGNAL("toggled(bool)"),self.selectBothCALTKR)
00363     self.connect(self.bgCAL,SIGNAL("clicked(int)"),self.selectCAL)
00364     self.connect(self.bgTKR,SIGNAL("clicked(int)"),self.selectTKR)
00365
00366     self.imgGreenOff = QPixmap()
00367     self.imgGreenOff.loadFromData(PowerPanelImpl.image_green_off,"PNG")
00368     self.imgGreenOn = QPixmap()
00369     self.imgGreenOn.loadFromData(PowerPanelImpl.image_green_on,"PNG")
00370     self.imgYellowOn = QPixmap()
00371     self.imgYellowOn.loadFromData(PowerPanelImpl.image_yellow_on,"PNG")
00372     self.imgYellowOff = QPixmap()
00373     self.imgYellowOff.loadFromData(PowerPanelImpl.image_yellow_off,"PNG")
00374
00375     self.__operator = None
00376     self.__adminOverride = None
00377     self.setEnablePowerUpButton(1)
00378     self.setEnablePowerDownButton(1)
00379
00380   def applyPermissions(self, operator):
00381     self.__operator = operator
00382     self.__adminOverride = operator.isAdministrator()
00383     self.setEnablePowerUpButton(1)
00384     self.setEnablePowerDownButton(1)
00385
00386   def setEnablePowerUpButton(self, enable):
00387     if self.__common.options().securedir is not None:
00388       if self.__operator is not None:
00389         if not 'enable_power_up' in self.__operator.getPermissions() and not self.__adminOverride:
00390           self.PwrUpButton.setEnabled(0)
00391           return
00392     self.PwrUpButton.setEnabled(enable)
00393
00394   def setEnablePowerDownButton(self, enable):
00395     if self.__common.options().securedir is not None:
00396       if self.__operator is not None:
00397         if not 'enable_power_down' in self.__operator.getPermissions() and not self.__adminOverride:
00398           self.PwrDownButton.setEnabled(0)
00399           return
00400     self.PwrDownButton.setEnabled(enable)
00401
00402
00403   def selectBothCALTKR(self, state):
00404     if state:
00405       self.__bothCALandTKR = 1
00406     else:
00407       self.__bothCALandTKR = 0
00408
00409   def selectCAL(self, id):
00410     if id > 15: return
00411     check = self.bgCAL.find(id)
00412     if check.isChecked():
00413       state = 1
00414     else:
00415       state = 0
00416     if self.__bothCALandTKR:
00417       check = self.bgTKR.find(id)
00418       check.setChecked(state)
00419
00420   def selectTKR(self, id):
00421     if id > 15: return
00422     check = self.bgTKR.find(id)
00423     if check.isChecked():
00424       state = 1
00425     else:
00426       state = 0
00427     if self.__bothCALandTKR:
00428       check = self.bgCAL.find(id)
00429       check.setChecked(state)
00430
00431   def selectAllACD(self):
00432     if self.__lat.existsAEM():
00433       for arcId in self.__lat.AEM.ARC:
00434         check = self.bgACD.find(arcId)
00435         check.setChecked(1)
00436
00437   def deSelectAllACD(self):
00438     if self.__lat.existsAEM():
00439       for arcId in self.__lat.AEM.ARC:
00440         check = self.bgACD.find(arcId)
00441         check.setChecked(0)
00442
00443   def selectAllCAL(self):
00444     for temId in self.__lat.TEM:
00445       check = self.bgCAL.find(temId)
00446       check.setChecked(1)
00447       self.selectCAL(temId)
00448
00449   def deSelectAllCAL(self):
00450     for temId in self.__lat.TEM:
00451       check = self.bgCAL.find(temId)
00452       check.setChecked(0)
00453       self.selectCAL(temId)
00454
00455   def selectAllTKR(self):
00456     for temId in self.__lat.TEM:
00457       check = self.bgTKR.find(temId)
00458       check.setChecked(1)
00459       self.selectTKR(temId)
00460
00461   def deSelectAllTKR(self):
00462     for temId in self.__lat.TEM:
00463       check = self.bgTKR.find(temId)
00464       check.setChecked(0)
00465       self.selectTKR(temId)
00466
00467   def activate(self):
00468     self.__lat    = self.__common.getLAT()
00469     if self.__lat is None:
00470       self.__rc.loadSchema()
00471     self.__xbrd   = self.__common.getXBRD()
00472     self.disableAllCheck()
00473     self.__fePowerUp.initialize(self.__lat, self.__xbrd)
00474     self.refreshPowerStatus()
00475     app = self.__rc.getApp()
00476     if app is not None:
00477       currentState = self.__rc.getFSM().current_state
00478       if currentState != 'RESET':
00479         self.setEnablePowerUpButton(0)
00480         self.setEnablePowerDownButton(0)
00481       else:
00482         self.setEnablePowerUpButton(1)
00483         self.setEnablePowerDownButton(1)
00484
00485
00486
00487   def disableAllCheck(self, preserveExisting=0):
00488     lat = self.__lat
00489     for i in range(12):
00490       check = self.bgACD.find(i)
00491       if preserveExisting and lat.existsAEM() and lat.AEM.existsARC(i):
00492         pass
00493       else:
00494         check.setEnabled(0)
00495         check.setChecked(0)
00496     for i in range(16):
00497       if preserveExisting and lat.existsTEM(i):
00498         pass
00499       else:
00500         check = self.bgCAL.find(i)
00501         check.setEnabled(0)
00502         check.setChecked(0)
00503     for i in range(16):
00504       if preserveExisting and lat.existsTEM(i):
00505         pass
00506       else:
00507         check = self.bgTKR.find(i)
00508         check.setEnabled(0)
00509         check.setChecked(0)
00510
00511   def initCheckPower(self):
00512     lat = self.__lat
00513     if self.__fePowerUp.isAEMactive(lat.AEM):
00514       for arcId in lat.AEM.ARC.keys():
00515         check = self.bgACD.find(arcId)
00516         check.setEnabled(1)
00517     activeTEMs = self.__fePowerUp.getActiveTEMs(lat)
00518     for temId in activeTEMs.keys():
00519       check = self.bgCAL.find(temId)
00520       check.setEnabled(1)
00521       check = self.bgTKR.find(temId)
00522       check.setEnabled(1)
00523
00524   def getACDPowerUps(self):
00525     acdPowerUp = []
00526     for i in range(self.bgACD.count()):
00527       check = self.bgACD.find(i)
00528       if check.isOn():
00529         acdPowerUp.append(i)
00530     return acdPowerUp
00531
00532   def getTEMPowerUps(self):
00533     temPowerUp = {}
00534     for i in range(16):
00535       powerSupply = 0
00536       check = self.bgCAL.find(i)
00537       if check.isOn():
00538         powerSupply |= 2
00539       check = self.bgTKR.find(i)
00540       if check.isOn():
00541         powerSupply |= 1
00542       temPowerUp[i] = powerSupply
00543     return temPowerUp
00544
00545   def powerUp(self):
00546     self.__fePowerUp.setAcdPowerUp(self.getACDPowerUps())
00547     self.__fePowerUp.setTemPowerUp(self.getTEMPowerUps())
00548     (acdPowerCheck, calPowerCheck, tkrPowerCheck) = self.__fePowerUp.up()
00549     self.refreshLEDs(acdPowerCheck, calPowerCheck, tkrPowerCheck)
00550
00551   def powerDown(self):
00552     self.__fePowerUp.setAcdPowerUp(self.getACDPowerUps())
00553     self.__fePowerUp.setTemPowerUp(self.getTEMPowerUps())
00554     (acdPowerCheck, calPowerCheck, tkrPowerCheck) = self.__fePowerUp.down()
00555     self.refreshLEDs(acdPowerCheck, calPowerCheck, tkrPowerCheck)
00556
00557   def refreshPowerStatus(self):
00558     self.initCheckPower()
00559     apply(self.refreshLEDs, self.__fePowerUp.refreshPowerStatus())
00560
00561   def refreshLEDs(self, acdPowerCheck, calPowerCheck, tkrPowerCheck):
00562     for i in range(12):
00563       acdLed = eval("self.acdLed"+str(i))
00564       if i in acdPowerCheck:
00565         acdLed.setPixmap(self.imgGreenOn)
00566       else:
00567         acdLed.setPixmap(self.imgGreenOff)
00568     for i in range(16):
00569       calLed = eval("self.calLed"+str(i))
00570       tkrLed = eval("self.tkrLed"+str(i))
00571       if i in calPowerCheck:
00572         calLed.setPixmap(self.imgGreenOn)
00573       else:
00574         calLed.setPixmap(self.imgGreenOff)
00575       if i in tkrPowerCheck:
00576         tkrLed.setPixmap(self.imgGreenOn)
00577       else:
00578         tkrLed.setPixmap(self.imgGreenOff)
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: pythfilter.py Source File

pythfilter.py

00001 #!/usr/bin/env python
00002
00003 # pythfilter.py v1.5.5, written by Matthias Baas (baas@ira.uka.de)
00004
00005 # Doxygen filter which can be used to document Python source code.
00006 # Classes (incl. methods) and functions can be documented.
00007 # Every comment that begins with ## is literally turned into an
00008 # Doxygen comment. Consecutive comment lines are turned into
00009 # comment blocks (-> /** ... */).
00010 # All the stuff is put inside a namespace with the same name as
00011 # the source file.
00012
00013 # Conversions:
00014 # ============
00015 # ##-blocks                  ->  /** ... */
00016 # "class name(base): ..."    ->  "class name : public base {...}"
00017 # "def name(params): ..."    ->  "name(params) {...}"
00018
00019 # Changelog:
00020 # 21.01.2003: Raw (r"") or unicode (u"") doc string will now be properly
00021 #             handled. (thanks to Richard Laager for the patch)
00022 # 22.12.2003: Fixed a bug where no function names would be output for "def"
00023 #             blocks that were not in a class.
00024 #             (thanks to Richard Laager for the patch)
00025 # 12.12.2003: Implemented code to handle static and class methods with
00026 #             this logic: Methods with "self" as the first argument are
00027 #             non-static. Methods with "cls" are Python class methods,
00028 #             which translate into static methods for Doxygen. Other
00029 #             methods are assumed to be static methods. As should be
00030 #             obvious, this logic doesn't take into account if the method
00031 #             is actually setup as a classmethod() or a staticmethod(),
00032 #             just if it follows the normal conventions.
00033 #             (thanks to Richard Laager for the patch)
00034 # 11.12.2003: Corrected #includes to use os.path.sep instead of ".". Corrected
00035 #             namespace code to use "::" instead of ".".
00036 #             (thanks to Richard Laager for the patch)
00037 # 11.12.2003: Methods beginning with two underscores that end with
00038 #             something other than two underscores are considered private
00039 #             and are handled accordingly.
00040 #             (thanks to Richard Laager for the patch)
00041 # 03.12.2003: The first parameter of class methods (self) is removed from
00042 #             the documentation.
00043 # 03.11.2003: The module docstring will be used as namespace documentation
00044 #             (thanks to Joe Bronkema for the patch)
00045 # 08.07.2003: Namespaces get a default documentation so that the namespace
00046 #             and its contents will show up in the generated documentation.
00047 # 05.02.2003: Directories will be delted during synchronization.
00048 # 31.01.2003: -f option & filtering entire directory trees.
00049 # 10.08.2002: In base classes the '.' will be replaced by '::'
00050 # 18.07.2002: * and ** will be translated into arguments
00051 # 18.07.2002: Argument lists may contain default values using constructors.
00052 # 18.06.2002: Support for ## public:
00053 # 21.01.2002: from ... import will be translated to "using namespace ...;"
00054 #             TODO: "from ... import *" vs "from ... import names"
00055 #             TODO: Using normal imports: name.name -> name::name
00056 # 20.01.2002: #includes will be placed in front of the namespace
00057
00058 ######################################################################
00059
00060 # The program is written as a state machine with the following states:
00061 #
00062 # - OUTSIDE               The current position is outside any comment,
00063 #                         class definition or function.
00064 #
00065 # - BUILD_COMMENT         Begins with first "##".
00066 #                         Ends with the first token that is no "##"
00067 #                         at the same column as before.
00068 #
00069 # - BUILD_CLASS_DECL      Begins with "class".
00070 #                         Ends with ":"
00071 # - BUILD_CLASS_BODY      Begins just after BUILD_CLASS_DECL.
00072 #                         The first following token (which is no comment)
00073 #                         determines indentation depth.
00074 #                         Ends with a token that has a smaller indendation.
00075 #
00076 # - BUILD_DEF_DECL        Begins with "def".
00077 #                         Ends with ":".
00078 # - BUILD_DEF_BODY        Begins just after BUILD_DEF_DECL.
00079 #                         The first following token (which is no comment)
00080 #                         determines indentation depth.
00081 #                         Ends with a token that has a smaller indendation.
00082
00083 import getopt
00084 import glob
00085 import os.path
00086 import shutil
00087 import string
00088 import sys
00089 import token
00090 import tokenize
00091
00092 from stat import *
00093
00094 OUTSIDE          = 0
00095 BUILD_COMMENT    = 1
00096 BUILD_CLASS_DECL = 2
00097 BUILD_CLASS_BODY = 3
00098 BUILD_DEF_DECL   = 4
00099 BUILD_DEF_BODY   = 5
00100 IMPORT           = 6
00101 IMPORT_OP        = 7
00102 IMPORT_APPEND    = 8
00103
00104 # Output file stream
00105 outfile = sys.stdout
00106
00107 # Output buffer
00108 outbuffer = []
00109
00110 out_row = 0
00111 out_col = 0
00112
00113 # Variables used by rec_name_n_param()
00114 name         = ""
00115 param        = ""
00116 doc_string   = ""
00117 record_state = 0
00118 bracket_counter = 0
00119
00120 # Tuple: (row,column)
00121 class_spos  = (0,0)
00122 def_spos    = (0,0)
00123 import_spos = (0,0)
00124
00125 # Which import was used? ("import" or "from")
00126 import_token = ""
00127
00128 # Comment block buffer
00129 comment_block = []
00130 comment_finished = 0
00131
00132 # Imported modules
00133 modules = []
00134
00135 # Program state
00136 stateStack = [OUTSIDE]
00137
00138 # Keep track of whether module has a docstring
00139 module_has_docstring = False
00140
00141 # Keep track of member protection
00142 protection_level = "public"
00143 private_member = False
00144
00145 # Keep track of the module namespace
00146 namespace = ""
00147
00148 ######################################################################
00149 # Output string s. '\n' may only be at the end of the string (not
00150 # somewhere in the middle).
00151 #
00152 # In: s    - String
00153 #     spos - Startpos
00154 ######################################################################
00155 def output(s,spos, immediate=0):
00156     global outbuffer, out_row, out_col, outfile
00157
00158     os = string.rjust(s,spos[1]-out_col+len(s))
00159     if immediate:
00160         outfile.write(os)
00161     else:
00162         outbuffer.append(os)
00163     if (s[-1:]=="\n"):
00164         out_row = out_row+1
00165         out_col = 0
00166     else:
00167         out_col = spos[1]+len(s)
00168
00169
00170 ######################################################################
00171 # Records a name and parameters. The name is either a class name or
00172 # a function name. Then the parameter is either the base class or
00173 # the function parameters.
00174 # The name is stored in the global variable "name", the parameters
00175 # in "param".
00176 # The variable "record_state" holds the current state of this internal
00177 # state machine.
00178 # The recording is started by calling start_recording().
00179 #
00180 # In: type, tok
00181 ######################################################################
00182 def rec_name_n_param(type, tok):
00183     global record_state,name,param,doc_string,bracket_counter
00184     s = record_state
00185     # State 0: Do nothing.
00186     if   (s==0):
00187          return
00188     # State 1: Remember name.
00189     elif (s==1):
00190         name = tok
00191         record_state = 2
00192     # State 2: Wait for opening bracket or colon
00193     elif (s==2):
00194         if (tok=='('):
00195             bracket_counter = 1
00196             record_state=3
00197         if (tok==':'): record_state=4
00198     # State 3: Store parameter (or base class) and wait for an ending bracket
00199     elif (s==3):
00200         if (tok=='*' or tok=='**'):
00201             tok=''
00202         if (tok=='('):
00203             bracket_counter = bracket_counter+1
00204         if (tok==')'):
00205             bracket_counter = bracket_counter-1
00206         if bracket_counter==0:
00207             record_state=4
00208         else:
00209             param=param+tok
00210     # State 4: Look for doc string
00211     elif (s==4):
00212         if (type==token.NEWLINE or type==token.INDENT or type==token.SLASHEQUAL):
00213             return
00214         elif (tok==":"):
00215             return
00216         elif (type==token.STRING):
00217             while tok[:1] in 'rRuU':
00218                 tok=tok[1:]
00219             while tok[:1] in ('"', "'"):
00220                 tok=tok[1:]
00221             while tok[-1:] in ('"', "'"):
00222                 tok=tok[:-1]
00223             doc_string=tok
00224         record_state=0
00225
00226 ######################################################################
00227 # Starts the recording of a name & param part.
00228 # The function rec_name_n_param() has to be fed with tokens. After
00229 # the necessary tokens are fed the name and parameters can be found
00230 # in the global variables "name" und "param".
00231 ######################################################################
00232 def start_recording():
00233     global record_state,param,name, doc_string
00234     record_state=1
00235     name=""
00236     param=""
00237     doc_string=""
00238
00239 ######################################################################
00240 # Test if recording is finished
00241 ######################################################################
00242 def is_recording_finished():
00243     global record_state
00244     return record_state==0
00245
00246 ######################################################################
00247 ## Gather comment block
00248 ######################################################################
00249 def gather_comment(type,tok,spos):
00250     global comment_block,comment_finished
00251     if (type!=tokenize.COMMENT):
00252         comment_finished = 1
00253     else:
00254         # Output old comment block if a new one is started.
00255         if (comment_finished):
00256             print_comment(spos)
00257             comment_finished=0
00258         if (tok[0:2]=="##" and tok[0:3]!="###"):
00259             comment_block.append(tok[2:])
00260
00261 ######################################################################
00262 ## Output comment block and empty buffer.
00263 ######################################################################
00264 def print_comment(spos):
00265     global comment_block,comment_finished
00266     if (comment_block!=[]):
00267         output("/**\n",spos)
00268         for c in comment_block:
00269             output(c,spos)
00270         output("*/\n",spos)
00271     comment_block    = []
00272     comment_finished = 0
00273
00274 ######################################################################
00275 def set_state(s):
00276     global stateStack
00277     stateStack[len(stateStack)-1]=s
00278
00279 ######################################################################
00280 def get_state():
00281     global stateStack
00282     return stateStack[len(stateStack)-1]
00283
00284 ######################################################################
00285 def push_state(s):
00286     global stateStack
00287     stateStack.append(s)
00288
00289 ######################################################################
00290 def pop_state():
00291     global stateStack
00292     stateStack.pop()
00293
00294
00295 ######################################################################
00296 def tok_eater(type, tok, spos, epos, line):
00297     global stateStack,name,param,class_spos,def_spos,import_spos
00298     global doc_string, modules, import_token, module_has_docstring
00299     global protection_level, private_member
00300
00301     rec_name_n_param(type,tok)
00302     if (string.replace(string.strip(tok)," ","")=="##private:"):
00303          protection_level = "private"
00304          output("private:\n",spos)
00305     elif (string.replace(string.strip(tok)," ","")=="##protected:"):
00306          protection_level = "protected"
00307          output("protected:\n",spos)
00308     elif (string.replace(string.strip(tok)," ","")=="##public:"):
00309          protection_level = "public"
00310          output("public:\n",spos)
00311     else:
00312          gather_comment(type,tok,spos)
00313
00314     state = get_state()
00315
00316 #    sys.stderr.write("%d: %s\n"%(state, tok))
00317
00318     # OUTSIDE
00319     if   (state==OUTSIDE):
00320         if  (tok=="class"):
00321             start_recording()
00322             class_spos = spos
00323             push_state(BUILD_CLASS_DECL)
00324         elif (tok=="def"):
00325             start_recording()
00326             def_spos = spos
00327             push_state(BUILD_DEF_DECL)
00328         elif (tok=="import") or (tok=="from"):
00329             import_token = tok
00330             import_spos = spos
00331             modules     = []
00332             push_state(IMPORT)
00333         elif (spos[1] == 0 and tok[:3] in ('"""', "'''")):
00334             # Capture module docstring as namespace documentation
00335             module_has_docstring = True
00336             comment_block.append("\\namespace %s\n" % name)
00337             comment_block.append(tok[3:-3])
00338             print_comment(spos)
00339
00340     # IMPORT
00341     elif (state==IMPORT):
00342         if (type==token.NAME):
00343             modules.append(tok)
00344             set_state(IMPORT_OP)
00345     # IMPORT_OP
00346     elif (state==IMPORT_OP):
00347         if (tok=="."):
00348             set_state(IMPORT_APPEND)
00349         elif (tok==","):
00350             set_state(IMPORT)
00351         else:
00352             for m in modules:
00353                 output('#include "'+m.replace('.',os.path.sep)+'.py"\n', import_spos, immediate=1)
00354                 if import_token=="from":
00355                     output('using namespace '+m.replace('.', '::')+';\n', import_spos)
00356             pop_state()
00357     # IMPORT_APPEND
00358     elif (state==IMPORT_APPEND):
00359         if (type==token.NAME):
00360             modules[len(modules)-1]+="."+tok
00361             set_state(IMPORT_OP)
00362     # BUILD_CLASS_DECL
00363     elif (state==BUILD_CLASS_DECL):
00364         if (is_recording_finished()):
00365             s = "class "+name
00366             if (param!=""): s = s+" : public "+param.replace('.','::')
00367             if (doc_string!=""): comment_block.append(doc_string)
00368             print_comment(class_spos)
00369             output(s+"\n",class_spos)
00370             output("{\n",(class_spos[0]+1,class_spos[1]))
00371             protection_level = "public"
00372             output("  public:\n",(class_spos[0]+2,class_spos[1]))
00373             set_state(BUILD_CLASS_BODY)
00374     # BUILD_CLASS_BODY
00375     elif (state==BUILD_CLASS_BODY):
00376         if (type!=token.INDENT and type!=token.NEWLINE and type!=40 and
00377             type!=tokenize.NL and type!=tokenize.COMMENT and
00378             (spos[1]<=class_spos[1])):
00379             output("}; // end of class\n",(out_row+1,class_spos[1]))
00380             pop_state()
00381         elif (tok=="def"):
00382             start_recording()
00383             def_spos = spos
00384             push_state(BUILD_DEF_DECL)
00385     # BUILD_DEF_DECL
00386     elif (state==BUILD_DEF_DECL):
00387         if (is_recording_finished()):
00388             s = ''
00389             # Do we document a class method? then remove the 'self' parameter
00390             if BUILD_CLASS_BODY in stateStack:
00391                 params = param.split(",")
00392                 if params[0] == 'self':
00393                     param = string.join(params[1:], ",")
00394                 else:
00395                     s = 'static '
00396                     if params[0] == 'cls':
00397                         param = string.join(params[1:], ",")
00398         s = s+name+"("+param+");\n"
00399                 if len(name) > 1 \
00400                    and name[0:2] == '__' \
00401                    and name[len(name)-2:len(name)] != '__' \
00402                    and protection_level != 'private':
00403                        private_member = True
00404                        output("  private:\n",(def_spos[0]+2,def_spos[1]))
00405             else:
00406             s = name+"("+param+");\n"
00407             if (doc_string!=""): comment_block.append(doc_string)
00408             print_comment(def_spos)
00409             output(s,def_spos)
00410 #       output("{\n",(def_spos[0]+1,def_spos[1]))
00411             set_state(BUILD_DEF_BODY)
00412     # BUILD_DEF_BODY
00413     elif (state==BUILD_DEF_BODY):
00414         if (type!=token.INDENT and type!=token.NEWLINE \
00415             and type!=40 and type!=tokenize.NL \
00416             and (spos[1]<=def_spos[1])):
00417 #            output("} // end of method/function\n",(out_row+1,def_spos[1]))
00418             if private_member and protection_level != 'private':
00419                 private_member = False
00420                 output("  " + protection_level + ":\n",(def_spos[0]+2,def_spos[1]))
00421             pop_state()
00422 #       else:
00423 #            output(tok,spos)
00424
00425
00426 def dump(filename):
00427     f = open(filename)
00428     r = f.readlines()
00429     for s in r:
00430         sys.stdout.write(s)
00431
00432 def filter(filename):
00433     global name, module_has_docstring
00434
00435     path,name = os.path.split(filename)
00436     root,ext  = os.path.splitext(name)
00437
00438     output("namespace "+root+" {\n",(0,0))
00439
00440     # set module name for tok_eater to use if there's a module doc string
00441     name = root
00442
00443     sys.stderr.write('Filtering "'+filename+'"...')
00444     f = open(filename)
00445     tokenize.tokenize(f.readline, tok_eater)
00446     f.close()
00447     print_comment((0,0))
00448
00449     output("\n",(0,0))
00450     output("}  // end of namespace\n",(0,0))
00451
00452     if not module_has_docstring:
00453         # Put in default namespace documentation
00454         output('/** \\namespace '+root+' \n',(0,0))
00455         output('    \\brief Module "%s" */\n'%(root),(0,0))
00456
00457     for s in outbuffer:
00458         outfile.write(s)
00459
00460
00461 def filterFile(filename, out=sys.stdout):
00462     global outfile
00463
00464     outfile = out
00465
00466     try:
00467         root,ext  = os.path.splitext(filename)
00468
00469         if ext==".py":
00470             filter(filename)
00471         else:
00472             dump(filename)
00473
00474         sys.stderr.write("OK\n")
00475     except IOError,e:
00476         sys.stderr.write(e[1]+"\n")
00477
00478
00479 ######################################################################
00480
00481 # preparePath
00482 def preparePath(path):
00483     """Prepare a path.
00484
00485     Checks if the path exists and creates it if it does not exist.
00486     """
00487     if not os.path.exists(path):
00488         parent = os.path.dirname(path)
00489         if parent!="":
00490             preparePath(parent)
00491         os.mkdir(path)
00492
00493 # isNewer
00494 def isNewer(file1,file2):
00495     """Check if file1 is newer than file2.
00496
00497     file1 must be an existing file.
00498     """
00499     if not os.path.exists(file2):
00500         return True
00501     return os.stat(file1)[ST_MTIME]>os.stat(file2)[ST_MTIME]
00502
00503 # convert
00504 def convert(srcpath, destpath):
00505     """Convert a Python source tree into a C+ stub tree.
00506
00507     All *.py files in srcpath (including sub-directories) are filtered
00508     and written to destpath. If destpath exists, only the files
00509     that have been modified are filtered again. Files that were deleted
00510     from srcpath are also deleted in destpath if they are still present.
00511     The function returns the number of processed *.py files.
00512     """
00513     count=0
00514     sp = os.path.join(srcpath,"*")
00515     sfiles = glob.glob(sp)
00516     dp = os.path.join(destpath,"*")
00517     dfiles = glob.glob(dp)
00518     leftovers={}
00519     for df in dfiles:
00520         leftovers[os.path.basename(df)]=1
00521
00522     for srcfile in sfiles:
00523         basename = os.path.basename(srcfile)
00524         if basename in leftovers:
00525             del leftovers[basename]
00526
00527         # Is it a subdirectory?
00528         if os.path.isdir(srcfile):
00529             sdir = os.path.join(srcpath,basename)
00530             ddir = os.path.join(destpath,basename)
00531             count+=convert(sdir, ddir)
00532             continue
00533         # Check the extension (only *.py will be converted)
00534         root, ext = os.path.splitext(srcfile)
00535         if ext.lower()!=".py":
00536             continue
00537
00538         destfile = os.path.join(destpath,basename)
00539         if destfile==srcfile:
00540             print "WARNING: Input and output names are identical!"
00541             sys.exit(1)
00542
00543         count+=1
00544 #        sys.stdout.write("%s\015"%(srcfile))
00545
00546         if isNewer(srcfile, destfile):
00547             preparePath(os.path.dirname(destfile))
00548 #            out=open(destfile,"w")
00549 #            filterFile(srcfile, out)
00550 #            out.close()
00551             os.system("python %s -f %s>%s"%(sys.argv[0],srcfile,destfile))
00552
00553     # Delete obsolete files in destpath
00554     for df in leftovers:
00555         dname=os.path.join(destpath,df)
00556         if os.path.isdir(dname):
00557             try:
00558                 shutil.rmtree(dname)
00559             except:
00560                 print "Can't remove obsolete directory '%s'"%dname
00561         else:
00562             try:
00563                 os.remove(dname)
00564             except:
00565                 print "Can't remove obsolete file '%s'"%dname
00566
00567     return count
00568
00569
00570 ######################################################################
00571 ######################################################################
00572 ######################################################################
00573
00574 filter_file = False
00575
00576 try:
00577     opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"])
00578 except getopt.GetoptError,e:
00579     print e
00580     sys.exit(1)
00581
00582 for o,a in opts:
00583     if o=="-f":
00584         filter_file = True
00585
00586 if filter_file:
00587     # Filter the specified file and print the result to stdout
00588     filename = string.join(args)
00589     filterFile(filename)
00590 else:
00591
00592     if len(args)!=2:
00593         sys.stderr.write("%s options input output\n"%(os.path.basename(sys.argv[0])))
00594         sys.exit(1)
00595
00596     # Filter an entire Python source tree
00597     print '"%s" -> "%s"\n'%(args[0],args[1])
00598     c=convert(args[0],args[1])
00599     print "%d files"%(c)
00600
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcArchiver.py Source File

runcontrol

rcArchiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Event archiver class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "02/13/2003"
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 from time import gmtime, strftime
00018 import os
00019 from struct import unpack
00020 from struct import pack
00021
00022 from LATTE.client.gEvtCli import EvtCli
00023
00024 MODE_CREATE = 0
00025 MODE_APPEND = 1
00026 MODE_READONLY = 2
00027
00028 class rcArchiver(object):
00029   """\brief Event Archiver
00030
00031   Default event archiver class to store event data to a file.
00032   This class can be inherited to create a custom event class and
00033   using it from a RunControl class by calling the setArchiverClass
00034   method.
00035   """
00036
00037   def __init__(self, filePath=None, fileName=None, mode=MODE_CREATE, userId=123):
00038     if fileName is None:
00039       ts   = strftime('%y%m%d%H%M%S', gmtime())
00040       self.__fileName = rcArchiver.getFileNameFromTS(ts)
00041     else:
00042       self.__fileName = fileName
00043     if filePath is None:
00044       self.__filePath = ""
00045     else:
00046       self.__filePath = filePath + os.sep
00047     self.__mode = mode
00048     if mode == MODE_CREATE:
00049       fileMode = 'w+b'
00050       self.__archFile = file(os.path.join(self.__filePath, self.__fileName), fileMode)
00051     elif mode == MODE_APPEND:
00052       fileMode = 'a+b'
00053       self.__archFile = file(os.path.join(self.__filePath, self.__fileName), fileMode)
00054     elif mode == MODE_READONLY:
00055       fileMode = 'r+b'
00056       self.__archFile = None
00057       self.__evtCli = EvtCli()
00058       self.__evtCli.open(os.path.join(self.__filePath, self.__fileName))
00059     else:
00060       raise RuntimeError, "Invalid archive file mode"
00061
00062   def write(self, rawEventData):
00063     if not self.__archFile.closed:
00064       self.__archFile.write(rawEventData)
00065
00066   def writeTuple(self, tuple):
00067     for item in tuple:
00068       self.__archFile.write(item)
00069
00070   def read(self):
00071     try:
00072       (header, dat) = self.__evtCli.read()
00073       return dat
00074     except:
00075       return None
00076
00077   def close(self):
00078     if self.__mode == MODE_READONLY:
00079       self.__evtCli.close()
00080     else:
00081       self.__archFile.close()
00082
00083   def isClosed(self):
00084     return self.__archFile.closed
00085
00086   def getFileName(self):
00087       return self.__fileName
00088
00089   def getFilePath(self):
00090     return self.__filePath
00091
00092   def getFileNameFromTS(ts):
00093     return ts + ".ldf"
00094   getFileNameFromTS = staticmethod(getFileNameFromTS)
00095
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcCommentPanel.py Source File

runcontrol

rcCommentPanel.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Comment panel for RunControl"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/05 00:39:17 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from   qt import *
00021 import os
00022 import time
00023
00024 class rcCommentPanel(QWidget):
00025   def __init__(self,parent = None,name = None,fl = 0):
00026     QWidget.__init__(self,parent,name,fl)
00027
00028     if not name:
00029         self.setName("rcComments")
00030
00031
00032     Form2Layout = QGridLayout(self,1,1,0,6,"Form2Layout")
00033
00034     self.__teComments = CommentEntryWidget(self)
00035
00036     Form2Layout.addWidget(self.__teComments,0,0)
00037
00038     self.languageChange()
00039
00040     self.resize(QSize(291,219).expandedTo(self.minimumSizeHint()))
00041
00042   def getWidget(self):
00043     return self.__teComments
00044
00045   def languageChange(self):
00046     self.setCaption(self.tr("rcComments"))
00047
00048 class CommentEntryWidget(QTextEdit):
00049   def __init__(self, parent=None):
00050     QTextEdit.__init__(self, parent)
00051
00052     self.__prompt = "--> "
00053
00054     # last line + last incomplete lines
00055     self.line    = QString()
00056     self.lines   = []
00057     # the cursor position in the last line
00058     self.point   = 0
00059     # flag: readline() is being used for e.g. raw_input() and input()
00060     self.reading = 0
00061     # history
00062     self.__history = []
00063     self.__timeStamps = []
00064     self.pointer = 0
00065     self.xLast   = 0
00066     self.yLast   = 0
00067     self.__xLastBP = 0
00068     self.__yLastBP = 0
00069     self.clip = QApplication.clipboard()
00070
00071     # user interface setup
00072     self.setTextFormat(QTextEdit.PlainText)
00073     self.setWrapPolicy(QTextEdit.Anywhere)
00074     # font
00075     if os.name == 'posix':
00076       font = QFont("Fixed", 12)
00077     elif os.name == 'nt' or os.name == 'dos':
00078       font = QFont("Courier New", 8)
00079     else:
00080       raise SystemExit, "FIXME for 'os2', 'mac', 'ce' or 'riscos'"
00081     font.setFixedPitch(1)
00082     self.setFont(font)
00083     self.connect(self, SIGNAL("clicked(int,int)"), self.handleClicked)
00084
00085     # geometry
00086     height = 40*QFontMetrics(font).lineSpacing()
00087     request = QSize(600, height)
00088     if parent is not None:
00089       request = request.boundedTo(parent.size())
00090     self.resize(request)
00091     self.setReadOnly(1)
00092     self.clearDisplay()
00093
00094   def getHistory(self):
00095     return self.__history
00096
00097   def getTimestamps(self):
00098     return self.__timeStamps
00099
00100   def clearHistory(self):
00101     self.__history = []
00102     self.__timeStamps = []
00103
00104   def clearDisplay(self):
00105     self.clear()
00106     self.write(self.__prompt)
00107     if self.isReadOnly():
00108       self.enterComment('Comment entry is disabled.')
00109     else:
00110       self.enterComment('Comment entry is enabled.')
00111
00112   def setPrompt(self, prompt):
00113     self.__prompt = prompt
00114
00115   def getPrompt(self):
00116     return self.__prompt
00117
00118   def flush(self):
00119     """
00120     Simulate stdin, stdout, and stderr.
00121     """
00122     pass
00123
00124   def isatty(self):
00125     """
00126     Simulate stdin, stdout, and stderr.
00127     """
00128     return 1
00129
00130   def readline(self):
00131     """
00132     Simulate stdin, stdout, and stderr.
00133     """
00134     self.reading = 1
00135     self.__clearLine()
00136     self.moveCursor(QTextEdit.MoveEnd, 0)
00137     while self.reading:
00138       qApp.processOneEvent()
00139     if self.line.length() == 0:
00140       return '\n'
00141     else:
00142       return str(self.line)
00143
00144   def write(self, text):
00145     """
00146     Simulate stdin, stdout, and stderr.
00147     """
00148     # The output of self.append(text) contains to many newline characters,
00149     # so work around QTextEdit's policy for handling newline characters.
00150     hack = self.text()
00151     hack.append(text)
00152     self.setText(hack)
00153     #self.setText(self.text().append(text)) # segmentation fault
00154     self.moveCursor(QTextEdit.MoveEnd, 0)
00155     self.yLast, self.xLast = self.getCursorPosition()
00156
00157   def writelines(self, text):
00158     """
00159     Simulate stdin, stdout, and stderr.
00160     """
00161     map(self.write, text)
00162     print "DO WE EVER GET HERE? IF YES, OPTIMIZATION POSSIBLE"
00163
00164   def enterComment(self, comment, addToHistory=0, source='system'):
00165     """This can be called from a user script to add to comments.
00166     The text is prepended with \a source to indicate that it is a
00167     machine generated comment.
00168
00169     \param comment      The text of the comment to be entered
00170     \param addtoHistory Whether this comment will be persistent or not
00171     \param source       The text to be prepended before the comment
00172
00173     """
00174     self.line = QString('[' + source + '] ' + comment.rstrip())
00175     self.write(self.line)
00176     self.__xLastBP, self.__yLastBP = self.xLast, self.yLast
00177     self.__xLastBP += 11 # Add the length of the timestamp
00178     self.write('\n')
00179     self.__run(addToHistory)
00180
00181   def __run(self, addToHistory=1):
00182     self.pointer = 0
00183     y, x = self.getCursorPosition()
00184     yFirst = y - len(self.lines) - 1
00185     self.setSelection(yFirst, 0, yFirst, 4)
00186     self.removeSelectedText()
00187     tStamp = time.gmtime()
00188     self.insertAt(time.strftime('[%H:%M:%S] ', tStamp), y - len(self.lines) - 1, 0)
00189     if addToHistory:
00190       self.__history.append(str(self.line))
00191       self.__timeStamps.append(tStamp)
00192     self.lines.append(str(self.line))
00193     self.write(self.__prompt)
00194     self.lines = []
00195     self.__clearLine()
00196
00197   def __clearLine(self):
00198     """
00199     Clear input line buffer
00200     """
00201     self.line.truncate(0)
00202     self.point = 0
00203
00204   def insertText(self, text, offsetY=0, absX=0, overwrite=0):
00205     """
00206     \param text     Text to be inserted
00207     \param offsetY  The position of the comment text relative to the current position
00208     \param absX     The absolute position of the comment text
00209     """
00210     posy = self.__yLastBP + offsetY
00211     posx = absX + 11 # Skip over the timestamp
00212     self.setCursorPosition(posy, posx)
00213     if overwrite:
00214       self.setSelection(posy, posx, posy, posx+len(text), 0)
00215       self.removeSelectedText()
00216     self.__insertText(QString(text), posy, posx)
00217
00218   def __insertText(self, text, posY=0, posX=0):
00219     """
00220     Insert text at the current cursor position.
00221     """
00222     y, x = self.getCursorPosition()
00223     if posX != 0: x = posX
00224     if posY != 0: y = posY
00225     self.insertAt(text, y, x)
00226     self.line.insert(self.point, text)
00227     self.point += text.length()
00228     self.setCursorPosition(y, x + text.length())
00229
00230   def keyPressEvent(self, e):
00231     """
00232     Handle user input a key at a time.
00233     """
00234
00235     if self.isReadOnly() or not self.isEnabled():
00236       e.ignore()
00237       return
00238     text  = e.text()
00239     key   = e.key()
00240     ascii = e.ascii()
00241
00242     if text.length() and ascii>=32 and ascii<127:
00243       self.__insertText(text)
00244       return
00245
00246     if e.state() & Qt.ControlButton or e.state() & Qt.ShiftButton:
00247       e.ignore()
00248       return
00249
00250     if key == Qt.Key_Backspace:
00251       if self.point:
00252         self.doKeyboardAction(QTextEdit.ActionBackspace)
00253         self.point -= 1
00254         self.line.remove(self.point, 1)
00255     elif key == Qt.Key_Delete:
00256       self.doKeyboardAction(QTextEdit.ActionDelete)
00257       self.line.remove(self.point, 1)
00258     elif key == Qt.Key_Return or key == Qt.Key_Enter:
00259       self.write('\n')
00260       if self.reading:
00261         self.reading = 0
00262       else:
00263         self.__run()
00264     elif key == Qt.Key_Tab:
00265       self.__insertText(text)
00266     elif key == Qt.Key_Left:
00267       if self.point:
00268         self.moveCursor(QTextEdit.MoveBackward,0)
00269         self.point -= 1
00270     elif key == Qt.Key_Right:
00271       if self.point < self.line.length():
00272         self.moveCursor(QTextEdit.MoveForward,0)
00273         self.point += 1
00274     elif key == Qt.Key_Home:
00275       self.setCursorPosition(self.yLast, self.xLast)
00276       self.point = 0
00277     elif key == Qt.Key_End:
00278       self.moveCursor(QTextEdit.MoveLineEnd,0)
00279       self.point = self.line.length()
00280     elif key == Qt.Key_Up:
00281       if len(self.__history):
00282         if self.pointer == 0:
00283           self.pointer = len(self.__history)
00284         self.pointer -= 1
00285         self.__recall()
00286     elif key == Qt.Key_Down:
00287       if len(self.__history):
00288         self.pointer += 1
00289         if self.pointer == len(self.__history):
00290           self.pointer = 0
00291         self.__recall()
00292     elif key == Qt.Key_Escape:
00293       self.__deleteLine()
00294     else:
00295         e.ignore()
00296
00297   def __deleteLine(self):
00298     self.setCursorPosition(self.yLast, self.xLast)
00299     self.setSelection(self.yLast, self.xLast,
00300                       self.yLast, self.paragraphLength(self.yLast))
00301     self.removeSelectedText()
00302     self.__clearLine()
00303
00304   def __recall(self):
00305     """
00306     Display the current item from the command history.
00307     """
00308     self.__deleteLine()
00309     self.__insertText(QString(self.__history[self.pointer]))
00310
00311
00312   def focusNextPrevChild(self, next):
00313     """
00314     Suppress tabbing to the next window in multi-line commands.
00315     """
00316     return QTextEdit.focusNextPrevChild(self, next)
00317
00318   def handleClicked(self, para, pos):
00319     """
00320     Keep the cursor after the last prompt.
00321     """
00322     if self.hasSelectedText():
00323       if len(self.selectedText()) > 0:
00324         self.clip.setText(self.selectedText())
00325     self.moveCursor(QTextEdit.MoveEnd, 0)
00326     return
00327
00328   def contentsContextMenuEvent(self,ev):
00329     """
00330     Suppress the right button context menu.
00331     Instead paste the contents of the clipboard.
00332     """
00333     if not self.isReadOnly():
00334       self.__insertText(self.clip.text())
00335     ev.accept()
00336     return
00337
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcComplStatus.py Source File

runcontrol

rcComplStatus.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Completion status helper class"
00012 __author__   = "S. Tuvi <Stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/10/22 18:47:32 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 class rcCompletionStatus(object):
00021   """This helper class provides methods to facilitate the management
00022   of completion codes.
00023   """
00024   __csDict = {
00025                      0: 'PASSED',
00026                     -1: 'UNDEFINED',
00027                     -2: 'ABORTED',
00028                     -3: 'FAILED',
00029                     -4: 'PASSED CONDITIONALLY',
00030                     -5: 'MARGINAL',
00031                     -6: 'OPERATOR ABORTED',
00032                     -7: 'INCOMPLETE',
00033                   }
00034
00035   def getCompletionStatus(statStr):
00036     """Return the completion status code based
00037     on the description.
00038
00039     \param statStr Completion status description
00040
00041     \return Completion status code or None if it doesn't exist.
00042     """
00043     for (status, statusStr) in rcCompletionStatus.__csDict.items():
00044       if statusStr == statStr:
00045         return status
00046   getCompletionStatus = staticmethod(getCompletionStatus)
00047
00048   def getCompletionStatusStr(self, status):
00049     """Return the completion status string based
00050     on the code.
00051
00052     \param status Completion status code
00053
00054     \return Completion status description or None if it doesn't exist.
00055     """
00056     if status in self.__csDict:
00057       return self.__csDict[status]
00058
00059   def isCompletionStatus(self, status):
00060     """Check if \a status is already in the dictionary.
00061
00062     \param status Completion status code
00063
00064     \return True : If it is already defined.
00065             False: Otherwise
00066     """
00067     return (status in self.__csDict)
00068
00069   def addCompletionStatus(self, status, statusStr):
00070     """Adds the new completion status code and its
00071     description to the dictionary.
00072
00073     \param status    Completion status code
00074     \param statusStr Completion status description
00075
00076     \return  0: If add is successful.
00077             -1: If status code already exists.
00078             -2: If a duplicate description was found.
00079     """
00080     if self.getCompletionStatus(statusStr) is not None:
00081       # Duplicate description
00082       return -2
00083     if status not in self.__csDict:
00084       self.__csDict[status] = statusStr
00085       # Status added successfully
00086       return 0
00087     else:
00088       # Already exists
00089       return -1
00090
00091 #-------------------------------------------------------------------------------
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcDefaultTrigger.py Source File

trigger

rcDefaultTrigger.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # This class uses
00021 from TrgUsingTiles      import TrgUsingTiles
00022 from TrgMiniGLT         import MiniGLTTrgConditionsValue
00023 from rcTrgMiniGLT       import rcTrgMiniGLT
00024 from rcTrgFunctions     import rcTrgEngines
00025 from TrgEngines         import TrgEngine
00026 from TrgEngines         import TrgReadout
00027 from NullObjects        import NoInputsEnabled
00028 from TrgConditionsValue import TrgConditionsValue
00029
00030 class rcGEMDefaultTrigger(TrgUsingTiles):
00031   """\brief rcGEMDefaultTrigger
00032   """
00033   def __init__(self):
00034     """\brief rcGEMDefaultTrigger constructor
00035     """
00036     TrgUsingTiles.__init__(self)
00037     self.__inputEnables             = NoInputsEnabled()
00038     self.__engines                  = rcGEMTrgEngines()
00039     self.__conditions               = rcSolicitedCondition()
00040
00041   # Pure Virtual function implementation
00042   def conditions(self):
00043     return self.__conditions
00044
00045   def coincidences(self):
00046     """\brief Implementation of coincdences 'pure virtual' method from TrgUsingTiles
00047     """
00048     # it just so happens that the roi is exactly the same as the coincidences object
00049     return self.roi()
00050
00051   def inputEnables(self):
00052     """\brief Implementation of inputEnables 'pure virtual' method from TrgAbstract
00053     """
00054     return self.__inputEnables
00055
00056   def engines(self):
00057     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00058     """
00059     return self.__engines
00060
00061   def useAcdAsTrigger(self):
00062     """Don't use ACD as a trigger source.
00063     """
00064     return False
00065
00066   def sweepOnShut(self):
00067     return False
00068
00069   def shut(self, sweepEvent=None, progress=None):
00070     pass
00071
00072 class rcMiniGLTDefaultTrigger(rcTrgMiniGLT):
00073   """\brief rcMiniGLTDefaultTrigger
00074   """
00075   def __init__(self):
00076     rcTrgMiniGLT.__init__(self)
00077     self.__engines      = rcMiniGLTTrgEngines()
00078     self.__conditions   = rcMiniGLTSolicitedCondition()
00079
00080   def engines(self):
00081     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00082     """
00083     return self.__engines
00084
00085   def conditions(self):
00086     """\brief Implementation of conditions 'pure virtual' method from TrgAbstract
00087     """
00088     return self.__conditions
00089
00090   def sweepOnShut(self):
00091     return False
00092
00093   def shut(self, sweepEvent=None, progress=None):
00094     pass
00095
00096 # implementaions of user-level trigger classes
00097
00098 class rcGEMTrgEngines(rcTrgEngines):
00099   """Class rcGEMTrgEngines:
00100      Initialize the trigger engines list class.
00101   """
00102   def __init__(self):
00103     rcTrgEngines.__init__(self)
00104     eng1 = rcSolicitedEngine()
00105     self.replaceEngine(0,eng1)
00106
00107 class rcSolicitedEngine(TrgEngine):
00108   """This class defines an engine which reads out the detector
00109      whenever there is a solicited trigger.
00110      This engine is not prescaled.
00111   """
00112   def __init__(self):
00113     TrgEngine.__init__(self)
00114     self.__request = TrgReadout()
00115   def participate(self,conditionsValue):
00116     # This function relies on the programmer's knowledge that the
00117     # conditionsValue is a bitfield.
00118     cond = rcSolicitedCondition()
00119     if conditionsValue & cond.value():
00120       return True
00121     return False
00122   def prescale(self):
00123     return 0
00124   def request(self):
00125     return self.__request
00126
00127 class rcSolicitedCondition(TrgConditionsValue):
00128   """ Define a condition where only the solicited trigger is asserted
00129   """
00130   def __init__(self):
00131     TrgConditionsValue.__init__(self)
00132   def solicited(self):
00133     return True
00134
00135 # implementaions of user-level trigger classes
00136 class rcMiniGLTTrgEngines(rcTrgEngines):
00137   def __init__(self):
00138     rcTrgEngines.__init__(self)
00139     # There are two engines in the MiniGLT.
00140     # 0) User defined engine
00141     # 15) Marker engine
00142     eng = rcMiniGLTSolicitedEngine()
00143     self.replaceEngine(0,eng)
00144
00145 class rcMiniGLTSolicitedEngine(TrgEngine):
00146   """This class defines an engine which reads out the detector
00147      whenever there is a solicited trigger.
00148      This engine is not prescaled.
00149   """
00150   def __init__(self):
00151     TrgEngine.__init__(self)
00152     self.__request = TrgReadout()
00153   def participate(self,conditionsValue):
00154     # This function relies on the programmer's knowledge that the
00155     # conditionsValue is a bitfield.
00156     cond = rcMiniGLTSolicitedCondition()
00157     condValue = cond.value()
00158     if conditionsValue & condValue:
00159       return True
00160     return False
00161   def prescale(self):
00162     return 0
00163   def request(self):
00164     return self.__request
00165
00166 class rcMiniGLTSolicitedCondition(MiniGLTTrgConditionsValue):
00167   """ Define a condition where only the CNO trigger is asserted
00168   """
00169   def __init__(self):
00170     TrgConditionsValue.__init__(self)
00171   def solicited(self):
00172     return True
00173
00174
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcFitsWriter.py Source File

runcontrol

rcFitsWriter.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "FITS writer class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/21 23:55:03 $").split(' ')[1]
00014 __version__  = "$Revision: 2.3.2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import os.path
00021 #import pyfits
00022 #import numarray
00023 from cfitsio import *
00024 import time
00025 import struct
00026 import types
00027 import sys
00028 import rcReportGen
00029
00030 FORMAT_WORD = 0
00031 FORMAT_BYTE = 1
00032
00033 MODE_CREATE = 0
00034 MODE_READONLY = 2
00035
00036 RUN_REPORT_VERSION = "1.0"
00037
00038 class rcFitsWriter(object):
00039   #~ def __init__(self, fileName=None):
00040     #~ if fileMame is None:
00041       #~ ts   = strftime('%y%m%d%H%M%S', gmtime())
00042       #~ self.__fileName = 'ebf' + ts + '.fits'
00043     #~ else:
00044       #~ self.__fileName = fileName
00045     #~ self.__fitsobj = pyfits.HDUList()
00046     #~ hdu = pyfits.PrimaryHDU()
00047     #~ self.__fitsobj.append(hdu)
00048
00049   #~ def write(self, eventSummary, rawEventData):
00050     #~ hdu = pyfits.ImageHDU(numarray.fromstring(rawEventData, numarray.Int32))
00051     #~ #col1 = pyfits.Column(name='event_data', format='i',
00052     #~ #                     array=numarray.fromstring(rawEventData, numarray.UInt32))
00053     #~ #hdu = pyfits.new_table([col1])
00054     #~ #hdu.data.field(0).byteswap()
00055     #~ hdu.header.update('EVT_NO', eventSummary.evNumber, "Event number")
00056     #~ hdu.header.update('EVT_TAG', eventSummary.tag, "Event tag")
00057     #~ self.__fitsobj.append(hdu)
00058
00059   #~ def close(self):
00060     #~ self.__fitsobj.writeto(self.__fileName)
00061
00062   def __init__(self, filePath=None, fileName=None, mode=MODE_CREATE, format=FORMAT_WORD, tableSize=1000, compress=0, flushInterval=0, reportGen=None):
00063     if fileName is None:
00064       ts   = time.strftime('%y%m%d%H%M%S', time.gmtime())
00065       self.__fileName = getFileNameFromTS(ts)
00066     else:
00067       self.__fileName = fileName
00068     if compress: self.__fileName += '.gz'
00069     if filePath is None:
00070       self.__filePath = ""
00071     else:
00072       self.__filePath = filePath
00073     self.__format = format
00074     self.__tableSize = tableSize
00075     self.__mode = mode
00076     self.__flushInterval = flushInterval
00077     self.__reportGen = reportGen
00078     if mode == MODE_READONLY:
00079       if format != FORMAT_BYTE:
00080         raise RuntimeError, "Sorry FITS file reading currently only works in BYTE mode"
00081       (self.__status, self.__fptr) = cfitsio.fits_open_file(os.path.join(self.__filePath, self.__fileName), cfitsio.READONLY)
00082       if self.__status != 0:
00083         raise IOError, "fits_open_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00084       else:
00085         if reportGen is not None:
00086           self.getHeaders()
00087         self.__tablenum = 2
00088         status = self.moveToHDU(self.__tablenum)
00089         self.__rownum = 0
00090     elif mode == MODE_CREATE:
00091       (self.__status, self.__fptr) = cfitsio.fits_create_file(os.path.join(self.__filePath, self.__fileName))
00092       if self.__status != 0:
00093         raise IOError, "fits_create_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00094       else:
00095         naxis = 0
00096         naxes = []
00097         self.__status = cfitsio.fits_create_img(self.__fptr, cfitsio.SHORT_IMG, naxis, naxes)
00098         if self.__status != 0:
00099           raise IOError, "fits_create_img: %s" % cfitsio.fits_get_errstatus(self.__status)
00100         else:
00101           try:
00102             from LDF import LDF
00103           except:
00104             raise RuntimeError, (__name__ + "Can't find LDF, aborting...")
00105           comment1 = "The data in this file can be parsed using %s of the Online software" % LDF.__version__
00106           comment2 = "package LDF or a similar package designed according to LAT-TD-00606-D1,"
00107           comment3 = " V/I 2.1/1; LAT-TD-00605-D1, V/I 3.1/1; LAT-TD-00639-D1, V/I 2.9/1 and"
00108           comment4 = " LAT-TD-01545, V/I 2.0/2 ."
00109           status = cfitsio.fits_write_comment(self.__fptr, " ")
00110           status = cfitsio.fits_write_comment(self.__fptr, comment1)
00111           status = cfitsio.fits_write_comment(self.__fptr, comment2)
00112           status = cfitsio.fits_write_comment(self.__fptr, comment3)
00113           status = cfitsio.fits_write_comment(self.__fptr, comment4)
00114           self.__tablenum = 0
00115     else:
00116       raise RuntimeError, "Invalid FITS file mode"
00117
00118
00119   def createNewTable(self, datagram_id=None, version_info=None):
00120     if datagram_id is not None:
00121       tmp = self.bcLong2Int(datagram_id)
00122       self.__status = cfitsio.fits_write_key_lng(self.__fptr, "DGRAMID",
00123                                                  tmp, "Datagram Identity")
00124     if version_info is not None:
00125       tmp = self.bcLong2Int(version_info)
00126       self.__status = cfitsio.fits_write_key_lng(self.__fptr, "EVTVERSN",
00127                                                  tmp, "Event Version")
00128     ttype = ['event_data']
00129     if self.__format == FORMAT_BYTE:
00130       tform = ['1PB(4096)']
00131     else:
00132       tform = ['1PV(1024)']
00133     tunit=[' ']
00134     extname='Event Data'
00135     tfields=1
00136     self.__status = cfitsio.fits_create_tbl(self.__fptr, cfitsio.BINARY_TBL,
00137                         self.__tableSize, tfields, ttype, tform, tunit, extname)
00138     if self.__status != 0:
00139       raise IOError, "fits_create_tbl: %s" % cfitsio.fits_get_errstatus(self.__status)
00140     self.__status = cfitsio.fits_write_key_lng(self.__fptr, "EVTCOUNT",
00141                                                 0, "Event Count")
00142     if self.__status != 0:
00143       raise IOError, "fits_write_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00144     self.__rownum = 1
00145     self.__tablenum += 1
00146
00147   def bcLong2Int(self, datum):
00148     # cfitsio has a problem with putting any long integer with bit 32 set into
00149     # a key.  (fits_write_key_ulng does not exist in nasa space)
00150     # do some bizarre ass bit conversions with integer arithmetic to make sure that the type
00151     # stays "int"
00152     if datum & 0x80000000L:
00153       shiftword = -2147483648                 # - 2^31, really 0x8000000 expressed as an int
00154       truncated = int(datum & 0x7fffffff)     # Slice off bit 31
00155       datum = truncated+shiftword             # add on bit 31
00156     return datum
00157
00158
00159   def bcLong2Int(self, datum):
00160     # cfitsio has a problem with putting any long integer with bit 32 set into
00161     # a key.  (fits_write_key_ulng does not exist in nasa space)
00162     # do some bizarre ass bit conversions with integer arithmetic to make sure that the type
00163     # stays "int"
00164     if datum & 0x80000000L:
00165       shiftword = -2147483648                 # - 2^31, really 0x8000000 expressed as an int
00166       truncated = int(datum & 0x7fffffff)     # Slice off bit 31
00167       datum = truncated+shiftword             # add on bit 31
00168     return datum
00169
00170
00171   def write(self, rawEventData):
00172     if self.__tablenum == 0:
00173       (datagram_id, datagram_length, version_info) = struct.unpack('!III', rawEventData[:12])
00174       self.createNewTable(datagram_id, version_info)
00175     elif self.__rownum > self.__tableSize:
00176       self.__status = cfitsio.fits_update_key_lng(self.__fptr, "EVTCOUNT",
00177                                                  self.__rownum - 1, "Event Count")
00178       if self.__status != 0:
00179         raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00180       if self.__flushInterval > 0:
00181           self.__status = cfitsio.fits_flush_file(self.__fptr)
00182           if self.__status != 0:
00183             raise IOError, "fits_flush_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00184       self.createNewTable()
00185     l = len(rawEventData)
00186     if self.__format == FORMAT_BYTE:
00187       self.__status = cfitsio.fits_write_col_byt(self.__fptr, 1, self.__rownum,
00188                                                  1, l, rawEventData)
00189       if self.__status != 0:
00190         raise IOError, "fits_write_col_byt: %s" % cfitsio.fits_get_errstatus(self.__status)
00191     else:
00192       extra = l % 4
00193       nelem = (l - extra) / 4
00194       if extra != 0:
00195         data = list(struct.unpack('!'+'i'*nelem, rawEventData[:-extra]))
00196       else:
00197         data = list(struct.unpack('!'+'i'*nelem, rawEventData))
00198       self.__status = cfitsio.fits_write_col_uint(self.__fptr, 1, self.__rownum,
00199                                                   1, nelem, data)
00200       if self.__status != 0:
00201         raise IOError, "fits_write_col_uint: %s" % cfitsio.fits_get_errstatus(self.__status)
00202     if (self.__flushInterval > 0) and (self.__rownum % self.__flushInterval == 0):
00203       self.__status = cfitsio.fits_update_key_lng(self.__fptr, "EVTCOUNT",
00204                                                 self.__rownum, "Event Count")
00205       if self.__status != 0:
00206         raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00207       self.__status = cfitsio.fits_flush_buffer(self.__fptr, 0)
00208       if self.__status != 0:
00209         raise IOError, "fits_flush_buffer: %s" % cfitsio.fits_get_errstatus(self.__status)
00210     self.__rownum +=1
00211
00212
00213   def moveToHDU(self, tablenum):
00214     (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, tablenum)
00215     if self.__status != 0:
00216       return self.__status
00217     (self.__status, self.__eventCount, comment) = cfitsio.fits_read_key_lng(self.__fptr, 'EVTCOUNT')
00218     # Skip the exception if there are tables after the event data (202 is keyword not found)
00219     if self.__status != 0 and self.__status != 202:
00220       raise IOError, "fits_read_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00221     return self.__status
00222
00223
00224   def read(self):
00225     self.__rownum += 1
00226     if self.__rownum > self.__eventCount:
00227       self.__tablenum += 1
00228       status = self.moveToHDU(self.__tablenum)
00229       if status != 0:
00230         return None
00231       self.__rownum = 1
00232     (self.__status, event_size, heap_addr) = cfitsio.fits_read_descript(self.__fptr, 1, self.__rownum)
00233     if self.__status != 0:
00234       raise IOError, "fits_read_descript: %s" % cfitsio.fits_get_errstatus(self.__status)
00235     (self.__status, dat) = cfitsio.fits_read_col_byt(self.__fptr, 1, self.__rownum, 1, event_size, None)
00236     if self.__status != 0:
00237       raise IOError, "fits_read_col_byt: %s" % cfitsio.fits_get_errstatus(self.__status)
00238     return dat
00239
00240
00241   def close(self, inShutdown=0):
00242     if self.__mode != MODE_READONLY:
00243       if self.__tablenum > 0:
00244         self.__status = cfitsio.fits_update_key_lng(self.__fptr, "EVTCOUNT",
00245                                                    self.__rownum - 1, "Event Count")
00246         if self.__status != 0:
00247           raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00248       if self.__reportGen is not None and not inShutdown:
00249         self.updateRunReportFields()
00250
00251     self.__status = cfitsio.fits_close_file(self.__fptr)
00252     if self.__status != 0:
00253       raise IOError, "fits_close_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00254     self.__fptr = None
00255
00256   def updateRunReportFields(self):
00257     (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, 1)
00258
00259     # Write the version for the run report keyword/value dump in case
00260     # we need to modify it in the future
00261     self.__status = cfitsio.fits_write_key_str(self.__fptr, "RPTVERSN",
00262                                                RUN_REPORT_VERSION,
00263                                                "Run Report Fields Version")
00264     if self.__status != 0:
00265       raise IOError, "fits_write_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00266
00267     reportFields      = self.__reportGen.getReportFields()
00268     reportData        = self.__reportGen.getReportData()
00269     reportUnits       = self.__reportGen.getReportUnits()
00270
00271     self.__status = cfitsio.fits_write_key_lng(self.__fptr, "NUM_KVS",
00272                                                len(reportFields),
00273                                                "Number of Key/Value pairs")
00274     if self.__status != 0:
00275       raise IOError, "fits_write_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00276
00277     for i in range(len(reportFields)):
00278       listType = 0
00279       dictType = 0
00280       x = None
00281     #  self.__status = cfitsio.fits_write_key_str(self.__fptr,
00282     #                                             reportShortNames[i],
00283     #                                             reportData[i],
00284     #                                             reportFields[i])
00285       try:
00286         exec("x=" + reportData[i])
00287         if type(x) == types.ListType:
00288           listType = 1
00289         elif type(x) == types.DictType:
00290           dictType = 1
00291       except:
00292         #print sys.exc_info()
00293         pass
00294       if listType and len(x) > 0:
00295         ttype = ['list_value']
00296         tform = ['80A']
00297         tunit=[' ']
00298         extname= reportFields[i]
00299         tfields=1
00300         self.__status = cfitsio.fits_create_tbl(self.__fptr, cfitsio.BINARY_TBL,
00301                             len(x), tfields, ttype, tform, tunit, extname)
00302         if self.__status != 0:
00303           raise IOError, "fits_create_tbl: %s" % cfitsio.fits_get_errstatus(self.__status)
00304
00305         self.__status = cfitsio.fits_write_col_str(self.__fptr, 1, 1, 1, map(str, x))
00306         if self.__status != 0:
00307           raise IOError, "fits_write_col_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00308         (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, 1)
00309         if self.__status != 0:
00310           raise IOError, "fits_movabs_hdu %s" % cfitsio.fits_get_errstatus(self.__status)
00311       elif dictType and len(x) > 0:
00312         ttype = ['dict_key', 'dict_value']
00313         tform = ['80A','80A']
00314         tunit=[' ',' ']
00315         extname= reportFields[i]
00316         tfields=2
00317         self.__status = cfitsio.fits_create_tbl(self.__fptr, cfitsio.BINARY_TBL,
00318                             len(x), tfields, ttype, tform, tunit, extname)
00319         if self.__status != 0:
00320           raise IOError, "fits_create_tbl: %s" % cfitsio.fits_get_errstatus(self.__status)
00321
00322         self.__status = cfitsio.fits_write_col_str(self.__fptr, 1, 1, 1, map(str, x.keys()))
00323         if self.__status != 0:
00324           raise IOError, "fits_write_col_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00325         self.__status = cfitsio.fits_write_col_str(self.__fptr, 2, 1, 1, map(str, x.values()))
00326         if self.__status != 0:
00327           raise IOError, "fits_write_col_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00328
00329         (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, 1)
00330         if self.__status != 0:
00331           raise IOError, "fits_movabs_hdu: %s" % cfitsio.fits_get_errstatus(self.__status)
00332       self.__status = cfitsio.fits_write_key_str(self.__fptr,
00333                                                   "KEY_%04d" % i,
00334                                                   reportFields[i],
00335                                                   "")
00336       if self.__status != 0:
00337         raise IOError, "fits_write_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00338
00339       if (listType or dictType):
00340         if len(x) > 0:
00341           self.__status = cfitsio.fits_write_key_str(self.__fptr,
00342                                                     "VAL_%04d" % i,
00343                                                     "",
00344                                                     "See table '" + reportFields[i] + "'")
00345         else:
00346           self.__status = cfitsio.fits_write_key_str(self.__fptr,
00347                                                     "VAL_%04d" % i,
00348                                                     "",
00349                                                     "")
00350         if self.__status != 0:
00351           raise IOError, "fits_write_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00352       else:
00353         if reportUnits[i] == rcReportGen.UNITS_STRING:
00354           self.__status = cfitsio.fits_write_key_str(self.__fptr,
00355                                                     "VAL_%04d" % i,
00356                                                     reportData[i],
00357                                                     "")
00358           if self.__status != 0:
00359             raise IOError, "fits_write_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00360
00361         elif reportUnits[i] in (rcReportGen.UNITS_INT, rcReportGen.UNITS_LONG):
00362           self.__status = cfitsio.fits_write_key_lng(self.__fptr,
00363                                                     "VAL_%04d" % i,
00364                                                     long(reportData[i]),
00365                                                     "")
00366           if self.__status != 0:
00367             raise IOError, "fits_write_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00368         elif reportUnits[i] == rcReportGen.UNITS_FLOAT:
00369           self.__status = cfitsio.fits_write_key_fixflt(self.__fptr,
00370                                                     "VAL_%04d" % i,
00371                                                     float(reportData[i]),
00372                                                     4,
00373                                                     "")
00374           if self.__status != 0:
00375             raise IOError, "fits_write_key_flt: %s" % cfitsio.fits_get_errstatus(self.__status)
00376         else:
00377           self.__status = cfitsio.fits_write_key_str(self.__fptr,
00378                                                     "VAL_%04d" % i,
00379                                                     reportData[i],
00380                                                     "")
00381           if self.__status != 0:
00382             raise IOError, "fits_write_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00383
00384
00385   def setFlushInterval(self, flushInterval):
00386     self.__flushInterval = flushInterval
00387
00388   def getStatus(self):
00389     return self.__status
00390
00391   def getFileName(self):
00392       return self.__fileName
00393
00394   def getFilePath(self):
00395     return self.__filePath
00396
00397   def getHeaders(self):
00398     """If we are in read only mode and reportGen is provided then read the headers of off the FITS file
00399
00400     """
00401     (self.__status, nkv, comment) = cfitsio.fits_read_key_lng(self.__fptr, "NUM_KVS")
00402     if self.__status != 0:
00403       raise IOError, "fits_read_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00404     #print "NUMBER OF KEYWORDS=", nkv
00405     for i in range(nkv):
00406       (self.__status, keyValue, comment) = cfitsio.fits_read_key_str(self.__fptr, "KEY_%04d" % i)
00407       if self.__status != 0:
00408         raise IOError, "fits_read_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00409       #print "KEY_%04d=%s %s" % (i,keyValue,comment)
00410       (self.__status, valValue, comment) = cfitsio.fits_read_key_str(self.__fptr, "VAL_%04d" % i)
00411       if self.__status != 0:
00412         raise IOError, "fits_read_key_str: %s" % cfitsio.fits_get_errstatus(self.__status)
00413       #print "VAL_%04d=%s %s" % (i,valValue,comment)
00414       if valValue == '':
00415         #print "Moving to HDU", keyValue
00416         self.__status = cfitsio.fits_movnam_hdu(self.__fptr, cfitsio.ANY_HDU, keyValue, 0)
00417         if self.__status != 0:
00418           #print "fits_movnam_hdu %s" % cfitsio.fits_get_errstatus(self.__status)
00419           self.__reportGen.addField(keyValue, "[]")
00420         else:
00421           repData = self.processTable()
00422           self.__reportGen.addField(keyValue, str(repData))
00423         (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, 1)
00424       else:
00425         self.__reportGen.addField(keyValue, str(valValue))
00426
00427   def processTable(self):
00428     (self.__status, nCols) = cfitsio.fits_get_num_cols(self.__fptr)
00429     if self.__status != 0:
00430       raise IOError, "fits_get_num_cols %s" % cfitsio.fits_get_errstatus(self.__status)
00431     #print "Number of columns=", nCols
00432     (self.__status, nRows) = cfitsio.fits_get_num_rows(self.__fptr)
00433     if self.__status != 0:
00434       raise IOError, "fits_get_num_rows %s" % cfitsio.fits_get_errstatus(self.__status)
00435     #print "Number of rows=", nRows
00436     if nCols == 1:
00437       (self.__status, repList) = cfitsio.fits_read_col_str(self.__fptr, 1, 1, 1, nRows)
00438       if self.__status != 0:
00439         raise IOError, "fits_read_col_str %s" % cfitsio.fits_get_errstatus(self.__status)
00440       return repList
00441     elif nCols == 2:
00442       (self.__status, keyList) = cfitsio.fits_read_col_str(self.__fptr, 1, 1, 1, nRows)
00443       if self.__status != 0:
00444         raise IOError, "fits_read_col_str %s" % cfitsio.fits_get_errstatus(self.__status)
00445       (self.__status, valList) = cfitsio.fits_read_col_str(self.__fptr, 2, 1, 1, nRows)
00446       if self.__status != 0:
00447         raise IOError, "fits_read_col_str %s" % cfitsio.fits_get_errstatus(self.__status)
00448       repDict={}
00449       for key,value in map(None,keyList,valList):
00450           repDict[key]=value
00451       return repDict
00452
00453 # ----- End rcFitsWriter ------
00454
00455 def getFileNameFromTS(ts):
00456     return "ebf" + ts + ".fits"
00457
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcHouseKeeping.py Source File

runcontrol

rcHouseKeeping.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Housekeeping FITS file generation class for RunControl"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/05 00:40:25 $").split(' ')[1]
00014 __version__  = "$Revision: 2.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import              os
00021 from cfitsio import *
00022 import              time
00023 from struct import  unpack
00024 import              threading
00025 import              operator
00026 import              calendar
00027 import logging as log
00028
00029 MODE_CREATE = 0
00030 MODE_READONLY = 2
00031
00032 TEM_ENV_REGS = 0
00033 AEM_ENV_REGS = 1
00034
00035 HSK_VERSION_STR = '1.0'
00036
00037 TEM_ENV_REG_LIST = [
00038                     'tkr_biasdac',
00039                     'cal_biasdac',
00040                     'adc_tkr_digital_2_5v',
00041                     'adc_tkr_digital_2_5i',
00042                     'adc_tkr_analog_a_1_5v',
00043                     'adc_tkr_analog_a_1_5i',
00044                     'adc_tkr_analog_b_2_5v',
00045                     'adc_tkr_analog_b_2_5i',
00046                     'adc_tkr_bias_v',
00047                     'adc_tkr_bias_i',
00048                     'adc_cal_digital_3_3v',
00049                     'adc_cal_digital_3_3i',
00050                     'adc_cal_analog_3_3v',
00051                     'adc_cal_analog_3_3i',
00052                     'adc_cal_bias_v',
00053                     'adc_cal_bias_i',
00054                     'adc_tem_digital_3_3v',
00055                     'adc_tem_digital_3_3i',
00056                     'adc_afee0_t0',
00057                     'adc_afee0_t1',
00058                     'adc_afee1_t0',
00059                     'adc_afee1_t1',
00060                     'adc_afee2_t0',
00061                     'adc_afee2_t1',
00062                     'adc_afee3_t0',
00063                     'adc_afee3_t1',
00064                     'adc_tkr_c0_t0',
00065                     'adc_tkr_c0_t1',
00066                     'adc_tkr_c1_t0',
00067                     'adc_tkr_c1_t1',
00068                     'adc_tkr_c2_t0',
00069                     'adc_tkr_c2_t1',
00070                     'adc_tkr_c3_t0',
00071                     'adc_tkr_c3_t1',
00072                     'adc_tkr_c4_t0',
00073                     'adc_tkr_c4_t1',
00074                     'adc_tkr_c5_t0',
00075                     'adc_tkr_c5_t1',
00076                     'adc_tkr_c6_t0',
00077                     'adc_tkr_c6_t1',
00078                     'adc_tkr_c7_t0',
00079                     'adc_tkr_c7_t1',
00080                     'sat_cal_lrs_ctr_0',
00081                     'sat_cal_lrs_ctr_1',
00082                     'sat_tkr_lrs_ctr_0',
00083                     'sat_tkr_lrs_ctr_1',
00084                     'sat_tkr_lrs_ctr_2',
00085                     'sat_tkr_lrs_ctr_3',
00086                     'sat_deadtime_lrs_ctr'
00087                     ]
00088
00089 AEM_ENV_REG_LIST = [
00090                     'env_free_00',
00091                     'env_free_01',
00092                     'env_free_02',
00093                     'env_free_03',
00094                     'env_free_04',
00095                     'env_free_05',
00096                     'env_free_06',
00097                     'env_free_07',
00098                     'env_free_08',
00099                     'env_free_09',
00100                     'env_free_10',
00101                     'env_free_11',
00102                     ]
00103
00104 class rcHouseKeeping(object):
00105   def __init__(self, lat, latFilename, mode=MODE_CREATE, tableSize=1000, flushInterval=0):
00106     self.__lat = lat
00107     self.__latFilename = latFilename
00108     self.__threadQuit = 0
00109     self.__threadPause = 0
00110     self.__envRegs = []
00111     self.__envUnits = []
00112     self.__envNames = []
00113     self.__updateInterval = 1.0 # default to 1 second
00114     self.__sampleCount = 0
00115     self.__envValues = []
00116     self.__envTStamps = []
00117     self.__tableSize = tableSize
00118     self.__fptr = None
00119     self.__mode = mode
00120     self.__flushInterval = flushInterval
00121     self.__status = 0
00122     self.__fileName = None
00123
00124   def initialize(self, filePath=None, fileName=None, compress=0):
00125     if self.__mode == MODE_CREATE:
00126       if filePath is not None or fileName is not None:
00127         if fileName is None:
00128           ts   = time.strftime('%y%m%d%H%M%S', time.gmtime())
00129           self.__fileName = getFileNameFromTS(ts)
00130           self.__timestamp = int(time.time())
00131         else:
00132           self.__fileName = fileName
00133           try:
00134             self.__timestamp = int(calendar.timegm(
00135                           time.strptime(self.__fileName.split('.',1)[0][3:], '%y%m%d%H%M%S')
00136                         ))
00137           except:
00138             self.__timestamp = 0
00139         if compress: self.__fileName += '.gz'
00140         if filePath is None:
00141           self.__filePath = ""
00142         else:
00143           self.__filePath = filePath
00144       fname = os.path.join(self.__filePath, self.__fileName)
00145       (self.__status, self.__fptr) = cfitsio.fits_create_file(fname)
00146       if self.__status != 0:
00147         raise IOError, "fits_create_file: %s filename=%s" % (cfitsio.fits_get_errstatus(self.__status), fname)
00148       naxis = 0
00149       naxes = []
00150       self.__status = cfitsio.fits_create_img(self.__fptr, cfitsio.SHORT_IMG, naxis, naxes)
00151       if self.__status != 0:
00152         raise IOError, "fits_create_img: %s" % cfitsio.fits_get_errstatus(self.__status)
00153       comment1 = "Housekeeping data file"
00154       status = cfitsio.fits_write_comment(self.__fptr, " ")
00155       status = cfitsio.fits_write_comment(self.__fptr, comment1)
00156       self.__status = cfitsio.fits_write_key_str(self.__fptr, "HSK_VER", HSK_VERSION_STR, "Housekeeping File Version")
00157       self.checkStatus("fits_write_key_str", self.__status)
00158       self.__status = cfitsio.fits_write_key_str(self.__fptr, "SCHEMA", self.__latFilename, "Schema File Name")
00159       self.checkStatus("fits_write_key_str", self.__status)
00160       self.__status = cfitsio.fits_write_key_lng(self.__fptr, "TIMESTMP",
00161                                                   self.__timestamp, "Housekeeping Timestamp")
00162       self.__tablenum = 0
00163     elif self.__mode == MODE_READONLY:
00164       pass
00165     else:
00166       raise RuntimeError, "Invalid Housekeeping mode"
00167
00168   def createNewTable(self):
00169     tfields = len(self.__envNames) + 1
00170     ttype = ['timestamp'] + self.__envNames
00171     tform = ['1D'] +  ['1V'] * (tfields - 1)
00172     tunit = ['seconds'] + self.__envUnits
00173     extname='Environmental Quantities'
00174     self.__status = cfitsio.fits_create_tbl(self.__fptr, cfitsio.BINARY_TBL,
00175                         self.__tableSize, tfields, ttype, tform, tunit, extname)
00176     if self.__status != 0:
00177       raise IOError, "fits_create_tbl: %s" % cfitsio.fits_get_errstatus(self.__status)
00178     self.__status = cfitsio.fits_write_key_lng(self.__fptr, "RECCOUNT",
00179                                                 0, "Record Count")
00180     if self.__status != 0:
00181       raise IOError, "fits_write_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00182     #for i in range(tfields):
00183     #  hdrLabel = "TDISP%d" % (i+1)
00184     #  if i == 0:
00185     #    hdrValue = "F10.3"
00186     #  else:
00187     #    hdrValue = "I12.1"
00188
00189     hdrLabel = "TDISP1"
00190     hdrValue = "F10.3"
00191
00192     self.__status = cfitsio.fits_write_key_str(self.__fptr, hdrLabel, hdrValue, "")
00193     self.checkStatus("fits_write_key_str", self.__status)
00194     self.__rownum = 1
00195     self.__tablenum += 1
00196
00197   def write(self):
00198     if self.__tablenum == 0:
00199       self.createNewTable()
00200     elif self.__rownum > self.__tableSize:
00201       self.__status = cfitsio.fits_update_key_lng(self.__fptr, "RECCOUNT",
00202                                                  self.__rownum - 1, "Record Count")
00203       if self.__status != 0:
00204         raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00205       if self.__flushInterval > 0:
00206           self.__status = cfitsio.fits_flush_file(self.__fptr)
00207           if self.__status != 0:
00208             raise IOError, "fits_flush_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00209       self.createNewTable()
00210
00211
00212     colNum = 1
00213     recTstamp = max(self.__envTStamps)
00214     self.__status = cfitsio.fits_write_col_dbl(self.__fptr, colNum, self.__rownum,
00215                                                1, 1, [recTstamp])
00216     if self.__status != 0:
00217       raise IOError, "fits_write_col_dbl: %s" % cfitsio.fits_get_errstatus(self.__status)
00218     for value in self.__envValues:
00219       colNum += 1
00220       self.__status = cfitsio.fits_write_col_lng(self.__fptr, colNum, self.__rownum,
00221                                                  1, [value])
00222       if self.__status != 0:
00223         raise IOError, "fits_write_col_lng %s" % cfitsio.fits_get_errstatus(self.__status)
00224
00225     if (self.__flushInterval > 0) and (self.__rownum % self.__flushInterval == 0):
00226       self.__status = cfitsio.fits_update_key_lng(self.__fptr, "RECCOUNT",
00227                                                 self.__rownum, "Record Count")
00228       if self.__status != 0:
00229         raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00230       self.__status = cfitsio.fits_flush_buffer(self.__fptr, 0)
00231       if self.__status != 0:
00232         raise IOError, "fits_flush_buffer: %s" % cfitsio.fits_get_errstatus(self.__status)
00233     self.__rownum +=1
00234
00235
00236   def moveToHDU(self, tablenum):
00237     (self.__status, hdutype) = cfitsio.fits_movabs_hdu(self.__fptr, tablenum)
00238     if self.__status != 0:
00239       return self.__status
00240     (self.__status, self.__eventCount, comment) = cfitsio.fits_read_key_lng(self.__fptr, 'RECCOUNT')
00241     if self.__status != 0:
00242       raise IOError, "fits_read_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00243     return self.__status
00244
00245
00246   def read(self):
00247     self.__rownum += 1
00248     if self.__rownum > self.__eventCount:
00249       self.__tablenum += 1
00250       status = self.moveToHDU(self.__tablenum)
00251       if status != 0:
00252         return None
00253       self.__rownum = 1
00254     (self.__status, event_size, heap_addr) = cfitsio.fits_read_descript(self.__fptr, 1, self.__rownum)
00255     if self.__status != 0:
00256       raise IOError, "fits_read_descript: %s" % cfitsio.fits_get_errstatus(self.__status)
00257     (self.__status, dat) = cfitsio.fits_read_col_byt(self.__fptr, 1, self.__rownum, 1, event_size, None)
00258     if self.__status != 0:
00259       raise IOError, "fits_read_col_byt: %s" % cfitsio.fits_get_errstatus(self.__status)
00260     return dat
00261
00262
00263   def close(self):
00264     if self.__fptr is not None:
00265       if self.__mode != MODE_READONLY:
00266         if self.__tablenum > 0:
00267           self.__status = cfitsio.fits_update_key_lng(self.__fptr, "RECCOUNT",
00268                                                     self.__rownum - 1, "Event Count")
00269           if self.__status != 0:
00270             raise IOError, "fits_update_key_lng: %s" % cfitsio.fits_get_errstatus(self.__status)
00271       self.__status = cfitsio.fits_close_file(self.__fptr)
00272       if self.__status != 0:
00273         raise IOError, "fits_close_file: %s" % cfitsio.fits_get_errstatus(self.__status)
00274
00275   def setFlushInterval(self, flushInterval):
00276     self.__flushInterval = flushInterval
00277
00278   def getStatus(self):
00279     return self.__status
00280
00281   def getFileName(self, full=0):
00282     if full:
00283       return os.path.join(self.__filePath, self.__fileName)
00284     else:
00285       return self.__fileName
00286
00287   def setEnvRegs(self, regList, componentId=None):
00288     self.__envRegs = []
00289     self.__envUnits = []
00290     self.__envNames = []
00291     self.addEnvRegs(regList, componentId)
00292
00293   def addEnvRegs(self, regList, componentId=None):
00294     if operator.isNumberType(regList):
00295       if regList == TEM_ENV_REGS:
00296         if componentId is None:
00297           raise RuntimeError, "Please specify from which TEM " \
00298                               "the environment values are going to be collected."
00299         if not self.__lat.existsTEM(componentId):
00300           raise RuntimeError, "TEM[%d] node not found in LAT hierarchy" % componentId
00301         tem = self.__lat.TEM[componentId]
00302         if not tem.existsTIC():
00303           raise RuntimeError, "GTIC node not found in LAT hierarchy"
00304         regNode  = tem.TIC
00305         regNames = TEM_ENV_REG_LIST
00306       elif regList == AEM_ENV_REGS:
00307         if not self.__lat.existsAEM():
00308           raise RuntimeError, "AEM node not found in LAT hierarchy"
00309         aem = self.__lat.AEM
00310         if not aem.existsAEQ():
00311           raise RuntimeError, "GAEQ node not found in LAT hierarchy"
00312         regNode = aem.AEQ
00313         regNames = AEM_ENV_REG_LIST
00314       else:
00315         raise RuntimeError, "Invalid register template id: %d" % regList
00316       regList = []
00317       for regName in regNames:
00318         reg = regNode.regs[regName]
00319         regList.append(regNode.regs[regName])
00320     self.__envRegs += regList
00321     for reg in self.__envRegs:
00322       node = reg.getNode()
00323       ids = str(node.getIdTuple())
00324       if ids[-2] == ',':
00325         ids = ids[:-2] + ids[-1]
00326       self.__envNames.append(self.getRegLabel(reg))
00327       self.__envUnits.append(reg.getEGU().units())
00328
00329   def setUpdateInterval(self, updateInterval):
00330     self.__updateInterval = updateInterval
00331
00332   def stop(self):
00333     self.__threadQuit = 1
00334     if self.__envThread.isAlive():
00335       self.__envThread.join()
00336     self.close()
00337
00338   def pause(self):
00339     self.__threadPause = 1
00340
00341   def resume(self):
00342     self.__threadPause = 0
00343
00344   def getRegLabel(self, reg):
00345     node = reg.getNode()
00346     ids = str(node.getIdTuple())
00347     if ids[-2] == ',':
00348       ids = ids[:-2] + ids[-1]
00349     return node.getName() + ids + "." + reg.getName()
00350
00351
00352
00353   def getSampleCount(self):
00354     return self.__sampleCount
00355
00356   def getEnvNames(self):
00357     return self.__envNames
00358
00359   def getCachedValues(self):
00360     return self.__envValues
00361
00362   def getCachedValue(self, reg, bypass=1, strVal=0):
00363     regName = reg.getName()
00364     regLabel = self.getRegLabel(reg)
00365     if regLabel in self.__envNames:
00366       val = self.__envValues[self.__envNames.index(regLabel)]
00367       if bypass == 0:
00368         if self.__mode != MODE_READONLY:
00369           val = reg.getEGU().egu(val)
00370         if strVal == 1:
00371           val = '%8.2f' %val + "%-2s" %reg.getEGU().units()
00372       else:
00373         if self.__mode == MODE_READONLY:
00374           val = reg.getEGU().raw(val)
00375         if strVal == 1:
00376           val = str(val)
00377       return val
00378     else:
00379       #print regName, "not found in", self.__envNames
00380       return None
00381
00382   def getEnvQuantities(self, regList, bypass=0):
00383     values = []
00384     tstamps = []
00385     for reg in regList:
00386       if reg.isCommand() or reg.isWriteOnly() or reg.isNoDirectAccess():
00387         raise RuntimeError, "Invalid environmental quantity register: %s" % reg.getName()
00388       try:
00389         value = reg.get(bypass)
00390       except:
00391         value = 0
00392       tstamp = reg.getTimeStamp()
00393       name = reg.getName()
00394       values.append(value)
00395       tstamps.append(tstamp)
00396     return (values, tstamps)
00397
00398   def updateValues(self): #revisit
00399      if self.__mode == MODE_READONLY:
00400        (values, tstamps) = self.getEnvQuantities(self.__envRegs, bypass=0)
00401        self.__envValues = values
00402      else:
00403        (values, tstamps) = self.getEnvQuantities(self.__envRegs, bypass=1)
00404        self.__envValues = map(long, values)
00405      self.__envTStamps = tstamps
00406      if self.__fptr is not None:
00407        self.write()
00408      self.__sampleCount += 1
00409
00410   def start(self):
00411     self.__threadQuit = 0
00412     self.__envThread = threading.Thread(target=self.run,name="HouseKeeping")
00413     self.__envThread.start()
00414     # Let the thread get at least one measurement
00415     time.sleep(1)
00416
00417   def run(self):
00418     if len(self.__envRegs) == 0:
00419       if self.__lat.existsTEM(0):
00420         self.addEnvRegs(TEM_ENV_REGS, 0)
00421       if self.__lat.existsAEM():
00422         self.addEnvRegs(AEM_ENV_REGS)
00423       if not self.__lat.existsTEM(0) and not self.__lat.existsAEM():
00424         #Probably in GASU mode, exit the thread
00425         return
00426     while(not self.__threadQuit):
00427       # get data here
00428       if not self.__threadPause:
00429         self.updateValues()
00430       t0 = time.time()
00431       while (time.time() - t0 < self.__updateInterval):
00432         time.sleep(.001)
00433         if self.__threadQuit:
00434           break
00435
00436   def checkStatus(self, cfitsio_function, status):
00437     if status != 0:
00438       raise IOError, "%s: %s" % (cfitsio_function, cfitsio.fits_get_errstatus(status))
00439
00440 # ---- End rcHouseKeeping -----
00441
00442 def getFileNameFromTS(ts):
00443     return "env" + ts + ".fits"
00444
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcLoginImpl.py Source File

runcontrol

rcLoginImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Dialog for authenticating the user"
00012 __author__   = "S. Tuvi <STuvi@SLAC.Stanford.edu>"
00013 __date__     = ("$Date: 2004/08/24 23:15:53 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from rcLogin import rcLogin
00021
00022 class rcLoginImpl(rcLogin):
00023   def __init__(self, parent=None, name="rcLoginImpl", fl=0):
00024     rcLogin.__init__(self,parent,name,fl)
00025
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcParamVerifier.py Source File

runcontrol

rcParamVerifier.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Parameter verifier class"
00012 __author__   = "S. Tuvi <STuvi@SLAC.Stanford.edu>"
00013 __date__     = ("$Date: 2005/01/10 21:14:42 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from rcParamVerifyGUIImpl import rcParamVerifyGUIImpl
00021
00022 class rcParamVerifier(object):
00023   def __init__(self, common, parent = None, name = None, fl = 0):
00024     self.__verifyGUI = rcParamVerifyGUIImpl(common, parent, name, fl)
00025     self.__common = common
00026
00027   def initialize(self, testName):
00028     self.__parNames = []
00029     self.__parValues = []
00030     self.__testName = testName
00031
00032   def add(self, parName, parValue):
00033     """\brief Add parameter and its value to the verify list
00034
00035     \param parName Parameter name or description
00036     \param parValue Parameter value that the operator inputted
00037     """
00038     if parName not in self.__parNames:
00039       self.__parNames.append(parName)
00040       self.__parValues.append(parValue)
00041     else:
00042       raise KeyError, "Parameter with name: %s already added." % parName
00043
00044   def getParameters(self, parName=None):
00045     """\brief Retrive parameters to verify
00046
00047     \param parName Parameter to retrieve from the verify list (optional)
00048
00049     \return A list containing the parameter name and value tuple if \a parName is specified or
00050             A list of parameter name and value tuples if \a parName is None.
00051     """
00052     if parName is not None:
00053       if parName in self.__parNames:
00054         return [(parName, self.__parValues[self.__parNames.index(parName)])]
00055     else:
00056       return map(None, self.__parNames, self.__parValues)
00057
00058   def verify(self):
00059     if len(self.getParameters()) > 0:
00060       self.__verifyGUI.initialize(self.__testName)
00061       for (parName, parValue) in self.getParameters():
00062         self.__verifyGUI.addParameter(parName, parValue)
00063       self.__verifyGUI.show()
00064       return self.__verifyGUI.exec_loop()
00065     else:
00066       return 1
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcParamVerifyGUIImpl.py Source File

runcontrol

rcParamVerifyGUIImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Parameter verifier dialog"
00012 __author__   = "S. Tuvi <STuvi@SLAC.Stanford.edu>"
00013 __date__     = ("$Date: 2004/09/01 02:05:00 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from qt import *
00021 from qttable import *
00022 import sys
00023 from rcParamVerifyGUI import rcParamVerifyGUI
00024
00025 class rcParamVerifyGUIImpl(rcParamVerifyGUI):
00026
00027   class ParamCheckTableItem(QTableItem):
00028
00029     RTTI = 1000
00030
00031     def __init__(self, *args):
00032       QTableItem.__init__(self, *args)
00033       self.__cb = None
00034       self.__checked = 0
00035
00036     #def alignment(self):
00037     #  return Qt.AlignRight
00038
00039     def rtti(self):
00040       return self.RTTI
00041
00042     def isChecked(self):
00043       return self.__cb.isChecked()
00044
00045 #    def paint(self, p, cg, cr, selected):
00046 #      if selected:
00047 #        br = QColorGroup.Highlight
00048 #      else:
00049 #        br = QColorGroup.Base
00050 #      p.fillRect(0, 0, cr.width(), cr.height(), cg.brush(br))
00051
00052 #      c = QColorGroup(cg);
00053 #      c.setBrush(QColorGroup.Background, c.brush(QColorGroup.Base));
00054 #      flags = QStyle.Style_Default;
00055 #      if self.isEnabled():
00056 #         flags |= QStyle.Style_Enabled
00057 #      if self.isChecked():
00058 #         flags |= QStyle.Style_On
00059 #      else:
00060 #         flags |= QStyle.Style_Off
00061 #      if self.isEnabled() and self.table().isEnabled():
00062 #         flags |= QStyle.Style_Enabled
00063
00064 #      sz = QSize(self.table().style().pixelMetric( QStyle.PM_IndicatorWidth ),
00065 #             self.table().style().pixelMetric( QStyle.PM_IndicatorHeight ) )
00066
00067 ##      self.table().style().drawPrimitive( QStyle.PE_Indicator, p,
00068 ##                  QRect(0, (cr.height() - sz.height()) / 2, sz.width(), sz.height() ), c, flags )
00069
00070 #      intCenterGap = ( self.table().cellGeometry( self.row(), self.col() ).width() - sz.width())/2
00071 #      #self.table().style().drawPrimitive( QStyle.PE_Indicator, p,
00072 #      #  QRect(intCenterGap, ( cr.height() - sz.height() ) / 2,
00073 #      #  sz.width(), sz.height()), c, flags )
00074
00075     def createEditor(self):
00076       self.__pwdg = QWidget(self.table().viewport(), "wdg_checkparent")
00077       self.__cb = QCheckBox(self.__pwdg, "qt_editor_checkbox" )
00078       #self.__cb = QCheckBox(self.table().viewport(), "qt_editor_checkbox" )
00079       self.__pwdg.setFocusProxy(self.__cb)
00080       self.__cb.setChecked( self.__checked )
00081       self.__cb.adjustSize()
00082       self.__cb.setText(self.text())
00083       self.__cb.move( ( (self.table().cellGeometry( self.row(), self.col() ).width() - self.__cb.size().width() )/2) , ( self.table().cellGeometry( self.row(), self.col() ).height() - self.__cb.size().height() )/2 )
00084       self.__cb.setEraseColor(self.table().viewport().eraseColor())
00085       self.__pwdg.setEraseColor(self.table().viewport().eraseColor())
00086       QObject.connect(self.__cb, SIGNAL("toggled(bool)"), self.doValueChanged)
00087       #return self.__cb
00088       return self.__pwdg
00089
00090     def setContentFromEditor(self, w):
00091       if self.__cb:
00092         self.__checked = self.__cb.isChecked()
00093
00094     def doValueChanged(self):
00095       self.table().setCurrentCell(self.row(), self.col())
00096       self.table().emit(SIGNAL('valueChanged'), (self.row(), self.col()))
00097
00098   class ParamTextTableItem(QTableItem):
00099     def __init__(self, *args):
00100       QTableItem.__init__(self, *args)
00101       self.__bold = 0
00102
00103     def alignment(self):
00104       return Qt.AlignLeft | Qt.AlignVCenter
00105
00106     def paint(self, p, cg, rect, selected):
00107       f = p.font()
00108       f.setBold(self.__bold)
00109       p.setFont(f)
00110       # Do the standard painting
00111       QTableItem.paint(self,p,cg,rect,selected)
00112
00113     def setBold(self, bold):
00114       self.__bold = bold
00115
00116
00117   def __init__(self, common, parent = None, name = None, fl = 0):
00118     rcParamVerifyGUI.__init__(self, parent, name, fl)
00119     self.__common = common
00120     self.parTable.setLeftMargin(0)
00121     self.parTable.setNumCols(3)
00122     colLabels = QStringList("Parameter")
00123     colLabels.append("Value")
00124     colLabels.append("")
00125     self.parTable.setColumnLabels(colLabels)
00126     self.parTable.setColumnReadOnly(0, 1)
00127     self.parTable.setColumnReadOnly(1, 1)
00128     self.parTable.setColumnReadOnly(2, 0)
00129     self.parTable.setColumnWidth(0,200)
00130     self.parTable.setColumnWidth(1,50)
00131     self.parTable.setColumnWidth(2,20)
00132     self.parTable.horizontalHeader().setResizeEnabled(0, 2)
00133     self.parTable.setColumnStretchable(0, 1)
00134     self.parTable.setColumnStretchable(1, 1)
00135     #self.parTable.horizontalHeader().setClickEnabled(0, 2)
00136     self.__paramCount = 0
00137     QObject.connect(self.parTable,
00138                 SIGNAL("valueChanged(int,int)"), self.parameterClicked)
00139     QObject.connect(self.buttonCancel,SIGNAL("clicked()"),self.cancel)
00140     QObject.connect(self.buttonConfirm,SIGNAL("clicked()"),self.confirm)
00141     self.__certifyText = str(self.textCertify.text())
00142
00143     # Dummy up some entries
00144     #self.textCertify.setText(str(self.textCertify.text()) % ("Selim Tuvi", "testAppCal"))
00145     #self.__paramCount = 6
00146     #ti = self.addParameter("Layers Selection", "(X0,Y0)")
00147     #ti = self.addParameter("No. of strobes per setting", 1)
00148     #ti = self.addParameter("Thr DAC", 30)
00149     #ti = self.addParameter("Thr Range", 0)
00150     #ti = self.addParameter("Cal DAC", 20)
00151     #ti = self.addParameter("Cal Range", 1)
00152
00153   def initialize(self, testName):
00154     prefs = self.__common.prefMan().preferences()
00155     user = prefs['operatorobj']
00156     self.textTestName.setText(testName)
00157     self.textUserName.setText(user.getName())
00158     self.textCertify.setText(self.__certifyText % (user.getName(), testName))
00159     self.buttonConfirm.setEnabled(0)
00160     self.txtPassword.setEnabled(0)
00161     self.__paramCount = 0
00162     self.txtPassword.setText("")
00163     self.clearAllRows()
00164
00165   def clearAllRows(self):
00166     for row in range(self.parTable.numRows()):
00167       self.parTable.removeRow(row)
00168
00169   def cancel(self):
00170     QDialog.done(self, QDialog.Rejected)
00171
00172   def confirm(self):
00173     prefs = self.__common.prefMan().preferences()
00174     secMan = self.__common.getSecurityMan()
00175     user = prefs['operatorobj']
00176     if secMan.authenticateUser(user.getLoginId(), str(self.txtPassword.text())) == 0:
00177       QDialog.done(self, QDialog.Accepted)
00178     else:
00179       QMessageBox.critical( None, "Authentication Error",
00180                                   "Incorrect Password",
00181                                   QMessageBox.Ok + QMessageBox.Default )
00182       self.txtPassword.selectAll()
00183
00184   def addParameter(self, name, value):
00185     self.parTable.setNumRows(self.__paramCount+1)
00186     ti = self.ParamTextTableItem(self.parTable, QTableItem.Never, name)
00187     self.parTable.setItem(self.__paramCount, 0, ti)
00188     ti = self.ParamTextTableItem(self.parTable, QTableItem.Never, str(value))
00189     self.parTable.setItem(self.__paramCount, 1, ti)
00190     ti = self.ParamCheckTableItem(self.parTable, QTableItem.Always, None)
00191     self.parTable.setItem(self.__paramCount, 2, ti)
00192     self.__paramCount+=1
00193     return ti
00194
00195   def parameterClicked(self, row, col):
00196     if col == 2:
00197       chk = self.parTable.item(row, col)
00198       if chk.isChecked():
00199         self.parTable.item(row, 0).setBold(1)
00200         self.parTable.item(row, 1).setBold(1)
00201         self.parTable.repaintSelections()
00202       else:
00203         self.parTable.item(row, 0).setBold(0)
00204         self.parTable.item(row, 1).setBold(0)
00205         self.parTable.repaintSelections()
00206
00207       if self.allParametersChecked():
00208         self.buttonConfirm.setEnabled(1)
00209         self.txtPassword.setEnabled(1)
00210       else:
00211         self.buttonConfirm.setEnabled(0)
00212         self.txtPassword.setEnabled(0)
00213
00214   def allParametersChecked(self):
00215     for row in range(self.__paramCount):
00216       chk = self.parTable.item(row, 2)
00217       if not chk.isChecked():
00218         return False
00219     return True
00220
00221 if __name__ == "__main__":
00222   a = QApplication(sys.argv)
00223   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00224   w = rcParamVerifyGUIImpl(None)
00225   a.setMainWidget(w)
00226   w.show()
00227   a.exec_loop()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPreferencesGUIImpl.py Source File

runcontrol

rcPreferencesGUIImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GUI for setting preferences for the Online Run Control system"
00012 __author__   = """J. Cohen-Tanugi <Cohen@SLAC.Stanford.edu>
00013                                   INFN/Pisa - GLAST LAT TKR"""
00014 __date__     = "2/5/2003"
00015 __version__  = "$Revision: 2.11.2.1 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 import os
00022 import sys
00023 import string
00024 from qt               import *
00025 from rcPreferencesGUI import rcPreferencesGUI
00026 from rcUsers          import rcUser
00027
00028 class rcPreferencesGUIImpl(rcPreferencesGUI):
00029   def __init__(self, common, parent=None, name="rcPreferencesGUIImpl", fl=0):
00030     rcPreferencesGUI.__init__(self,parent,name,fl)
00031
00032     self.__prefMan = common.prefMan()
00033     self.__prefs = common.prefMan().preferences()
00034     self.__common = common
00035
00036     self.connect(self.CANCEL,SIGNAL("clicked()"),self.cancel)
00037     self.connect(self.OK,SIGNAL("clicked()"),self.loadAndExit)
00038     self.connect(self.DEFAULT,SIGNAL("clicked()"),self.default)
00039     self.connect(self.SAVE,SIGNAL("clicked()"),self.writeConfig)
00040     self.connect(self.logButton,SIGNAL("clicked()"),self.logBrowser)
00041     self.connect(self.dataButton,SIGNAL("clicked()"),self.dataBrowser)
00042     self.connect(self.scriptButton,SIGNAL("clicked()"),self.appBrowser)
00043     self.connect(self.reposButton,SIGNAL("clicked()"),self.reposBrowser)
00044     self.connect(self.repButton,SIGNAL("clicked()"),self.repBrowser)
00045     self.connect(self.fitsButton,SIGNAL("clicked()"),self.fitsBrowser)
00046     self.connect(self.snapshotButton,SIGNAL("clicked()"),self.snapshotBrowser)
00047     self.connect(self.exportButton,SIGNAL("clicked()"),self.exportBrowser)
00048     self.connect(self.runIdButton,SIGNAL("clicked()"),self.runIdBrowser)
00049     self.connect(self.comboStyle, SIGNAL("activated(const QString&)"), self.selectStyle)
00050     self.connect(self.buttonSelectFont,SIGNAL("clicked()"),self.selectFont)
00051     self.connect(self.buttonSaveUser,SIGNAL("clicked()"),self.saveUser)
00052     self.connect(self.buttonAddPassword,SIGNAL("clicked()"),self.addChangePassword)
00053     self.connect(self.buttonDeleteUser,SIGNAL("clicked()"),self.deleteUser)
00054     self.connect(self.txtUserID,SIGNAL("lostFocus()"),self.updateUserIDText)
00055     self.connect(self.txtUserName,SIGNAL("returnPressed()"),self.saveUser)
00056     self.connect(self.chkServerDisable,SIGNAL("clicked()"),self.handleServerText)
00057     self.connect(self.listviewUsers, SIGNAL("doubleClicked(QListViewItem*)"), self.listUsersDblClick)
00058
00059     for style in QStyleFactory.keys():
00060       self.comboStyle.insertItem(style)
00061
00062     secMan = common.getSecurityMan()
00063     if secMan is None:
00064       self.txtPassword.setEnabled(0)
00065       self.txtPasswordAgain.setEnabled(0)
00066       self.txtOldPassword.setEnabled(0)
00067       self.buttonAddPassword.setEnabled(0)
00068
00069
00070   def applyPermissions(self, operator):
00071     adminOverride = operator.isAdministrator()
00072     for i in range(self.rcPrefsTab.count()):
00073       tabPage = self.rcPrefsTab.page(i)
00074       pageName = tabPage.name()
00075       if 'edit_' + pageName in operator.getPermissions() or adminOverride:
00076         tabPage.setEnabled(1)
00077       else:
00078         tabPage.setEnabled(0)
00079
00080     if 'edit_repository_dir' in operator.getPermissions() or adminOverride:
00081       self.reposEdit.setEnabled(1)
00082       self.reposButton.setEnabled(1)
00083     else:
00084       self.reposEdit.setEnabled(0)
00085       self.reposButton.setEnabled(0)
00086
00087     if 'edit_script_dir' in operator.getPermissions() or adminOverride:
00088       self.scriptEdit.setEnabled(1)
00089       self.scriptButton.setEnabled(1)
00090     else:
00091       self.scriptEdit.setEnabled(0)
00092       self.scriptButton.setEnabled(0)
00093
00094     if 'edit_data_dir' in operator.getPermissions() or adminOverride:
00095       self.dataEdit.setEnabled(1)
00096       self.dataButton.setEnabled(1)
00097     else:
00098       self.dataEdit.setEnabled(0)
00099       self.dataButton.setEnabled(0)
00100
00101     if 'edit_log_dir' in operator.getPermissions() or adminOverride:
00102       self.logEdit.setEnabled(1)
00103       self.logButton.setEnabled(1)
00104     else:
00105       self.logEdit.setEnabled(0)
00106       self.logButton.setEnabled(0)
00107
00108     if 'edit_report_dir' in operator.getPermissions() or adminOverride:
00109       self.repEdit.setEnabled(1)
00110       self.repButton.setEnabled(1)
00111     else:
00112       self.repEdit.setEnabled(0)
00113       self.repButton.setEnabled(0)
00114
00115     if 'edit_fits_dir' in operator.getPermissions() or adminOverride:
00116       self.fitsEdit.setEnabled(1)
00117       self.fitsButton.setEnabled(1)
00118     else:
00119       self.fitsEdit.setEnabled(0)
00120       self.fitsButton.setEnabled(0)
00121
00122     if 'edit_snapshot_dir' in operator.getPermissions() or adminOverride:
00123       self.snapshotEdit.setEnabled(1)
00124       self.snapshotButton.setEnabled(1)
00125     else:
00126       self.snapshotEdit.setEnabled(0)
00127       self.snapshotButton.setEnabled(0)
00128
00129     if 'edit_export_dir' in operator.getPermissions() or adminOverride:
00130       self.exportEdit.setEnabled(1)
00131       self.exportButton.setEnabled(1)
00132     else:
00133       self.exportEdit.setEnabled(0)
00134       self.exportButton.setEnabled(0)
00135
00136     if 'edit_runid_dir' in operator.getPermissions() or adminOverride:
00137       self.runIdEdit.setEnabled(1)
00138       self.runIdButton.setEnabled(1)
00139     else:
00140       self.runIdEdit.setEnabled(0)
00141       self.runIdButton.setEnabled(0)
00142
00143     if 'set_data_archiving_option' in operator.getPermissions() or adminOverride:
00144       self.archiveDataBox.setEnabled(1)
00145     else:
00146       self.archiveDataBox.setEnabled(0)
00147
00148     if 'set_message_logging_option' in operator.getPermissions() or adminOverride:
00149       self.logMsgBox.setEnabled(1)
00150     else:
00151       self.logMsgBox.setEnabled(0)
00152
00153     if 'set_message_logging_filter' in operator.getPermissions() or adminOverride:
00154       self.verbosityLevel.setEnabled(1)
00155     else:
00156       self.verbosityLevel.setEnabled(0)
00157
00158     if 'set_envmon_logging_option' in operator.getPermissions() or adminOverride:
00159       self.chkEnvMon.setEnabled(1)
00160     else:
00161       self.chkEnvMon.setEnabled(0)
00162
00163     if 'set_snapshots_option' in operator.getPermissions() or adminOverride:
00164       self.chkSnapshot.setEnabled(1)
00165     else:
00166       self.chkSnapshot.setEnabled(0)
00167
00168     if 'set_data_export_option' in operator.getPermissions() or adminOverride:
00169       self.exportDataBox.setEnabled(1)
00170     else:
00171       self.exportDataBox.setEnabled(0)
00172
00173     if 'set_version_info_option' in operator.getPermissions() or adminOverride:
00174       self.chkVersions.setEnabled(1)
00175     else:
00176       self.chkVersions.setEnabled(0)
00177
00178     if 'set_elog_integration_option' in operator.getPermissions() or adminOverride:
00179       self.chkElogIntegration.setEnabled(1)
00180     else:
00181       self.chkElogIntegration.setEnabled(0)
00182
00183     if 'set_site_run_condition' in operator.getPermissions() or adminOverride:
00184       self.comboSite.setEnabled(1)
00185     else:
00186       self.comboSite.setEnabled(0)
00187
00188     if 'set_instrument_type_run_condition' in operator.getPermissions() or adminOverride:
00189       self.comboInstrumentType.setEnabled(1)
00190     else:
00191       self.comboInstrumentType.setEnabled(0)
00192
00193     if 'set_phase_run_condition' in operator.getPermissions() or adminOverride:
00194       self.comboPhase.setEnabled(1)
00195     else:
00196       self.comboPhase.setEnabled(0)
00197
00198     if 'enable_delete_user' in operator.getPermissions() or adminOverride:
00199       self.buttonDeleteUser.setEnabled(1)
00200     else:
00201       self.buttonDeleteUser.setEnabled(0)
00202
00203     if 'set_python_path_system_pref' in operator.getPermissions() or adminOverride:
00204       self.txtPythonPath.setEnabled(1)
00205     else:
00206       self.txtPythonPath.setEnabled(0)
00207
00208     if 'set_elog_url_system_pref' in operator.getPermissions() or adminOverride:
00209       self.txtElogBookURL.setEnabled(1)
00210     else:
00211       self.txtElogBookURL.setEnabled(0)
00212
00213     if 'set_dds_system_pref' in operator.getPermissions() or adminOverride:
00214       self.txtServer.setEnabled(1)
00215       self.chkServerDisable.setEnabled(1)
00216     else:
00217       self.txtServer.setEnabled(0)
00218       self.chkServerDisable.setEnabled(0)
00219
00220     if 'set_visual_system_pref' in operator.getPermissions() or adminOverride:
00221       self.buttonSelectFont.setEnabled(1)
00222       self.comboStyle.setEnabled(1)
00223     else:
00224       self.buttonSelectFont.setEnabled(0)
00225       self.comboStyle.setEnabled(0)
00226
00227   def selectStyle(self, style):
00228     font = QApplication.font()
00229     if self.__prefs.has_key('fontfamily'):
00230       font.setFamily(self.__prefs['fontfamily'])
00231     if self.__prefs.has_key('fontsize'):
00232       font.setPointSize(int(self.__prefs['fontsize']))
00233     if self.__prefs.has_key('fontweight'):
00234       font.setWeight(int(self.__prefs['fontweight']))
00235     if self.__prefs.has_key('fontitalic'):
00236       font.setItalic(int(self.__prefs['fontitalic']))
00237     QApplication.setFont(font, 1)
00238     QApplication.setStyle(QStyleFactory.create(style))
00239     self.__prefs["style"] = str(style)
00240
00241
00242   def selectFont(self):
00243     ok = 0
00244     oldfont = QApplication.font()
00245     newfont, ok = QFontDialog.getFont(oldfont, self)
00246     if ok:
00247       try:
00248         QApplication.setFont(newfont, 1)
00249         self.__prefs["fontfamily"] = str(newfont.family())
00250         self.__prefs["fontsize"] = newfont.pointSize()
00251         self.__prefs["fontweight"] = newfont.weight()
00252         if newfont.italic():
00253           fontitalic = 1
00254         else:
00255           fontitalic = 0
00256         self.__prefs["fontitalic"] = fontitalic
00257       except:
00258         pass
00259
00260   def updateUserIDText(self):
00261     userId = str(self.txtUserID.text()).strip()
00262     try:
00263       userId = "%03d" % int(userId)
00264       self.txtUserID.setText(userId)
00265       user = self.__prefs["users"].getUser(userId)
00266       if user is not None:
00267         self.showUser(user)
00268       else:
00269         self.txtUserName.setText("")
00270         self.txtLoginId.setText("")
00271     except:
00272       pass
00273
00274   def listUsersDblClick(self, item):
00275     userId = str(item.text(0))
00276     user = self.__prefs["users"].getUser(userId)
00277     self.showUser(user)
00278
00279   def showUser(self, user):
00280     userId = user.getId()
00281     userName = user.getName()
00282     userLoginId = user.getLoginId()
00283     self.txtUserID.setText(userId)
00284     self.txtUserName.setText(userName)
00285     self.txtLoginId.setText(userLoginId)
00286     secMan = self.__common.getSecurityMan()
00287     if secMan is not None:
00288       if secMan.checkPassword(userLoginId) == 0:
00289         self.txtPassword.setText("**********")
00290         self.txtPasswordAgain.setText("**********")
00291         self.buttonAddPassword.setText("Change Password")
00292       else:
00293         self.txtPassword.setText("")
00294         self.txtPasswordAgain.setText("")
00295         self.buttonAddPassword.setText("Add Password")
00296       self.txtOldPassword.setText("")
00297
00298   def checkModifyUserPermission(self, userId):
00299     secMan = self.__common.getSecurityMan()
00300     if secMan is not None:
00301       operator = self.__prefs["operatorobj"]
00302       adminOverride = operator.isAdministrator()
00303       if 'enable_other_user_entry' not in operator.getPermissions() and not adminOverride:
00304         if operator.getId() != userId:
00305           QMessageBox.critical( None, "User Entry Error",
00306                                       "Not enough permissions to modify a user other than self",
00307                                       QMessageBox.Ok + QMessageBox.Default )
00308           return -1
00309     return 0
00310
00311   def saveUser(self):
00312     userId = str(self.txtUserID.text()).strip()
00313     if self.checkModifyUserPermission(userId) != 0: return
00314     try:
00315       userId = "%03d" % int(userId)
00316     except:
00317       QMessageBox.critical( None, "User Entry Error",
00318                                   "Invalid user id. Please enter as three digits",
00319                                   QMessageBox.Ok + QMessageBox.Default )
00320       return
00321     #if userId in self.__prefs["users"].values():
00322     #  QMessageBox.critical( None, "User Entry Error",
00323     #                              "User ID %s already exists" % userId,
00324     #                              QMessageBox.Ok + QMessageBox.Default )
00325     #elif self.__prefs["users"].has_key(user):
00326     #  QMessageBox.critical( None, "User Entry Error",
00327     #                              "User %s already exists" % user,
00328     #                              QMessageBox.Ok + QMessageBox.Default )
00329     #else:
00330     secMan = self.__common.getSecurityMan()
00331     oldLoginId = None
00332     oldUser = self.__prefs["users"].getUser(userId)
00333     if oldUser is not None:
00334       oldLoginId = oldUser.getLoginId()
00335     userLoginId = str(self.txtLoginId.text()).strip()
00336     userName = str(self.txtUserName.text()).strip()
00337     if userLoginId == '':
00338       self.txtLoginId.setText(userName)
00339       userLoginId = userName
00340     user = self.__prefs["users"].getUserByLoginId(userLoginId)
00341     if user is not None and user.getId() != userId:
00342       QMessageBox.critical( None, "User Entry Error",
00343                                   "Duplicate login id, please choose another",
00344                                   QMessageBox.Ok + QMessageBox.Default )
00345       return
00346     user = rcUser(userId, userLoginId, userName)
00347     secMan = self.__common.getSecurityMan()
00348     self.__prefs["users"].addUser(user)
00349     if oldLoginId is not None:
00350       if secMan is not None:
00351         if secMan.checkPassword(oldLoginId) == 0:
00352             secMan.deleteUser(oldLoginId)
00353     if self.__prefs["operatorobj"].getId() == userId:
00354       self.__prefs["operatorobj"] = user
00355       self.__prefs["operator"]= user.getName()
00356     existingItem = self.listviewUsers.findItem(userId, 0)
00357     if existingItem is not None:
00358       self.listviewUsers.takeItem(existingItem)
00359     QListViewItem(self.listviewUsers, userId, user.getName(), user.getLoginId())
00360     self.showUser(user)
00361
00362   def addChangePassword(self):
00363     secMan = self.__common.getSecurityMan()
00364     if secMan is None:
00365       QMessageBox.critical( None, "Security not enabled",
00366                                   "Can not add or change passwords when security is not enabled.",
00367                                   QMessageBox.Ok + QMessageBox.Default )
00368     else:
00369       userId = str(self.txtUserID.text()).strip()
00370       if self.checkModifyUserPermission(userId) != 0: return
00371       loginId = str(self.txtLoginId.text()).strip()
00372       userName = str(self.txtUserName.text()).strip()
00373       password1 = str(self.txtPassword.text()).strip()
00374       password2 = str(self.txtPasswordAgain.text()).strip()
00375       oldPassword = str(self.txtOldPassword.text()).strip()
00376       user = self.__prefs["users"].getUser(userId)
00377       if user.getLoginId() != loginId or user.getName() != userName:
00378         QMessageBox.critical( None, "Entry Error",
00379                                     "Please 'Save User' before adding/changing password.",
00380                                     QMessageBox.Ok + QMessageBox.Default )
00381         return
00382       if password1 == "**********":
00383         QMessageBox.critical( None, "Entry Error",
00384                                     "Please enter a valid new password.",
00385                                     QMessageBox.Ok + QMessageBox.Default )
00386         return
00387       if password1 != password2:
00388         QMessageBox.critical( None, "Entry Error",
00389                                     "Passwords don't match.",
00390                                     QMessageBox.Ok + QMessageBox.Default )
00391         return
00392       if len(password1) < 6:
00393         QMessageBox.critical( None, "Entry Error",
00394                                     "Passwords need to be at least 6 characters in length.",
00395                                     QMessageBox.Ok + QMessageBox.Default )
00396         return
00397       if secMan.checkPassword(loginId) == 0:
00398         # Change password
00399         if oldPassword == "":
00400           QMessageBox.critical( None, "Entry Error",
00401                                       "Please enter the old password.",
00402                                       QMessageBox.Ok + QMessageBox.Default )
00403         else:
00404           changePass = secMan.changePassword(loginId, password1, userName, oldPassword)
00405           if changePass == 0:
00406             QMessageBox.information( None, "Change Password",
00407                                         "User password changed successfully.",
00408                                         QMessageBox.Ok + QMessageBox.Default )
00409             self.showUser(user)
00410           elif changePass == -1:
00411             QMessageBox.critical( None, "Change Password",
00412                                         "Invalid user id or password.",
00413                                         QMessageBox.Ok + QMessageBox.Default )
00414           elif changePass == -2:
00415             QMessageBox.critical( None, "Change Password",
00416                                         "Can not access the password database.",
00417                                         QMessageBox.Ok + QMessageBox.Default )
00418           else:
00419             QMessageBox.critical( None, "Change Password",
00420                                         "Unknown error. Please check the message log.",
00421                                         QMessageBox.Ok + QMessageBox.Default )
00422
00423       else:
00424         # Add password
00425         addPass = secMan.addPassword(loginId, password1, userName)
00426         if addPass == 0:
00427           QMessageBox.information( None, "Add Password",
00428                                       "User password added successfully.",
00429                                       QMessageBox.Ok + QMessageBox.Default )
00430           user = self.__prefs["users"].getUser(userId)
00431           self.showUser(user)
00432         elif addPass == -1:
00433           QMessageBox.critical( None, "Add Password",
00434                                       "Invalid user id or password.",
00435                                       QMessageBox.Ok + QMessageBox.Default )
00436
00437         elif addPass == -2:
00438           QMessageBox.critical( None, "Add Password",
00439                                       "User already exists in the password database.",
00440                                       QMessageBox.Ok + QMessageBox.Default )
00441         elif addPass == -3:
00442           QMessageBox.critical( None, "Add Password",
00443                                       "Error accessing the database. Please check the message log",
00444                                       QMessageBox.Ok + QMessageBox.Default )
00445         else:
00446           QMessageBox.critical( None, "Add Password",
00447                                       "Unknown error. Please check the message log.",
00448                                       QMessageBox.Ok + QMessageBox.Default )
00449
00450   def deleteUser(self):
00451     selItem = self.listviewUsers.selectedItem()
00452     userId = str(selItem.text(0))
00453     secMan = self.__common.getSecurityMan()
00454     user = self.__prefs["users"].getUser(userId)
00455     secMan.deleteUser(user.getLoginId())
00456     self.__prefs["users"].deleteUser(userId)
00457     self.listviewUsers.takeItem(selItem)
00458
00459   def handleServerText(self):
00460     self.txtServer.setEnabled(not self.chkServerDisable.isChecked())
00461
00462   def loadConfig(self):
00463     self.reposEdit.setText(self.__prefs.get("reposdir"))
00464     self.scriptEdit.setText(self.__prefs.get("appdir"))
00465     self.dataEdit.setText(self.__prefs.get("datadir"))
00466     self.logEdit.setText(self.__prefs.get("logdir"))
00467     self.repEdit.setText(self.__prefs.get("reportdir"))
00468     self.fitsEdit.setText(self.__prefs.get("fitsdir"))
00469     self.snapshotEdit.setText(self.__prefs.get("snapshotdir"))
00470     self.exportEdit.setText(self.__prefs.get("exportdir"))
00471     self.runIdEdit.setText(self.__prefs.get("runiddir"))
00472     self.archiveDataBox.setChecked(int(self.__prefs["datasave"]))
00473     self.exportDataBox.setChecked(int(self.__prefs["dataexport"]))
00474     self.logMsgBox.setChecked(int(self.__prefs["lognbl"]))
00475     self.verbosityLevel.setCurrentText(self.__prefs["loglevel"])
00476     self.logHostEdit.setText(self.__prefs["loghost"])
00477     #self.chkFITSoutput.setChecked(int(self.__prefs["fitsnbl"]))
00478     self.chkFITSoutput.setChecked(0)
00479     self.chkFITSoutput.setEnabled(0)
00480     #self.chkFITScompress.setChecked(int(self.__prefs["fitscompress"]))
00481     self.chkFITScompress.setChecked(0)
00482     self.chkFITScompress.setEnabled(0)
00483     self.chkEnvMon.setChecked(int(self.__prefs["envmonnbl"]))
00484     self.chkEnvMonCompress.setChecked(int(self.__prefs["envmoncompress"]))
00485     self.chkEnvMonReadOnly.setChecked(int(self.__prefs["envmonreadonly"]))
00486     self.chkSnapshot.setChecked(int(self.__prefs["snapnbl"]))
00487     self.chkVersions.setChecked(int(self.__prefs["versionnbl"]))
00488     self.chkElogIntegration.setChecked(int(self.__prefs["elognbl"]))
00489     self.txtPythonPath.setText(self.__prefs["pythonpath"])
00490     self.txtElogBookURL.setText(self.__prefs["elogurl"])
00491     self.txtServer.setText(self.__prefs["server"])
00492     self.chkServerDisable.setChecked(not int(self.__prefs["servernbl"]))
00493     self.handleServerText()
00494
00495     self.setupCombo(self.comboSite, 'site', 'lastsite')
00496     self.setupCombo(self.comboInstrumentType, 'instrument type', 'lastinstrumenttype')
00497     self.setupCombo(self.comboPhase, 'phase', 'lastphase')
00498
00499     if self.__prefs.has_key('style'):
00500       style = self.__prefs['style']
00501       if QString(style) in QStyleFactory.keys():
00502         self.comboStyle.setCurrentText(style)
00503
00504     self.listviewUsers.clear()
00505     for (userId, user) in self.__prefs['users'].getUsers().items():
00506       QListViewItem(self.listviewUsers, userId, user.getName(), user.getLoginId())
00507     self.listviewUsers.setAllColumnsShowFocus(1)
00508     #self.listviewUsers.setSortOrder(Qt.Ascending)
00509     self.listviewUsers.setSorting(0, 1)
00510     #self.listviewUsers.setShowSortIndicator(1)
00511     return self.__prefs
00512
00513   def setupCombo(self, combo, group, last):
00514     combo.clear()
00515     if self.__prefs.has_key(group):
00516       dictPref = self.__prefs[group]
00517       keyList = dictPref.keys()
00518       keyList.sort()
00519       for item in keyList:
00520         if item != "Don't Use":
00521           combo.insertItem(item)
00522
00523       if self.__prefs.has_key(last):
00524         combo.setCurrentText(self.__prefs[last])
00525       else:
00526         self.__prefs[last] = str(combo.currentText())
00527
00528
00529   def loadAndExit(self):
00530     prefs = self.screenToPrefs()
00531     if not self.sanityCheck(prefs): return
00532     self.__prefMan.refreshPrefs(prefs)
00533     QDialog.done(self, QDialog.Accepted)
00534
00535   def writeConfig(self):
00536     prefs = self.screenToPrefs()
00537     if not self.sanityCheck(prefs): return
00538     self.__prefMan.refreshPrefs(prefs)
00539     self.__prefMan.writeConfig()
00540     QDialog.done(self, QDialog.Accepted)
00541
00542   def sanityCheck(self, prefs):
00543     if prefs['exportdir'] == prefs['datadir']:
00544       QMessageBox.critical( None, "Error",
00545                                   "Data Export path should be different than the Data File path",
00546                                   QMessageBox.Ok + QMessageBox.Default )
00547       return False
00548     return True
00549
00550   def screenToPrefs(self):
00551     reposDir       = str(self.reposEdit.text())
00552     appDir         = str(self.scriptEdit.text())
00553     dataDir        = str(self.dataEdit.text())
00554     logDir         = str(self.logEdit.text())
00555     reportDir      = str(self.repEdit.text())
00556     fitsDir        = str(self.fitsEdit.text())
00557     snapshotDir    = str(self.snapshotEdit.text())
00558     exportDir      = str(self.exportEdit.text())
00559     runIdDir       = str(self.runIdEdit.text())
00560     if self.archiveDataBox.isChecked():
00561       dataSave     = 1
00562     else:
00563       dataSave     = 0
00564     if self.exportDataBox.isChecked():
00565       dataExport   = 1
00566     else:
00567       dataExport   = 0
00568     if self.logMsgBox.isChecked():
00569       lognbl       = 1
00570     else:
00571       lognbl       = 0
00572     loglevel       = str(self.verbosityLevel.currentText())
00573     loghost        = str(self.logHostEdit.text())
00574     if self.chkFITSoutput.isChecked():
00575       fitsnbl      = 1
00576     else:
00577       fitsnbl      = 0
00578     if self.chkFITScompress.isChecked():
00579       fitscompress = 1
00580     else:
00581       fitscompress = 0
00582     if self.chkEnvMon.isChecked():
00583       envmonnbl      = 1
00584     else:
00585       envmonnbl      = 0
00586     if self.chkEnvMonCompress.isChecked():
00587       envmoncompress = 1
00588     else:
00589       envmoncompress = 0
00590     if self.chkEnvMonReadOnly.isChecked():
00591       envmonreadonly = 1
00592     else:
00593       envmonreadonly = 0
00594     if self.chkSnapshot.isChecked():
00595       snapnbl      = 1
00596     else:
00597       snapnbl      = 0
00598     if self.chkVersions.isChecked():
00599       versionnbl      = 1
00600     else:
00601       versionnbl      = 0
00602     if self.chkElogIntegration.isChecked():
00603       elognbl      = 1
00604     else:
00605       elognbl      = 0
00606     site           = str(self.comboSite.currentText())
00607     instrumentType = str(self.comboInstrumentType.currentText())
00608     phase          = str(self.comboPhase.currentText())
00609     pythonpath     = str(self.txtPythonPath.text())
00610     if pythonpath.strip() != '':
00611       sys.path =  map(string.strip, os.path.expandvars(pythonpath).split(';'))
00612       sys.path += self.__prefMan._rcPreferencesManager__pythonPath
00613     elogurl        = str(self.txtElogBookURL.text())
00614     server         = str(self.txtServer.text())
00615     if self.chkServerDisable.isChecked():
00616       servernbl    = 0
00617     else:
00618       servernbl    = 1
00619     prefs = {}
00620     prefs['reposdir'] = reposDir
00621     prefs['appdir']   = appDir
00622     prefs['datadir'] = dataDir
00623     prefs['logdir'] = logDir
00624     prefs['reportdir'] = reportDir
00625     prefs['fitsdir'] = fitsDir
00626     prefs['snapshotdir'] = snapshotDir
00627     prefs['exportdir'] = exportDir
00628     prefs['runiddir'] = runIdDir
00629     prefs['datasave'] = dataSave
00630     prefs['dataexport'] = dataExport
00631     prefs['fitsnbl'] = fitsnbl
00632     prefs['fitscompress'] = fitscompress
00633     prefs['envmonnbl'] = envmonnbl
00634     prefs['envmoncompress'] = envmoncompress
00635     prefs['envmonreadonly'] = envmonreadonly
00636     prefs['snapnbl'] = snapnbl
00637     prefs['versionnbl'] = versionnbl
00638     prefs['elognbl'] = elognbl
00639     prefs['lognbl'] = lognbl
00640     prefs['loglevel'] = loglevel
00641     prefs['loghost'] = loghost
00642     prefs['pythonpath'] = pythonpath
00643     prefs['elogurl'] = elogurl
00644     prefs['server'] = server
00645     prefs['servernbl'] = servernbl
00646     prefs['lastinstrumenttype'] = instrumentType
00647     prefs['lastphase'] = phase
00648     prefs['lastsite'] = site
00649     return prefs
00650
00651   def cancel(self):
00652     QDialog.done(self,QDialog.Rejected)
00653
00654   def default(self):
00655     self.reposEdit.setText(self.__prefMan.defPrefs()["reposdir"])
00656     self.scriptEdit.setText(self.__prefMan.defPrefs()["appdir"])
00657     self.dataEdit.setText(self.__prefMan.defPrefs()["datadir"])
00658     self.logEdit.setText(self.__prefMan.defPrefs()["logdir"])
00659     self.repEdit.setText(self.__prefMan.defPrefs()["reportdir"])
00660     self.fitsEdit.setText(self.__prefMan.defPrefs()["fitsdir"])
00661     self.snapshotEdit.setText(self.__prefMan.defPrefs()["snapshotdir"])
00662     self.exportEdit.setText(self.__prefMan.defPrefs()["exportdir"])
00663     self.runIdEdit.setText(self.__prefMan.defPrefs()["runiddir"])
00664     self.archiveDataBox.setChecked(int(self.__prefMan.defPrefs()["datasave"]))
00665     self.exportDataBox.setChecked(int(self.__prefMan.defPrefs()["dataexport"]))
00666     self.logMsgBox.setChecked(int(self.__prefMan.defPrefs()["lognbl"]))
00667     self.verbosityLevel.setCurrentText(self.__prefMan.defPrefs()["loglevel"])
00668     self.logHostEdit.setText(self.__prefMan.defPrefs()["loghost"])
00669     self.chkFITSoutput.setChecked(int(self.__prefMan.defPrefs()["fitsnbl"]))
00670     self.chkFITScompress.setChecked(int(self.__prefMan.defPrefs()["fitscompress"]))
00671     self.chkEnvMon.setChecked(int(self.__prefMan.defPrefs()["envmonnbl"]))
00672     self.chkEnvMonCompress.setChecked(int(self.__prefMan.defPrefs()["envmoncompress"]))
00673     self.chkEnvMonReadOnly.setChecked(int(self.__prefMan.defPrefs()["envmonreadonly"]))
00674     self.chkSnapshot.setChecked(int(self.__prefMan.defPrefs()["snapnbl"]))
00675     self.chkVersions.setChecked(int(self.__prefMan.defPrefs()["versionnbl"]))
00676     self.chkElogIntegration.setChecked(int(self.__prefMan.defPrefs()["elognbl"]))
00677
00678   def choosePath(self, lineEdit, caption):
00679     folder = QFileDialog.getExistingDirectory(self.__prefs.expandVars(str(lineEdit.text())), self, None, caption)
00680     folder = str(folder)
00681     if folder != '':
00682       lineEdit.setText(self.__prefs.composePath(folder))
00683
00684   def reposBrowser(self):
00685     self.choosePath(self.reposEdit, "Select repository path")
00686
00687   def appBrowser(self):
00688     self.choosePath(self.scriptEdit, "Select application path")
00689
00690   def dataBrowser(self):
00691     self.choosePath(self.dataEdit, "Select archive data file path")
00692
00693   def logBrowser(self):
00694     self.choosePath(self.logEdit, "Select log file path")
00695
00696   def repBrowser(self):
00697     self.choosePath(self.repEdit, "Select test report path")
00698
00699   def fitsBrowser(self):
00700     self.choosePath(self.fitsEdit, "Select FITS file path")
00701
00702   def snapshotBrowser(self):
00703     self.choosePath(self.snapshotEdit, "Select snapshot file path")
00704
00705   def exportBrowser(self):
00706     self.choosePath(self.exportEdit, "Select export repository path")
00707
00708   def runIdBrowser(self):
00709     self.choosePath(self.runIdEdit, "Select the runId.cfg path")
00710
00711
00712 if __name__ == "__main__":
00713   from RunControlCommon     import RunControlCommon
00714
00715   rcCommon = RunControlCommon()
00716   rcCommon.initialize()
00717   rcCommon.setLoggingLevel("INFO")
00718
00719   app = QApplication(sys.argv)
00720   QObject.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()"))
00721
00722   m = rcCommon.prefMan()
00723   m.loadConfig()
00724   prefs = m.preferences()
00725   font = QApplication.font()
00726   if prefs.has_key('fontfamily'):
00727     font.setFamily(prefs['fontfamily'])
00728   if prefs.has_key('fontsize'):
00729     font.setPointSize(int(prefs['fontsize']))
00730   if prefs.has_key('fontweight'):
00731     font.setWeight(int(prefs['fontweight']))
00732   if prefs.has_key('fontitalic'):
00733     font.setItalic(int(prefs['fontitalic']))
00734   app.setFont(font)
00735
00736   if prefs.has_key('style'):
00737     style = prefs['style']
00738     if style in QStyleFactory.keys():
00739       app.setStyle(QStyleFactory.create(style))
00740
00741   prefGUI = rcCommon.prefGUI()
00742   app.setMainWidget(prefGUI)
00743   prefGUI.show()
00744   prefGUI.loadConfig()
00745   prefGUI.exec_loop()
Generated on Fri Jan 21 18:00:50 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPreferencesManager.py Source File

runcontrol

rcPreferencesManager.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Run Control Preferences manager GUI module"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/12/08 21:21:26 $").split(' ')[1]
00014 __version__  = "$Revision: 2.10.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                sys
00021 import                os
00022 import                types
00023 import                re
00024 import                string
00025 from ConfigParser     import *
00026 from rcUsers          import rcUser, rcUsers
00027
00028 class rcPreferencesManager(object):
00029   def __init__(self, configFile):
00030     self.__prefs = Preferences()
00031     self.__configFile = configFile
00032     self.__pythonPath = sys.path
00033     self.__configFile = os.path.abspath(configFile)
00034     confParser = self.loadDefaults(os.getcwd())
00035     self.__defPrefs = self.parserToPrefs(confParser)
00036
00037   def loadConfig(self):
00038     confParser = ConfigParser()
00039     if os.path.exists(self.__configFile):
00040       confParser.read(self.__configFile)
00041     else:
00042       return None
00043
00044     self.parserToPrefs(confParser, self.__prefs)
00045     self.__prefs['fitsnbl'] = 0
00046     self.__prefs['fitscompress'] = 0
00047
00048     # Do not override the paths with default values anymore since the paths
00049     # may point to disconnected network drives.
00050     #
00051     #for dirname in Preferences.DIR_LIST:
00052     #  if not self.__prefs.has_key(dirname) or not os.path.isdir(self.__prefs[dirname]):
00053     #    self.__prefs[dirname] = self.__defPrefs[dirname]
00054
00055     for choice in (Preferences.CHOICE_LIST +
00056                    Preferences.LOGGING_LIST +
00057                    Preferences.SYSTEM_LIST):
00058       if not self.__prefs.has_key(choice):
00059         self.__prefs[choice] = self.__defPrefs[choice]
00060
00061     return 1
00062
00063   def writeConfig(self):
00064     confParser = self.prefsToParser()
00065     try:
00066       confParser.write(file(self.getConfigFile(), "w+"))
00067     except IOError, (errno, errdetail):
00068       print "*** rcPreferencesGUIImpl cannot save preferences to \'%s\': %s" \
00069             %(self.getConfigFile(), errdetail)
00070
00071   def preferences(self):
00072     return self.__prefs
00073
00074   def defPrefs(self):
00075     return self.__defPrefs
00076
00077   def getConfigFile(self):
00078     return self.__configFile
00079
00080   def refreshPrefs(self, newPrefs):
00081     for (key, val) in newPrefs.items():
00082       self.__prefs[key] = val
00083
00084   def setPref(self, keyword, value):
00085     self.__prefs[keyword] = value
00086
00087   def parserToPrefs(self, confParser, prefs={}):
00088     # don't overwrite existing users when loading prefs
00089     lastuser = None
00090     if 'users' in prefs:
00091       userList = prefs['users']
00092     else:
00093       userList = rcUsers()
00094     sections = confParser.sections()
00095     for section in sections:
00096       if section in ('paths', 'choices', 'logging', 'system'):
00097         options = confParser.options(section)
00098         for option in options:
00099           prefs[option] = confParser.get(section, option)
00100       elif section == 'users':
00101         options = confParser.options(section)
00102         for option in options:
00103           value = confParser.get(section, option).split(',',1)
00104           if len(value) == 2:
00105             # Must be login id and user name separated by comma.
00106             user = rcUser(option, value[0].strip(), value[1].strip())
00107           else:
00108             # No login id, set the login id to be the same as user name.
00109             user = rcUser(option, value[0].strip(), value[0].strip())
00110           if option == 'lastuser':
00111             lastuser = user
00112           else:
00113             userList.addUser(user)
00114       else:
00115         # again don't overwrite existing lists
00116         if section in prefs:
00117           optionList = prefs[section]
00118         else:
00119           optionList = {}
00120         options = confParser.options(section)
00121         for option in options:
00122           if option in Preferences.LAST_ITEMS:
00123             prefs[option] = confParser.get(section, option)
00124           else:
00125             optionList[confParser.get(section, option)] = option
00126         prefs[section] = optionList
00127     prefs['users'] = userList
00128     if lastuser is None:
00129       # Last user hasn't been set yet, use the first id available.
00130       userIds = prefs["users"].getUsers().keys()
00131       userIds.sort()
00132       if len(userIds) > 0:
00133         lastuser = userList.getUser(userIds[0])
00134     if lastuser is not None:
00135       # Get the real user object that contains the id.
00136       lastuser = userList.getUserByName(lastuser.getName())
00137       prefs["operatorobj"] = lastuser
00138       prefs["operator"] = lastuser.getName()
00139       prefs["userid"] = lastuser.getId()
00140
00141     # add _ROOT env vars to path: revisit
00142     if prefs.has_key('pythonpath'):
00143       additionalpaths = os.path.expandvars(prefs['pythonpath']).split(';')
00144       if prefs['pythonpath'].strip() != '':
00145         sys.path = map(string.strip, additionalpaths) + self.__pythonPath
00146     return prefs
00147
00148   def prefsToParser(self):
00149     prefs = self.__prefs
00150     confParser = ConfigParser()
00151     confParser.add_section("paths")
00152     confParser.add_section("choices")
00153     confParser.add_section("logging")
00154     confParser.add_section("users")
00155     confParser.add_section("system")
00156     for (option, value) in prefs.items():
00157       if option in Preferences.DIR_LIST:
00158         confParser.set("paths", option, prefs.get(option))
00159       elif option in Preferences.CHOICE_LIST:
00160         confParser.set("choices", option, str(prefs[option]))
00161       elif option in Preferences.LOGGING_LIST:
00162         confParser.set("logging", option, str(prefs[option]))
00163       elif option in Preferences.SYSTEM_LIST:
00164         confParser.set("system", option, prefs[option])
00165       elif option == 'users':
00166         for (userId, user) in value.getUsers().items():
00167           confParser.set("users", "%03d" % int(userId), "%s,%s" % (user.getLoginId(), user.getName()))
00168       elif option == 'operatorobj':
00169         confParser.set("users", "lastuser", "%s,%s" % (value.getLoginId(), value.getName()))
00170       elif type(value) == types.DictType:
00171         confParser.add_section(option)
00172         for (key, val) in value.items():
00173           confParser.set(option, val, key)
00174         if option == 'instrument type':
00175           confParser.set(option, "lastinstrumenttype", prefs['lastinstrumenttype'])
00176         elif option == 'phase':
00177           confParser.set(option, "lastphase", prefs['lastphase'])
00178         elif option == 'site':
00179           confParser.set(option, "lastsite", prefs['lastsite'])
00180         elif option == 'orientation':
00181           if prefs.has_key('lastorientation'):
00182             confParser.set(option, "lastorientation", prefs['lastorientation'])
00183         elif option == 'particle type':
00184           if prefs.has_key('lastparticletype'):
00185             confParser.set(option, "lastparticletype", prefs['lastparticletype'])
00186
00187     return confParser
00188
00189
00190   def loadDefaults(self, currentDir):
00191     cp = ConfigParser()
00192     cp.add_section("paths")
00193     cp.add_section("choices")
00194     cp.add_section("logging")
00195     cp.add_section("system")
00196     cp.set("paths","reposdir",currentDir)
00197     cp.set("paths","appdir",currentDir)
00198     cp.set("paths","datadir",currentDir)
00199     cp.set("paths","logdir",currentDir)
00200     cp.set("paths","reportdir",currentDir)
00201     cp.set("paths","fitsdir",currentDir)
00202     cp.set("paths","snapshotdir",currentDir)
00203     cp.set("paths","exportdir",currentDir)
00204     cp.set("paths","runiddir",currentDir)
00205     cp.set("choices","datasave","1")
00206     cp.set("choices","dataexport","1")
00207     cp.set("choices","fitsnbl","0")
00208     cp.set("choices","fitscompress","0")
00209     cp.set("choices","envmonnbl","0")
00210     cp.set("choices","envmoncompress","0")
00211     cp.set("choices","envmonreadonly","0")
00212     cp.set("choices","snapnbl","1")
00213     cp.set("choices","versionnbl","1")
00214     cp.set("choices","elognbl","0")
00215     cp.set("logging","lognbl","1")
00216     cp.set("logging","loglevel","INFO")
00217     cp.set("logging","loghost","localhost")
00218     cp.set("system","pythonpath","")
00219     cp.set("system","elogurl","")
00220     cp.set("system","server","1")
00221     cp.set("system","servernbl","0")
00222
00223     return cp
00224
00225   def isnumeric(self, str):
00226     return re.match('^[0-9]+$', str) is not None
00227
00228
00229   def setOperator(self, operator):
00230     operator = str(operator).strip()
00231     user = self.__prefs["users"].getUserByName(operator)
00232     self.setPref("operator", user.getName())
00233     self.setPref("operatorobj", user)
00234     self.setPref("userid", user.getId())
00235     self.writeConfig()
00236
00237   def setParticleType(self, particleType):
00238     self.setPref("lastparticletype", str(particleType))
00239     self.writeConfig()
00240
00241   def setOrientation(self, orientation):
00242     self.setPref("lastorientation", str(orientation))
00243     self.writeConfig()
00244
00245   def userId(self):
00246     if self.__prefs.has_key("userid"):
00247       return int(self.__prefs["userid"])
00248     else:
00249       return 1234
00250
00251
00252 class Preferences(dict):
00253   """\brief Preferences dictionary
00254   Preferences needs a special dictionary class since the data it stores
00255   may have macros and environment variables in it.
00256
00257   In order to read the values unprocessed use the self.__prefs.get(item)
00258   method. If you need to resolve all the macros and environment variables
00259   then access it like any other dictionary (self.__prefs[item])
00260
00261   """
00262   ROOT_DIR_ENVS = ['ONLINE_ROOT','INT_ROOT','ACD_ROOT','CAL_ROOT','TKR_ROOT','ELX_ROOT','LAT_ROOT']
00263
00264   DIR_LIST = ("reposdir", "appdir", "datadir",
00265                 "logdir", "reportdir", "fitsdir",
00266                 "snapshotdir", "exportdir", "runiddir")
00267
00268   CHOICE_LIST = ("datasave", "dataexport", "fitsnbl", "fitscompress",
00269                  "envmonnbl", "envmoncompress", "envmonreadonly",
00270                  "snapnbl", "versionnbl", "elognbl")
00271
00272   LOGGING_LIST = ("lognbl", "loglevel", "loghost")
00273
00274   SYSTEM_LIST = ("pythonpath", "elogurl", "server", "servernbl",
00275                  "fontfamily", "fontsize", "fontweight", "fontitalic",
00276                  "style")
00277
00278   LAST_ITEMS = ("lastuser", "lastsite", "lastorientation", "lastparticletype",
00279                 "lastinstrumenttype", "lastphase")
00280
00281   TREAT_AS_INT = ("datasave", "dataexport", "fitsnbl", "fitscompress",
00282                  "envmonnbl", "envmoncompress", "envmonreadonly",
00283                  "snapnbl", "versionnbl", "elognbl", "lognbl", "servernbl")
00284
00285   def __init__(self):
00286     dict.__init__(self)
00287
00288   def __getitem__(self, item):
00289     value = dict.__getitem__(self, item)
00290     if self.isDir(item):
00291       return self.expandVars(value)
00292     elif self.isNumber(item):
00293       return int(value)
00294     else:
00295       return value
00296
00297   def isDir(self, item):
00298     return item in Preferences.DIR_LIST
00299
00300   def isNumber(self, item):
00301     return item in Preferences.TREAT_AS_INT
00302
00303   def expandVars(self, path):
00304     p = os.path.expandvars(path)
00305     dirs = os.path.normpath(p).split(os.sep)
00306     i = 0
00307     for d in dirs:
00308       if d.startswith('@') and d[1:] in dict.keys(self):
00309         dirs[i] = dict.get(self,d[1:])
00310
00311       if d.startswith('@') and d[1:] in dict.keys(self):
00312         if d[1:] == 'lastinstrumenttype':
00313           dirs[i] = dict.get(self,'instrument type')[dict.get(self,d[1:])]
00314         else:
00315           dirs[i] = dict.get(self,d[1:])
00316
00317       i+=1
00318     if not dirs[0].endswith(os.sep):
00319       dirs[0]+=os.sep
00320     return reduce(os.path.join, dirs)
00321
00322   def composePath(self, path):
00323     for env in Preferences.ROOT_DIR_ENVS:
00324       if env in os.environ:
00325         if os.path.normpath(path).lower().startswith(os.path.normpath(os.environ[env]).lower()):
00326           return '$' + env + path[len(os.environ[env]):]
00327     return path
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcPythonShell.py Source File

runcontrol

rcPythonShell.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Python shell class for RunControl"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/24 23:16:43 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 import os, sys
00021 from code import InteractiveInterpreter as Interpreter
00022 from qt import *
00023
00024 class rcPythonShell(QWidget):
00025   def __init__(self,parent = None,name = None,fl = 0):
00026     QWidget.__init__(self,parent,name,fl)
00027
00028     if not name:
00029       self.setName("rcPythonShell")
00030
00031     self.__parent = parent
00032
00033     Form2Layout = QGridLayout(self,1,1,0,6,"Form2Layout")
00034
00035     self.__teShell = PythonShellWidget(locals=sys.modules['__main__'].__dict__, log='', parent=self)
00036
00037     Form2Layout.addWidget(self.__teShell,0,0)
00038
00039     self.languageChange()
00040
00041     self.resize(QSize(291,219).expandedTo(self.minimumSizeHint()))
00042
00043   def getParent(self):
00044     return self.__parent
00045
00046   def getWidget(self):
00047     return self.__teShell
00048
00049   def languageChange(self):
00050     self.setCaption(self.tr("rcPythonShell"))
00051
00052 class PythonShellWidget(QTextEdit):
00053   def __init__(self, locals=None, log='', parent=None):
00054     """Constructor.
00055
00056     The optional 'locals' argument specifies the dictionary in
00057     which code will be executed; it defaults to a newly created
00058     dictionary with key "__name__" set to "__console__" and key
00059     "__doc__" set to None.
00060
00061     The optional 'log' argument specifies the file in which the
00062     interpreter session is to be logged.
00063
00064     The optional 'parent' argument specifies the parent widget.
00065     If no parent widget has been specified, it is possible to
00066     exit the interpreter by Ctrl-D.
00067     """
00068
00069     QTextEdit.__init__(self, parent)
00070     self.interpreter = Interpreter(locals)
00071
00072     # session log
00073     self.log = log or ''
00074
00075     self.parent = parent
00076
00077     # to exit the main interpreter by a Ctrl-D if PyCute has no parent
00078     if os.name == 'nt' or os.name == 'dos':
00079       self.eofKey = Qt.Key_Z
00080     else:
00081       self.eofKey = Qt.Key_D
00082
00083     # last line + last incomplete lines
00084     self.line    = QString()
00085     self.lines   = []
00086     # the cursor position in the last line
00087     self.point   = 0
00088     # flag: the interpreter needs more input to run the last lines.
00089     self.more    = 0
00090     # flag: readline() is being used for e.g. raw_input() and input()
00091     self.reading = 0
00092     # history
00093     self.history = []
00094     self.pointer = 0
00095     self.xLast   = 0
00096     self.yLast   = 0
00097     self.clip = QApplication.clipboard()
00098
00099
00100     # user interface setup
00101     self.setTextFormat(QTextEdit.PlainText)
00102     self.setWrapPolicy(QTextEdit.Anywhere)
00103     self.setCaption('Python Shell')
00104     # font
00105     if os.name == 'posix':
00106       font = QFont("Fixed", 12)
00107     elif os.name == 'nt' or os.name == 'dos':
00108       font = QFont("Courier New", 8)
00109     else:
00110       raise SystemExit, "FIXME for 'os2', 'mac', 'ce' or 'riscos'"
00111     font.setFixedPitch(1)
00112     self.setFont(font)
00113
00114     # geometry
00115     height = 40*QFontMetrics(font).lineSpacing()
00116     request = QSize(600, height)
00117     if parent is not None:
00118       request = request.boundedTo(parent.size())
00119     self.resize(request)
00120
00121     # interpreter prompt.
00122     try:
00123       sys.ps1
00124     except AttributeError:
00125       sys.ps1 = ">>> "
00126     try:
00127       sys.ps2
00128     except AttributeError:
00129       sys.ps2 = "... "
00130
00131     # interpreter banner
00132     self.write('Python shell running Python %s on %s.\n' %
00133                 (sys.version, sys.platform))
00134     self.write('Type "copyright", "credits" or "license"'
00135                 ' for more information on Python.\n')
00136     self.write(sys.ps1)
00137
00138     self.connect(self, SIGNAL("clicked(int,int)"), self.handleClicked)
00139
00140   def redirectIO(self):
00141     # capture all interactive input/output
00142     sys.stdout   = self
00143     sys.stderr   = self
00144     sys.stdin    = self
00145
00146   def restoreIO(self):
00147     # restore all interactive input/output to their original values
00148     sys.stdout   = sys.__stdout__
00149     sys.stderr   = sys.__stderr__
00150     sys.stdin    = sys.__stdin__
00151
00152   def flush(self):
00153     """
00154     Simulate stdin, stdout, and stderr.
00155     """
00156     pass
00157
00158   def isatty(self):
00159     """
00160     Simulate stdin, stdout, and stderr.
00161     """
00162     return 1
00163
00164   def readline(self):
00165     """
00166     Simulate stdin, stdout, and stderr.
00167     """
00168     self.reading = 1
00169     self.__clearLine()
00170     self.moveCursor(QTextEdit.MoveEnd, 0)
00171     while self.reading:
00172       qApp.processOneEvent()
00173     if self.line.length() == 0:
00174       return '\n'
00175     else:
00176       return str(self.line)
00177
00178   def write(self, text):
00179     """
00180     Simulate stdin, stdout, and stderr.
00181     """
00182     # The output of self.append(text) contains to many newline characters,
00183     # so work around QTextEdit's policy for handling newline characters.
00184     hack = self.text()
00185     hack.append(text)
00186     self.setText(hack)
00187     #self.setText(self.text().append(text)) # segmentation fault
00188     self.moveCursor(QTextEdit.MoveEnd, 0)
00189     self.yLast, self.xLast = self.getCursorPosition()
00190
00191   def writelines(self, text):
00192     """
00193     Simulate stdin, stdout, and stderr.
00194     """
00195     map(self.write, text)
00196     print "DO WE EVER GET HERE? IF YES, OPTIMIZATION POSSIBLE"
00197
00198   def fakeUser(self, lines):
00199     """
00200     Simulate a user: lines is a sequence of strings, (Python statements).
00201     """
00202     for line in lines:
00203       self.line = QString(line.rstrip())
00204       self.write(self.line)
00205       self.write('\n')
00206       self.__run()
00207
00208   def __run(self):
00209     """
00210     Append the last line to the history list, let the interpreter execute
00211     the last line(s), and clean up accounting for the interpreter results:
00212     (1) the interpreter succeeds
00213     (2) the interpreter fails, finds no errors and wants more line(s)
00214     (3) the interpreter fails, finds errors and writes them to sys.stderr
00215     """
00216     self.pointer = 0
00217     self.history.append(QString(self.line))
00218     self.lines.append(str(self.line))
00219     source = '\n'.join(self.lines)
00220     self.redirectIO()
00221     self.more = self.interpreter.runsource(source)
00222     self.restoreIO()
00223     if self.more:
00224       self.write(sys.ps2)
00225     else:
00226       self.write(sys.ps1)
00227       self.lines = []
00228     self.__clearLine()
00229
00230   def __clearLine(self):
00231     """
00232     Clear input line buffer
00233     """
00234     self.line.truncate(0)
00235     self.point = 0
00236
00237   def __insertText(self, text):
00238     """
00239     Insert text at the current cursor position.
00240     """
00241     y, x = self.getCursorPosition()
00242     self.insertAt(text, y, x)
00243     self.line.insert(self.point, text)
00244     self.point += text.length()
00245     self.setCursorPosition(y, x + text.length())
00246
00247   def keyPressEvent(self, e):
00248     """
00249     Handle user input a key at a time.
00250     """
00251     text  = e.text()
00252     key   = e.key()
00253     ascii = e.ascii()
00254
00255     if text.length() and ascii>=32 and ascii<127:
00256       self.__insertText(text)
00257       return
00258
00259     if e.state() & Qt.ControlButton and key == self.eofKey:
00260       if self.parent is None:
00261         try:
00262           file = open(self.log, "w")
00263           file.write(str(self.text()))
00264           file.close()
00265         except:
00266           pass
00267         sys.exit()
00268       else:
00269         self.restoreIO()
00270         self.parent.getParent().hide()
00271       return
00272
00273     if e.state() & Qt.ControlButton or e.state() & Qt.ShiftButton:
00274       e.ignore()
00275       return
00276
00277     if key == Qt.Key_Backspace:
00278       if self.point:
00279         self.doKeyboardAction(QTextEdit.ActionBackspace)
00280         self.point -= 1
00281         self.line.remove(self.point, 1)
00282     elif key == Qt.Key_Delete:
00283       self.doKeyboardAction(QTextEdit.ActionDelete)
00284       self.line.remove(self.point, 1)
00285     elif key == Qt.Key_Return or key == Qt.Key_Enter:
00286       self.write('\n')
00287       if self.reading:
00288         self.reading = 0
00289       else:
00290           self.__run()
00291     elif key == Qt.Key_Tab:
00292       self.__insertText(text)
00293     elif key == Qt.Key_Left:
00294       if self.point:
00295         self.moveCursor(QTextEdit.MoveBackward, 0)
00296         self.point -= 1
00297     elif key == Qt.Key_Right:
00298       if self.point < self.line.length():
00299         self.moveCursor(QTextEdit.MoveForward, 0)
00300         self.point += 1
00301     elif key == Qt.Key_Home:
00302       self.setCursorPosition(self.yLast, self.xLast)
00303       self.point = 0
00304     elif key == Qt.Key_End:
00305       self.moveCursor(QTextEdit.MoveLineEnd, 0)
00306       self.point = self.line.length()
00307     elif key == Qt.Key_Up:
00308       if len(self.history):
00309         if self.pointer == 0:
00310           self.pointer = len(self.history)
00311         self.pointer -= 1
00312         self.__recall()
00313     elif key == Qt.Key_Down:
00314       if len(self.history):
00315         self.pointer += 1
00316         if self.pointer == len(self.history):
00317           self.pointer = 0
00318         self.__recall()
00319     elif key == Qt.Key_Escape:
00320       self.__deleteLine()
00321     else:
00322       e.ignore()
00323
00324   def __deleteLine(self):
00325     self.setCursorPosition(self.yLast, self.xLast)
00326     self.setSelection(self.yLast, self.xLast,
00327                       self.yLast, self.paragraphLength(self.yLast))
00328     self.removeSelectedText()
00329     self.__clearLine()
00330
00331   def __recall(self):
00332     """
00333     Display the current item from the command history.
00334     """
00335     self.__deleteLine()
00336     self.__insertText(self.history[self.pointer])
00337
00338
00339   def focusNextPrevChild(self, next):
00340     """
00341     Suppress tabbing to the next window in multi-line commands.
00342     """
00343     if next and self.more:
00344       return 0
00345     return QTextEdit.focusNextPrevChild(self, next)
00346
00347   def handleClicked(self, para, pos):
00348     """
00349     Keep the cursor after the last prompt.
00350     """
00351     if self.hasSelectedText():
00352       if len(self.selectedText()) > 0:
00353         self.clip.setText(self.selectedText())
00354     self.moveCursor(QTextEdit.MoveEnd, 0)
00355     return
00356
00357   def contentsContextMenuEvent(self,ev):
00358     """
00359     Suppress the right button context menu.
00360     Instead paste the contents of the clipboard.
00361     """
00362     self.__insertText(self.clip.text())
00363     ev.accept()
00364     return
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcReportGen.py Source File

runcontrol

rcReportGen.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Run report generator class for RunControl"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "02/10/2003"
00014 __version__  = "$Revision: 2.9 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import os
00020 import logging as log
00021 import time
00022 import cStringIO
00023
00024 from xml.sax.saxutils  import XMLGenerator
00025 from xml.parsers.expat import ParserCreate
00026
00027 from qt    import QVariant
00028 from qtsql import QSqlDatabase, QSqlCursor
00029
00030 UNITS_INT    = 0
00031 UNITS_LONG   = 1
00032 UNITS_FLOAT  = 2
00033 UNITS_STRING = 3
00034 UNITS_LIST   = 4
00035 UNITS_DICT   = 5
00036
00037 UNIT_MAP = {
00038             'OperatorId'      : UNITS_LONG,
00039             'EventCount'      : UNITS_LONG,
00040             'BadEventCount'   : UNITS_LONG,
00041             'ErrorEventCount' : UNITS_LONG,
00042             'PauseCount'      : UNITS_INT,
00043             'ElapsedTime'     : UNITS_FLOAT,
00044             'CompletionStatus': UNITS_INT,
00045            }
00046
00047 class rcReportGen(object):
00048   def __init__(self, fileName="rcReport.out", prefs=None):
00049     self.__fileName  = fileName
00050     self.__prefs     = prefs
00051     if prefs is not None:
00052       self.__elognbl   = int(prefs["elognbl"])
00053     else:
00054       self.__elognbl   = 0
00055
00056
00057   def initialize(self, tstamp=None):
00058     self.__tstamp = tstamp
00059     self.__repFields = []
00060     self.__repData = []
00061     self.__repUnits = []
00062     if self.__elognbl:
00063       self.__sqldriver = 'QMYSQL3'
00064       self.__dbname    = 'elogbook'
00065       if QSqlDatabase.isDriverAvailable(self.__sqldriver):
00066         self.__db = QSqlDatabase.addDatabase(self.__sqldriver)
00067         if not self.connectDB():
00068           log.error("Error opening database %s"
00069                     " disabling Elogbook integration" % self.__dbname)
00070           log.error(str(self.__db.lastError().text()))
00071           self.__elognbl = 0
00072         else:
00073           log.debug("Database %s opened successfully" % self.__dbname)
00074       else:
00075         log.error("The SQL driver %s is not available,"
00076                   " disabling Elogbook integration" % self.__sqldriver)
00077         self.__elognbl = 0
00078
00079   def connectDB(self):
00080     if 'ELOGBOOK_HOST' in os.environ:
00081       host = os.environ['ELOGBOOK_HOST']
00082     else:
00083       host = 'localhost'
00084     self.__db.setHostName(host)
00085     self.__db.setUserName('elogbook')
00086     self.__db.setPassword('elogbook')
00087     self.__db.setDatabaseName(self.__dbname)
00088     return self.__db.open()
00089
00090   def disconnectDB(self):
00091     return self.__db.close()
00092
00093   def addField(self, field, data, units=UNITS_STRING):
00094     if field == 'TimeStamp':
00095       self.__tstamp = data
00096     else:
00097       self.__repFields.append(field)
00098       self.__repData.append(data)
00099       self.__repUnits.append(units)
00100
00101   def writeReportCSV(self):
00102     if not os.path.exists(self.__fileName):
00103       f = file(self.__fileName, 'w+')
00104       i = 0
00105       for header in self.__repFields:
00106         f.write(header)
00107         i = i + 1
00108         if i < len(self.__repFields):
00109           f.write(',')
00110       f.write('\n')
00111
00112     f = file(self.__fileName, 'a+')
00113     i = 0
00114     for data in self.__repData:
00115       f.write('"'+data+'"')
00116       i = i + 1
00117       if i < len(self.__repData):
00118         f.write(',')
00119     f.write('\n')
00120     f.close()
00121
00122   def writeReportXML(self):
00123     if not os.path.exists(self.__fileName):
00124       f = file(self.__fileName, 'w+')
00125       newReportFile = 1
00126     else:
00127       f = file(self.__fileName, 'a+')
00128       newReportFile = 0
00129
00130     result = cStringIO.StringIO()
00131     gen = XMLGenerator(result)
00132     if newReportFile:
00133       gen.startDocument()
00134     if self.__tstamp is None:
00135       self.__tstamp = time.gmtime()
00136     self.__tstamp = str(self.__tstamp)
00137     gen.startElement("testReport", {'timestamp': self.__tstamp})
00138     i = 0
00139     for header in self.__repFields:
00140       gen.startElement(header,{})
00141       gen.characters(self.__repData[i])
00142       gen.endElement(header)
00143       i = i + 1
00144     gen.endElement("testReport")
00145     if newReportFile:
00146       gen.endDocument()
00147     f.write(result.getvalue()+'\n')
00148     f.close()
00149     if self.__elognbl:
00150       self.writeReportSQL()
00151       self.disconnectDB()
00152
00153   def writeReportSQL(self):
00154     fieldMap = {'RunId': 'RunID',
00155                 'OperatorId': 'OperatorID'
00156                }
00157
00158     dateFields = ['TimeStamp', 'StartTime', 'EndTime']
00159
00160     self.__repFields.append('TimeStamp')
00161     self.__repData.append(self.__tstamp)
00162     table = "elogreport"
00163     cur = QSqlCursor(table)
00164     fields = [f.name() for f in self.__db.recordInfo(table)]
00165     recBuffer = cur.primeInsert()
00166     additional = ""
00167     for i in range(len(self.__repFields)):
00168       field = self.__repFields[i]
00169       if field in fieldMap:
00170         field = fieldMap[field]
00171       if field in dateFields:
00172         t = eval(self.__repData[i])
00173         value = "%04d-%02d-%02d %02d:%02d:%02d" % (t[0], t[1], t[2], t[3], t[4], t[5])
00174       else:
00175         value = self.__repData[i]
00176       if field in fields:
00177         recBuffer.setValue(field, QVariant(value))
00178       else:
00179         log.debug("Can not find field %s in table %s. Adding it to the 'Additional Fields' column."
00180                  % (field, table))
00181         additional = additional + field + "???" + value + "!!!"
00182       if additional != "":
00183         recBuffer.setValue("AdditionFields", QVariant(additional))
00184     if cur.insert() != 1:
00185       log.error("Could not insert elogreport record, dumping field data:")
00186       for i in range(len(self.__repFields)):
00187         log.error("\t%s\t\t\t%s" % (self.__repFields[i], self.__repData[i]))
00188       log.error("SQL Error text: %s", str(cur.lastError().text()))
00189
00190   def readReportXML(self):
00191     # 3 handler functions
00192     def start_element(name, attrs):
00193       #print 'Start element:', str(name), attrs
00194       self.__data = ''
00195       if str(name) == 'testReport':
00196         self.__tstamp = str(attrs['timestamp'])
00197         self.__repFields.append('TimeStamp')
00198         self.__repData.append(self.__tstamp)
00199         self.__repUnits.append(UNITS_STRING)
00200       else:
00201         self.__repFields.append(str(name))
00202     def end_element(name):
00203       #print 'End element:', str(name)
00204       name = str(name)
00205       if name != 'testReport':
00206         self.__repData.append(self.__data)
00207         if name in UNIT_MAP:
00208           self.__repUnits.append(UNIT_MAP[name])
00209         else:
00210           self.__repUnits.append(UNITS_STRING)
00211     def char_data(data):
00212       #print 'Character data:', str(data)
00213       if self.__data is not None:
00214         self.__data += str(data)
00215     def external_entity_ref_handler(context,base,systemId,publicId):
00216       subParser = p.ExternalEntityParserCreate(context)
00217       subParser.StartElementHandler = start_element
00218       subParser.EndElementHandler = end_element
00219       subParser.CharacterDataHandler = char_data
00220       subParser.ParseFile(file(systemId))
00221       return 1
00222     self.__data = None
00223     p = ParserCreate()
00224     p.ExternalEntityRefHandler = external_entity_ref_handler
00225     p.Parse("""<!DOCTYPE report [<!ENTITY reportfile SYSTEM \""""+self.__fileName+"""\">
00226             ]><report>&reportfile;</report>""")
00227
00228   def getReportFields(self):
00229     return self.__repFields
00230
00231   def getReportData(self):
00232     return self.__repData
00233
00234   def getReportUnits(self):
00235     return self.__repUnits
00236
00237   def getTimestamp(self):
00238     return self.__tstamp
00239
00240
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcRunIdHelper.py Source File

runcontrol

rcRunIdHelper.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Utility class to set and retrieve run id"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/05 00:41:27 $").split(' ')[1]
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 from ConfigParser import *
00020 import os
00021
00022 class rcRunIdHelper(object):
00023   SECTION_M = 'MachineData'
00024   SECTION_R = 'RunIdData'
00025   OPTION_MID = 'machineid'
00026   OPTION_RID = 'runid'
00027
00028   def __init__(self, prefs):
00029     self.__parser = ConfigParser()
00030
00031     if 'runiddir' in prefs:
00032       self.configFile = os.path.join(prefs['runiddir'], 'runId.cfg')
00033     else:
00034       raise RuntimeError, "Preference file doesn't specify runId location"
00035
00036     if os.path.exists(self.configFile):
00037       self.__parser.read(self.configFile)
00038     else:
00039       errorMsg = self.configFile + " not found. "
00040       errorMsg += "Did you forget to copy it from a previous installation or from runId.cfg.sample?"
00041       raise RuntimeError, errorMsg
00042
00043   def currentRunId(self):
00044     rid = -1
00045     mid = -1
00046     try:
00047       mid = int(self.__parser.get(self.SECTION_M, self.OPTION_MID))
00048       rid = int(self.__parser.get(self.SECTION_R, self.OPTION_RID))
00049     except:
00050       pass
00051
00052     if mid == -1 or rid == -1:
00053       return '-1'
00054     else:
00055       return ('%03d%06d' % (mid, rid))
00056
00057   def nextRunId(self):
00058     rid = -1
00059     mid = -1
00060     try:
00061       mid = int(self.__parser.get(self.SECTION_M, self.OPTION_MID))
00062       rid = int(self.__parser.get(self.SECTION_R, self.OPTION_RID))
00063     except:
00064       pass
00065
00066     if mid == -1 or rid == -1:
00067       return '-1'
00068     else:
00069       if mid == 0:
00070         errorMsg = self.configFile + " has an invalid machine id. "
00071         errorMsg += "Please choose a valid and unique id for your subsystem and this teststand "
00072         errorMsg += "and enter it in this file (See runId.cfg.sample file in the same directory for "
00073         errorMsg += "subsystem allocation of machine ids)."
00074         raise RuntimeError, errorMsg
00075       else:
00076         rid +=1
00077         self.__parser.set(self.SECTION_R, self.OPTION_RID, str(rid))
00078         self.__parser.write(file(self.configFile, "w+"))
00079         return ('%03d%06d' % (mid, rid))
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcScmCfgSelector.py Source File

runcontrol

rcScmCfgSelector.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT finite state transistions classes"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/24 23:16:43 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import qt
00021
00022 #  This class puts up a GUI for getting the SchemaConfig file to use.
00023 class rcScmCfgSelector(qt.QFileDialog):
00024   "GUI for getting the SchemaConfig file to use."
00025   def __init__(self, startwithDir, startwithFile, parent = None, name = None, fl = 0):
00026     qt.QFileDialog.__init__(self, parent, name, fl)
00027
00028     self.setMode(qt.QFileDialog.ExistingFile)
00029     self.setFilter("(*.xml)")
00030     if startwithDir is not None:
00031       self.setDir(startwithDir)
00032     self.setCaption("Choose a schema/configuration file")
00033     if startwithFile is not None:
00034       self.setSelection(startwithFile)
00035
00036     if self.exec_loop() == qt.QDialog.Accepted:
00037       self.__value = str(self.selectedFile())
00038     else:
00039       self.__value = None
00040
00041   def getValue(self):
00042     return self.__value
00043
00044 class rcScmCfgSelText(object):
00045   "Text user interface for getting the user to a SchemaConfig file"
00046   def __init__(self, startwith):
00047     self.__startwith = startwith
00048
00049   def getValue(self):
00050     startwith = self.__startwith
00051     if startwith is None:
00052       startwith = ''
00053     answer = raw_input("Choose a schema/configuration file [%s]: " % startwith)
00054     if answer == '':
00055       answer = self.__startwith
00056     return answer
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSecurityMan.py Source File

runcontrol

rcSecurityMan.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Security Manager for RunControl"
00012 __author__   = "S. Tuvi <STuvi@SLAC.Stanford.edu>"
00013 __date__     = ("$Date: 2005/01/10 21:19:01 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import os
00021 from struct       import calcsize, pack, unpack
00022 #from binascii     import hexlify
00023 #import md5
00024 import sys
00025 import logging as log
00026 from ConfigParser import ConfigParser
00027 import sha, random, base64
00028
00029 class rcSecurityMan(object):
00030   """Security Manager class that contains
00031   user authentication and rights management routines.
00032   """
00033   def __init__(self, secureDir, users):
00034     self.__secureDir = secureDir
00035     self.__users = users
00036     self.__passwords = os.path.join(self.__secureDir, "passwords")
00037     self.__security = os.path.join(self.__secureDir, "security.cfg")
00038     self.__fmt = "40s 256s 32s 40s h"
00039     self.__roles = {}
00040     self.__permissions = {}
00041
00042   def readPermissions(self):
00043     """Read permissions from the security.cfg file
00044     and update user objects.
00045     """
00046     if os.access(self.__passwords,os.O_RDONLY):
00047       permParser = ConfigParser()
00048       permParser.read(self.__security)
00049       pUsers = permParser.options("users")
00050       for loginId in pUsers:
00051         user = self.__users.getUserByLoginId(loginId)
00052         if user is not None:
00053           roles = permParser.get("users", loginId).split(", ")
00054           for role in roles:
00055             user.addRole(role)
00056             if role not in self.__roles:
00057               self.__roles[role] = []
00058             if role == 'administrator': continue
00059             if not permParser.has_option("roles", role):
00060               log.warn("No permissions defined for role %s" % role)
00061             else:
00062               permissions = permParser.get("roles", role).split(", ")
00063               for permission in permissions:
00064                 if not permParser.has_option("permissions", permission):
00065                   log.warn("Permission %s is not in the security database" % permission)
00066                 else:
00067                   permDesc = permParser.get("permissions", permission)
00068                   user.addPermission(permission)
00069                   if permission not in self.__roles[role]:
00070                     self.__roles[role].append(permission)
00071                     if permission not in self.__permissions:
00072                       self.__permissions[permission] = permDesc
00073                     else:
00074                       log.warn("Permission %s has already been defined." % permission)
00075
00076         # Add the roles and permissions which do not belong to any user
00077         for role in permParser.options("roles"):
00078           if role not in self.__roles:
00079             self.__roles[role] = []
00080             permissions = permParser.get("roles", role).split(", ")
00081             for permission in permissions:
00082               if permission in permParser.options("permissions"):
00083                 self.__roles[role].append(permission)
00084         for permission in permParser.options("permissions"):
00085           if permission not in self.__permissions:
00086             self.__permissions[permission] = permParser.get("permissions", permission)
00087
00088
00089   def registerPermission(self, role, permission, permDesc):
00090     """Method available to be called by a user script that
00091     allows the script to register a permission given a role
00092     and update any user permissions who belong in that role
00093
00094     \param role       Role name for the \a permission to be included.
00095     \param permission Permission name.
00096     \param permDesc   Permission description
00097     """
00098     if self.roleHasPermission(role, permission):
00099       log.warn("Permission %s already exists in role %s" % (permission, role))
00100     else:
00101       if permission not in self.__permissions:
00102         self.__permissions[permission] = permDesc
00103       for user in self.__users:
00104         if role in user.getRoles():
00105           if permission not in user.getPermissions():
00106             user.addPermission(permission)
00107
00108   def checkPermission(self, user, permission):
00109     """Checks if the user has been granted the specified permission
00110
00111     \param user       rcUser object instance
00112     \param permission Permission name
00113
00114     \return True:  If the \a user is granted the \a permission
00115             False: Otherwise
00116     """
00117     return (permission in user.getPermissions())
00118
00119   def roleHasPermission(self, role, permission):
00120     """Check if \a permission exists in \a role.
00121
00122     \param role Role name
00123     \param permission Permission name
00124
00125     \return True:  If \a role has \a permission.
00126             False: otherwise.
00127     """
00128     return (permission in self.__roles[role])
00129
00130   def getPermissions(self, role=None):
00131     """Returns the list of all permissions defined.
00132     If \a role has been specified then returns
00133     all permissions defined for that role.
00134
00135     \param role Role name
00136
00137     \return List of sll permissions or permissions for the specified role
00138     """
00139     if role is not None:
00140       return self.__roles[role]
00141     else:
00142       return self.__permissions.keys()
00143
00144   def getPermissionDescription(self, permission):
00145     """Returns the description for the specified permission.
00146     If permission does not exist, returns None.
00147
00148     \param permission Permission name
00149
00150     \return Permission description string
00151     """
00152     if permission in self.__permissions:
00153       return self.__permissions[permission]
00154
00155   def getRoles(self):
00156     """Returns the list of all roles defined.
00157
00158     \return List of all roles.
00159     """
00160     return self.__roles.keys()
00161
00162   def authenticateUser(self, loginId, password):
00163     """Authenticate the user based on the given login id and password.
00164
00165     \param loginId  User's login id
00166     \param password User's password
00167
00168     \return -1: User authentication failed, invalid user id or password
00169             -2: Password database is not accessible
00170              0: Access granted
00171     """
00172     openFlag = os.O_RDONLY
00173     if sys.platform =='win32':
00174       openFlag|=os.O_BINARY
00175     if os.access(self.__passwords,os.O_RDONLY):
00176       fd = os.open(self.__passwords,openFlag)
00177     else:
00178       log.debug("Password database is not accessible.")
00179       return -2
00180
00181     #md5sum = md5.new()
00182     user_name = "Nothing"
00183     user_home = "Nothing"
00184     user_login = loginId
00185     user_password = password
00186     #md5sum.update(user_password)
00187     #user_passhash = hexlify(md5sum.digest())
00188     user_passhash="Nothing"
00189     user_attempts = 0
00190     user_sizeof = calcsize(self.__fmt)
00191     user_data = pack(self.__fmt,user_name,user_home,user_login,user_passhash,user_attempts)
00192     while len(user_data) == user_sizeof:
00193       user_data = os.read(fd,user_sizeof)
00194       if len(user_data) == user_sizeof:
00195         (u_name,u_home,u_login,u_passhash,u_attempts) = unpack(self.__fmt,user_data)
00196         #print "<%s><%s><%s><%s>" % (u_login, user_login, u_passhash, user_passhash)
00197         if u_login.strip('\0 ') == user_login.strip() and self.__check(u_passhash, user_password):
00198           log.debug("Access Granted to user with the login id=%s" % loginId)
00199           os.close(fd)
00200           return 0
00201     log.debug("User authentication failed, loginId=%s" % loginId)
00202     os.close(fd)
00203     return -1
00204
00205
00206   def changePassword(self, loginId, password, userName, oldPassword=""):
00207     """Change an existing user's password.
00208
00209     \param loginId     User's login id
00210     \param password    The new password for the user
00211     \param userName    User's full name
00212     \param oldPassword User's old password (optional).
00213                        If this parameter is not specified the old password
00214                        is not verified. This is useful when the password
00215                        needs to be reset due to a forgotten password.
00216
00217     \return -1: Invalid login or password
00218             -2: Password database is not accessible
00219             -3: Error accessing the password database
00220              0: Password changed successfully
00221     """
00222
00223     try:
00224       # Need to use low-level file I/O here since we are going to use lseek
00225       if os.access(self.__passwords,os.O_RDWR):
00226         fd = os.open(self.__passwords,os.O_BINARY|os.O_RDWR)
00227       else:
00228         log.debug("Password database is not accessible.")
00229         return -2
00230     except:
00231       log.exception("Error accessing the password database")
00232       return -3
00233
00234
00235     #md5sum = md5.new()
00236     user_name = userName
00237     user_home = "Nothing"
00238     user_login = loginId
00239     user_password = oldPassword
00240     #md5sum.update(user_password)
00241     #user_passhash = hexlify(md5sum.digest())
00242     user_passhash = "Nothing"
00243     user_attempts = 0
00244     user_sizeof = calcsize(self.__fmt)
00245     user_data = pack(self.__fmt,user_name,user_home,user_login,user_passhash,user_attempts)
00246     while len(user_data) == user_sizeof:
00247       user_data = os.read(fd, user_sizeof)
00248       if len(user_data) == user_sizeof:
00249         (u_name,u_home,u_login,u_passhash,u_attempts) = unpack(self.__fmt,user_data)
00250         if u_login.strip('\0 ') == user_login.strip() and (oldPassword == "" or self.__check(u_passhash, user_password)):
00251           new_password = password
00252           #newmd5sum = md5.new(new_password)
00253           #new_passhash = hexlify(newmd5sum.digest())
00254           new_passhash = self.__create(new_password)
00255           user_info = pack(self.__fmt,user_name,u_home,u_login,new_passhash,u_attempts)
00256           os.lseek(fd,-user_sizeof,1)
00257           os.write(fd,user_info)
00258           os.close(fd)
00259           log.debug("Password for user %s changed" % loginId)
00260           return 0
00261     os.close(fd)
00262     log.debug("Invalid login or password trying to change the password for user %s" % loginId)
00263     return -1
00264
00265   def addPassword(self, loginId, password, userName):
00266     """Add a new user to the password database
00267
00268     \param loginId  User's login id
00269     \param password The new password for the user
00270     \param userName User's full name
00271
00272     \return -3: Error accessing the password database
00273             -2: User already exists in password database
00274             -1: Invalid login or password
00275              0: Added user to the password database
00276     """
00277     try:
00278       if os.access(self.__passwords,os.O_RDWR):
00279         fd = os.open(self.__passwords,os.O_BINARY|os.O_RDWR)
00280         newfile = 0
00281       else:
00282         fd = os.open(self.__passwords,os.O_BINARY|os.O_RDWR|os.O_CREAT)
00283         newfile = 1
00284     except:
00285       log.exception("Error accessing the password database")
00286       return -3
00287     #md5sum = md5.new()
00288     user_name = userName
00289     user_home = "Nothing"
00290     user_login = loginId
00291     user_password = password
00292     #md5sum.update(user_password)
00293     #user_passhash = hexlify(md5sum.digest())
00294     user_passhash = self.__create(user_password)
00295     user_attempts = 0
00296     user_sizeof = calcsize(self.__fmt)
00297     user_info = pack(self.__fmt,user_name,user_home,user_login,user_passhash,user_attempts)
00298     user_data = user_info
00299     if newfile:
00300       log.debug("Added user %s to the password database" % loginId)
00301       os.write(fd,user_info)
00302       os.close(fd)
00303       return 0
00304     while len(user_data) == user_sizeof:
00305       user_data = os.read(fd,user_sizeof)
00306       if len(user_data) == user_sizeof:
00307         (u_name,u_home,u_login,u_passhash,u_attempts) = unpack(self.__fmt,user_data)
00308         if u_login.strip('\0 ') == user_login.strip():
00309           log.debug("User %s already exists in password database." % loginId)
00310           os.close(fd)
00311           return -2
00312     log.debug("Added user %s to the password database" % loginId)
00313     os.write(fd,user_info)
00314     os.close(fd)
00315     return 0
00316
00317   def checkPassword(self, loginId):
00318     """Checks if a user already has a password
00319
00320     \param loginId  User's login id
00321
00322     \return -1: Password does not exist
00323              0: Password exists
00324     """
00325     if os.access(self.__passwords,os.O_RDONLY):
00326       fd = os.open(self.__passwords,os.O_BINARY|os.O_RDONLY)
00327     else:
00328       return -1
00329     #md5sum = md5.new()
00330     user_name = "Nothing"
00331     user_home = "Nothing"
00332     user_login = loginId
00333     user_password = "Nothing"
00334     user_passhash = "Nothing"
00335     user_attempts = 0
00336     user_sizeof = calcsize(self.__fmt)
00337     user_info = pack(self.__fmt,user_name,user_home,user_login,user_passhash,user_attempts)
00338     user_data = user_info
00339     while len(user_data) == user_sizeof:
00340       user_data = os.read(fd,user_sizeof)
00341       if len(user_data) == user_sizeof:
00342         (u_name,u_home,u_login,u_passhash,u_attempts) = unpack(self.__fmt,user_data)
00343         if u_login.strip('\0 ') == user_login.strip():
00344           os.close(fd)
00345           return 0
00346     os.close(fd)
00347     return -1
00348
00349
00350   def deleteUser(self, loginId):
00351     """Deletes the user based on the given login id and password.
00352
00353     \param loginId  User's login id
00354     \param password User's password
00355
00356     \return -1: User authentication failed, invalid user id or password
00357             -2: Password database is not accessible
00358              0: User deleted
00359     """
00360     if os.access(self.__passwords,os.O_RDWR):
00361       fd = os.open(self.__passwords,os.O_BINARY|os.O_RDWR)
00362     else:
00363       log.debug("Password database is not accessible.")
00364       return -2
00365
00366     #md5sum = md5.new()
00367     (fmode, fino, fdev, fnlink, fuid, fgid, fsize, fatime, fmtime, fctime) = os.fstat(fd)
00368     user_name = "Nothing"
00369     user_home = "Nothing"
00370     user_login = loginId
00371     #user_password = password
00372     #md5sum.update(user_password)
00373     #user_passhash = hexlify(md5sum.digest())
00374     user_passhash="Nothing"
00375     user_attempts = 0
00376     user_sizeof = calcsize(self.__fmt)
00377     user_data = pack(self.__fmt,user_name,user_home,user_login,user_passhash,user_attempts)
00378     while len(user_data) == user_sizeof:
00379       user_data = os.read(fd,user_sizeof)
00380       if len(user_data) == user_sizeof:
00381         (u_name,u_home,u_login,u_passhash,u_attempts) = unpack(self.__fmt,user_data)
00382         #print "<%s><%s><%s><%s>" % (u_login, user_login, u_passhash, user_passhash)
00383         if u_login.strip('\0 ') == user_login.strip(): # and self.__check(u_passhash, user_password):
00384           log.debug("Access Granted to user with the login id=%s" % loginId)
00385           curpos = os.lseek(fd,0,1)
00386           if curpos == fsize:
00387             os.close(fd)
00388             f = open(self.__passwords, "ab+")
00389             f.truncate(fsize - user_sizeof)
00390             f.close()
00391             log.debug("User %s deleted" % loginId)
00392             return 0
00393           buf = os.read(fd,fsize - curpos)
00394           os.lseek(fd,curpos - user_sizeof,0)
00395           os.write(fd,buf)
00396           os.close(fd)
00397           f = open(self.__passwords,"ab+")
00398           f.truncate(fsize - user_sizeof)
00399           f.close()
00400           log.debug("User %s deleted" % loginId)
00401           return 0
00402     log.debug("User authentication failed, loginId=%s" % loginId)
00403     os.close(fd)
00404     return -1
00405
00406
00407   ## private:
00408
00409   # Password encryption/verification routines
00410   def __makesalt(self):
00411       l = [ chr(random.randint(0,255)) for i in range(4) ]
00412       return ''.join(l)
00413
00414   def __create(self, password):
00415       salt = self.__makesalt()
00416       text = salt + password
00417       pwdHash = sha.new(text).digest()
00418       data = salt + pwdHash
00419       return base64.encodestring(data)
00420
00421   def __check(self, data, password):
00422       data = base64.decodestring(data)
00423       salt, pwdHash = data[:4], data[4:]
00424       pwdHash2 = sha.new(salt + password).digest()
00425       return pwdHash2 == pwdHash
00426
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcStatusMonitor.py Source File

runcontrol

rcStatusMonitor.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Status Monitor for Run Control"
00012 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00013 __date__     = ("$Date: 2004/09/07 20:52:54 $").split(' ')[1]
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from qt import *
00022
00023 class StatusItem(QListViewItem):
00024   def __init__(self, *args):
00025     QListViewItem.__init__(self, *args)
00026     self.alarmExpr = None
00027
00028   def paintCell(self, p, cg, column, width, align):
00029     g = QColorGroup(cg)
00030     g.setColor( QColorGroup.Base, Qt.white)
00031     g.setColor( QColorGroup.Foreground, Qt.black)
00032     if self.alarmExpr is not None:
00033       # If alarm expr starts with '@' then treat the monitored
00034       # value as a string in the expression.
00035       if self.alarmExpr.startswith("@"):
        expr = "'"+str(self.text(1))+"'" + self.alarmExpr[1:]
00036       else:
00037         expr = str(self.text(1)) + self.alarmExpr
00038       if eval(expr):
00039         g.setColor( QColorGroup.Text, Qt.red)
00040       else:
00041         g.setColor( QColorGroup.Text, Qt.black)
00042
00043
00044     # Do the standard painting
00045     QListViewItem.paintCell(self,p,g,column,width,align)
00046
00047     p.setPen( QPen( cg.dark(), 1 ) )
00048     p.drawLine( 0, self.height() - 1, width, self.height() - 1 )
00049     p.drawLine( width - 1, 0, width - 1, self.height() )
00050
00051   def setText(self, column, value):
00052     QListViewItem.setText(self, column, value)
00053
00054   def setAlarmExpr(self, alarmExpr):
00055     self.alarmExpr = alarmExpr
00056
00057
00058 class WatchItem(object):
00059   def __init__(self, accessor, key, label, alarmExpr):
00060     self.__accessor = accessor
00061     self.__statusItem = None
00062     self.__key = key
00063     self.__label = label
00064     self.__alarmExpr = alarmExpr
00065     self.__inView = 0
00066
00067
00068   def evaluate(self):
00069     if self.__key is not None:
00070       if self.__accessor.has_key(self.__key):
00071         return self.__accessor[self.__key]
00072       else:
00073         return 'N/A'
00074     else:
00075       val = self.__accessor()
00076       if val is None:
00077         return 'N/A'
00078       else:
00079         return val
00080
00081   def getLabel(self):
00082     return self.__label
00083
00084   def getAlarmExpr(self):
00085     return self.__alarmExpr
00086
00087   def getStatusItem(self):
00088     return self.__statusItem
00089
00090   def setStatusItem(self, si):
00091     self.__statusItem = si
00092
00093   def isInView(self):
00094     return self.__inView
00095
00096   def setInView(self):
00097     self.__inView = 1
00098
00099   def setAccessor(self, accessor, key):
00100     self.__accessor = accessor
00101     self.__key      = key
00102
00103
00104 class rcStatusPanel(QWidget):
00105   def __init__(self,parent = None,name = None,fl = 0):
00106     QWidget.__init__(self,parent,name,fl)
00107
00108     self.contextMenu = QPopupMenu( self )
00109     self.contextMenu.insertItem( "&Copy", self.copyToClipboard, Qt.CTRL+Qt.Key_C)
00110
00111     self.clip = QApplication.clipboard()
00112
00113     if not name:
00114       self.setName("rcStatusPanel")
00115
00116
00117     rcStatusPanelLayout = QGridLayout(self,1,1,0,6,"rcStatusPanelLayout")
00118
00119     self.statusView = QListView(self,"statusView")
00120     self.statusView.addColumn(self.tr("Data"))
00121     self.statusView.addColumn(self.tr("Value"))
00122     self.statusView.setAllColumnsShowFocus(1)
00123
00124     rcStatusPanelLayout.addWidget(self.statusView,0,0)
00125
00126     self.resize(QSize(151,271).expandedTo(self.minimumSizeHint()))
00127     QObject.connect(self.statusView,
00128                     SIGNAL("contextMenuRequested(QListViewItem*,const QPoint&,int)"),
00129                     self.contextMenuShow
00130                    )
00131
00132   def contextMenuShow(self, item, point, column):
00133     self.selectedItem = item
00134     self.contextMenu.exec_loop(point)
00135
00136   def copyToClipboard(self):
00137     self.clip.setText(self.statusView.selectedItem().text(1))
00138
00139
00140 class rcStatusMonitor(object):
00141   def __init__(self, interval, gui=None):
00142     self.__interval = interval
00143     self.__gui = gui
00144     self.__watchList = {}
00145     self.__labelSeq = []
00146     self.__timer = QTimer(gui)
00147     self.__lastItem = None
00148     QObject.connect(self.__timer, SIGNAL("timeout()"), self.updateWatchItems)
00149
00150   def startWatch(self):
00151     self.__timer.start(self.__interval)
00152
00153   def stopWatch(self):
00154     self.__timer.stop()
00155
00156   def addWatchItem(self, label, accessor, key=None, alarmExpr=None):
00157     if not self.__watchList.has_key(label):
00158       self.__watchList[label] = WatchItem(accessor, key, label, alarmExpr)
00159       self.__labelSeq.append(label)
00160     else:
00161       self.__watchList[label].setAccessor(accessor, key)
00162
00163   def updateWatchItems(self):
00164     for label in self.__labelSeq:
00165       wi = self.__watchList[label]
00166       if self.__gui is None:
00167         print label, wi.evaluate()
00168       else:
00169         if not wi.isInView():
00170           if self.__lastItem is None:
00171             si = StatusItem(self.__gui.statusView, label)
00172           else:
00173             si = StatusItem(self.__gui.statusView, self.__lastItem, label)
00174           si.setAlarmExpr(wi.getAlarmExpr())
00175           self.__lastItem = si
00176           wi.setStatusItem(si)
00177           wi.setInView()
00178         else:
00179           si = wi.getStatusItem()
00180         si.setText(1, str(wi.evaluate()))
00181
00182
00183
00184 #~ if __name__ == '__main__':
00185
00186   #~ from random import random
00187   #~ import sys
00188   #~ from RunControlMainGUIImpl import *
00189   #~ from RunControlCommon import *
00190
00191   #~ class Dummy(object):
00192     #~ def __init__(self):
00193       #~ pass
00194
00195     #~ def getValue(self):
00196       #~ return random()
00197
00198   #~ app = QApplication(sys.argv)
00199
00200   #~ rcCommon = RunControlCommon()
00201
00202   #~ gui = RunControlMainGUIImpl(rcCommon)
00203
00204   #~ #statMon = rcStatusMonitor(1000)
00205   #~ statMon = rcStatusMonitor(1000, gui)
00206   #~ dummy = Dummy()
00207   #~ statMon.addWatchItem('TestValue', dummy.getValue)
00208   #~ statMon.startWatch()
00209   #~ app.setMainWidget(gui)
00210   #~ gui.show()
00211   #~ app.exec_loop()
00212
00213
00214
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcSuite.py Source File

runcontrol

rcSuite.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT run control suite execution framework"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:29:18 $").split(' ')[1]
00014 __version__  = "$Revision: 2.8.2.5 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020 import threading
00021 import rcUtil
00022 import logging  as log
00023 import types
00024 import copy
00025 #import rcScmCfgSelector
00026 #import gSchemaConfig
00027
00028 class rcSuite(object):
00029   class StopRequestedException(Exception):
00030     def __init__(self,msg,suite,module):
00031       self.args = (msg, suite, module)
00032       self.msg = msg
00033       self.suite = suite
00034       self.module = module
00035
00036   def __init__(self, gui, userId, debug):
00037     log.debug("rcSuite.__init__()")
00038
00039     self.__userId      = userId
00040     self.__debug       = debug
00041     self.__cmdCli      = None
00042     self.__evtCli      = None
00043
00044     #self.__modules     = []
00045     #self.__schemas     = []
00046     self.__isOKtoQuitOrPause  = threading.Event()
00047     self.__cmdQuit     = 0
00048     self.__paused      = False
00049     self.__running     = False
00050     self.__app         = None
00051     self.__scriptSeq   = 0
00052
00053     # The following data members are meant to be marked "protected"
00054     self.gui           = gui
00055
00056     # Expose the schema to the suite
00057     self.lat = self.getSessionVar('_LATSchema')
00058
00059 #  def addApplication(self, appName, schema):
00060 #    try:
00061 #      (module, filename) = rcUtil.importModule(appName, reload=0)
00062 #    except Exception:
00063 #      gutil.logException()
00064
00065
00066 #    if 'userApplication' not in dir(module):
00067 #      msg = 'Application %s is missing a userApplication class' % appName
00068 #      log.error(msg)
00069 #      return msg
00070
00071 #    log.info("Application loaded from %s" % filename)
00072 #    self.__modules.append(module)
00073 #    self.__schemas.append(schema)
00074
00075   def setupSuite(self):
00076     """ Override this method to do custom processing before the suite is started and/or
00077     to return a custom schema file
00078     """
00079     return None
00080
00081   def rcPauseSuite(self):
00082     fn = "rcSuite.rcPauseSuite"
00083     log.debug("%s -- %s" % (fn, self.getName()))
00084     if self.__paused:
00085       return -1
00086     if self.pauseSuite() is not None:
00087       return
00088     if self.__app is not None:
00089       if self.__app.__class__.__name__ == 'userApplication':
00090         self.__isOKtoQuitOrPause.wait()
00091         if self.__app is not None and self.__app.rcPause() is None:
00092           self.__paused = True
00093           return None
00094       else:
00095         if self.__app.rcPauseSuite() is None:
00096           self.__paused = True
00097           return None
00098     return -1
00099
00100   def pauseSuite(self):
00101     """ Override this method to do custom processing before the currently running
00102     application is paused. Pause can be rejected by not returning None
00103     """
00104     return None
00105
00106
00107   def rcSetupSuite(self):
00108     """ This method can be called from either RunControlMain or from another suite.
00109     """
00110     fn = "rcSuite.rcSetupSuite"
00111     log.debug("%s -- %s" % (fn, self.getName()))
00112
00113     #askForSchema = 0
00114     #if schema is None:
00115     #  reuseSchema = self.getSessionVar('_reuseSchema')
00116     #  schema = self.getSessionVar("_suiteLATSchemaFile")
00117     #  if not reuseSchema:
00118     #    askForSchema = 1
00119
00120     #if askForSchema:
00121     #  scmCfg = self.gui.createGUI(rcScmCfgSelector.rcScmCfgSelector, self.gui.common().preferences()['reposdir'],
00122     #                              schema, self.gui, 'ScmCfgSelector')
00123     #  scmCfgFile = scmCfg.getValue()
00124     #  # Allow the C++ object to be deleted
00125     #  scmCfg.deleteLater()
00126     #  if scmCfgFile is None or os.path.splitext(scmCfgFile.lower())[1] != '.xml':
00127     #    if scmCfgFile is not None:
00128     #      log.error("%s: Invalid SchemaConfig filename '%s'" % (fn, scmCfgFile))
00129     #    schema = None
00130     #  else:
00131     #    self.setSessionVar("_LATSchemaFile", scmCfgFile)
00132     #    self.setSessionVar("_suiteLATSchemaFile", scmCfgFile)
00133     #    schema = scmCfgFile
00134
00135     #if schema is not None:
00136     #  self.setupSuite()
00137     #else:
00138
00139     #return schema
00140
00141     self.setupSuite()
00142     return 0
00143
00144   def rcStartSuite(self, spawn=1):
00145     fn = "rcSuite.rcStartSuite"
00146     log.debug("%s -- %s" % (fn, self.getName()))
00147     if self.__running and not self.__paused:
00148       return -1
00149     self.__running = True
00150     if self.__paused:
00151       if self.__app.__class__.__name__ == 'userApplication':
00152         if self.__app.rcResume() is None:
00153           self.__paused = False
00154       else:
00155         self.__app.rcStartSuite()
00156     else:
00157       self.__cmdQuit = 0
00158       if spawn:
00159         self.__suiteRun = threading.Thread(group=None, name="SuiteThread", target=self.startSuite)
00160         self.__suiteRun.start()
00161       else:
00162         self.startSuite()
00163
00164   def stopSuite(self):
00165     """ Override this method to do custom processing before the suite is terminated
00166     """
00167     pass
00168
00169   def rcStopSuite(self):
00170     fn = "rcSuite.rcStopSuite"
00171     log.debug("%s -- %s" % (fn, self.getName()))
00172     if self.stopRequested(): return
00173     if self.__app is not None:
00174       self.__isOKtoQuitOrPause.wait()
00175     self.__cmdQuit = 1
00176     if self.__app is not None:
00177       if self.__app.__class__.__name__ == 'userSuite':
00178         self.__app.rcStopSuite()
00179       else:
00180         if self.__paused:
00181           if self.__app.rcResume() is None:
00182             self.__paused = False
00183             self.__app.rcStopRun()
00184             self.__app.rcTeardown()
00185         else:
00186           self.__app.rcStopRun()
00187           self.__app.rcTeardown()
00188     self.stopSuite()
00189     self.__running = False
00190     #self.__suiteRun.join()
00191
00192   #def __suiteRunThread(self):
00193   #  i = 0
00194   #  for module in self.__modules:
00195   #    self.scriptRun(module, self.__schemas[i])
00196   #    if self.__cmdQuit: break
00197   #    i += 1
00198
00199   def scriptRun(self, module, context={}):
00200     fn = "rcSuite.scriptRun"
00201     log.debug("%s: %s" % (fn, module))
00202     self.__scriptSeq += 1
00203     if self.stopRequested():
00204         raise rcSuite.StopRequestedException("Operator requested stop of execution",
00205                                              self.getName(),
00206                                              ""
00207                                             )
00208     self.__isOKtoQuitOrPause.clear()
00209     for (key, value) in context.items():
00210       self.setSessionVar(key, value)
00211     if type(module) is types.StringType:
00212       try:
00213         (module, filename) = rcUtil.importModule(module, reload=0)
00214       except Exception:
00215         log.exception("")
00216         return
00217     if 'userApplication' in dir(module):
00218       self.__app = module.userApplication( self.gui, self.__userId,
00219                                             self.__debug )
00220       self.__app.setSuite(self.getName())
00221       self.__app.setSuiteInstance(self)
00222       self.__app.setCmdCli(self.__cmdCli)
00223       if self.__app.getEvtCli() is None:
00224         self.__app.setEvtCli(self.__evtCli)
00225       self.__app.rcSetup()
00226       status = self.__app.rcStartRun()
00227       self.__isOKtoQuitOrPause.set()
00228       if status is not None:
00229         raise rcSuite.StopRequestedException("startRun() is rejected, stopping suite execution",
00230                                              self.__app.getSuite(),
00231                                              self.__app.getName()
00232                                             )
00233       self.__app.wait()
00234       if self.stopRequested():
00235         raise rcSuite.StopRequestedException("Operator requested stop of execution",
00236                                              self.__app.getSuite(),
00237                                              self.__app.getName()
00238                                             )
00239       self.__isOKtoQuitOrPause.clear()
00240       self.__app.rcStopRun()
00241       self.__app.rcTeardown()
00242       del self.__app
00243       self.__app = None
00244       self.__isOKtoQuitOrPause.set()
00245     elif 'userSuite' in dir(module):
00246       self.__app = module.userSuite( self.gui, self.__userId, self.__debug)
00247       log.info("Suite %s loaded from %s" % (self.__app.getName(), filename))
00248       self.__app.setCmdCli(self.__cmdCli)
00249       self.__app.setEvtCli(self.__evtCli)
00250       #if self.__app.rcSetupSuite(self.getSessionVar("_suiteLATSchemaFile")) is None:
00251       #  log.error("Suite setup failed...Aborting suite %s" % self.__app.getName())
00252       #  return
00253       #else:
00254       self.__app.rcSetupSuite()
00255       self.__app.rcStartSuite(spawn=0)
00256       self.__isOKtoQuitOrPause.set()
00257         #self.__app.rcStopSuite()
00258         #self.__app = None
00259     else:
00260       raise RuntimeError, '%s is not a recognized user script. userApplication or userSuite class missing' % module
00261     return self.__copySessionVars()
00262
00263   def setCmdCli(self, cmdCli):
00264     self.__cmdCli = cmdCli
00265
00266   def setEvtCli(self, evtCli):
00267     self.__evtCli = evtCli
00268
00269   def getEvtCli(self):
00270     return self.__evtCli
00271
00272   def getScriptSequence(self):
00273     return self.__scriptSeq
00274
00275   def getScriptState(self):
00276     # !!! revisit !!!
00277     return 'RESET'
00278
00279   def getApp(self):
00280     return self.__app
00281
00282   def setSessionVar(self, key, value):
00283     """Set a session variable. Do not use variable names beginning
00284     with the underscore ('_') character since these are reserved for RunControl
00285     """
00286     sessionVars = self.gui.common().getDBN()
00287     if sessionVars is not None:
00288       sessionVars[key] = value
00289     else:
00290       raise RuntimeError, "Database node does not exist"
00291
00292   def getSessionVar(self, key):
00293     """Retrieve the values of the session variable indicated by \a key.
00294
00295     \return Session variable value
00296     """
00297     sessionVars = self.gui.common().getDBN()
00298     if sessionVars is not None and sessionVars.has_key(key):
00299       return sessionVars[key]
00300     else:
00301       return None
00302
00303   def __copySessionVars(self):
00304     newCopy = {}
00305     vars = self.gui.common().getDBN()
00306     for varName in vars.keys():
00307       if varName.startswith('_'): continue
00308       try:
00309         newCopy[varName] = copy.deepcopy(vars[varName])
00310       except:
00311         newCopy[varName] = copy.copy(vars[varName])
00312     return newCopy
00313
00314   #def readSchema(self, scmCfgFile):
00315   #  fn = "rcTransitions.readSchema"
00316   #  lat = gSchemaConfig.readSchema(scmCfgFile)
00317   #  if lat is None:
00318   #    log.error("%s: Unable to instatiate a LAT from SchemaConfig file '%s'" % \
00319   #              (fn, scmCfgFile))
00320   #    return None
00321   #  includeFiles = lat._GLAT__includeFiles
00322   #  incFileModTime = {}
00323   #  for f in includeFiles:
00324   #    incFileModTime[f] = os.path.getmtime(f)
00325   #  lat.setCmd(self.__cmdCli)
00326   #  self.setSessionVar('_LATSchema', lat)
00327   #  self.setSessionVar('_LATSchemaFile', scmCfgFile)
00328   #  self.setSessionVar('_LATSchemaFileModTime', os.path.getmtime(scmCfgFile))
00329   #  self.setSessionVar('_LATIncludeFileModTime', incFileModTime)
00330   #  return lat
00331
00332   def readSchema(self, scmCfgFile):
00333     self.gui.common().readSchema(scmCfgFile)
00334
00335   def applyConfig(self, seq=None, gxbrd=None):
00336     if self.lat is not None:
00337       self.lat.applyConfig(seq, gxbrd)
00338
00339   def stopRequested(self):
00340     return self.__cmdQuit
00341
00342   def isPaused(self):
00343     return self.__paused
00344
00345   def isRunning(self):
00346     return self.__running
00347
00348   def getName(self):
00349     return self.__class__.__name__
00350
00351   def startSuite(self):
00352     raise RuntimeError, "Suite does not define a startSuite method"
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTestReport.py Source File

runcontrol

rcTestReport.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Test report generator class for RunControl"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/11 21:40:06 $").split(' ')[1]
00014 __version__  = "$Revision: 2.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                         Pyana
00021 #from xml.dom            import Node
00022 #from xml.dom            import implementation
00023 #from xml.dom.ext        import PrettyPrint
00024 #from xml.dom.ext.reader import Sax2
00025 from xml.dom.minidom    import getDOMImplementation, parseString, Node
00026 from cStringIO          import StringIO
00027
00028 class rcTestReport(object):
00029   """\brief Test Report class for RunControl.
00030
00031   This class provides a mechanism to create test reports in a well formed (XML) format using
00032   the provided report building methods and lets the user transform it to HTML format by providing
00033   an XSLT stylesheet template. A third-party tool called Pyana is used to do the transformation.
00034   A sample template (reportStyle.xsl.sample) is provided in the RunControl directory. For more
00035   information on XSLT see the following links:
00036
00037   <p><a href="http://www.w3.org/TR/xslt">XSL Transformations W3C Recommendation</a></p>
00038   <p><a href="http://www.xfront.com/xsl.html">XSLT Tutorial</a></p>
00039
00040   """
00041
00042   def __init__(self):
00043     self.__reports = []
00044
00045   def initReport(self, title):
00046     """ Initializes the report class and provides a title for the report
00047
00048     \param title The title that will show in the window title of the HTML browser
00049     """
00050     #self.__doc = implementation.createDocument(None,None,None)
00051     self.__doc = getDOMImplementation().createDocument(None,None,None)
00052     self.__root = self.__doc.createElement("TestReport")
00053     self.__doc.appendChild(self.__root)
00054     titleNode = self.__doc.createElement("Title")
00055     data = self.__doc.createTextNode(title)
00056     titleNode.appendChild(data)
00057     self.__root.appendChild(titleNode)
00058     self.__maxHeadingLine = 0
00059     self.__maxSectionId = 0
00060     self.__maxTableId = 0
00061     self.__sectionNodes = {}
00062     self.__tableNodes = {}
00063
00064   def addHTML(self, htmlString, section=None):
00065     """ Adds an arbitrary HTML fragment to the end of the report or a section
00066
00067     \param htmlString HTML fragment.
00068     \param section    Optional section id that this HTML will be written to.
00069                       If no section is specified then HTML is added to the
00070                       end of the report.
00071     """
00072     htmlDom = self.__createHTMLDom(htmlString)
00073     if section is None:
00074       self.__root.appendChild(htmlDom)
00075     else:
00076       sectionNode = self.__sectionNodes[section]
00077       sectionNode.appendChild(htmlDom)
00078
00079   def addHeading(self, text):
00080     """ Adds a heading to the report
00081
00082     \param text Heading text
00083     """
00084     heading = self.findTag(self.__root, 'Heading')
00085     if heading is None:
00086       heading = self.__doc.createElement('Heading')
00087       self.__root.appendChild(heading)
00088     self.__maxHeadingLine += 1
00089     line = self.__doc.createElement('Line')
00090     line.setAttribute('no', str(self.__maxHeadingLine))
00091     line.appendChild(self.__createHTMLDom(text))
00092     heading.appendChild(line)
00093
00094   def addSection(self, caption, insert=1):
00095     """ Adds a section to the report and returns the section id.
00096
00097     \param  caption Section caption
00098     \param  insert 0 = Do not insert the section into the report
00099                    1 = Insert the section into the report (default)
00100     \return Section id.
00101     """
00102     self.__maxSectionId += 1
00103     sectionNode = self.__doc.createElement('Section')
00104     sectionNode.setAttribute('id', str(self.__maxSectionId))
00105     sectionNode.appendChild(self.__createHTMLNode('Caption',caption))
00106
00107     if insert == 1:
00108       self.__root.appendChild(sectionNode)
00109     self.__sectionNodes[self.__maxSectionId] = sectionNode
00110     return self.__maxSectionId
00111
00112   def insertSection(self, sectionId, beforeSectionId=None):
00113     """ Inserts a previously added section (with insert=0)
00114     to the specified position in the report.
00115
00116     \param sectionId       Id of the section to be inserted
00117     \param beforeSectionId Id of the section that will come after the section specified
00118                            by \a sectionId. If it is None then it is appended to the end.
00119                            Defaults to None.
00120     """
00121     if beforeSectionId is not None:
00122       self.__root.insertBefore(self.__sectionNodes[sectionId], self.__sectionNodes[beforeSectionId])
00123     else:
00124       self.__root.appendChild(self.__sectionNodes[sectionId])
00125
00126   def addSectionItem(self, sectionId, label, text, url=''):
00127     """ Adds a section item.
00128     Section items are entries with a label and text and an optional URL.
00129
00130     \param sectionId Id of the section that this item will be inserted in.
00131     \param label     Item label
00132     \param text      Item text
00133     \param url       Item URL
00134     """
00135     sectionNode = self.__sectionNodes[sectionId]
00136     itemNode = self.__doc.createElement('Item')
00137     itemNode.appendChild(self.__createHTMLNode('Label',label))
00138     itemNode.appendChild(self.__createHTMLNode('Text',text))
00139     if (url != '') & (url != None):
00140       linkNode = self.__doc.createElement('Link')
00141       data = self.__doc.createTextNode(url)
00142       linkNode.appendChild(data)
00143       itemNode.appendChild(linkNode)
00144     sectionNode.appendChild(itemNode)
00145
00146   def addSectionImage(self, sectionId, caption, url, width='', height=''):
00147     """ Adds an image to a section. Images can have a caption,
00148     and an optional width and height. The url parameter specifies the
00149     location of the image.
00150
00151     \param sectionId Id of the section that this image will be inserted in.
00152     \param caption   Image caption
00153     \param url       Image source URL
00154     \param width     Optional width of the image
00155     \param height    Optional height of the image
00156     """
00157     sectionNode = self.__sectionNodes[sectionId]
00158     imageNode = self.__doc.createElement('Image')
00159     imageNode.appendChild(self.__createHTMLNode('Caption',caption))
00160     linkNode = self.__doc.createElement('Link')
00161     data = self.__doc.createTextNode(url)
00162     linkNode.appendChild(data)
00163     imageNode.appendChild(linkNode)
00164     if width != '':
00165       widthNode = self.__doc.createElement('Width')
00166       data = self.__doc.createTextNode(str(width))
00167       widthNode.appendChild(data)
00168       imageNode.appendChild(widthNode)
00169     if height != '':
00170       heightNode = self.__doc.createElement('Height')
00171       data = self.__doc.createTextNode(str(height))
00172       heightNode.appendChild(data)
00173       imageNode.appendChild(heightNode)
00174     sectionNode.appendChild(imageNode)
00175
00176
00177   def addSectionTable(self, sectionId, border='1', width=''):
00178     """ Adds a table to a section. Border and width are optional
00179
00180     \param sectionId Id of the section that this image will be inserted in.
00181     \param border    Specifies whether the table will have a border or not. Default value is 1.
00182     \param width     Specifies the width of the border in percentage relative to the width of the page.
00183
00184     \return          Table id.
00185     """
00186     self.__maxTableId += 1
00187     sectionNode = self.__sectionNodes[sectionId]
00188     tableNode = self.__doc.createElement('Table')
00189     if border != '':
00190       tableNode.setAttribute('border', border)
00191     if width != '':
00192       tableNode.setAttribute('width', width)
00193     sectionNode.appendChild(tableNode)
00194     self.__tableNodes[self.__maxTableId] = tableNode
00195     return self.__maxTableId
00196
00197   def addTableHeader(self, tableId, text, align=''):
00198     """ Adds one column header to the table.
00199
00200     \param tableId Id of the table where column headers are being added.
00201     \param text    Column header text.
00202     \param align   Optional text alignment.
00203     """
00204     tableNode = self.__tableNodes[tableId]
00205     tr = self.findTag(tableNode, 'TR')
00206     if tr is None:
00207       tr = self.__doc.createElement('TR')
00208       tableNode.appendChild(tr)
00209     th = self.__doc.createElement('TH')
00210     if align != '':
00211       th.setAttribute('align', align)
00212     #data = self.__doc.createTextNode(text)
00213     #th.appendChild(data)
00214     th.appendChild(self.__createHTMLDom(text))
00215     tr.appendChild(th)
00216
00217   def beginTableRow(self, tableId):
00218     """ Starts a table row.
00219
00220     \param tableId Id of the table where the row is being added.
00221     """
00222     tableNode = self.__tableNodes[tableId]
00223     tr = self.__doc.createElement('TR')
00224     tableNode.appendChild(tr)
00225     self.__currentTableRow = tr
00226
00227   def addTableData(self, text, url='', align='', width=''):
00228     """ Adds a data column to the table row that was started by the last
00229     beginTableRow() call.
00230
00231     \param text  Text of the data column.
00232     \param url   Optional. If the text refers to a hyperlink provide the URL here.
00233     \param align Optional text alignment.
00234     \param width Optional column width in percentage.
00235     """
00236     tr = self.__currentTableRow
00237     if tr is None:
00238       raise RuntimeError, "No current row"
00239     else:
00240       td = self.__doc.createElement('TD')
00241       if align != '':
00242         td.setAttribute('align', align)
00243       if width != '':
00244         td.setAttribute('width', align)
00245       if url != '':
00246         href = self.__doc.createElement('A')
00247         href.setAttribute('href',url)
00248       data = self.__createHTMLDom(str(text))
00249       if url != '':
00250         href.appendChild(data)
00251         data = href
00252       td.appendChild(data)
00253       tr.appendChild(td)
00254
00255
00256   def findTag(self, node, tagName):
00257     tNode = None
00258     for n in self.getChildNodes(node):
00259       if n.tagName == tagName:
00260         tNode = n
00261         break
00262     return tNode
00263
00264   def xmlToString(self):
00265     xmlStr = StringIO()
00266     #PrettyPrint(self.__doc, xmlStr)
00267     self.__doc.writexml(xmlStr)
00268     return xmlStr.getvalue()
00269
00270   def transformToFile(self, xslFileName, htmlFileName):
00271     """ Based on the input template and output filename parameters
00272     creates an HTML report.
00273
00274     \param xslFileName  Input XSLT template file name.
00275     \param htmlFileName Output HTML filename.
00276     """
00277     xslFile = file(xslFileName)
00278     htmlFile = file(htmlFileName, 'w+')
00279     Pyana.transform2Writer(self.xmlToString(), xslFile, htmlFile)
00280     self.__reports.append(htmlFileName)
00281
00282   def getReports(self):
00283     return self.__reports
00284
00285   def getChildNodes(self, node):
00286     childNodes = []
00287     for n in node.childNodes:
00288       if (n.nodeType == Node.TEXT_NODE and \
00289           (n.data[0] == '\n' or n.data[0].strip() == '')) \
00290           or n.nodeType == Node.COMMENT_NODE:
00291         pass
00292       else:
00293         childNodes.append(n)
00294     return childNodes
00295
00296 ##private
00297   def __createHTMLDom(self, text):
00298     return self.__createHTMLNode('cdatanode', text)
00299
00300   def __createHTMLNode(self, nodeName, text):
00301     htmlString = '<'+nodeName+'>' + text + '</'+nodeName+'>'
00302     #htmlDoc = Sax2.FromXml(htmlString).documentElement
00303     htmlDoc = parseString(htmlString).documentElement
00304     return self.__doc.importNode(htmlDoc,1)
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTransitions.py Source File

runcontrol

rcTransitions.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT finite state transistions classes"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/20 21:26:15 $").split(' ')[1]
00014 __version__  = "$Revision: 2.69.2.6 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from   threading import Thread, Event, Lock
00021 import logging   as     log
00022 import os
00023 import time
00024 import sys
00025 import types
00026 import struct
00027
00028 import rcReportGen
00029 import rcRunIdHelper
00030 import rcHouseKeeping
00031 import rcFitsWriter
00032 import rcArchiver
00033 import LATsweep
00034 import rcComplStatus
00035 import rcTestReport
00036
00037 from   LATTE.tools              import FreeSpace
00038 from   LATTE.tools              import DataExport
00039 from   LATTE.trigger            import rcDefaultTrigger
00040 from   LATTE.client             import gLog
00041 from   LATTE.database           import gGLT
00042 from   LATTE.client.gEvtCli     import EvtCli
00043 from   LATTE.database.gVersions import Gversions, ROOT_DIR_ENVS
00044
00045 class rcTransitions(object):
00046   "Class that handles the state machine transitions issued by Run Control"
00047   __SWEEP_MARKER     = 5               # Arbitrary marker value for recognizing
00048                                        #   when the event pipeline is flushed
00049
00050   COMPL_STATUS_UNDEFINED            = \
00051       rcComplStatus.rcCompletionStatus.getCompletionStatus('UNDEFINED')
00052   COMPL_STATUS_ABORTED              = \
00053       rcComplStatus.rcCompletionStatus.getCompletionStatus('ABORTED')
00054   COMPL_STATUS_ERROR                = \
00055       rcComplStatus.rcCompletionStatus.getCompletionStatus('FAILED')
00056   COMPL_STATUS_SUCCESS              = \
00057       rcComplStatus.rcCompletionStatus.getCompletionStatus('PASSED')
00058   COMPL_STATUS_FAILED               = \
00059       rcComplStatus.rcCompletionStatus.getCompletionStatus('FAILED')
00060   COMPL_STATUS_PASSED               = \
00061       rcComplStatus.rcCompletionStatus.getCompletionStatus('PASSED')
00062   COMPL_STATUS_PASSED_CONDITIONALLY = \
00063       rcComplStatus.rcCompletionStatus.getCompletionStatus('PASSED CONDITIONALLY')
00064   COMPL_STATUS_MARGINAL             = \
00065       rcComplStatus.rcCompletionStatus.getCompletionStatus('MARGINAL')
00066   COMPL_STATUS_OPERATOR_ABORTED = \
00067       rcComplStatus.rcCompletionStatus.getCompletionStatus('OPERATOR ABORTED')
00068   COMPL_STATUS_INCOMPLETE = \
00069       rcComplStatus.rcCompletionStatus.getCompletionStatus('INCOMPLETE')
00070
00071   # Database node for storing session variables
00072   #__dbn      = GDBN()
00073
00074   # Watermark for diskspace warning
00075   DISKSPACE_WARN_LEVEL = (100*1024*1024)
00076
00077   # Deadtime related constants
00078   DEADTIME_RATE_IN_MHZ = 20.0
00079   TIMEBASE_RATE_IN_MHZ = 16.6666667
00080
00081   EVENT_HANDLER_STANDARD      = 0
00082   EVENT_HANDLER_LEAN_AND_MEAN = 1
00083   EVENT_HANDLER_PLAYBACK      = 2
00084   EVENT_HANDLER_CUSTOM        = 3
00085
00086
00087   def __init__(self, rc, userId, debug):
00088     fn = "rcTransitions.__init__"
00089     log.debug("%s -- %s" % (fn, self.getName()))
00090     self.__userId      = userId
00091
00092     # Used in case the script is run in standalone mode
00093     if debug.__class__.__name__ == 'RunControlCommon':
00094       self.__common      = debug
00095       self.__debug       = None
00096     else:
00097       self.__debug       = debug
00098       if rc is not None:
00099         self.__common    = rc.common()
00100       else:
00101         raise RuntimeError, "Please supply a RunControlCommon object"
00102
00103     # The following data members are meant to be marked "protected"
00104     self.rc                    = rc
00105     self.gui                   = rc # For backward compatibility
00106
00107     self.__complStatus         = rcComplStatus.rcCompletionStatus()
00108
00109     self.prefs                 = self.__common.prefMan().preferences()
00110     if self.__common.getLAT() is None:
00111       if rc is not None:
00112         rc.execGUImethod(rc.loadSchema)
00113       else:
00114         msg = "Please select a schema first"
00115         log.error(msg)
00116         raise RuntimeError, msg
00117     self.lat                   = self.__common.getLAT()
00118     self.xbrd                  = self.__common.getXBRD()
00119     self.ocs                   = self.__common.getOCS()
00120     self.evtCli                = self.__common.getEvtCli()
00121     self.__cmdCli              = self.__common.getCmdCli()
00122     self.__scmCfgFile          = self.__common.getDBN()['_LATSchemaFile']
00123
00124     self.__trigger             = None
00125     self.__archiver            = None
00126     self.__archiverClass       = None
00127     self.__fits                = None
00128     self.__errArchiver         = None
00129     self.__badArchiver         = None
00130     self.__eventHandlerReady   = Event()
00131     self.__sweepEvent          = Event()
00132     self.__sweepEvent.set()
00133     self.__evtHandlerQuit      = False
00134
00135     self.evtCnt                = 0
00136     self.__pauseCount          = 0
00137     self.__pausedTime          = 0
00138     self.__pauseTime           = None
00139     self.__startTime           = None
00140     self.__strobeTime          = None
00141     self.__elapsedTime         = 0
00142     self.__endTime             = None
00143     self.__excludedTime        = 0
00144     self.__excludeTime         = 0
00145     self.__excluding           = False
00146     self.__excludeLock         = Lock()
00147     self.__badEvents           = 0
00148     self.__errEvents           = 0
00149     self.__hsk                 = None
00150     self.__tstamp              = None
00151     self.__tstampRaw           = None
00152     self.__deadtimeCtrReg      = None
00153     self.__deadTimeVal         = 0
00154     self.__deadTimeTS          = 0
00155     self.__avgDeadTime         = None
00156     self.__statMon             = None
00157     self.__dgSize              = 0
00158     self.__dgSumSize           = 0L
00159     self.__lastDgSumSize       = 0
00160     self.__instByteRate        = 0.0
00161     self.__lastEvtCnt          = 0
00162     self.__lastTime            = 0
00163     self.__lastDgSumSize       = 0
00164     self.__instByteRate        = 0.0
00165
00166     # This will contain the parent suite name during execution
00167     self.__suite               = None
00168
00169     # This will contain the parent suite instance during execution
00170     self.__suiteInst           = None
00171
00172     # This will be True if it is the last script in the suite
00173     self.__lastSuiteScript     = False
00174
00175     self.__EBFplayback         = self.__common.options().playback is not None
00176
00177     self.__runIdHelper         = rcRunIdHelper.rcRunIdHelper(self.prefs)
00178     self.runId                 = 'N/A'
00179
00180     self.__customReportData    = {}
00181
00182     if rc is not None:
00183       self.__paramVerifier       = self.rc.parameterVerifier()
00184
00185     self.__verifyStatus        = None
00186
00187     self.__appStatus           = None
00188     self.__completionStatus    = self.COMPL_STATUS_UNDEFINED
00189
00190     if self.rc is not None:
00191       self.__dds               = self.__common.getDDS()
00192     else:
00193       self.__dds               = None
00194
00195     # Contains the rcTestReport instance used by the script if any
00196     self.__testReport = None
00197     # Contains the file name for the test report generated by the script
00198     self.__testReportFile = None
00199
00200     if self.rc is not None and 'statusMonitor' in dir(rc):
00201       statMon = self.rc.statusMonitor()
00202       statMon.addWatchItem('Run Id', self.getRunId)
00203       statMon.addWatchItem('Test Name', self.getName)
00204       statMon.addWatchItem('Additional Input Files', self.getAddlInputFiles)
00205       statMon.addWatchItem('Completion Status', self.getCompletionStatusStr,
00206                             alarmExpr="@!='" + self.__complStatus.getCompletionStatusStr(rcTransitions.COMPL_STATUS_PASSED)+"'")
00207       statMon.addWatchItem('Event Count', self.getEventCount)
00208       statMon.addWatchItem('TEM Error Events', self.getErrorEvents, alarmExpr='!=0')
00209       statMon.addWatchItem('Bad SBC Events', self.getBadEvents, alarmExpr='!=0')
00210       statMon.addWatchItem('Start Time', self.getStartTime)
00211       statMon.addWatchItem('End Time', self.getEndTime)
00212       statMon.addWatchItem('Elapsed Time', self.getElapsedTime)
00213       statMon.addWatchItem('Average Event Rate', self.getEventRate)
00214       statMon.addWatchItem('Instant Event Rate', self.getInstEventRate)
00215       statMon.addWatchItem('Average Datagram Size', self.getAvgDatagramSize)
00216       statMon.addWatchItem('Instant Datagram Size', self.getInstDatagramSize)
00217       #statMon.addWatchItem('Average Byte Rate', self.getAvgByteRate)
00218       statMon.addWatchItem('Instant Byte Rate', self.getInstByteRate)
00219       statMon.addWatchItem('Avg DeadTime', self.getAvgDeadTime)
00220       statMon.addWatchItem('Pause Count', self.getPauseCount)
00221       statMon.addWatchItem('Paused Time', self.getPausedTime)
00222       statMon.addWatchItem('Archive File', self.getArchiveFile)
00223       statMon.addWatchItem('FITS File', self.getFITSfile)
00224       statMon.addWatchItem('HSK File', self.getHSKfile)
00225       statMon.addWatchItem('Bad SBC Events File', self.getBadEventsFile)
00226       statMon.addWatchItem('TEM Error Events File', self.getErrorEventsFile)
00227       statMon.addWatchItem('Valid Events', self.getValidEvents)
00228       statMon.addWatchItem('Failed Event TCP Sends', self.getFailedEventSends, alarmExpr='!=0')
00229       statMon.addWatchItem('Failed Event H/W Xmits', self.getFailedEvents, alarmExpr='!=0')
00230       statMon.addWatchItem('Discarded Events', self.getDiscardedEvents, alarmExpr='!=0')
00231       statMon.addWatchItem('Length Mismatched Events', self.getLengthMismatchedEvents, alarmExpr='!=0')
00232       statMon.addWatchItem('Unsent Events', self.getUnsentEvents, alarmExpr='!=0')
00233       statMon.addWatchItem('Free Disk Space', FreeSpace.FreeSpace,
00234                            alarmExpr='<'+ str(rcTransitions.DISKSPACE_WARN_LEVEL))
00235       self.__statMon = statMon
00236
00237     if self.rc is not None:
00238       rdir = self.prefs["reportdir"]
00239     else:
00240       rdir = '.'
00241     self.__reportGen = rcReportGen.rcReportGen( os.path.join(rdir, 'rcReport.out'), self.prefs)
00242
00243     try:
00244       self.setArchiverClass(rcArchiver.rcArchiver)
00245     except (ImportError, IOError), e:
00246       log.error("%s: Archiver disabled: %s" % (fn, e))
00247
00248     if self.__common.options().noerrfile is not None:
00249       self.handleEventOutput = self.__handleEventOutputStub
00250     else:
00251       self.handleEventOutput = self.__handleEventOutput
00252
00253   def getFailedEvents(self):
00254     """\brief Return failed event count.
00255
00256     OES increments this counter when
00257     there is a packet transmission error.
00258
00259     \return Failed event count.
00260     """
00261     if self.__cmdCli.isConnected():
00262       try:
00263         saveDebug = self.__cmdCli.getDebug()
00264         self.__cmdCli.setDebug(0)
00265         cnt = self.lat.stats_failed_events
00266         self.__cmdCli.setDebug(saveDebug)
00267         return cnt
00268       except: pass
00269     return 0
00270
00271   def getFailedEventSends(self):
00272     """\brief Return number of failed event sends.
00273
00274     OES increments this counter when there is a TCP
00275     transport problem between the SBC and the teststand.
00276
00277     \return Number of failed event sends.
00278     """
00279     if self.__cmdCli.isConnected():
00280       try:
00281         saveDebug = self.__cmdCli.getDebug()
00282         self.__cmdCli.setDebug(0)
00283         cnt = self.lat.stats_failed_event_sends
00284         self.__cmdCli.setDebug(saveDebug)
00285         return cnt
00286       except: pass
00287     return 0
00288
00289   def getValidEvents(self):
00290     """\brief Return number of events successfully sent.
00291
00292     OES increments this counter when an event has been
00293     successfully transmitted to the teststand.
00294
00295     \return Number of valid events sent.
00296     """
00297     if self.__cmdCli.isConnected():
00298       try:
00299         saveDebug = self.__cmdCli.getDebug()
00300         self.__cmdCli.setDebug(0)
00301         cnt = self.lat.stats_valid_events
00302         self.__cmdCli.setDebug(saveDebug)
00303         return cnt
00304       except: pass
00305     return 0
00306
00307   def getDiscardedEvents(self):
00308     """\brief Return number of events discarded.
00309
00310     OES increments this counter when an event has been
00311     discarded. Currently this method always returns 0.
00312
00313     \return Number of events discarded.
00314     """
00315     if self.__cmdCli.isConnected():
00316       try:
00317         saveDebug = self.__cmdCli.getDebug()
00318         self.__cmdCli.setDebug(0)
00319         cnt = self.lat.stats_discarded_event_sends
00320         self.__cmdCli.setDebug(saveDebug)
00321         return cnt
00322       except: pass
00323     return 0
00324
00325   def getLengthMismatchedEvents(self):
00326     """\brief Return number of length mismatched events.
00327
00328     OES increments this counter when an event size doesn't
00329     match the length specified in the event.
00330     Currently this method always returns 0.
00331
00332     \return Number of length mismatched events.
00333     """
00334     if self.__cmdCli.isConnected():
00335       try:
00336         saveDebug = self.__cmdCli.getDebug()
00337         self.__cmdCli.setDebug(0)
00338         cnt = self.lat.stats_length_mismatch_count
00339         self.__cmdCli.setDebug(saveDebug)
00340         return cnt
00341       except: pass
00342     return 0
00343
00344   def getUnsentEvents(self):
00345     """\brief Return number of events filtered or prescaled.
00346
00347     OES increments this counter when there is a filter
00348     or prescale set that prevents the event from being
00349     transmitted.
00350
00351     \return Number of unsent events.
00352     """
00353     if self.__cmdCli.isConnected():
00354       try:
00355         saveDebug = self.__cmdCli.getDebug()
00356         self.__cmdCli.setDebug(0)
00357         cnt = self.lat.stats_events_not_sent
00358         self.__cmdCli.setDebug(saveDebug)
00359         return cnt
00360       except: pass
00361     return 0
00362
00363   def getAvgDeadTime(self):
00364     """\brief Return the average deadtime.
00365
00366     Returns the average deadtime as a percentage.
00367
00368     \return Average deadtime.
00369     """
00370     if self.__cmdCli.isConnected():
00371       self.__avgDeadTime = self.__calcDeadTime()
00372       if self.__avgDeadTime is not None:
00373         return "%3.1f" % self.__avgDeadTime
00374     return "N/A"
00375
00376   def getRunId(self):
00377     """\brief Return the run id
00378
00379     \return Run id
00380     """
00381     return self.runId
00382
00383   def getSchemaConfigFile(self):
00384     """\brief Return the full path of the schema file
00385
00386     \return Schema file path
00387     """
00388     return self.getSessionVar('_LATSchemaFile')
00389
00390   def getAddlInputFiles(self):
00391     """\brief Return a list containing the additional input files.
00392
00393     This list is automatically generated from the XML files included
00394     in the schema using the <include> tag. The list contains only the
00395     filename portion and doesn't include the full path.
00396
00397     \return List of additional input files.
00398     """
00399     if self.lat is not None:
00400       return [f for (p,f) in map(os.path.split, self.lat._GLAT__includeFiles)]
00401
00402   def getArchiveFile(self):
00403     """\brief Return the filename for the archive file (LDF file).
00404
00405     \return Archive filename.
00406     """
00407     if self.__archiver is not None:
00408       return self.__archiver.getFileName()
00409     else:
00410       return None
00411
00412   def getBadEventsFile(self):
00413     """\brief Return the filename for the bad events archive.
00414
00415     \return Bad events archive filename.
00416     """
00417     if self.__badArchiver is not None:
00418       return self.__badArchiver.getFileName()
00419     else:
00420       return None
00421
00422   def getErrorEventsFile(self):
00423     """\brief Return the filename for the error events archive.
00424
00425     \return Error events archive filename.
00426     """
00427     if self.__errArchiver is not None:
00428       return self.__errArchiver.getFileName()
00429     else:
00430       return None
00431
00432   def getFITSfile(self):
00433     """\brief Return the filename for the FITS file.
00434
00435     \return FITS filename.
00436     """
00437     if self.__fits is not None:
00438       return self.__fits.getFileName()
00439     else:
00440       return None
00441
00442   def getHSKfile(self):
00443     """\brief Return the filename for the housekeeping FITS file.
00444
00445     \return Housekeeping FITS filename.
00446     """
00447     if self.__hsk is not None:
00448       return self.__hsk.getFileName()
00449     else:
00450       return None
00451
00452
00453   def getPauseCount(self):
00454     """\brief Return number of times the test is paused.
00455
00456     \return Pause count
00457     """
00458     return self.__pauseCount
00459
00460   def getPausedTime(self):
00461     """\brief Return the amount of time spent in pause.
00462
00463     \return Pause time.
00464     """
00465     if self.__pauseTime is not None:
00466       return "%.2f seconds" % (self.__pausedTime + (time.time() - self.__pauseTime))
00467     else:
00468       return "%.2f seconds" % self.__pausedTime
00469
00470   def getEventCount(self):
00471     """\brief Return number of events received.
00472
00473     \return Event count
00474     """
00475     return self.evtCnt
00476
00477   def getElapsedTime(self):
00478     """\brief Return the elapsed time spent during test execution.
00479
00480     \return Elapsed time.
00481     """
00482     self.__excludeLock.acquire()
00483     if self.__strobeTime is not None and \
00484        self.__pauseTime  is     None and not self.__excluding:
00485       msg = "%.2f seconds" % (self.__elapsedTime + (time.time() - self.__strobeTime))
00486     else:
00487       msg = "%.2f seconds" % (self.__elapsedTime)
00488     self.__excludeLock.release()
00489     return msg
00490
00491   def getEventRate(self):
00492     """\brief Return the event rate.
00493
00494     \return Event rate.
00495     """
00496     self.__excludeLock.acquire()
00497     if self.__strobeTime is not None and \
00498        self.__pauseTime  is     None and not self.__excluding:
00499       elapsedTime = self.__elapsedTime + (time.time() - self.__strobeTime)
00500       if elapsedTime > 0:
00501         msg = "%.2f events/sec" % (self.evtCnt / elapsedTime)
00502       else:
00503         msg = "N/A"
00504     elif self.__elapsedTime == 0:
00505       msg = "N/A"
00506     else:
00507       msg = "%.2f events/sec" % (self.evtCnt / (self.__elapsedTime))
00508     self.__excludeLock.release()
00509     return msg
00510
00511   def getInstEventRate(self):
00512     """\brief Return the instant event rate.
00513
00514     \return Instant event rate.
00515     """
00516     self.__excludeLock.acquire()
00517     evtCnt               = self.evtCnt
00518     dC                   = evtCnt - self.__lastEvtCnt
00519     self.__lastEvtCnt    = evtCnt
00520
00521     dgSumSize            = self.__dgSumSize
00522     dS                   = dgSumSize - self.__lastDgSumSize
00523     self.__lastDgSumSize = dgSumSize
00524
00525     now                  = time.time()
00526     dT                   = now - self.__lastTime
00527     self.__lastTime      = now
00528
00529     if dT == 0:  dT = .00001
00530     msg = "%.2f events/sec" % (float(dC) / dT)
00531     self.__instByteRate = float(dS) / dT
00532     self.__excludeLock.release()
00533     return msg
00534
00535   def getInstDatagramSize(self):
00536     """\brief Return the instant datagram size.
00537
00538     \return Instant datagram size.
00539     """
00540     self.__excludeLock.acquire()
00541     msg = str(self.__dgSize)
00542     self.__excludeLock.release()
00543     return msg
00544
00545   def getAvgDatagramSize(self):
00546     """\brief Return the instant datagram size divided by the number of events.
00547
00548     \return Average datagram size
00549     """
00550     self.__excludeLock.acquire()
00551     if self.evtCnt:
00552       msg = str(float(self.__dgSumSize) / float(self.evtCnt))
00553     else:
00554       msg = "N/A"
00555     self.__excludeLock.release()
00556     return msg
00557
00558   def getInstByteRate(self):
00559     """\brief Return the instant datagram byte rate
00560
00561     \return Average datagram byte rate
00562     """
00563     return "%.2f Kbytes/sec" % (self.__instByteRate / 1024)
00564
00565   def getStartTime(self):
00566     """\brief Return the test start time
00567
00568     \return Test start time in GMT as a tuple
00569     """
00570     if self.__startTime is not None:
00571       return time.asctime(time.gmtime(self.__startTime))
00572     else:
00573       return None
00574
00575   def getEndTime(self):
00576     """\brief Return the test end time
00577
00578     \return Test end time in GMT as a tuple
00579     """
00580     if self.__endTime is not None:
00581       return time.asctime(time.gmtime(self.__endTime))
00582     else:
00583       return None
00584
00585   def getBadEvents(self):
00586     """\brief Return number of events with a bad GGLT status
00587
00588     \return Number of bad events
00589     """
00590     return self.__badEvents
00591
00592   def getErrorEvents(self):
00593     """\brief Return number of error events
00594
00595     \return Number of error events
00596     """
00597     return self.__errEvents
00598
00599   def setCmdCli(self, cmdCli):
00600     """\brief Set the command client instance (used in suites)
00601
00602     \param A CmdCli instance
00603     """
00604     self.cmdCli = cmdCli
00605
00606   def setEvtCli(self, evtCli):
00607     """\brief Set the event client instance.
00608
00609     Used to set the custom event client.
00610
00611     \param A CmdCli instance
00612     """
00613     log.debug("Event client set to: %s" % evtCli.__class__.__name__)
00614     evtCli.setSocket(self.evtCli.socket())
00615     self.evtCli = evtCli
00616
00617   def getEvtCli(self):
00618     """\brief Return the current event client instance.
00619
00620     \return An EvtCli instance
00621     """
00622     return self.evtCli
00623
00624   def getDataDistributor(self):
00625     """\brief Return the data distribution server instance.
00626
00627     \return Data distribution server instance.
00628     """
00629     return self.__dds
00630
00631   def setSessionVar(self, key, value):
00632     """\brief Set session variable \a key to value \a value.
00633
00634     Session variables are data that is shared between different runs.
00635     They exist as long as the run control session they are defined in.
00636     Typical uses of session variables are to pass data from one suite
00637     script to another or to maintain state during a multiple step
00638     test run.
00639
00640     \param key   Session variable identifier.
00641     \param value Session variable value.
00642     """
00643     if self.rc is not None:
00644       sessionVars = self.__common.getDBN()
00645       if sessionVars is not None:
00646         sessionVars[key] = value
00647       else:
00648         raise RuntimeError, "Database node does not exist"
00649
00650   def getSessionVar(self, key):
00651     """\brief Return the session variable identified by \a key.
00652
00653     \param key Session variable identifier.
00654
00655     \return Value of the session variable if it exists,
00656             otherwise None.
00657     """
00658     if self.rc is not None:
00659       sessionVars = self.__common.getDBN()
00660       if sessionVars is not None and sessionVars.has_key(key):
00661         return sessionVars[key]
00662       else:
00663         return None
00664     else:
00665       return None
00666
00667   def setPrefs(self, prefs):
00668     """\brief Explicitly set preferences.
00669
00670     When scripts are run in standalone mode it may be
00671     necessary to pass in a script defined set of preferences.
00672
00673     The preferences specified in \a prefs get appended to
00674     the set of preferences read from the configuration file.
00675
00676     \param prefs Preferences as a dictionary.
00677     """
00678     for (key, val) in prefs.items():
00679       self.prefs[key] = val
00680
00681   def setCompletionStatus(self, completionStatus, completionStatusStr=None):
00682     """\brief Sets the completion status of the test.
00683
00684     Please use one of the following:
00685
00686       - COMPL_STATUS_ABORTED              = -2
00687       - COMPL_STATUS_ERROR                = -3
00688       - COMPL_STATUS_FAILED               = -3
00689       - COMPL_STATUS_SUCCESS              =  0
00690       - COMPL_STATUS_PASSED               =  0
00691       - COMPL_STATUS_PASSED_CONDITIONALLY = -4
00692       - COMPL_STATUS_MARGINAL             = -5
00693
00694     Or a user defined completion status in which case
00695     a description needs to be supplied along with the code.
00696
00697     \param completionStatus    Numeric completion status code
00698     \param completionStatusStr Completion status description
00699
00700     """
00701     if not self.__complStatus.isCompletionStatus(completionStatus):
00702       if completionStatusStr is None:
00703         raise RuntimeError, "Need to specify a completion status description " \
00704                             "when specifying a user defined completion status"
00705       else:
00706         addRes = self.__complStatus.addCompletionStatus(completionStatus, completionStatusStr)
00707         if addRes == -2:
00708           raise RuntimeError, "Completion status description '%s' already exists " \
00709                               "under a different status code." % completionStatusStr
00710     self.__completionStatus = completionStatus
00711
00712   def getCompletionStatus(self):
00713     """\brief Return the completion status code.
00714
00715     Returns the code set by the script or
00716     COMPL_STATUS_UNDEFINED if it hasn't been set.
00717
00718     \return Completion status code.
00719     """
00720     if self.__appStatus is None:
00721       return self.__completionStatus
00722     else:
00723       return self.__appStatus
00724
00725   def getCompletionStatusStr(self):
00726     """\brief Return the description of the completion status.
00727
00728     Returns the code as set by the script or
00729     'UNDEFINED' if it hasn't been set.
00730
00731     \return Completion status description.
00732     """
00733     completionStatus = self.getCompletionStatus()
00734     return self.__complStatus.getCompletionStatusStr(completionStatus)
00735     #if completionStatus == rcTransitions.COMPL_STATUS_ABORTED:
00736     #  return("ABORTED")
00737     #elif completionStatus == rcTransitions.COMPL_STATUS_ERROR:
00738     #  return("ERROR")
00739     #elif completionStatus == rcTransitions.COMPL_STATUS_SUCCESS:
00740     #  return("SUCCESS")
00741     #else:
00742     #  return("UNDEFINED")
00743
00744   def __isTestComplete(self):
00745     if self.__common.options().securedir is not None:
00746       requiredOptions = ['snapnbl', 'datasave']
00747       complete = True
00748       for option in requiredOptions:
00749         if self.prefs[option] != 1:
00750           complete = False
00751           break
00752       return complete
00753     else:
00754       return True
00755
00756   def getHSK(self):
00757     """
00758     \brief Return the housekeeping class instance.
00759
00760     \return Housekeeping class instance
00761     """
00762     return self.__hsk
00763
00764   def addCustomReportData(self, key, value):
00765     """\brief Add custom report data to the run report.
00766
00767     This method allows the application to add any additional data
00768     that Run Control is not already providing to the run report
00769     (rcReport.out).
00770
00771     When the custom report data gets processed and written to the
00772     database, it will go under the "AdditionFields" column. Please
00773     only provide values that can be converted to a string.
00774
00775     \param key   Custom report data identifier.
00776     \param value Custom report data value.
00777     """
00778     self.__customReportData[key] = value
00779
00780   def getParameterVerifier(self):
00781     """\brief Return the parameter verifier instance
00782
00783     \return Parameter verifier instance
00784     """
00785     return self.__paramVerifier
00786
00787   def addExportedFile(self,file=None,delete=False):
00788     """\brief Add file to the list of files to be exported.
00789
00790     \param file   file to be added
00791     \param delete delete original on export (default False)
00792     """
00793     if file is not None:
00794       (filePath,fileName) = os.path.split(file)
00795       self.__exportedFiles.append( [filePath,fileName,delete] )
00796
00797       # Try to extract the report file from the rcTestReport instance
00798       # that the script may have been using.
00799       if self.__testReport is None:
00800         for objStr in dir(self):
00801           obj = getattr(self, objStr)
00802           if '__class__' in dir(obj):
00803             if rcTestReport.rcTestReport in obj.__class__.__mro__:
00804               self.__testReport = obj
00805               break
00806       if self.__testReport is not None and file in self.__testReport.getReports():
00807         self.__testReportFile = fileName
00808
00809
00810   def getFileTimeStamp(self):
00811     """\brief Return the formatted timestamp used to name output files.
00812
00813     Using this method, applications can request the formatted timestamp
00814     value used in naming archive, snapshot and housekeeping files.
00815     The format is YYMMDDHHMISS.
00816
00817     \return Formatted GMT timestamp
00818     """
00819     return self.__tstamp
00820
00821   def getRawTimeStamp(self):
00822     """\brief Return the raw timestamp as returned from gmtime().
00823
00824     \return Raw GMT timestamp tuple.
00825     """
00826     return self.__tstampRaw
00827
00828   def getSuite(self):
00829     """\brief Return the name of the suite that this script is a part of.
00830
00831     \return Suite name.
00832     """
00833     return self.__suite
00834
00835   def setSuite(self, suite):
00836     """\brief Set name of the suite for this script.
00837
00838     Called from rcSuite.
00839     """
00840     self.__suite = suite
00841
00842   def getSuiteInstance(self):
00843     """\brief Return the suite instance that this script is a part of.
00844
00845     \return Suite instance.
00846     """
00847     return self.__suiteInst
00848
00849   def setSuiteInstance(self, suiteInst):
00850     """\brief Set the suite instance for this script.
00851
00852     Called from rcSuite.
00853     """
00854     self.__suiteInst = suiteInst
00855
00856   def setLastSuiteScript(self):
00857     """\brief Set the script as the last one in the suite.
00858
00859     Called from rcSuite.
00860     """
00861     self.__lastSuiteScript = True
00862
00863   def isLastSuiteScript(self):
00864     """\brief Check if the script is the last one.
00865
00866     """
00867     return self.__lastSuiteScript
00868
00869
00870   def trigger(self, trg=None, replaceShut=True):
00871     """\brief Return the trigger used in this script or
00872     initialize the trigger.
00873
00874     \param trg         Trigger object.
00875     \param replaceShut Flag to specify whether the trigger's default
00876                        shut logic should be wrapped by Run Control's
00877                        LATsweep shut logic. Default is True.
00878
00879     \return Trigger object.
00880     """
00881     if trg is not None:
00882       self.__trigger = trg
00883       if replaceShut:
00884         # Don't cache the shut call more than once.  Otherwise you get recursion.
00885         if "_shut" not in dir(self.__trigger):
00886           self.__trigger._shut = self.__trigger.shut
00887         latSweep = LATsweep.LATsweep(self.lat, self.__trigger, self.__trigger._shut)
00888         self.__trigger.shut = latSweep.shut
00889     return self.__trigger
00890
00891   def isRunFromSuite(self):
00892     """\brief Check if the script is being run from a suite.
00893
00894     \return True  If the script is being run from a suite,
00895             False otherwise.
00896     """
00897     return self.__suite is not None
00898
00899   def __genReport(self):
00900     log.debug("Generating run report...")
00901     self.__reportGen.initialize(self.__tstampRaw)
00902     self.__reportGen.addField("TestName", self.getName())
00903     self.__reportGen.addField("RunId", self.runId)
00904     if self.rc is not None:
00905       if self.prefs.has_key("operator"):
00906         self.__reportGen.addField("Operator", self.prefs["operator"])
00907       if self.prefs.has_key("userid"):
00908         self.__reportGen.addField("OperatorId", self.prefs["userid"], rcReportGen.UNITS_LONG)
00909     self.__reportGen.addField("EventCount", str(self.evtCnt), rcReportGen.UNITS_LONG)
00910     self.__reportGen.addField("BadEventCount", str(self.__badEvents), rcReportGen.UNITS_LONG)
00911     self.__reportGen.addField("ErrorEventCount", str(self.__errEvents), rcReportGen.UNITS_LONG)
00912     self.__reportGen.addField("PauseCount", str(self.__pauseCount), rcReportGen.UNITS_INT)
00913     self.__reportGen.addField("StartTime", str(time.gmtime(self.__startTime)))
00914     self.__reportGen.addField("ElapsedTime", str(self.__elapsedTime), rcReportGen.UNITS_FLOAT)
00915     self.__reportGen.addField("EndTime", str(time.gmtime(self.__endTime)))
00916     self.__reportGen.addField("SchemaConfigFile", os.path.split(self.__scmCfgFile)[1])
00917     self.__reportGen.addField("AdditionalInputFiles", str(self.getAddlInputFiles()))
00918     self.__reportGen.addField("AssociatedFiles", str([exp[1] for exp in self.__exportedFiles]))
00919
00920
00921     if int(self.prefs["versionnbl"]) == 1:
00922       self.__waitCursor()
00923       versions = Gversions.getModuleVersions(self.ocs)
00924       versions.update(self.rc.getHardwareVersions())
00925       self.__reportGen.addField("VersionData", str(versions))
00926       self.__normalCursor()
00927
00928     filesToVerify= [self.__scmCfgFile] + self.lat._GLAT__includeFiles
00929     releases = {}
00930     failed = []
00931     for env in ROOT_DIR_ENVS:
00932       if os.environ.has_key(env):
00933         release = Gversions.verifyModuleDigests(digestDataFile=None, rootDirEnv=env,
00934                                                 additionalFilesToVerify=filesToVerify)
00935         subsys = env[:env.find("_ROOT")]
00936         releases[subsys] = release[0]
00937         failed += release[1]
00938         if len(release[1]) > 0:
00939           log.error("Some modules failed verification for %s release %s. Check Elogbook for the modules that failed." % (subsys, release[0]))
00940     self.__reportGen.addField("Release", str(releases))
00941     self.__reportGen.addField("ModulesFailedVerification", str(failed))
00942
00943     # As per Eduardo's request override the PASSED completion status to be
00944     # INCOMPLETE if any of his criteria (see __isTestComplete) aren't met
00945     if self.getCompletionStatus() == self.COMPL_STATUS_PASSED and \
00946            not self.__isTestComplete():
00947       self.__appStatus = self.COMPL_STATUS_INCOMPLETE
00948
00949     self.__reportGen.addField("CompletionStatus", str(self.getCompletionStatus()), rcReportGen.UNITS_INT)
00950     self.__reportGen.addField("CompletionStatusStr", self.getCompletionStatusStr())
00951     if self.__fits is not None:
00952       self.__reportGen.addField("FITSfile", self.__fits.getFileName())
00953     if self.__archiver is not None:
00954       self.__reportGen.addField("ArchiveFile", self.__archiver.getFileName())
00955     if self.__errArchiver is not None:
00956       self.__reportGen.addField("ErrorArchive", self.__errArchiver.getFileName())
00957     if self.__badArchiver is not None:
00958       self.__reportGen.addField("BadEventArchive", self.__badArchiver.getFileName())
00959     hskOutputEnabled = (int(self.prefs["envmonnbl"]) == 1)
00960     hskReadOnly = (int(self.prefs["envmonreadonly"]) == 1)
00961     if hskOutputEnabled and self.__hsk is not None and not hskReadOnly:
00962       self.__reportGen.addField("HSKArchive", self.__hsk.getFileName())
00963     if self.rc is not None:
00964       if self.prefs.has_key("logfilename"):
00965         self.__reportGen.addField("LogFile", self.prefs["logfilename"])
00966     if self.rc is not None:
00967       cw = self.rc.getCommentWidget()
00968       if cw is not None:
00969         hist = cw.getHistory()
00970         tstamp = cw.getTimestamps()
00971         self.__reportGen.addField("Comments", str(zip(tstamp, hist)))
00972     for (key, value) in self.__customReportData.items():
00973       self.__reportGen.addField(key, str(value))
00974     if self.prefs is not None:
00975       prefs = self.prefs
00976       if prefs.has_key("lastsite"):
00977         self.__reportGen.addField("Site",           prefs["lastsite"])
00978       if prefs.has_key("lastparticletype"):
00979         self.__reportGen.addField("ParticleType",   prefs["lastparticletype"])
00980       if prefs.has_key("lastinstrumenttype"):
00981         self.__reportGen.addField("InstrumentType", prefs["lastinstrumenttype"])
00982       if prefs.has_key("lastorientation"):
00983         self.__reportGen.addField("Orientation",    prefs["lastorientation"])
00984       if prefs.has_key("lastphase"):
00985         self.__reportGen.addField("Phase",          prefs["lastphase"])
00986     self.__reportGen.addField("AverageDeadTime", str(self.getAvgDeadTime()))
00987     if self.__verifyStatus is not None:
00988       self.__reportGen.addField("ParamVerify", str(self.__verifyStatus))
00989     allSerials = self.lat.getAllSerialNos()
00990     repSerials = {}
00991     if allSerials != {}:
00992       for (node, serialnos) in allSerials.items():
00993         strNode = "%s%s" % (node.getName(), node.getIdTuple())
00994         repSerials[strNode] = serialnos
00995       self.__reportGen.addField("SerialNos", str(repSerials))
00996     if self.__testReportFile is not None:
00997       self.__reportGen.addField("ScriptReport", self.__testReportFile)
00998     self.__reportGen.writeReportXML()
00999     log.debug("Run report generation complete.")
01000
01001   def takeSnapshot(self, stream=sys.stdout, fileName=None,
01002                    captureGTIC=1, captureGAEQ=1,
01003                    trigger=None,
01004                    configName='', configVersion=''):
01005     """\brief Take a snapshot of the hardware.
01006
01007     If snapshots are enabled in Run Control preferences,
01008     two snapshots will be taken, one before and one after
01009     the test has been run. This method allows the application
01010     to take a snapshot at a specific point of the run.
01011
01012     It is the application's responsibility to add the
01013     resulting file to the list of exported files by calling
01014     the addExportedFile method.
01015
01016     Since snapshots essentially have the same format as
01017     configuration blocks, configName and configVersion parameters
01018     can be used to output a named configuration.
01019
01020     \param stream         Output stream for the snapshot.
01021                           sys.stdout by default.
01022     \param fileName       Full path of the snapshot file.
01023     \param captureGTIC    Capture TEM environmental quantities.
01024                           Enabled by default.
01025     \param captureGAEQ    Capture AEM environmental quantities.
01026                           Enabled by default.
01027     \param trigger        Trigger object. If miniGLT is used as a
01028                           trigger then GLT registers can be snapshot.
01029     \param configName     Configuration name
01030     \param configVersion  Configuration version
01031
01032     \return True  if the snapshot was successful,
01033             False if errors were encountered during snapshot
01034     """
01035
01036     if self.__statMon is not None:
01037       self.rc.execGUImethod(self.__statMon.stopWatch)
01038
01039     result = self.lat.takeSnapshot(stream, fileName,
01040                           captureGTIC, captureGAEQ,
01041                           trigger, configName, configVersion)
01042
01043     if self.__statMon is not None:
01044       self.rc.execGUImethod(self.__statMon.startWatch)
01045
01046     return result
01047
01048   def readConfig(self, cfgFileName):
01049     """\brief Read a configuration XML file.
01050
01051     \param cfgFileName Full path of the configuration file.
01052
01053     \return Sequence number for this configuration. This number
01054             can later be passed to applyConfig.
01055     """
01056     seq = self.lat.readConfig(cfgFileName)
01057     if seq != -1 and cfgFileName not in self.lat._GLAT__includeFiles:
01058       self.lat._GLAT__includeFiles.append(cfgFileName)
01059     return seq
01060
01061   def applyConfig(self, seq=None, gxbrd=None):
01062     """\brief Apply configuration.
01063
01064     \param seq   Sequence number of the configuration.
01065                  If None, then apply all configurations.
01066     \param gxbrd Apply the GXBRD configuration as well.
01067                  Disabled by default.
01068     """
01069     self.lat.applyConfig(seq, gxbrd)
01070
01071   def setArchiverClass(self, archiverClass):
01072     """\brief Set a custom archiver class.
01073
01074     Set a custom archiver class.  This is typically done in the __init__ method
01075     of the userApplication class.
01076
01077     \param The archiver class (not the instance)
01078
01079     """
01080     self.__archiverClass = archiverClass
01081     log.debug("Event archiver set to: %s", self.__archiverClass.__name__)
01082
01083   def getArchiverInstance(self):
01084     """\brief Return the archiver instance.
01085
01086     Returns the archiver instance.  Can be used by the user application.
01087
01088     \return Archiver instance
01089     """
01090     return self.__archiver
01091
01092   def startExcludeTime(self):
01093     """\brief Save the start time for exclusion from the run's elapsed time.
01094
01095     This method allows excluding some amount of time from the run's elapsed
01096     time.  The start time is the time that the method is called.
01097
01098     Note that time spent in the PAUSED state is also excluded from the elapsed
01099     time value.  Overlapping time is excluded from the elapsed time only once.
01100     """
01101     if not self.__excluding:
01102       self.__excludeLock.acquire()
01103       now = time.time()
01104       self.__excluding = True
01105       self.__excludeTime  = now
01106       self.__elapsedTime += now - self.__strobeTime
01107       self.__strobeTime   = now
01108       self.__excludeLock.release()
01109     elif self.__pauseTime is not None:
01110       pass                              # Going into PAUSED started it
01111     else:
01112       assert not self.__excluding, "Error: " + \
01113              "Attempt made to exclude time when it is already being excluded"
01114
01115   def endExcludeTime(self):
01116     """\brief Strobe the end time for exclusion from the run's elapsed time.
01117
01118     This method allows excluding some amount of time from the run's elapsed
01119     time.  The end time is the time that the method is called.  The difference
01120     between the end time and the start time is added to the excluded time.
01121     """
01122
01123     if self.__pauseTime is None:
01124       assert self.__excluding, "Error: startExcludeTime was not called"
01125       self.__excludeLock.acquire()
01126       now = time.time()
01127       dExcludedTime         = now - self.__excludeTime
01128       self.__excludedTime += dExcludedTime
01129       self.__elapsedTime  += now - self.__strobeTime - dExcludedTime
01130       self.__strobeTime    = now
01131       self.__excludeTime   = None
01132       self.__excluding     = False
01133       self.__excludeLock.release()
01134     else:                               # In PAUSED state: nothing to do
01135       pass
01136
01137   def adjustExcludeTime(self, dExcludeTime):
01138     """\brief This method allows adjustment of the amount of time to be
01139     excluded from the run's elapsed time.
01140
01141     The amount of time to be excluded from the run's elapsed time can be
01142     adjusted positivily or negativily with this method.  It does not take
01143     into account any other effects on the excluded time, such as whether
01144     the run was in the PAUSED state.
01145
01146     \param dExcludeTime  The amount of time to be excluded as given by the
01147     difference of two time.time() values.
01148     """
01149     # Ensure this doesn't interrupt another thread diddling excludeTime
01150     self.__excludeLock.acquire()
01151     self.__excludedTime += dExcludeTime
01152     self.__excludeLock.require()
01153
01154   def rcSetup(self):
01155     """\brief Setup transition method.
01156
01157
01158     """
01159     fn = "rcTransitions.rcSetup"
01160     log.debug("%s -- %s" % (fn, self.getName()))
01161
01162     # Set the Global Trigger
01163     if not self.lat.existsGEM():
01164       glt = self.xbrd.GLT
01165       if glt is None: # temporary: eventually will be explicit in schema
01166         glt = self.xbrd._GXBRD__addGLT()
01167       glt.initialize()
01168       self.setSessionVar('_glt', glt)
01169
01170       # Disable triggers
01171       glt.disableMask()        # call this directly.  don't use trigger()
01172
01173     # Apply the configuration to the hardware
01174     self.__waitCursor()
01175     self.applyConfig(gxbrd = self.xbrd)
01176     self.__normalCursor()
01177
01178     # set the event mode to take events normally
01179     self.ocs.evtHandlerSendAll()
01180     self.ocs.synchronize()
01181     self.ocs.verifyVersion()
01182
01183     # The application may pick a different event handler in the SETUP and
01184     # START_RUN transitions.  If it doesn't make sure there is a default.
01185     self.selectEventHandler(rcTransitions.EVENT_HANDLER_STANDARD)
01186
01187     hskReadOnly = (self.rc is not None) and (int(self.prefs["envmonreadonly"]) == 1)
01188
01189     if hskReadOnly:
01190       self.__hsk = rcHouseKeeping.rcHouseKeeping(self.lat, None, rcHouseKeeping.MODE_READONLY)
01191     else:
01192       self.__hsk = rcHouseKeeping.rcHouseKeeping(self.lat, os.path.split(self.__scmCfgFile)[1])
01193
01194     # Call the application back
01195     try:
01196       status = self.setup()
01197       if status is not None:  return status
01198     except:
01199       log.exception("Exception in " + self.getName() + ".setup()")
01200       self.__appStatus = self.COMPL_STATUS_FAILED
01201       return False                      # Stay in RESET state
01202
01203     # finish setting up the trigger, add the GEM or GLT
01204     if self.lat.existsGEM():
01205       if self.trigger() is None:
01206         # there's no trigger defined, define a default
01207         # As there's no "real" trigger, don't replace the shut method
01208         self.trigger( rcDefaultTrigger.rcGEMDefaultTrigger(), replaceShut = False )
01209       self.trigger().GEM(self.lat.downGEM())
01210     else:
01211       if self.trigger() is None:
01212         # there's no trigger defined, define a default
01213         self.trigger( rcDefaultTrigger.rcMiniGLTDefaultTrigger(), replaceShut = False )
01214       self.trigger().GLT(glt)
01215     # commit the trigger.  This class defined in rcTrg{Gem,MiniGLT}.py
01216     self.trigger().commit()
01217
01218
01219   def rcTeardown(self):
01220     fn = "rcTransitions.rcTeardown"
01221     log.debug("%s -- %s" % (fn, self.getName()))
01222
01223     # Call the application back
01224     try:
01225       status = self.teardown()
01226     except:                             # Continue as if nothing had happened
01227       log.exception("Exception in " + self.getName() + ".teardown()")
01228       self.__appStatus = self.COMPL_STATUS_FAILED
01229       status = None                     # Go into RESET state
01230
01231     return status
01232
01233   def rcStartRun(self):
01234     fn = "rcTransitions.rcStartRun"
01235     log.debug("%s -- %s" % (fn, self.getName()))
01236
01237     self.evtCnt             = 0
01238     self.__lastEvtCnt       = 0
01239     self.__dgSize           = 0
01240     self.__dgSumSize        = 0L
01241     self.__appStatus        = None
01242     self.__completionStatus = self.COMPL_STATUS_UNDEFINED
01243     self.__badEvents        = 0
01244     self.__errEvents        = 0
01245     self.__endTime          = None
01246     self.__startTime        = None
01247     self.__excludeLock.acquire()
01248     self.__elapsedTime      = 0
01249     self.__strobeTime       = None
01250     self.__excluding        = False
01251     self.__excludedTime     = 0
01252     self.__excludeLock.release()
01253     self.__pauseCount       = 0
01254     self.__pausedTime       = 0
01255
01256     # Initialize the event statistics
01257     self.lat.stats_failed_events         = 0
01258     self.lat.stats_failed_event_sends    = 0
01259     self.lat.stats_valid_events          = 0
01260     self.lat.stats_discarded_event_sends = 0
01261     self.lat.stats_length_mismatch_count = 0
01262     self.lat.stats_events_not_sent       = 0
01263
01264     self.__clearEventSizeNTuple()
01265
01266     # The timestamp is measured here because things below depend on its value.
01267     # Therefore the run time includes the amount of time spent in the parameter verifier
01268     # in addition to the time the user spends entering the parameters.
01269     self.__tstampRaw   = time.gmtime()
01270     self.__tstamp      = time.strftime('%y%m%d%H%M%S', self.__tstampRaw)
01271
01272     self.__exportedFiles      = []
01273
01274     self.runId = self.__runIdHelper.nextRunId()
01275
01276     hskOutputEnabled = (self.rc is not None) and (int(self.prefs["envmonnbl"]) == 1)
01277     if hskOutputEnabled:
01278       hskFileName = rcHouseKeeping.getFileNameFromTS(self.__tstamp)
01279       self.__hsk.initialize(filePath=self.prefs["logdir"],
01280                             fileName=hskFileName,
01281                             compress=(int(self.prefs["envmoncompress"]) == 1))
01282       self.__hsk.start()
01283
01284     # Sweep out stale events
01285     # self.__sweep()
01286
01287     # Load the archive file writer, if desired
01288     if self.prefs is not None:
01289       archiveOutputEnabled = (int(self.prefs["datasave"]) == 1)
01290       if archiveOutputEnabled:
01291         archFileName = self.__archiverClass.getFileNameFromTS(self.__tstamp)
01292         self.__archiver = self.__archiverClass(filePath=self.prefs["datadir"],
01293                                                 fileName=archFileName)
01294         self.__archive = self.__archiveIt
01295       else:
01296         self.__archive = self.__archiveDummy
01297
01298     if self.__dds is not None:
01299       self.__publish = self.__publishIt
01300     else:
01301       self.__publish = self.__publishDummy
01302
01303     if self.rc is not None:
01304       self.__paramVerifier.initialize(self.getName())
01305     self.__verifyStatus = None
01306
01307     # publish the startRun on dds
01308     self.publishConsumerDG('startRun='+self.getRunId())
01309
01310     # Call the application back
01311     try:
01312       status = self.startRun()
01313     except:
01314       log.exception("Exception in " + self.getName() + ".startRun()")
01315       self.__appStatus = self.COMPL_STATUS_FAILED
01316       status = False                    # Stay in STOPPED state
01317     if status is not None:
01318       # startRun rejected, cleanup here.
01319       if hskOutputEnabled:
01320         self.__hsk.stop()
01321       return status
01322
01323     if self.__common.options().securedir is not None:
01324       scriptSeq = 0
01325       if self.isRunFromSuite():
01326         scriptSeq = self.getSuiteInstance().getScriptSequence()
01327       if scriptSeq == 0 or scriptSeq == 1:
01328         self.__paramVerifier.add("Schema File", os.path.split(self.__scmCfgFile)[1])
01329         self.__paramVerifier.add("Particle Type", self.prefs["lastparticletype"])
01330         self.__paramVerifier.add("Orientation", self.prefs["lastorientation"])
01331         self.__paramVerifier.add("Site", self.prefs["lastsite"])
01332         self.__paramVerifier.add("Instrument Type", self.prefs["lastinstrumenttype"])
01333         self.__paramVerifier.add("Phase", self.prefs["lastphase"])
01334       self.__verifyStatus = self.rc.execGUImethod(self.__paramVerifier.verify)
01335       if self.__verifyStatus == 1: # The user successfully signed off on the parameters
01336         pass
01337       elif self.__verifyStatus == 0: # The user cancelled the verification
01338         log.error("Parameter verification failed because the user cancelled verification.")
01339         return self.__verifyStatus
01340       else:
01341         if self.__verifyStatus is None: self.__verifyStatus = -1
01342         log.error("Parameter verification failed due to an unknown reason.")
01343         return self.__verifyStatus
01344
01345     log.info("""%s -- Test %s starting run, Operator: %s,"""
01346              """ Run Id: %s, Time Started: %s -- %s"""
01347               % (fn, self.getName(), self.prefs["operator"],
01348                  self.runId, self.__tstamp, time.asctime(self.__tstampRaw)))
01349
01350     # Take snapshot. Note that the triggers must be disabled prior to
01351     # this action, therefore the glt changes are being committed afterwards.
01352
01353     snapshotEnabled = 0
01354     if self.rc is not None and self.prefs.has_key("snapnbl"):
01355       snapshotEnabled = (self.rc is not None) and (int(self.prefs["snapnbl"]) == 1)
01356     if snapshotEnabled:
01357       self.__waitCursor()
01358
01359       snFile = os.path.join(self.prefs["snapshotdir"],
01360                             "rsa" + self.__tstamp + ".xml")
01361       self.takeSnapshot(stream=None, fileName=snFile,
01362                             captureGTIC=1, captureGAEQ=1, trigger=self.trigger())
01363       self.addExportedFile(snFile,delete=True)
01364
01365       self.__normalCursor()
01366
01367     self.handleEventOutput()
01368
01369     # Check if there's enough space on the disks
01370     if self.rc is not None:
01371       fitsDir = self.prefs["fitsdir"]
01372       archDir = self.prefs["datadir"]
01373       if ( (FreeSpace.FreeSpace(fitsDir) < rcTransitions.DISKSPACE_WARN_LEVEL) or
01374            (FreeSpace.FreeSpace(archDir) < rcTransitions.DISKSPACE_WARN_LEVEL)    ):
01375         warning = self.rc.execGUImethod(self.rc.warnFreeSpace,
01376                                         rcTransitions.DISKSPACE_WARN_LEVEL)
01377         if warning:            # OK, continue
01378           pass
01379         else:
01380           return False         # reject the transition
01381
01382       # Spawn a thread to handle events
01383       if self.trigger().sweepOnShut():
01384         self.__eventHandlerReady.clear()               # Make sure handler ready
01385         self.rc.eventHandler.spawn(self.__jacket, self.__eventHandlerFn)
01386         # Sweep out stale events
01387         self.__sweep()
01388
01389       if 'commandSynch' in dir(self):
01390         self.rc.commandSynch.spawn(self.__jacket, self.commandSynch)
01391     else:
01392       if self.trigger().sweepOnShut():
01393         self.__eventHandlerReady.clear()               # Make sure handler ready
01394         evtHandler = Thread(None, self.__eventHandlerFn, 'EventHandler', ())
01395         evtHandler.start()
01396         # Sweep out stale events
01397         self.__sweep()
01398
01399       if 'commandSynch' in dir(self):
01400         cmdSynch = Thread(None, self.commandSynch, 'CmdSynch', ())
01401         cmdSynch.start()
01402
01403     # wait for Event Handler ready signal
01404     if self.trigger().sweepOnShut():
01405       self.__eventHandlerReady.wait()
01406
01407     # Handle enabling of the triggers
01408     enableTrigger = True                     # Default is to enable triggers
01409     if 'triggerEnableOverride' in dir(self): # Allow application to override
01410       enableTrigger = type(self.triggerEnableOverride) == types.MethodType and \
01411                       not self.triggerEnableOverride()
01412     now = time.time()
01413
01414     if enableTrigger:
01415       # Write the user script's trigger mask settings to the hardware
01416       self.trigger().enable()
01417
01418     #Initialize timers
01419     self.__endTime     = None
01420     self.__startTime   = now
01421     self.__excludeLock.acquire()
01422     self.__elapsedTime = 0
01423     self.__strobeTime  = now
01424     self.__excludeLock.release()
01425     self.__avgDeadTime = None
01426
01427     # Hardcode first TEM in schema for deadtime measurement for now. # revisit
01428     if self.lat.TEMcnt() > 0:
01429       tic = self.lat.TEM[self.lat.TEM.keys()[0]].TIC
01430       if tic is not None:
01431         self.__deadtimeCtrReg = tic.regs['sat_deadtime_lrs_ctr']
01432         regNo = self.__deadtimeCtrReg.id()
01433         #(dtUserId, dtStatus, self.__deadTimeVal, self.__deadTimeTS)  = self.__cmdCli.gGTICread(0, regNo)
01434         resp = tic.read(regNo)
01435         self.__deadTimeVal = resp.value()
01436         self.__deadTimeTS = resp.payloads()[1]
01437
01438     return status
01439
01440   def __jacket(self, function, *args, **kwargs):
01441     """Jacketting method for catching exceptions and initiating graceful
01442     termination of the user application.
01443     """
01444     try:
01445       function(*args, **kwargs)
01446     except Exception, e:
01447       import logging
01448       logging.exception("%s: %s" % (function.__name__, e))
01449       self.__appStatus = self.COMPL_STATUS_ABORTED
01450       self.rc.doReset()
01451
01452   def __handleEventOutput(self):
01453     # Load the FITS file writer, if desired
01454     fn = "__handleEventOutput"
01455     self.__fits = None
01456     if self.prefs is not None:
01457       fitsOutputEnabled = ("fitsnbl" in self.prefs) and (int(self.prefs["fitsnbl"]) == 1)
01458       if fitsOutputEnabled:
01459         try:
01460           fitsFileName = rcFitsWriter.getFileNameFromTS(self.__tstamp)
01461           self.__fits = rcFitsWriter.rcFitsWriter(filePath=self.prefs["fitsdir"],
01462                                                   fileName=fitsFileName,
01463                                                   format=rcFitsWriter.FORMAT_BYTE,
01464                                                   compress=(int(self.prefs["fitscompress"]) == 1),
01465                                                   flushInterval=100,
01466                                                   reportGen=self.__reportGen)
01467         except (ImportError, IOError), e:
01468           log.error("%s: FITS writer disabled: %s" % (fn, e))
01469       try:
01470         fileName = rcArchiver.rcArchiver.getFileNameFromTS(self.__tstamp)
01471         errFileName = 'err' + fileName.split('.',1)[0] + '.ldf'
01472         self.__errArchiver = rcArchiver.rcArchiver(filePath=self.prefs["datadir"],
01473                                                     fileName=errFileName)
01474         badFileName = 'bad' + fileName.split('.',1)[0] + '.ldf'
01475         self.__badArchiver = rcArchiver.rcArchiver(filePath=self.prefs["datadir"],
01476                                                     fileName=badFileName)
01477       except (ImportError, IOError), e:
01478         log.error("%s: Archiver disabled: %s" % (fn, e))
01479
01480   def __handleEventOutputStub(self):
01481     pass
01482
01483   def rcStopRun(self):
01484     fn = "rcTransitions.rcStopRun"
01485     log.debug("%s -- %s" % (fn, self.getName()))
01486
01487     # Disable triggers
01488     self.trigger().disable()
01489
01490     # Flush out the remaining triggers in the pipeline and exit evtHandler
01491     self.__flushEvents()
01492
01493     self.__common.getDBN()['_event_size'] = 0
01494
01495     # Call the application back after events are no longer flowing
01496     try:
01497       self.stopRun()       # RiC: It appears rejecting the transition won't work
01498     except:                             # Go into STOPPED state
01499       log.exception("Exception in " + self.getName() + ".stopRun()")
01500       self.__appStatus = self.COMPL_STATUS_FAILED
01501
01502     # Stop the run - Must be done after the application stopRun()
01503     self.__stopRun()
01504     self.__logEndRun(fn)
01505
01506   def rcStop(self):
01507     fn = "rcTransitions.rcStop"
01508     log.debug("%s -- %s" % (fn, self.getName()))
01509
01510     # Disable triggers
01511     self.trigger().disable()
01512
01513     # Flush out the remaining triggers in the pipeline and exit evtHandler
01514     self.__flushEvents()
01515
01516     self.__common.getDBN()['_event_size'] = 0
01517
01518     # Mark the resume time
01519     now = time.time()
01520     self.__pausedTime += (now - self.__pauseTime)
01521     self.__pauseTime   = None
01522
01523     if not self.__excluding:
01524       self.__excludeLock.acquire()
01525       dExcludedTime        = now - self.__excludeTime
01526       self.__excludedTime += dExcludedTime
01527       self.__elapsedTime  += now - self.__strobeTime - dExcludedTime
01528       self.__strobeTime    = now
01529       self.__excludeTime   = None
01530       self.__excludeLock.release()
01531     else:                 # Time is still being excluded: nothing to do
01532       pass
01533
01534     # Call the application back after events are no longer flowing
01535     try:
01536       self.stop()         # RiC: It appears rejecting the transition won't work
01537     except:                             # Go into STOPPED state
01538       log.exception("Exception in " + self.getName() + ".stop()")
01539       self.__appStatus = self.COMPL_STATUS_FAILED
01540
01541     # Stop the run
01542     self.__stopRun()
01543     self.__logEndRun(fn)
01544
01545   def __logEndRun(self, fn):
01546     log.info("%s -- Test %s finished, Status: %s, Completion Time: %s"
01547              % (fn, self.getName(), self.getCompletionStatusStr(),
01548                 time.asctime(time.gmtime(self.__endTime))))
01549
01550   def rcPause(self):
01551     fn = "rcTransitions.rcPause"
01552     log.debug("%s -- %s" % (fn, self.getName()))
01553
01554     # Sweep out any currently buffered triggers
01555     if self.trigger().sweepOnShut():
01556       self.__sweep()
01557
01558     # Increment pause count
01559     self.__pauseCount += 1
01560
01561     # Calculate elapsed time so far
01562     now = time.time()
01563     self.__pauseTime = now
01564
01565     if not self.__excluding:
01566       self.__excludeLock.acquire()
01567       self.__excludeTime  = now
01568       self.__elapsedTime += now - self.__strobeTime
01569       self.__strobeTime   = now
01570       self.__excludeLock.release()
01571     else:                 # Time is already being excluded: nothing to do
01572       pass
01573
01574     # Call the application back
01575     try:
01576       status = self.pause()
01577     except:                             # Go into PAUSED state
01578       log.exception("Exception in " + self.getName() + ".pause()")
01579       self.__appStatus = self.COMPL_STATUS_FAILED
01580
01581     return status
01582
01583   def rcResume(self):
01584     fn = "rcTransitions.rcResume"
01585     log.debug("%s -- %s" % (fn, self.getName()))
01586
01587     # Mark the resume time before reenabling triggers
01588     now = time.time()
01589     self.__pausedTime += (now - self.__pauseTime)
01590     self.__pauseTime   = None
01591
01592     if not self.__excluding:
01593       self.__excludeLock.acquire()
01594       dExcludedTime        = now - self.__excludeTime
01595       self.__excludedTime += dExcludedTime
01596       self.__elapsedTime  += now - self.__strobeTime - dExcludedTime
01597       self.__strobeTime    = now
01598       self.__excludeTime   = None
01599       self.__excludeLock.release()
01600     else:                 # Time is still being excluded: nothing to do
01601       pass
01602
01603     # Reenable triggers
01604     self.trigger().enable()
01605
01606     # Call the application back
01607     try:
01608       status = self.resume()
01609     except:                             # Go into RUNNING state
01610       log.exception("Exception in " + self.getName() + ".resume()")
01611       self.__appStatus = self.COMPL_STATUS_FAILED
01612
01613     return status
01614
01615   # Not used anymore - ST
01616   #def extend(self):
01617   #  """Overload this function to provide additional space after the event in
01618   #  the datagram.  This space can be used to add application dependent
01619   #  LATcontributions to the datagram.  This method is evaluated at startRun time
01620   #  and not on a per trigger basis.  It should return a Python string big enough
01621   #  to fit whatever additional space is needed for the user data.  To gain
01622   #  access to this space use the LATdatagram.alloc(size) method.
01623   #  """
01624   #  return ""
01625
01626 # The following methods are meant to be overridden by the application
01627
01628   def getName(self):
01629     return self.__class__.__name__
01630
01631   def setup(self):
01632     "Method that is called on the SETUP transition"
01633     log.debug("rcTransitions.setup()")
01634     # The transition can be rejected by not returning None
01635     return None
01636
01637   def teardown(self):
01638     "Method that is called on the TEARDOWN transition"
01639     log.debug("rcTransitions.teardown()")
01640     # The transition can be rejected by not returning None
01641     return None
01642
01643   def startRun(self):
01644     "Method that is called on the START_RUN transition"
01645     log.debug("rcTransitions.startRun()")
01646     # The transition can be rejected by not returning None
01647     return None
01648
01649   def stopRun(self):
01650     "Method that is called on the STOP_RUN transition"
01651     log.debug("rcTransitions.stopRun()")
01652     # The transition can be rejected by not returning None
01653     return None
01654
01655   def pause(self):
01656     "Method that is called on the PAUSE transition"
01657     log.debug("rcTransitions.pause()")
01658     # The transition can be rejected by not returning None
01659     return None
01660
01661   def resume(self):
01662     "Method that is called on the RESUME transition"
01663     log.debug("rcTransitions.resume()")
01664     # The transition can be rejected by not returning None
01665     return None
01666
01667   def stop(self):
01668     "Method that is called on the STOP transition"
01669     log.debug("rcTransitions.stop()")
01670     # The transition can be rejected by not returning None
01671     return None
01672
01673   def process(self, eventBuffer):
01674     "Method that is called on every data event taken"
01675     log.debug("rcTransitions.process()")
01676
01677
01678 # Private methods appear below
01679
01680 ## private:
01681
01682   def __clearEventSizeNTuple(self):
01683     # Clear the event size plot ntuple
01684     dbn = self.__common.getDBN()
01685     if '_EventSizeNTuple' in dbn:
01686       dbn['_EventSizeNTuple'].clear()
01687
01688   def __normalCursor(self):
01689     if self.rc is not None and 'normalCursor' in dir(self.rc):
01690       self.rc.normalCursor()
01691
01692   def __waitCursor(self):
01693     if self.rc is not None and 'waitCursor' in dir(self.rc):
01694       self.rc.waitCursor()
01695
01696   def __eventProgress(self):
01697     """
01698     Method used by the sweep logic to time out waiting for sweep events.
01699     This function returns the number of events that were handled by the
01700     event handler since the last time it was called.
01701     """
01702     progress = self.evtCnt - self.__lastEvtCnt
01703     self.__lastEvtCnt = self.evtCnt
01704     return progress
01705
01706   def __sweep(self):
01707     """
01708     Method used to ensure that the event pipeline is swept of pending events.
01709     When this method returns triggers are disabled but set up as they were upon
01710     entry.
01711     """
01712
01713     # Wait for marked event to show up while pipelined events drain
01714     self.__waitCursor()
01715     # Make sure TEM registers are in a 'good' state for event data taking
01716     # and solicit the sweep trigger.
01717     #~ gutil.solicitSweep(self.lat, self.trigger(), self.__sweepEvent)
01718     self.trigger().shut(self.__sweepEvent, self.__eventProgress)
01719     self.__normalCursor()
01720     # Triggers are disabled at this point.
01721
01722   def __flushEvents(self):
01723     # Cause eventHandler to exit when the sweep marker is seen
01724
01725     # Handle the race condition when event handler
01726     # may exit before the sweep event is received.
01727     self.__sweepEvent.clear()
01728     self.__evtHandlerQuit = True
01729
01730     # Sweep any buffered triggers
01731     if self.trigger().sweepOnShut():
01732       self.__sweep()
01733
01734     # Handle the race condition when event handler
01735     # may exit before the sweep event is received.
01736     self.__sweepEvent.set()
01737
01738
01739   def __stopRun(self):
01740     # Calculate the final elapsed time
01741     now = time.time()
01742     self.__endTime      = now
01743     self.__excludeLock.acquire()
01744     if self.__strobeTime is not None:
01745       self.__elapsedTime += now - self.__strobeTime
01746     self.__strobeTime   = None
01747     self.__excludeLock.release()
01748
01749     self.__avgDeadTime = self.__calcDeadTime()
01750
01751     hskOutputEnabled = (self.rc is not None) and (int(self.prefs["envmonnbl"]) == 1)
01752     if hskOutputEnabled:
01753       self.__hsk.stop()
01754
01755     # publish the endRun on dds
01756     self.publishConsumerDG('endRun='+self.getRunId())
01757
01758     if self.__completionStatus == self.COMPL_STATUS_UNDEFINED:
01759       log.warn("Script completed with an undefined completion status. "
01760                "Please use the setCompletionStatus method.")
01761
01762     # Close fits file
01763     if self.__fits is not None:
01764       self.__fits.close(self.rc.inShutdown)
01765     if self.__badArchiver is not None:
01766       self.__badArchiver.close()
01767       self.__removeZeroLengthFile(self.__badArchiver.getFilePath(), self.__badArchiver.getFileName())
01768       self.__badArchiver = None
01769     if self.__errArchiver is not None:
01770       self.__errArchiver.close()
01771       self.__removeZeroLengthFile(self.__errArchiver.getFilePath(), self.__errArchiver.getFileName())
01772       self.__errArchiver = None
01773
01774     if self.__archiver is not None:
01775       self.__archiver.close()
01776
01777     if self.prefs is not None:
01778       if self.rc is not None and self.rc.inShutdown:
01779         pass
01780       else:
01781         snapshotEnabled = 0
01782         if self.prefs.has_key("snapnbl"):
01783           snapshotEnabled = (int(self.prefs["snapnbl"]) == 1)
01784         if snapshotEnabled:
01785           self.__waitCursor()
01786
01787           snFile = os.path.join(self.prefs["snapshotdir"],
01788                                 "rsb" + self.__tstamp + ".xml")
01789           self.takeSnapshot(stream=None, fileName=snFile,
01790                             captureGTIC=1, captureGAEQ=1,
01791                             trigger=self.trigger())
01792           self.addExportedFile(snFile, delete=True)
01793
01794           self.__normalCursor()
01795
01796     # Create test report
01797     if self.rc is not None and not self.rc.inShutdown:
01798       self.rc.execGUImethod(self.__genReport)
01799
01800     if self.rc is not None:
01801       self.__exportData()
01802
01803   def __calcDeadTime(self):
01804     if self.__deadtimeCtrReg is not None:
01805       saveDebug = self.__cmdCli.getDebug()
01806       self.__cmdCli.setDebug(0)
01807       regNo = self.__deadtimeCtrReg.id()
01808       #(userId, status, newVal, newTS)  = self.__cmdCli.gGTICread(0, regNo)
01809       resp = self.__deadtimeCtrReg.getNode().read(regNo)
01810       newVal = resp.value()
01811       newTS = resp.payloads()[1]
01812       self.__cmdCli.setDebug(saveDebug)
01813
01814       dTime = newVal - self.__deadTimeVal
01815       dTS = newTS - self.__deadTimeTS
01816       if dTime < 0:
01817         dTime += (1L << 32)
01818       if dTS < 0:
01819         dTS += (1L << 64)
01820       if dTS != 0:
01821         avgDeadTime =  (float(dTime)/float(dTS))
01822         avgDeadTime *= (rcTransitions.TIMEBASE_RATE_IN_MHZ / rcTransitions.DEADTIME_RATE_IN_MHZ) * 100.0
01823       else:
01824         avgDeadTime = None
01825       return avgDeadTime
01826     else:
01827       return None
01828
01829   def __removeZeroLengthFile(self, filePath, fileName):
01830     fname = os.path.join(filePath, fileName)
01831     size = os.stat(fname)[6]
01832     if size == 0:
01833       try:
01834         os.remove(fname)
01835       except:
01836         return -1
01837     return 0
01838
01839   def __exportData(self):
01840     """
01841       Routine to export all relevant data from a run to
01842       local storage and possibly to offsite backup.
01843       This routine is designed to execute after the completion of a run,
01844       but before teardown of Run Control.
01845       The name of the export directory is the run ID.  This is
01846       to guarantee against unintentional overwrites between multiple
01847       teststands.
01848     """
01849
01850     # If we aren't exporting, return
01851     exportEnabled = (int(self.prefs["dataexport"]) == 1)
01852     if not exportEnabled: return
01853
01854     # first thing is to create a local directory structure
01855     outDir = self.getRunId()
01856     outDirRoot = self.prefs["datadir"]
01857     outPath = os.path.join(outDirRoot,outDir)
01858
01859     # Define two exporters.
01860     # One which purges the files after export, one which doesn't.
01861     hardExporter    = DataExport.DataExport()
01862     safeExporter    = DataExport.DataExport()
01863     hardExporter.setPurge(True)
01864     safeExporter.setPurge(False)
01865
01866     # append to the list of exported files
01867
01868     # schema configuration:  Don't delete these!
01869     self.addExportedFile(self.getSchemaConfigFile(), delete=False)
01870     if self.lat is not None:                    # additional files from GLAT...
01871       for f in self.lat._GLAT__includeFiles:
01872         self.addExportedFile(f, delete=False)
01873
01874     if os.access(outDirRoot,os.W_OK):             # can we write?
01875       os.mkdir(outPath)
01876
01877       # list of files that get hardExported.
01878       moveList = [ self.__archiver,    self.__badArchiver, \
01879                    self.__errArchiver, self.__fits ]
01880       for fileObj in moveList:
01881         if fileObj is not None:
01882           self.addExportedFile(os.path.join(fileObj.getFilePath(), fileObj.getFileName()), delete=True)
01883
01884       # export housekeeping file
01885       hskReadOnly = (int(self.prefs["envmonreadonly"]) == 1)
01886       if self.__hsk is not None and (int(self.prefs["envmonnbl"]) == 1) and not hskReadOnly:
01887         self.addExportedFile(self.__hsk.getFileName(full=1), delete=True)
01888
01889       # make the rcReport.out file
01890       rcLastLine = self.__rcLastLine()    # Grab the info from rcReport.out
01891       rcOutFile = open(os.path.join(outPath,"rcReport.out"), 'w')
01892       rcOutFile.write(rcLastLine)
01893       rcOutFile.close()
01894
01895       for path,name,delete in self.__exportedFiles:
01896         try:
01897           if delete:
01898             hardExporter.export(os.path.join(path,name),os.path.join(outPath,name))
01899           else:
01900             safeExporter.export(os.path.join(path,name),os.path.join(outPath,name))
01901         except Exception, e:
01902           log.error("Exception %s in trying to export file %s" % (e, name))
01903
01904     else: # Can't write to outDirRoot
01905       err = "rcTransitions.__exportData: Local directory ", outDirRoot, " is not writable"
01906       log.error(err)
01907       return         # Can't continue exporting, so return
01908
01909
01910     # if the data dir and the export dir are the same, don't export.
01911     if os.path.abspath(self.prefs["datadir"]) == os.path.abspath(self.prefs["exportdir"]):
01912       msg = "Data source and Export directories are identical\n" + \
01913             "source: %s, export: %s" % ( self.prefs["datadir"] , self.prefs["exportdir"] )
01914       log.warn(msg)
01915       exportEnabled = False
01916
01917     # Export the directory to permanent storage
01918     if exportEnabled:
01919       destDir    = os.path.join(self.prefs["exportdir"] ,outDir)
01920       dbn = self.__common.getDBN()
01921       dbn['_LastExportPath'] = destDir
01922       sourceDir  = outPath
01923       hardExporter.export(sourceDir, destDir)
01924
01925   def __rcLastLine(self):
01926     """Get the last line of the run report file.
01927     """
01928     # Now, we need the info from rcReport.out
01929     # As this routine runs after the writing of the file, just grab
01930     # the last usable line.
01931     if self.rc is not None:
01932       rdir = self.prefs["reportdir"]
01933     else:
01934       rdir = '.'
01935     filename = ( os.path.join(rdir, 'rcReport.out') )
01936
01937     rcFile = open(filename,'r')
01938     charsPerLine = 4096                         # this probably needs tuning.
01939     while 1:
01940       try:                                      # read from the end of the file
01941         rcFile.seek(-1 * charsPerLine ,2)
01942       except IOError:                           # the file's shorter than charsPerLine
01943         rcFile.seek(0)                          # reposition at head
01944       if rcFile.tell() == 0:
01945         atstart=True
01946       else:
01947         atstart=False
01948
01949       rcLines=rcFile.read().split("\n")         # last line of file is blank,
01950       if (len(rcLines) > 2) or atstart:         # so require 2 full lines
01951         break
01952                                                 # The lines are bigger than we thought,
01953       charsPerLine=charsPerLine * 2             # so double the read
01954
01955     rcFile.close()
01956     rcLastLine = rcLines[len(rcLines)-2]        # cache this for later
01957     return rcLastLine
01958
01959   def selectEventHandler(self, type, customEventHandler = None):
01960     """Use this method to select an event handler to use.
01961     The application can call this method from the SETUP or START_RUN
01962     transitions.  If it doesn't, a default is used.
01963     """
01964     if self.rc is None:
01965       # Standalone mode
01966       self.__eventHandlerFn = self.__eventHandler
01967     else:
01968       fsm = self.rc.getFSM()
01969       # Check if FSM is None in case we are in a suite
01970       if fsm is None:
01971         self.__eventHandlerFn = self.__eventHandler
01972       else:
01973         currentState = self.rc.getFSM().current_state
01974         if currentState == 'RESET' or currentState == 'STOPPED':
01975           if type == rcTransitions.EVENT_HANDLER_STANDARD:
01976             self.__eventHandlerFn = self.__eventHandler
01977           elif type == rcTransitions.EVENT_HANDLER_LEAN_AND_MEAN:
01978             self.__eventHandlerFn = self.__datagramHandler
01979           elif type == rcTransitions.EVENT_HANDLER_PLAYBACK:
01980             self.__eventHandlerFn = self.__eventHandlerPlayback
01981           elif type == rcTransitions.EVENT_HANDLER_CUSTOM:
01982             self.__eventHandlerFn = customEventHandler
01983           else:
01984             log.error("Unrecognized eventHandler type")
01985         else:
01986           log.error("The event handler can not be changed in the %s state" % \
01987                     (currentState))
01988
01989 # Private method for calling the application back with event data
01990   def __eventHandler(self):
01991     """Handler for calling the application back with event data
01992     """
01993     evtCli       = self.evtCli
01994     endRunMarker = rcTransitions.__SWEEP_MARKER
01995
01996     # On playback, see if we need to trigger an event
01997     if self.__EBFplayback:
01998       # If application DIDN'T enable the internal trigger,
01999       # enable it and trigger first event
02000       if not self.trigger().conditions().solicited():
02001         playbackTrigger = True
02002         # two cases, GEM/GLT.
02003         # force an enable of the solicit in both cases.
02004         if self.lat.existsGEM():
02005           from LATTE.trigger.TrgGem import TrgGem
02006           self.trigger().enable(TrgGem._TrgGem__SOLICIT_MASK)
02007         else:
02008           from LATTE.trigger.TrgMiniGLT import TrgMiniGLT
02009           self.trigger().enable(TrgMiniGLT._TrgMiniGLT__SOLICIT_MASK)
02010
02011         self.trigger().solicit()
02012       else:     # Application is taking care of triggering the event
02013         playbackTrigger = False
02014
02015     self.__evtHandlerQuit = False
02016
02017     # Indicate that the Event Handler is ready to take events
02018     self.__eventHandlerReady.set()
02019
02020     # Set up the LCB to deliver events
02021     self.lat.LCB.setEvtEnable(True)
02022
02023     while True:
02024       try:
02025         # Go wait for an event to show up
02026         status = evtCli.readEvent()
02027
02028         # Count every event to ensure displayed rate makes sense
02029         self.evtCnt      += 1
02030         self.__dgSize     = evtCli.header[2]
02031         self.__dgSumSize += evtCli.header[2]
02032
02033         # ST - We want to pass the event as is so that we can check what type
02034         #      of error it has in user script's process() method
02035         #parser_status = evtCli.readEvent()
02036         #if evtCli.checkOnlineStatus(parser_status, EvtCli.GGLT_STATUS_ERROR):
02037         #  status = evtCli.getGGLTStatus()
02038         #else:
02039         #  status = parser_status
02040
02041         if (status == 0) or evtCli.checkOnlineStatus(status, EvtCli.PLAYBACK_ERROR):
02042           self.errorEvent = evtCli.isErrorEvent()
02043           summaryMarker = evtCli.evt.summary.marker
02044           self.eventMarker = summaryMarker
02045           if summaryMarker == rcTransitions.__SWEEP_MARKER:
02046             self.__sweepEvent.set()     # Signal that the marked event was seen
02047             # Commented out, since we want the sweep marker event to be seen by process()
02048             #if self.__evtHandlerQuit:  break
02049             #continue
02050
02051         # For efficiency first check whether event playback is enabled only once
02052         if self.__EBFplayback:
02053           # Whenever evtSvr detects errors during playback, stop the current run
02054           if evtCli.checkOnlineStatus(status, EvtCli.PLAYBACK_ERROR):
02055             self.rc.doStop()
02056             continue
02057
02058           # Since we know we're in playback mode, trigger the next event if
02059           # the application DIDN'T enable the internal trigger
02060           if playbackTrigger:
02061             self.trigger().solicit()
02062           else:     # Application is taking care of triggering the event
02063             pass
02064
02065         # Allow application to process all kinds of events
02066         #try:
02067           #self.process((status,evtCli.dat))
02068         latContribs = self.__process(status, evtCli.dat)
02069         #except:
02070         #  log.exception("")
02071         #  self.__appStatus = self.COMPL_STATUS_FAILED
02072         #  self.rc.doReset()
02073
02074         # Policy: don't write out unnavigable or empty events
02075         if status != 0:
02076           self.__badEvents+=1
02077           if evtCli.dat is not None:
02078             try:
02079               self.__badArchiver.write(evtCli.dat)
02080             except AttributeError:
02081               # Archiver may be disabled by the --noerrfile option
02082               pass
02083         else:
02084           (l,) = struct.unpack('!L', evtCli.dat[4:8])
02085           if self.__fits is not None:
02086             self.__fits.write(evtCli.dat[:l])
02087           if self.errorEvent:
02088             try:
02089               self.__errArchiver.write(evtCli.dat[:l])
02090             except AttributeError:
02091               # Archiver may be disabled by the --noerrfile option
02092               pass
02093             if summaryMarker != rcTransitions.__SWEEP_MARKER:
02094               self.__errEvents+=1
02095           #if self.__archiver is not None:
02096             #self.__archiver.write(evtCli.dat[:l])
02097           self.__archive(evtCli.header[1], latContribs)
02098           #if self.__dds is not None:
02099           self.__publish(evtCli.dat)
02100       except IOError:
02101         # Handle the event timeout if enabled
02102         if str(sys.exc_info()[1]) == "Event read timeout":
02103           evtCli.dat = ''
02104           status = EvtCli.READ_TIMEOUT_ERROR
02105         else:
02106           self.trigger().disable()
02107           raise IOError, "Unhandled IOError in rcTransitions::readEvent: %s" % sys.exc_info()[1]
02108
02109       if self.__evtHandlerQuit and self.__sweepEvent.isSet():  break
02110
02111       # HEADS UP: At this point evtCli.dat could be byteswapped
02112
02113     log.debug('rcTransitions.__eventHandler: %s terminating' % (self.getName()))
02114
02115
02116   def __archiveIt(self, datagramId, latContribs):
02117     # Calculate the length of the entire datagram
02118     size = 8                            # Datagram ID and its length
02119     for latContrib in latContribs:
02120       size += len(latContrib)
02121
02122     # Create the datagram header
02123     dgHdr = struct.pack('>2L', datagramId, size)
02124
02125     # Archive the datagram and all its contributions
02126     self.__archiver.writeTuple((dgHdr,) + latContribs)
02127
02128   def __archiveDummy(self, datagramId, latContribs):
02129     pass
02130
02131   def __archiveBad(self, datagram):
02132     archiver = self.__badArchiver
02133     if archiver is not None:
02134       archiver.write(datagram)
02135
02136   def __archiveErr(self, datagram):
02137     archiver = self.__errArchiver
02138     if archiver is not None:
02139       archiver.write(datagram)
02140
02141   def __publishIt(self, datagram):
02142     self.__dds.publish(datagram)
02143
02144   def __publishDummy(self, datagram):
02145     pass
02146
02147   def __process(self, status, datagram):
02148     try:
02149       # Make a copy of the whole event (not just a reference)
02150       # that proccess can byte swap.  - Revisit for efficiency
02151       #dgBuf = str(buffer(datagram))
02152       #import array
02153       #dgBuf = array.array('L', datagram).tostring()
02154       dgBuf = datagram[:1] + datagram[1:]
02155
02156       latContribs = self.process((status, dgBuf))
02157       if latContribs is not None:  return latContribs
02158     except Exception, e:
02159       import logging
02160       logging.exception("Trapped userApplication:process() exception: %s" % e)
02161       self.__appStatus = self.COMPL_STATUS_FAILED
02162       self.rc.doReset()
02163
02164     # RiC: The following may be a better solution to the copy done above
02165     # if datagram[0:4] == LDF.LATdatagram.ID:  datagram.byteswap()
02166
02167     return (datagram[8:],)        # LATcontributions, not LATdatagrams
02168
02169   def __datagramHandler(self):
02170     """Handler for calling the application back with event datagrams
02171     """
02172
02173     sweepEvt  = self.__sweepEvent
02174     evtCli    = self.evtCli
02175     sweepMkr  = rcTransitions.__SWEEP_MARKER
02176     markerMsk = 0x7 << 22
02177     errorMsk  = 0x1 << 21
02178
02179     self.__evtHandlerQuit = False
02180
02181     # Indicate that the Event Handler is ready to take events
02182     self.__eventHandlerReady.set()
02183
02184     # Set up the LCB to deliver events
02185     self.lat.LCB.setEvtEnable(True)
02186
02187     while not (self.__evtHandlerQuit and sweepEvt.isSet()):
02188
02189       # Get the data from the socket
02190       header, datagram = evtCli.readSocket()
02191
02192       # Count every event to ensure displayed rate makes sense
02193       self.evtCnt      += 1
02194       self.__dgSize     = header[2]
02195       self.__dgSumSize += header[2]
02196
02197       # Give application quick access to error bit and marker
02198       self.errorEvent  = (header[6] & errorMsk) != 0
02199       self.eventMarker = (header[6] & markerMsk) >> 22
02200
02201       # Process the datagram
02202       latContribs = self.__process(header[0], datagram)
02203
02204       # Check FSW event delivery to OES status
02205       if header[0] == 0:
02206         # Archive the data
02207         self.__archive(header[1], latContribs)
02208
02209         # Multicast the data
02210         self.__publish(datagram)
02211
02212         # Handle datagrams with TEM contribution errors
02213         if self.errorEvent and self.eventMarker != sweepMkr:
02214           self.__archiveErr(datagram)
02215           self.__errEvents += 1
02216       else:
02217         # Handle datagrams for which FSW choked
02218         self.__badEvents += 1
02219         self.__archiveBad(datagram)
02220
02221       # Make sure the above is done before setting the sweepEvt to prevent
02222       # things from getting out of synch.
02223       if self.eventMarker == sweepMkr:  sweepEvt.set()
02224
02225     log.debug('rcTransitions.__datagramHandler: %s terminating' %
02226               (self.getName()))
02227
02228
02229   def __eventHandlerPlayback(self):
02230     """Handler for calling the application back with played back event data
02231     """
02232     pass # Currently handled by __eventHandler() above
02233
02234   def publishConsumerDG(self, buf):
02235     import LDF
02236     # Pad the contributions with zeros to force it to be an integer number of
02237     # longwords in length
02238     remainder = len(buf) & 0x3
02239     if remainder:  buf += "\x00\x00\x00"[0:4-remainder]
02240     # need to byteswap the raw buffer if little endian
02241     if sys.byteorder == "little":
02242       import array
02243       buf = array.array('L',buf)
02244       buf.byteswap()
02245       buf = buf.tostring()
02246     # get type for this UDF contribution
02247     # pending definition of this contribution, use Scratch
02248     primary   = LDF.LATprimaryId().Base_Scratch
02249     secondary = LDF.LATsecondaryId().Base_Scratch
02250     typeId = LDF.LATtypeId(primary, secondary)
02251     # construct header
02252     dg = LDF.LATdatagram()
02253     # 8's are to accomodate pairs of long words of the UDF heade
02254     # opaque is length of my contribution with header in bytes
02255     dg = struct.pack('>4L',dg.ID,len(buf)+len(dg)+8,typeId.value(),len(buf)+8)
02256     dg = dg+str(buf)
02257     self.__publish(dg)
02258     time.sleep(0.05)
02259
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgFunctions.py Source File

trigger

rcTrgFunctions.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Input Enable Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from TrgObject             import TrgObject
00021 from TrgConditionsValue    import TrgConditionsValue
00022 from TrgEngines            import *
00023 from NullObjects           import NullEngine
00024 from TrgInputEnables       import TrgTileEnables
00025 from TrgCoincidences       import TrgCoincidence
00026
00027
00028 """rcTrgFunctions: Run control Interfaces for Trigger modules"""
00029
00030 class rcTrgEngines(TrgEngines):
00031   """\brief rcTrgEngines Class
00032
00033   Setup a LATTE based trigger engine system.
00034   All sixteen (16) engines are defined.  [0..14] are NullEngine, the last
00035   is a reserved engine that transmits the sweep marker on transitions.
00036   """
00037   def __init__(self):
00038     """\brief rcTrgEngines constructor
00039     """
00040     TrgEngines.__init__(self)
00041     self.__engines = []
00042     for i in range(TrgObject.ENGINE_NUMBER_MAX):
00043       self.__engines.append( NullEngine() )
00044     self.__engines.append( SweepMarkerEngine() )
00045
00046   def replaceEngine(self,engineNumber,engine):
00047     """\brief replaceEngine() method
00048
00049     Replace one of the engines.
00050     \param engineNumber: The engine number to replace [0..14]
00051     \param engine:  The replacement engine
00052     """
00053     if engineNumber == 0xf:
00054       raise IndexError, "Sorry, can't replace engine number 15"
00055     self.__engines[engineNumber] = engine
00056
00057   def engine(self, engineNumber):
00058     """\brief engine() method
00059
00060     Return one of the engines
00061     \param engineNumber: The engine to return
00062     """
00063     if engineNumber < TrgObject.ENGINE_NUMBER_MIN or \
00064        engineNumber > TrgObject.ENGINE_NUMBER_MAX:
00065       raise IndexError, "engineNumber is out of range"
00066     return self.__engines[engineNumber]
00067
00068 class SweepMarkerEngine(TrgEngine):
00069   """\brief SweepMarkerEngine class
00070
00071      This class defines an engine which injects a sweep marker signal.
00072      This engine is not prescaled.
00073   """
00074   SWEEP_MARKER = 5
00075   def __init__(self):
00076     """\brief SweepMarkerEngine constructor
00077     """
00078     TrgEngine.__init__(self)
00079     self.__request = rcTrgInjectMarker(SweepMarkerEngine.SWEEP_MARKER)
00080
00081   def participate(self,conditionsValue):
00082     """\brief participate() method
00083
00084     This function always returns False as this engine never
00085     participates except when RunControl wants it to.
00086     """
00087     return False
00088
00089   def prescale(self):
00090     """\brief prescale() method
00091
00092     Returns 0.  This engine isn't prescaled
00093     """
00094     return 0
00095
00096   def request(self):
00097     """\brief request() method
00098
00099     Returns a TrgInjectMarker object
00100     """
00101     return self.__request
00102
00103 class rcTrgInjectMarker(TrgInjectMarker):
00104   def __init__(self, marker):
00105     TrgInjectMarker.__init__(self, marker)
00106   def zeroSuppress(self):
00107     return True
00108   def sequence(self):
00109     return 1
00110
00111
00112 class rcTrgTileEnables(TrgTileEnables):
00113   """\brief rcTrgTileEnables class
00114
00115   Class to abstract the additions of tiles to the input enable list.
00116   All tiles *not* in the enable list are specifically disabled
00117   """
00118   def __init__(self):
00119     """\brief rcTrgTileEnables constructor
00120     """
00121     TrgTileEnables.__init__(self)
00122     self.__tileA = []
00123     self.__tileB = []
00124
00125   def tile(self, tileNumber):
00126     rc = 0
00127     if tileNumber in self.__tileA :
00128       rc |= 0x1
00129     if tileNumber in self.__tileB :
00130       rc |= 0x2
00131     return rc
00132
00133   def addTile(self, tileNumber, side):
00134     if side & 0x1:
00135       self.__tileA.append(tileNumber)
00136     if side & 0x2:
00137       self.__tileB.append(tileNumber)
00138
00139 class rcTrgCoincidence(TrgCoincidence):
00140   """\brief rcTrgCoincidence class
00141
00142   Class to provide a function to add tiles to coincidence sets.
00143   Also does checking to see if tiles are in the allowed tile set
00144   """
00145   def __init__(self):
00146     TrgCoincidence.__init__(self)
00147     self.__pairList = {}
00148     from TrgGemRegisterGeometry import AcdTileNumbering as TN
00149     self.__badTiles = ( TN['NA0'], TN['NA1'], TN['NA2'], TN['NA3'], TN['NA4'],
00150                         TN['NA5'], TN['NA6'], TN['NA7'], TN['NA8'], TN['NA9'], TN['NA10'] )
00151
00152   def addPair(self, tile1, tile2):
00153     """\brief addPair(tile1, tile2)
00154
00155     \param tile1 an integer
00156     \param tile2 an integer
00157
00158     Add a tile pair, tile1,tile2 to a coincidence list.
00159     Note, the set of tile1 objects must be unique.
00160     """
00161     self.__checkTile(tile1)
00162     self.__checkTile(tile2)
00163     self.__pairList[tile1] = tile2
00164
00165   def inCoincidence(self,tileNumber):
00166     self.__bounds(tileNumber)
00167     if self.__pairList.has_key(tileNumber):
00168       return self.__pairList[tileNumber]
00169     else:
00170       return -1  # Tile not in coincidence List
00171
00172   def __checkTile(self, tile):
00173     self.__bounds(tile)
00174     # self.__badlist(tile)
00175
00176   def __bounds(self,tile):
00177     if tile < TrgObject.TILE_NUMBER_MIN or \
00178        tile > TrgObject.TILE_NUMBER_MAX:
00179       msg = "Tile number %d is out of range" % tile
00180       raise IndexError, msg
00181
00182   def __badlist(self, tile):
00183     if tile in self.__badTiles:
00184       msg = "Tile number %d is a non-assigned tile" % tile
00185       raise IndexError, msg
00186
00187
00188
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgGem.py Source File

trigger

rcTrgGem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.7 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 """rcTrgGem: This class implements a 'threaded' model for enabling/disabling the trigger
00022 """
00023
00024 from TrgGem       import TrgGem
00025 from threading    import Event
00026 import logging
00027 import time
00028
00029 class rcTrgGem(TrgGem):
00030   """\brief rcTrgGem class definition
00031   This class implements a 'threaded' model for enabling/disabling the trigger
00032   """
00033   __SWEEP_TMO        = 3.0            # Sweep timeout in floating point seconds
00034
00035   def __init__(self):
00036     """rcTrgGem constructor
00037     """
00038     self.__triggersEnabled = Event()
00039     self.__enableTime      = -99999999999
00040     self.__disableTime     = -99999999999
00041
00042     TrgGem.__init__(self)                    # do this last
00043
00044   def commit(self, gem = None):
00045     """\brief public commit function
00046
00047     This function commits the configuration defined by this
00048     TrgGem object to the hardware.  It does *all* the registers.
00049     This function should never be called by anyone other than Run Control.
00050     """
00051     if gem is not None:
00052       self.GEM(gem)
00053     self._TrgGem__commit()
00054
00055   def waitForMaskEnable(self, tmo = None):
00056     """Waits until the enableMask() method is called.
00057     This is usually needed by non-self-triggering scripts where
00058     the _commandSynch thread needs to wait until RunControl
00059     actually enables the mask before continuing.
00060
00061     \param tmo  Optional parameter giving the wait timeout in seconds
00062     """
00063     self.__triggersEnabled.wait(tmo)
00064
00065   def getEnableTime(self):
00066     """ Returns the VxWorks timestamp at the time the triggers are enabled
00067
00068     \return Trigger enable time
00069     """
00070     return self.__enableTime
00071
00072   def getDisableTime(self):
00073     """ Returns the VxWorks timestamp at the time the triggers are disabled
00074
00075     \return Trigger disable time
00076     """
00077     return self.__disableTime
00078
00079   def getTimeStamp(self):
00080     """ Returns the VxWorks timestamp for the last time a self-trigger
00081         was asserted.
00082     \return Trigger timestamp
00083     """
00084     ts = self.GEM().GEMC.regs['cmd_trigger'].getTimeStamp()
00085     return ts
00086
00087   def sweepOnShut(self):
00088     """ Returns whether or not shut() does a sweep event.  Default true.
00089     \return a boolean
00090     """
00091     return True
00092
00093   ############### Pure virtual function reimplementation
00094
00095   def enable(self, mask=None):
00096     """Re-implementation of the enable() function to take advantage
00097     of threading
00098     """
00099     if mask is not None:
00100       outMask = mask
00101     elif self.conditions() is not None:
00102       outMask = self.conditions().value()
00103     else:
00104       raise AssertionError, "Attempting to enable a TrgConditionsValue of None"
00105
00106     if self.__triggersEnabled.isSet(): return        # triggers already enabled
00107
00108     gemw = self.GEM().GEMW
00109     gemw.WINDOW_OPEN_MASK = outMask
00110     self.__triggersEnabled.set()
00111
00112     self.__enableTime = gemw.regs['window_open_mask'].getTimeStamp()
00113
00114   def disable(self):
00115     """Re-implementation of the disable() function to take advantage
00116     of threading
00117     """
00118     self.__triggersEnabled.clear()
00119     gemw = self.GEM().GEMW
00120     gemw.WINDOW_OPEN_MASK = 0
00121     self.__disableTime = gemw.regs['window_open_mask'].getTimeStamp()
00122
00123   def shut(self, sweepEvent, progress = None):
00124     """Re-implementation of the shut function to take advantage of the
00125     fact that in rcTrgGem, trigger engine 0 is reserved for the marker.
00126
00127     \param sweepEvent: A sweep Event() defined by runControl
00128     \param progress:   An optional function that returns a non-zero value when
00129                        when events are passing through the system.  If omitted
00130                        a fixed timeout is used.
00131     """
00132
00133     gemw = self.GEM().GEMW
00134     gemsc = self.GEM().GEMSC
00135
00136     #0) determine whether we are enabled or not
00137     if gemw.WINDOW_OPEN_MASK != 0:
00138       enabled = True
00139     else:
00140       enabled = False
00141
00142     #1) disable triggers
00143     goodSolicit  = self.solicit
00144     self.solicit = self.__falseSolicit
00145     self.disable()
00146     sweepEvent.clear()
00147
00148     #2) Replace contents of all schedulers with solicited with (Engine) f
00149     #   Doing it by hand
00150     oldSched = [ gemsc.CONDITIONS_40_47,
00151                  gemsc.CONDITIONS_48_4F,
00152                  gemsc.CONDITIONS_50_57,
00153                  gemsc.CONDITIONS_58_5F,
00154                  gemsc.CONDITIONS_60_67,
00155                  gemsc.CONDITIONS_68_6F,
00156                  gemsc.CONDITIONS_70_77,
00157                  gemsc.CONDITIONS_78_7F ]
00158     scheduler = ( 0xffffffffL )               # Everything's f!
00159     gemsc.CONDITIONS_40_47 = scheduler
00160     gemsc.CONDITIONS_48_4F = scheduler
00161     gemsc.CONDITIONS_50_57 = scheduler
00162     gemsc.CONDITIONS_58_5F = scheduler
00163     gemsc.CONDITIONS_60_67 = scheduler
00164     gemsc.CONDITIONS_68_6F = scheduler
00165     gemsc.CONDITIONS_70_77 = scheduler
00166     gemsc.CONDITIONS_78_7F = scheduler
00167
00168     #2.5) Wait until we don't have progress
00169     if progress is not None:
00170       while True:
00171         if progress() == 0:
00172           break
00173         time.sleep(.5)
00174         # print "waiting for progress"
00175
00176     #3) Change conditions to be solicit only, solicit a trigger
00177     gemw.WINDOW_OPEN_MASK = TrgGem._TrgGem__SOLICIT_MASK
00178     self.GEM().downGEMC().CMD_TRIGGER = 1
00179
00180     #4) Block until the sweep is detected by rcTransitions then disable triggers
00181     tmo = rcTrgGem.__SWEEP_TMO
00182     while (tmo > 0.0):
00183       if sweepEvent.isSet():  break
00184       sweepEvent.wait(0.50)
00185       if progress is not None:
00186         if progress() != 0:
00187           tmo = rcTrgGem.__SWEEP_TMO
00188           continue
00189       tmo -= 0.50
00190     if tmo <= 0:
00191       logging.error("Trigger sweep timed out before all events were drained")
00192       sweepEvent.set()
00193
00194     self.disable()
00195
00196     #5) Put the original contents of schedulers back
00197     gemsc.CONDITIONS_40_47 = oldSched[0]
00198     gemsc.CONDITIONS_48_4F = oldSched[1]
00199     gemsc.CONDITIONS_50_57 = oldSched[2]
00200     gemsc.CONDITIONS_58_5F = oldSched[3]
00201     gemsc.CONDITIONS_60_67 = oldSched[4]
00202     gemsc.CONDITIONS_68_6F = oldSched[5]
00203     gemsc.CONDITIONS_70_77 = oldSched[6]
00204     gemsc.CONDITIONS_78_7F = oldSched[7]
00205
00206     #6) Put the trigger conditions back.
00207     if enabled:
00208       self.enable()
00209     self.solicit = goodSolicit
00210
00211
00212   def __falseSolicit(self):
00213     pass
00214
00215
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcTrgMiniGLT.py Source File

trigger

rcTrgMiniGLT.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.6 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """rcTrgMiniGLT:
00021 This class implements a 'threaded' model for enabling/disabling the trigger
00022 """
00023
00024 from TrgMiniGLT   import TrgMiniGLT
00025 from threading    import Event
00026 import logging
00027
00028 class rcTrgMiniGLT(TrgMiniGLT):
00029   """\brief rcTrgMiniGLT class definition
00030   This class implements a 'threaded' model for enabling/disabling the trigger
00031   """
00032   __SWEEP_MARKER     = 5               # Arbitrary marker value for recognizing
00033                                        #   when the event pipeline is flushed
00034   __SWEEP_TMO        = 3.0             # Sweep timeout in floating point seconds
00035   def __init__(self):
00036     """\brief rcTrgGem constructor
00037     """
00038     self.__triggersEnabled = Event()
00039
00040     TrgMiniGLT.__init__(self)                 # do this last
00041     self.__cacheMask       = None
00042
00043   def commit(self):
00044     """\brief public commit function
00045     This function commits the configuration defined by this
00046     TrgGem object to the hardware.  It does *all* the registers.
00047     This function should never be called by anyone other than Run Control.
00048     """
00049     self._TrgMiniGLT__commit()
00050
00051   def waitForMaskEnable(self, tmo = None):
00052     """Waits until the enableMask() method is called.
00053     This is usually needed by non-self-triggering scripts where
00054     the _commandSynch thread needs to wait until RunControl
00055     actually enables the mask before continuing.
00056
00057     \param tmo  Optional parameter giving the wait timeout in seconds
00058     """
00059     self.GLT().waitForMaskEnable(tmo)
00060
00061   def getEnableTime(self):
00062     """ Returns the VxWorks timestamp at the time the triggers are enabled
00063
00064     \return Trigger enable time
00065     """
00066     return self.GLT().getEnableTime()
00067
00068   def getDisableTime(self):
00069     """ Returns the VxWorks timestamp at the time the triggers are disabled
00070
00071     \return Trigger disable time
00072     """
00073     return self.GLT().getDisableTime()
00074
00075   def getTimeStamp(self):
00076     """ Returns the VxWorks timestamp for the last time a self-trigger
00077         was asserted.
00078     \return Trigger timestamp
00079     """
00080     return self.GLT().regs['CMD_SELF_TRIGGER'].getTimeStamp()
00081
00082   def sweepOnShut(self):
00083     """ Returns whether or not shut() does a sweep event.  Default true.
00084     \return a boolean
00085     """
00086     return True
00087
00088   ############### Pure virtual function reimplementation
00089
00090   def enable(self, newMask=None):
00091     """Re-implementation of the enable() function to take advantage
00092     of threading and timestamps
00093
00094     Adds an argument to deal with several weird masking problems
00095     Only rcTransitions should use the above argument
00096     """
00097     if self.conditions() is not None:
00098       outMask = ~self.conditions().value()          # remember the MiniGLT has ~logic
00099     else:
00100       raise AssertionError, "Attempting to enable a TrgConditionsValue of None"
00101
00102     if newMask is not None:
00103       self.__cacheMask = newMask
00104
00105     if self.__cacheMask is not None:
00106       outMask = self.__cacheMask
00107
00108     self.GLT().MASK = outMask
00109     self.GLT().enableMask()
00110
00111   def disable(self):
00112     """Re-implementation of the disable() function to take advantage
00113     of threading and timestamps
00114     """
00115     self.GLT().disableMask()
00116
00117   def shut(self, sweepEvent, progress = None):
00118     """Re-implementation of the shut function to take advantage of the
00119     fact that in rcTrgMiniGLT, trigger engine 0 is reserved for the marker.
00120
00121     \param sweepEvent: A sweep Event() defined by runControl
00122     \param progress:   An optional function that returns a non-zero value when
00123                        when events are passing through the system.  If omitted
00124                        a fixed timeout is used.
00125     """
00126
00127     glt = self.GLT()
00128
00129     #0) disable triggers
00130     if not glt.triggersDisabled():
00131       enabled = True
00132     else:
00133       enabled = False
00134     goodSolicit  = self.solicit
00135     self.solicit = self.__falseSolicit
00136
00137     self.disable()
00138     sweepEvent.clear()
00139
00140     #1) Set up marker logic
00141     mask           = glt.MASK           # Cache Mask, CalStrobe and Tack
00142     calStrobe      = glt.CAL_STROBE
00143     tack           = glt.TACK
00144     zeroSuppress   = glt.ZERO_SUPPRESS
00145     fourRange      = glt.FOUR_RANGE_READOUT
00146     marker         = glt.MARKER
00147
00148     glt.MASK       = TrgMiniGLT._TrgMiniGLT__SOLICIT_MASK # Enable internal trigger only
00149     glt.MARKER     = rcTrgMiniGLT.__SWEEP_MARKER          # Signal that we're sweeping
00150     glt.CAL_STROBE = 0                  # Don't inject charge
00151     glt.TACK       = 1                  # Force a readout
00152     glt.ZERO_SUPPRESS       = 1         # Yes to zero suppression
00153     glt.FOUR_RANGE_READOUT  = 0         # No to four range readout
00154
00155     #2) enable and solicit
00156     glt.enableMask()
00157     self.waitForMaskEnable()
00158     self.GLT().CMD_SELF_TRIGGER = 1     # Solicit a trigger
00159
00160     #3) Block until the sweep is detected by rcTransitions then disable triggers
00161     tmo = rcTrgMiniGLT.__SWEEP_TMO
00162     while (tmo > 0.0):
00163       if sweepEvent.isSet():  break
00164       sweepEvent.wait(0.5)
00165       if progress is not None:
00166         if progress() != 0:
00167           tmo = rcTrgMiniGLT.__SWEEP_TMO
00168           continue
00169       tmo -= 0.5
00170     if tmo <= 0:
00171       logging.error("Trigger sweep timed out before all events were drained")
00172       sweepEvent.set()
00173     self.disable()
00174
00175     #4) Put the original contents of scheduler 0x40 back, and put the TAM back
00176     glt.CAL_STROBE         = calStrobe
00177     glt.TACK               = tack
00178     glt.MARKER             = marker
00179     glt.ZERO_SUPPRESS      = zeroSuppress
00180     glt.FOUR_RANGE_READOUT = fourRange
00181     glt.MASK               = mask
00182
00183     #5) Put the trigger conditions back
00184     if enabled:
00185       glt.enableMask()
00186     self.solicit = goodSolicit
00187
00188
00189   def __falseSolicit(self):
00190     pass
00191
00192
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUsers.py Source File

runcontrol

rcUsers.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "User maintenance classes"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/24 23:16:44 $").split(' ')[1]
00014 __version__  = "$Revision: 2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 class rcUser(object):
00020   """Class that stores security and identification information about users
00021   """
00022   def __init__(self, userId, loginId, userName):
00023     self.__userId = userId
00024     self.__loginId = loginId
00025     self.__userName = userName
00026     self.__roles = []
00027     self.__permissions = []
00028
00029   def getId(self):
00030     """Returns the three digit user id
00031
00032     \return User Id
00033     """
00034     return self.__userId
00035
00036   def getLoginId(self):
00037     """Returns the user's login id
00038
00039     \return Login id
00040     """
00041     return self.__loginId
00042
00043   def getName(self):
00044     """Returns the user name
00045
00046     \return User name
00047     """
00048     return self.__userName
00049
00050   def getRoles(self):
00051     """Returns the list of roles that this user belongs in
00052
00053     \return List of roles
00054     """
00055     return self.__roles
00056
00057   def getPermissions(self):
00058     """Returns the list of permissions that this user has
00059
00060     \return List of permissions
00061     """
00062     return self.__permissions
00063
00064   def addRole(self, role):
00065     """Adds \a role to this user's roles
00066
00067     \param role Role name
00068     """
00069     self.__roles.append(role)
00070
00071   def addPermission(self, permission):
00072     """Adds \a permission to this user's permissions
00073
00074     \param permission Permission name
00075     """
00076     self.__permissions.append(permission)
00077
00078   def isAdministrator(self):
00079     """Returns the user's administrator status
00080
00081     \return 1: If this user is an administrator
00082             0: Otherwise
00083     """
00084     return ('administrator' in self.__roles)
00085
00086   def __str__(self):
00087     return self.getName()
00088
00089 class rcUsers(object):
00090   """A dictionary like class that maintains a list of user objects
00091   """
00092   def __init__(self):
00093     self.__users = {}
00094
00095   def addUser(self, user):
00096     """Adds the \a user to the list
00097
00098     \param user An rcUser object instance
00099     """
00100     self.__users[user.getId()] = user
00101
00102   def deleteUser(self, userId):
00103     """Deletes the user from the list based on the \a userId
00104
00105     \param userId The three digit id of the user
00106     """
00107     self.__users.__delitem__(userId)
00108
00109   def getUserByLoginId(self, loginId):
00110     """Retrieves the user based on the \a loginId
00111
00112     \param loginId Login id of the user
00113
00114     \return rcUser object instance
00115     """
00116     for user in self.__users.values():
00117       if loginId == user.getLoginId():
00118         return user
00119
00120   def getUserByName(self, name):
00121     """Retrieves the user based on the \a name
00122
00123     \param name Name of the user
00124
00125     \return rcUser object instance
00126     """
00127     for user in self.__users.values():
00128       if name == user.getName():
00129         return user
00130
00131   def getUser(self, userId):
00132     """Retrieves the user based on \a userid
00133
00134     \param Three digit of the user
00135
00136     \return rcUser object instance
00137     """
00138     if userId in self.__users:
00139       return self.__users[userId]
00140
00141   def getUsers(self):
00142     """Retrieves all users
00143
00144     \return A dictionary of all users keyed by the user id
00145     """
00146     return self.__users
00147
00148   def getIdNameDict(self):
00149     """Retrieves all users in the form of a dictionary
00150     where values are user names. Provided for backward compatibility
00151     with the old code.
00152
00153     \return A dictionary of user names keyed by the user id
00154     """
00155     # Provided for backward compatibility to mimick the old list
00156     userList = {}
00157     for (userId, user) in self.__users.items():
00158       userList[userId] = user.getName()
00159     return userList
00160
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: rcUtil.py Source File

runcontrol

rcUtil.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT run control related utility methods"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/11/05 00:46:34 $").split(' ')[1]
00014 __version__  = "$Revision: 2.3 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import imp
00020 import os
00021 import sys
00022
00023 class Reloader:
00024   """Class allows for reloading all modules imported
00025   after the instance is created.
00026   """
00027   DONT_RELOAD_LIST = ['scipy', 'weave', 'qwt', 'xml', 'pyexpat', 'win32']
00028   def __init__(self):
00029     self.keys = sys.modules.keys()
00030   def __call__(self, *args, **namedargs):
00031     # Delete the modules from the system before reloading them
00032     dontReloadList = Reloader.DONT_RELOAD_LIST
00033     if args[0] is not None:
00034       for m in args[0]:
00035         if m not in dontReloadList:
00036           dontReloadList.append(m)
00037     toBeDeleted = {}
00038     for key, val in sys.modules.items():
00039       if (key not in self.keys):
00040         shouldReload = 1
00041         for module_prefix in dontReloadList:
00042           if key.startswith(module_prefix):
00043             shouldReload = 0
00044             break
00045         if shouldReload:
00046           toBeDeleted[key] = val
00047           del sys.modules[key]
00048
00049     for key, val in toBeDeleted.items():
00050       try:
00051         # Uncomment the "print" line below to find out the modules
00052         # that may cause problems when they get reloaded.
00053         # After determining which modules should be excluded
00054         # add import statements for these modules in RunControlMain
00055
00056         #print "Reloading", key
00057         reload( val )
00058       except (ImportError):
00059         #print "Couldn't reload module:", key
00060         pass
00061       except (TypeError): # for None's
00062         pass
00063
00064 reloadModules = Reloader()
00065
00066 def deleteModule(moduleName):
00067   if moduleName in sys.modules:
00068     for m in dir(sys.modules[moduleName]):
00069       if m in sys.modules and m != moduleName:
00070         deleteModule(m)
00071     print "Deleting ", moduleName
00072     del sys.modules[moduleName]
00073
00074
00075 def importModule(appName, reload=1, dontReloadList=None):
00076   """Import a RunControl application or suite
00077   \param appName        Name of the module or pathname of the python script
00078   \param reload         1 = Reload all modules that have been loaded since RunControl started (default)
00079                         0 = Do not reload modules (used if a suite is being loaded)
00080   \param dontReloadList Optional parameter which specifies the additional list of module prefixes
00081                         that should not be reloaded. If this parameter is missing then the default list
00082                         (Reloader.DONT_RELOAD_LIST) is used, if it is specified then it gets appended
00083                         to the default list.
00084
00085   \return The name of the module and the resolved pathname
00086
00087   """
00088
00089   # First check if a module name is specified, if so try to resolve its source.
00090   (appPath, appFile) = os.path.split(appName)
00091   (appBase, appExt)  = os.path.splitext(appFile)
00092   if appExt == '':
00093     try:
00094       if appPath == '':
00095         (f, path, desc) = imp.find_module(appBase)
00096       else:
00097         (f, path, desc) = imp.find_module(appBase, [appPath])
00098       (appPath, appFile) = os.path.split(path)
00099       (appBase, appExt)  = os.path.splitext(appFile)
00100     except ImportError, e:
00101       raise e
00102
00103   _suffixes = {}
00104   for ext, mode, typ in imp.get_suffixes():
00105     _suffixes[ext] = (ext, mode, typ)
00106   _infoMap =  {
00107                 '.py' : ('.py','r',1),
00108                 '.pyc': ('.pyc','rb',2),
00109                 '.pyo': ('.pyo','rb',2)
00110               }
00111
00112
00113   # Temporarily change the directory in case the application
00114   # needs to load additional modules from the same directory.
00115   curDir = os.getcwd()
00116   if appPath != '': os.chdir(appPath)
00117   if '.' not in sys.path:
00118     sys.path.append('.')
00119
00120   # Handle relative paths, by resolving the path again after current directory is changed.
00121   appPath = os.getcwd()
00122   appName = os.path.join(appPath, appFile)
00123   #~ appStuff = self.__bml.find_module(appBase, (appPath,))
00124   #~ if appStuff is None:
00125     #~ msg = 'Application %s is invalid' % appName
00126     #~ logging.error(msg)
00127     #~ return msg
00128
00129   pycFile = os.path.join(appPath, appBase + '.pyc')
00130   pyoFile = os.path.join(appPath, appBase + '.pyo')
00131   if appExt == '.py':
00132     if os.path.exists(pyoFile) and os.path.getmtime(pyoFile) >= os.path.getmtime(appName):
00133         filename = pyoFile
00134         appExt = '.pyo'
00135     elif _suffixes.has_key('.pyo'):
00136         filename = appName
00137     elif os.path.exists(pycFile) and os.path.getmtime(pycFile) >= os.path.getmtime(appName):
00138       filename = pycFile
00139       appExt = '.pyc'
00140     else:
00141       filename = appName
00142   elif appExt == '.pyc':
00143     if os.path.exists(pyoFile) and os.path.getmtime(pyoFile) >= os.path.getmtime(appName):
00144       filename = pyoFile
00145       appExt = '.pyo'
00146     else:
00147       filename = appName
00148   elif appExt == '.pyo':
00149     filename = appName
00150   else:
00151     msg = 'Invalid module extension: %s' % appName
00152     raise RuntimeError, msg
00153   info = _infoMap[appExt]
00154   f = file(filename, info[1])
00155
00156   #module = self.__bml.load_module(appBase, appStuff)
00157
00158   # RiC: Commented out outter try block since I don't understand what it's for.
00159   #      It hides the traceback that I need to see why an import fails.
00160   #try:
00161   try:
00162     # Reload the modules that was loaded after this script
00163     if reload: reloadModules(dontReloadList)
00164     module = imp.load_module(appBase, f, filename, info)
00165   finally:
00166     f.close()
00167     os.chdir(curDir)
00168   #except Exception, e:
00169   #  raise e
00170   return (module, filename)
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Receiver.py Source File

monitoring

Receiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Housekeeping receiver module"
00012 __author__   = "J. Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "7/20/2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.Trendable import Trendable
00021 import logging
00022
00023 class Receiver(object):
00024   """\brief Abstract Receiver class
00025
00026   Receiver objects retrieve the trendable data from some location.
00027   """
00028   def __init__(self):
00029     self.log=logging.getLogger('monitoring.Receiver')
00030     self.__loopStop=0
00031     self.__recThread=None
00032
00033   def isReceiving(self):
00034     if self.__monThread: return 1
00035     else: return 0
00036
00037   def setReceiving(self,bool):
00038     if bool: self.__startLoop()
00039     else: self.__stopLoop()
00040
00041   def shutdown(self):
00042     self.setReceiving(0)
00043
00044   def receive(self):
00045     raise NotImplementedError('receive()' \
00046                               +'must be implemented in a subclass.')
00047
00048   def process(self,trendables):
00049     for t in trendables:
00050       self.log.info(t)
00051
00052 ##private
00053   def __startLoop(self):
00054     if not self.__recThread:
00055       from threading import Thread
00056       self.__recThread=Thread(None,self.__recLoop,'ReceiverLoop')
00057       self.__recThread.start()
00058     else:
00059       self.log.warning('Already a ReceiverLoop Running')
00060
00061   def __stopLoop(self):
00062     if self.__recThread:
00063       self.__loopStop=1
00064       self.__recThread.join()
00065       self.loopStop=0
00066       self.__recThread=None
00067
00068   def __recLoop(self):
00069     self.log.info('Starting Receive Loop')
00070     while (not self.__loopStop):
00071       self.receive()
00072     self.log.info('Receive Loop Stopped')
00073
00074 class UDPReceiver(Receiver):
00075   """\brief UDPReceiver class
00076   """
00077   tType = (Trendable('InvalidName', 0))
00078   def __init__(self):
00079     Receiver.__init__(self)
00080     self.__ddc=None
00081     self.log=logging.getLogger('monitoring.UDPReceiver')
00082
00083   def receive(self):
00084     if self.__ddc:
00085       from cPickle import loads
00086       d,s=self.__ddc.receive()
00087       if not d: return
00088       trendables=loads(d)
00089       for t in trendables:
00090         if not isinstance(t,type(self.tType)):
00091           self.log.error('Data received is not a Trendable')
00092           trendables.remove(t)
00093       self.process(trendables)
00094
00095   def setUDPClient(self,name,server):
00096     from LATTE.tools.DataDistributor import DataDistributorClient
00097     self.log.info('Connecting to DataDistributorServer %s on %s',
00098                     name,server)
00099     #self.__ddc=DataDistributorClient(name,length=40960)
00100     self.__ddc=DataDistributorClient(name)
00101     self.__ddc.connect(server)
00102
00103   def shutdown(self):
00104     if self.__ddc:
00105       self.__ddc.returnNone()
00106     self.setReceiving(0)
00107     if self.__ddc:
00108       self.log.info('Disconnecting from DataDistributorServer')
00109       self.__ddc.disconnect()
00110       self.__ddc=None
00111
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Recorder.py Source File

monitoring

Recorder.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import logging
00020 import os
00021
00022 class Recorder(object):
00023   """\brief Recorder class
00024
00025   Base class for the Recorder portion of the monitoring system.
00026   Recorders send on the data that the Retriever class acquires.
00027   """
00028   def __init__(self):
00029     self.__cachedValues={}
00030     self.__log=logging.getLogger('monitoring.Recorder')
00031
00032   def updateTrends(self, trendables):
00033     if trendables is None: return
00034     for t in trendables:
00035       self.__cachedValues[t.name]=t
00036     self.processTrends(trendables)
00037
00038   def processTrends(self, trendables):
00039     raise NotImplementedError('processTrends(trendables)'\
00040                               +'must be implemented in a subclass.')
00041
00042   def shutdown(self):
00043     pass
00044
00045 class DummyRecorder(Recorder):
00046   """\brief Example recorder that dumps the trendables to a logger
00047   """
00048   def __init__(self):
00049     Recorder.__init__(self)
00050     self.__log=logging.getLogger('monitoring.Recorder')
00051
00052   def processTrends(self, trendables):
00053     for t in trendables:
00054       self.__log.info(t)
00055
00056 class FlatFileRecorder(Recorder):
00057   def __init__(self, flatFile):
00058     Recorder.__init__(self)
00059     self.__flatFile = open(flatFile, 'a+')
00060
00061     keyList         = self.__flatFile.readline()
00062     if keyList == '':  # No file,
00063       self.processTrends = self.__createFileHeader
00064     else:
00065       # create a list of keys from whitespace separated text blobs
00066       self.__keyList = keyList.split()
00067       self.processTrends = self.__processTrends
00068     self.__flatFile.seek(0,2)
00069     self.__pad = '   '
00070
00071   def shutdown(self):
00072     self.__flatFile.close()
00073
00074   def __processTrends(self, trendables):
00075     trendMap  = {}
00076     # Add the timestamp
00077     timeStamp = trendables[0].time
00078     trendMap['TimeStamp'] =timeStamp
00079     line = ''
00080
00081     for t in trendables:
00082       trendMap[t.name] = t.content['Raw Value']
00083
00084     for k in self.__keyList:
00085       line += str(trendMap[k]) + self.__pad
00086     line += '\n'
00087     self.__flatFile.write(line)
00088     self.__flatFile.flush()
00089
00090   def __createFileHeader(self, trendables):
00091     # 1: reset function pointer to processTrends
00092     self.processTrends = self.__processTrends
00093     # 2: create the sorted key list
00094     self.__keyList     = []
00095     for t in trendables:
00096       self.__keyList.append(t.name)
00097     self.__keyList.sort()
00098     self.__keyList.insert(0, 'TimeStamp')
00099     line = ''
00100     # 3: write the index line of the file:
00101     for k in self.__keyList:
00102       line += (k + self.__pad)
00103     line += '\n'
00104     self.__flatFile.writelines([line])
00105     # 4: Profit!
00106     self.processTrends(trendables)
00107
00108
00109 class UDPRecorder(Recorder):
00110   """\brief Example recorder that UDP broadcasts trendables
00111
00112   Uses LATTE.tools.DataDistributionServer
00113   """
00114   def __init__(self):
00115     Recorder.__init__(self)
00116     self.__dds=None
00117     self.__log=logging.getLogger('monitoring.UDPRecorder')
00118
00119   def startUDPServer(self,name,server):
00120     from LATTE.tools.DataDistributor import DataDistributorServer
00121     self.__log.info("Starting DataDistributorServer %s on %s",name,server)
00122     self.__dds=DataDistributorServer(name)
00123     self.__dds.connect(server)
00124
00125   def stopUDPServer(self):
00126     if self.__dds:
00127       self.__log.info('Disconnecting Broadcast Server')
00128       self.__dds.disconnect()
00129       self.__dds=None
00130
00131   def processTrends(self,trendables):
00132     if self.__dds:
00133       from cPickle import dumps
00134       # Send to receiver as a binary pickled object
00135       self.__dds.publish(dumps(trendables,1))
00136
00137   def shutdown(self):
00138     self.stopUDPServer()
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Retriever.py Source File

monitoring

Retriever.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Housekeeping retriever module"
00012 __author__   = "J. Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "7/20/2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.Trendable import Trendable
00021
00022 class Retriever(object):
00023   def __init__(self):
00024     pass
00025   def startup(self):
00026     pass
00027   def shutdown(self):
00028     pass
00029   def retrievePacket(self):
00030     raise NotImplementedError('retrievePacket()'\
00031                               +'must be implemented in a subclass.')
00032
00033 class DummyRetriever(Retriever):
00034   """ Dummy retriever used for testing.
00035
00036   Creates 24 trendable objects which are simply sin/cos functions.
00037   """
00038   def __init__(self):
00039     self.monitorList={}
00040     for i in range(12):
00041       self.monitorList['cos_'+'%02i'%(i,)]={'lofail':-0.9,'lowarn':-0.7,
00042                                             'hiwarn':0.7,'hifail':0.9}
00043       self.monitorList['sin_'+'%02i'%(i,)]={'lofail':-0.9,'lowarn':-0.7,
00044                                             'hiwarn':0.7,'hifail':0.9}
00045
00046   def retrievePacket(self):
00047     import math, time
00048     t=time.time()
00049     data=[]
00050     keys=self.monitorList.keys()
00051     keys.sort()
00052     for k in keys:
00053       if k.startswith('sin'):
00054         v=math.sin(t*math.pi/12)
00055       elif k.startswith('cos'):
00056         v=math.cos(t*math.pi/12)
00057       # print "appending Trendable ", k
00058       data.append(Trendable(k,t,{'Raw Value':v}))
00059     return data
00060
Generated on Fri Jan 21 18:00:51 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: robustapply.py Source File

dispatch

robustapply.py

00001 """Robust apply mechanism
00002
00003 Provides a function "call", which can sort out
00004 what arguments a given callable object can take,
00005 and subset the given arguments to match only
00006 those which are acceptable.
00007 """
00008
00009 def function( receiver ):
00010     """Get function-like callable object for given receiver
00011
00012     returns (function_or_method, codeObject, fromMethod)
00013
00014     If fromMethod is true, then the callable already
00015     has its first argument bound
00016     """
00017     if hasattr(receiver, '__call__'):
00018         # receiver is a class instance; assume it is callable.
00019         # Reassign receiver to the actual method that will be called.
00020         if hasattr( receiver.__call__, 'im_func') or hasattr( receiver.__call__, 'im_code'):
00021             receiver = receiver.__call__
00022     if hasattr( receiver, 'im_func' ):
00023         # an instance-method...
00024         return receiver, receiver.im_func.func_code, 1
00025     elif not hasattr( receiver, 'func_code'):
00026         raise ValueError('unknown reciever type %s %s'%(receiver, type(receiver)))
00027     return receiver, receiver.func_code, 0
00028
00029 def robustApply(receiver, *arguments, **named):
00030     """Call receiver with arguments and an appropriate subset of named
00031     """
00032     receiver, codeObject, startIndex = function( receiver )
00033     acceptable = codeObject.co_varnames[startIndex+len(arguments):codeObject.co_argcount]
00034     for name in codeObject.co_varnames[startIndex:startIndex+len(arguments)]:
00035         if named.has_key( name ):
00036             raise TypeError(
00037                 """Argument %r specified both positionally and as a keyword for calling %r"""% (
00038                     name, receiver,
00039                 )
00040             )
00041     if not (codeObject.co_flags & 8):
00042         # fc does not have a **kwds type parameter, therefore
00043         # remove unacceptable arguments.
00044         for arg in named.keys():
00045             if arg not in acceptable:
00046                 del named[arg]
00047     return receiver(*arguments, **named)
00048
00049
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControl.py Source File

runcontrol

RunControl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT run control class"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "10/11/2002"
00014 __version__  = "$Revision: 2.4 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020 import                          os
00021 import                          sys
00022 import                          atexit
00023 import                          threading
00024 import logging           as     log
00025 from   qt                import *
00026
00027 from   Queue             import Queue
00028 from   RunControlFSM     import RunControlFSM
00029 from   RunControlGUIImpl import RunControlGUIImpl
00030
00031 from   LATTE.database.gVersions import Gversions
00032 from   LATTE.tools.guiBridges   import QtThreadBridge, PyThreadBridge
00033 from   LATTE.client.gLog        import logException
00034 from   LATTE.tools.taskEngine   import TaskEngine
00035
00036
00037 class ConnectState:
00038   Disconnected = 0
00039   Waiting      = 1
00040   Connected    = 2
00041
00042 class RunControl(RunControlGUIImpl):
00043   """Class for providing a run control framework
00044   """
00045
00046   GUI_CMD_INST    = QEvent.User + 1
00047   GUI_CMD_FUNC    = QEvent.User + 2
00048   GUI_CMD_FUNC_NR = QEvent.User + 3
00049
00050   def __init__(self, common, parent = None, name = None, fl = 0):
00051     RunControlGUIImpl.__init__(self, common, parent, name, fl)
00052
00053     self.gui      = self                # For backward compatibility
00054
00055     self.__common       = common
00056     self.__fsm          = None
00057     self.__actionEngine = None
00058     self.__hwVersions   = None
00059     self.__queue        = None
00060     self.__engine       = None
00061
00062     # Set this object to be the client handler
00063     common.getCmdCli().handler(self)
00064     self.__connection_state = ConnectState.Disconnected
00065     #self.StopButton.setEnabled(False)
00066     #self.RunButton.setEnabled(False)
00067     #self.PauseButton.setEnabled(False)
00068
00069     # Set up the GUI bridge
00070     self.initGUIbridges()
00071
00072     self.__actionEngine = TaskEngine("FSMactionEngine")
00073     self.__actionEngine.start()
00074
00075     self.commandSynch = TaskEngine("CommandSynch")
00076     self.commandSynch.start()
00077
00078     self.eventHandler = TaskEngine("EventHandler")
00079     self.eventHandler.start()
00080
00081     # Clean up at exit
00082     self.inShutdown = False
00083     atexit.register(self.__shutdown)
00084
00085   def disconnected(self):
00086     self.__disconnect()
00087
00088   def timedout(self):
00089     self.__disconnect()
00090
00091   def __connection_notthere(self): # GUI thread
00092     #self.StopButton.setEnabled(False)
00093     #self.RunButton.setEnabled(False)
00094     #self.PauseButton.setEnabled(False)
00095     if self.__connection_state == ConnectState.Connected:
00096       log.error("OCS server disconnected, trying to reconnect")
00097       self.__connection_state = ConnectState.Waiting
00098       self.__common.disconnect() # RiC
00099       self.__connect()
00100
00101   def __connection_established(self): # GUI thread
00102     log.info("OCS server is now connected")
00103     #self.StopButton.setEnabled(True)
00104     #self.RunButton.setEnabled(True)
00105     #self.PauseButton.setEnabled(True)
00106     self.__connection_state = ConnectState.Connected
00107
00108   def __connection_failed(self, msg): # GUI thread
00109     if self.__tries == 0:
00110       log.error(msg)
00111     self.__tries += 1
00112     return self.__connection_state
00113
00114   def connectClicked(self): # GUI thread
00115     if self.__connection_state is ConnectState.Disconnected:
00116       self.fileConnectAction.setMenuText("Disconnect")
00117       self.__connection_state = ConnectState.Waiting
00118       self.__tries = 0
00119       self.__connect()
00120     else:
00121       self.fileConnectAction.setMenuText("Connect")
00122       self.__connection_state = ConnectState.Disconnected
00123       self.__disconnect()
00124
00125   def __connect(self):
00126     connecthdlr = threading.Thread(None, self.__connection_handler, 'ConnectHandler',())
00127     connecthdlr.setDaemon(True)
00128     connecthdlr.start()
00129
00130   def __disconnect(self):
00131     self.execGUImethod(self.__connection_notthere)
00132
00133   def __connection_handler(self):
00134     while (True):
00135       try:
00136         self.__common.connect()
00137         self.execGUImethodNR(self.__connection_established)
00138         break
00139       except RuntimeError, msg:
00140         state = self.execGUImethod(self.__connection_failed, msg)
00141         if state == ConnectState.Disconnected: break
00142         time.sleep(3)
00143
00144   def userId(self):
00145     return 43231  #self.preferences()["userid"]
00146
00147   def __statusMsg(self, msg, tmo):
00148     self.statusBar().message(msg, tmo)
00149
00150   def __shutdown(self):
00151     """\brief Clean up and shut down the various threads.
00152     """
00153     # This method expects to be executed from the GUI thread.
00154
00155     self.inShutdown = True
00156
00157     # Bring the system into the RESET state
00158     self.doReset()
00159
00160     # Use the following non-NR call to wait for the reset to finish
00161     self.execGUImethod(self.statusBar().message, "Exiting")
00162
00163     # Shut down the task engines
00164     self.__actionEngine.shutdown()
00165     self.eventHandler.shutdown()
00166     self.commandSynch.shutdown()
00167
00168     # After the FSM Action Engine has shut down we can delete the FSM
00169     if self.__fsm:
00170       del self.__fsm
00171       self.__fsm = None
00172
00173   def __start(self, applName):
00174     ## Import the application
00175     #(appPath, appFile) = os.path.split(applName)
00176     #(appBase, appExt)  = os.path.splitext(appFile)
00177     #appStuff = self.__bml.find_module(appBase, (appPath,))
00178     #if appStuff is None:
00179     #  msg = 'Application %s is invalid' % applName
00180     #  logging.error(msg)
00181     #  return msg
00182     #module = self.__bml.load_module(appBase, appStuff)
00183     #if 'userApplication' not in dir(module):
00184     #  msg = 'Application %s is missing a userApplication class' % applName
00185     #  logging.error(msg)
00186     #  return msg
00187
00188     import rcUtil
00189     try:
00190       dontReloadList = self.__common.options().noreload
00191       (module, filename) = rcUtil.importModule(appName=applName, reload=1, dontReloadList=dontReloadList)
00192     except Exception, e:
00193       logException()
00194       self.execGUImethodNR(self.__statusMsg, e[0], 0)
00195       return
00196
00197     # Instantiate the application
00198     app = module.userApplication(self, self.__common.prefMan().userId(),
00199                                  self.__common.options().evtdebug is not None)
00200     log.info("Application %s loaded" % app.getName())
00201
00202     # Set up the Finite State Machine
00203     self.__fsm = RunControlFSM(app)
00204
00205     self.execGUImethodNR(self.__statusMsg, '%s: Loaded application %s' %
00206                          (self.__fsm.current_state, applName), 0)
00207
00208   def SetupClicked(self):
00209     RunControlGUIImpl.SetupClicked(self)
00210     self.__actionEngine.spawn(self.__setup)
00211
00212   def __setup(self):
00213     if self.__fsm is not None:
00214       self.__fsm.process('SETUP')
00215       self.__statusMsg(self.__fsm.current_state, 0)
00216
00217   def TeardownClicked(self):
00218     RunControlGUIImpl.TeardownClicked(self)
00219     self.__actionEngine.spawn(self.__teardown)
00220
00221   def __teardown(self):
00222     if self.__fsm is not None:
00223       self.__fsm.process('TEARDOWN')
00224       self.__statusMsg(self.__fsm.current_state, 0)
00225
00226   def StartRunClicked(self):
00227     RunControlGUIImpl.StartRunClicked(self)
00228     self.__actionEngine.spawn(self.__run)
00229
00230   def __run(self):
00231     if self.__fsm is not None:
00232       self.__fsm.process('START_RUN')
00233       self.__statusMsg(self.__fsm.current_state, 0)
00234
00235   def StopRunClicked(self):
00236     RunControlGUIImpl.StopRunClicked(self)
00237     self.__actionEngine.spawn(self.__stoprun)
00238
00239   def __stoprun(self):
00240     if self.__fsm is not None:
00241       self.__fsm.process('STOP_RUN')
00242       self.__statusMsg(self.__fsm.current_state, 0)
00243
00244   def PauseClicked(self):
00245     RunControlGUIImpl.PauseClicked(self)
00246     self.__actionEngine.spawn(self.__pause)
00247
00248   def __pause(self):
00249     if self.__fsm is not None:
00250       self.__fsm.process('PAUSE')
00251       self.__statusMsg(self.__fsm.current_state, 0)
00252
00253   def ResumeClicked(self):
00254     RunControlGUIImpl.ResumeClicked(self)
00255     self.__actionEngine.spawn(self.__resume)
00256
00257   def __resume(self):
00258     if self.__fsm is not None:
00259       self.__fsm.process('RESUME')
00260       self.__statusMsg(self.__fsm.current_state, 0)
00261
00262   def StopClicked(self):
00263     RunControlGUIImpl.StopClicked(self)
00264     self.__actionEngine.spawn(self.__stop)
00265
00266   def __stop(self):
00267     if self.__fsm is not None:
00268       self.__fsm.process('STOP')
00269       self.__statusMsg(self.__fsm.current_state, 0)
00270
00271
00272   def load(self):
00273     if self.__fsm is not None and self.__fsm.current_state != 'RESET':
00274       print "Applications are loadable only in the RESET state"
00275       self.__statusMsg('%s: Applications are loadable only in the RESET state' %
00276                        (self.__fsm.current_state), 0)
00277       return
00278
00279     applName = RunControlGUIImpl.load(self)
00280     if applName is None:
00281       if self.__fsm is not None:
00282         self.__statusMsg('%s: Loading aborted' % (self.__fsm.current_state), 0)
00283       else:
00284         self.__statusMsg('Loading aborted', 0)
00285       return
00286
00287     if self.__fsm is not None:
00288       self.__shutdown()
00289
00290     # Start the application in its own thread after the reset from above
00291     # (if any) completes.
00292     self.__actionEngine.spawn(self.__start, str(applName))
00293
00294     #msg = self.__start(str(applName))
00295     #if msg is None:
00296     #  self.__statusMsg('%s: Loaded application %s' %
00297     #                   (self.__fsm.current_state, applName), 0)
00298     #else:
00299     #  self.__statusMsg(msg, 0)
00300
00301   def fileExit(self):
00302     self.close()
00303
00304   def ExitButtonClicked(self):
00305     self.close()
00306
00307   def doReset(self):
00308     """Emit a Reset button click under program control.
00309     Can be done from a subthread."""
00310     self.doEmit(self.ResetButton)
00311
00312   def doStop(self):
00313     """Emit a Stop button click under program control.
00314     Can be done from a subthread."""
00315
00316     # Ignore the doStop for this RunControl GUI
00317     return
00318     self.doEmit(self.StopButton)
00319
00320   def doStopRun(self):
00321     """Depricated version of doStop()."""
00322     self.doStop()
00323
00324   def doRun(self):
00325     """Emit a Run button click under program control.
00326     Can be done from a subthread."""
00327     self.doEmit(self.RunButton)
00328
00329   def doPause(self):
00330     """Emit a Pause button click under program control.
00331     Can be done from a subthread."""
00332     self.doEmit(self.PauseButton)
00333
00334   def doEmit(self, obj, signal = SIGNAL("clicked()"), args = ()):
00335     """Emit a signal, possibly from a subthread.
00336     By default the signal is 'clicked()' with no arguments."""
00337     if self.isGUIthread():
00338       obj.emit(signal, args)
00339     else:
00340       self.execGUImethodNR(obj.emit, signal, args)
00341
00342   def normalCursor(self):
00343     self.execGUImethodNR(self.setCursor, QCursor(QWidget.ArrowCursor))
00344
00345   def waitCursor(self):
00346     self.execGUImethodNR(self.setCursor, QCursor(QWidget.WaitCursor))
00347
00348   def getHardwareVersions(self, lat=None):
00349     if self.__hwVersions is None:
00350       self.__hwVersions = Gversions.getHardwareVersions(lat)
00351     return self.__hwVersions
00352
00353   def clearHardwareVersionsCache(self):
00354     self.__hwVersions = None
00355
00356   def getFSM(self):
00357     return self.__fsm
00358
00359   def setLAT(self, lat):
00360     self.__lat = lat
00361
00362   def initGUIbridges(self):
00363     self.__thread = threading.currentThread()
00364     inQueue  = Queue()
00365     outQueue = Queue()
00366     self.__qtBridge = QtThreadBridge("QtBridge", outQueue, inQueue)
00367     self.__qtBridge.start()
00368     self.__pyBridge = PyThreadBridge("PyBridge", inQueue, outQueue)
00369
00370   def isGUIthread(self):
00371     return threading.currentThread() == self.__thread
00372
00373   def customEvent(self, e):
00374     # This method overrides the QObject base class's
00375     data = e.data()
00376     qtBridge = data[-1]
00377     if e.type() == RunControl.GUI_CMD_INST:
00378       qtBridge.pushResponse(data[0](*data[1:-2], **data[-2]))
00379     elif e.type() == RunControl.GUI_CMD_FUNC:
00380       qtBridge.pushResponse(data[0](*data[1:-2], **data[-2]))
00381     elif e.type() == RunControl.GUI_CMD_FUNC_NR:
00382       data[0](*data[1:-2], **data[-2])
00383
00384   def createGUI(self, obj, *args, **kwargs):
00385     """Method used for instantiating a GUI from a non-GUI subthread"""
00386     self.__pyBridge.pushEvent((RunControl.GUI_CMD_INST, self, (obj,)+args+(kwargs,)))
00387     return self.__pyBridge.pullResponse()
00388
00389   def execGUImethodNR(self, func, *args, **kwargs):
00390     """Method used for executing a GUI function from a non-GUI thread.
00391     Use this method when no (useful) response is expected or
00392     when waiting for one could cause a deadlock.  Any response from the
00393     function is lost."""
00394     if self.inShutdown:  return # Don't try to update the GUI during shutdown
00395     self.__pyBridge.pushEvent((RunControl.GUI_CMD_FUNC_NR, self, (func,)+args+(kwargs,)))
00396
00397   def execGUImethod(self, func, *args, **kwargs):
00398     """Method used for executing a GUI function from a non-GUI thread.
00399     Use this method when a response is expected from the function and
00400     when it is appropriate to wait for it (no deadlock arises)"""
00401     self.__pyBridge.pushEvent((RunControl.GUI_CMD_FUNC, self, (func,)+args+(kwargs,)))
00402     return self.__pyBridge.pullResponse()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlCommon.py Source File

runcontrol

RunControlCommon.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT run control common class"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "2/5/2003"
00014 __version__  = "$Revision: 2.22.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019
00020 import sys
00021 import os
00022 import time
00023 import types
00024 import atexit
00025 import socket
00026 import logging as log
00027 import logging.handlers
00028 from rcLoginImpl          import rcLoginImpl
00029 from rcSecurityMan        import rcSecurityMan
00030 from rcPreferencesManager import rcPreferencesManager
00031 from rcPreferencesGUIImpl import rcPreferencesGUIImpl
00032
00033 from LATTE.client.gOptions import Options
00034 from LATTE.client.gCmdCli import CmdCli
00035 from LATTE.client.gEvtCli import EvtCli
00036 from LATTE.database.gLAT import GLAT
00037 from LATTE.database.gXBR import GXBRD
00038 from LATTE.database.gOCS import GOCS
00039 from LATTE.logger.MSGLogGUIImpl import MSGLogGUIImpl
00040
00041 class GDBN(dict):
00042   """\brief Database node record.
00043
00044      The database node contains session level variables in addition
00045      to preferences and entries used for diagnostics purposes.
00046   """
00047   def __init__(self):
00048     """\brief Initialize the dictionary.
00049
00050     """
00051     dict.__init__(self)
00052
00053
00054 class RunControlSocketHandler(logging.handlers.SocketHandler):
00055   def __init__(self, *args):
00056     apply(logging.handlers.SocketHandler.__init__, (self,) + args)
00057
00058   def handleError(self, record):
00059     if self.closeOnError and self.sock:
00060       self.sock.shutdown(2)
00061       self.sock.close()
00062       self.sock = None        #try to reconnect next time
00063     else:
00064       raise IOError, sys.exc_info()[1]
00065
00066 class RunControlFileHandler(log.FileHandler):
00067   """\brief FileHandler class for handling multiple line log entries
00068
00069   If a log entry contains multiple lines, such as the case for
00070   tracebacks or exceptions a begin and end delimiter is added
00071   to the log entry so that it can be parsed by the MessageLogger
00072   """
00073   def __init__(self, filename, mode):
00074     log.FileHandler.__init__(self, filename, mode)
00075
00076   def emit(self, record):
00077     try:
00078       msg = self.format(record)
00079       (msg1, msg2) = msg.split(' - ',1)
00080       if msg2.find('\n') > 0:
00081         msg = msg1 + " - <//" + msg2+"//>"
00082       if not hasattr(types, "UnicodeType"): #if no unicode support...
00083         self.stream.write("%s\n" % msg)
00084       else:
00085         try:
00086           self.stream.write("%s\n" % msg)
00087         except UnicodeError:
00088           self.stream.write("%s\n" % msg.encode("UTF-8"))
00089       self.flush()
00090     except:
00091       self.handleError(record)
00092
00093 class RunControlCommon(object):
00094   """Common class for providing a run control helper functions
00095   """
00096   def __init__(self):
00097     self.MSGLogger = None
00098     self.__startGMT = time.gmtime()
00099     self.__options  = Options(['server', 'config'],
00100                               ['schema','evtdebug','cmddebug','securedir'],
00101                               ['noerrfile', 'playback'],
00102                              )
00103     self.__lat = None
00104     self.__xbrd = None
00105     self.__dds = None
00106     self.__server = None
00107     self.__cmdCli = CmdCli()
00108     self.__evtCli = EvtCli()
00109     self.__ocs = GOCS(self.__cmdCli)
00110     self.__securityMan = None
00111     self.__dbn = GDBN()
00112     self.__prefMan = None
00113     self.__prefGUI = None
00114     # Arrange for logging to be properly shutdown at program exit
00115     atexit.register(log.shutdown)
00116
00117   def initialize(self):
00118     try:
00119       self.__options.parse()
00120     except Exception, msg:
00121       self.__options.usage(self.__usage())
00122       raise Exception, msg
00123
00124     self.__prefMan = rcPreferencesManager(self.__options.config)
00125     if (self.__prefMan.loadConfig()):
00126       if self.__options.cmddebug is not None:
00127         self.__cmdCli.setDebug(int(self.__options.cmddebug))
00128
00129       if self.__options.evtdebug is not None:
00130         self.__evtCli.setDebug(int(self.__options.evtdebug))
00131
00132       if self.__options.schema is not None:
00133         self.readSchema(self.__options.schema)
00134
00135       if self.__options.securedir is not None:
00136         self.__securityMan = rcSecurityMan(os.path.abspath(self.__options.securedir),
00137                                            self.__prefMan.preferences()["users"])
00138         self.__securityMan.readPermissions()
00139         self.__dbn['_securityMan'] = self.__securityMan
00140     else:
00141       raise RuntimeError, "Can not find configuration file: %s" % self.__options.config
00142
00143   def __usage(self):
00144     return """
00145
00146 Detailed explanation:
00147
00148 Mandatory options:
00149 --server to specify the hostname or the IP address of the teststand crate
00150    to connect to.
00151 --config to specify the run control configuration file to use
00152
00153 Optional options:
00154 --schema to specify the schema file to load.
00155 --evtdebug to specify event client debug mode (defaults to 0)
00156    The following debug modes are available and can be added together
00157    for combinations:
00158      0: No Debug
00159      1: Debug All
00160      2: Event Dump
00161      4: Warnings
00162      8: Parser Output
00163     16: Error Output
00164 --cmddebug to specify command client debug mode (defaults to 0).
00165    If this option is specified then all register accesses from the
00166    command client is logged to the logger.
00167 --playback to indicate that Run Control should command the
00168    event server to play back the next event from its file. Since
00169    this is done using the GLT's self trigger command, the state of
00170    the internal trigger enable bit deterimines whether the
00171    application or Run Control will issue the self trigger command.
00172    No events will be delivered if the application has the internal
00173    trigger enabled, but doesn't issue CMD_SELF_TRIGGERs.
00174 --noreload to specify a file that contains prefixes of modules
00175    which should not be reloaded when a user script is selected.
00176    This list gets appended to the default list which currently contains
00177    the following prefixes 'scipy', 'weave', 'qwt', 'xml', 'pyexpat', 'win32'.
00178    The file should contain one prefix per line.
00179 --securedir The full path to the secure directory where the password file
00180    ("passwords") and the user permissions file ("security.cfg") is stored.
00181    If this switch is specified then RunControl is started in secure mode.
00182   """
00183
00184
00185
00186
00187   def connect(self):
00188     self.__cmdCli.connect(self.__options.server)
00189     self.__evtCli.connect(self.__options.server)
00190
00191   def disconnect(self):
00192     self.__cmdCli.disconnect()
00193     self.__evtCli.disconnect()
00194
00195   def readSchema(self, filename):
00196     self.__lat = GLAT(self.__cmdCli)
00197     self.__xbrd = GXBRD(self.__cmdCli)
00198     self.__lat.readSchema(filename)
00199     self.__xbrd = self.__xbrd.readSchema(filename)
00200     self.__dbn['_LATSchema'] = self.__lat
00201     self.__dbn['_LATSchemaFile'] = filename
00202     self.__dbn['_XBRDSchema'] = self.__xbrd
00203     self.__dbn['_XBRDchemaFile'] = filename
00204
00205   def elogWebsite(self):
00206     import webbrowser
00207     webbrowser.open(url=self.__prefMan.preferences()["elogurl"], new=1)
00208
00209   def EBFdistribution(self):
00210     if int(self.__prefMan.preferences()["servernbl"]) == 0:
00211       if self.__dds is not None:
00212         self.__dds.disconnect()
00213         log.info("Disconnected from the data distribution server since it was disabled in preferences.")
00214         self.__dds = None
00215       return
00216     dataType   = 'LAT_EBFdata'
00217     server     = self.__prefMan.preferences()["server"].strip()
00218     if server != '':
00219       try:
00220         import LATTE.tools.DataDistributor as DD
00221       except:
00222         log.error("Can't find DataDistributor module, is it in PYTHONPATH?")
00223       else:
00224         if self.__server is None:
00225           self.__dds = DD.DataDistributorServer(dataType)
00226           try:
00227             self.__dds.connect(server)
00228             log.info("Connected to the data distribution server at %s." % server)
00229             #atexit.register(self.__dds.disconnect)  # Already done somewhere?
00230           except:
00231             log.warn("Unable to connect to data distribution server %s: serving of %s disabled" % (self.__prefMan.preferences()["server"], dataType))
00232             self.__dds = None
00233         elif server != self.__server:
00234           if self.__dds is not None:
00235             self.__dds.disconnect()
00236             log.info("Disconnected from the data distribution server.")
00237           self.__dds = DD.DataDistributorServer(dataType)
00238           try:
00239             self.__dds.connect(server)
00240             log.info("Reconnected to the data distribution server since the server changed in preferences.")
00241             #atexit.register(self.__dds.disconnect)  # Already done somewhere?
00242           except:
00243             log.warn("Unable to connect to data distribution server %s: serving of %s disabled" % (self.__prefMan.preferences()["server"], dataType))
00244             self.__dds = None
00245       self.__server = self.__prefMan.preferences()["server"].strip()
00246
00247   def setLoggingLevel(self, logLevel=None):
00248     if logLevel is None: logLevel = self.__prefMan.preferences()["loglevel"]
00249     log.getLogger("").setLevel(eval("log."+logLevel))
00250
00251   def startLogger(self):
00252     # Start up the message logger
00253     log.basicConfig()
00254     self.setLoggingLevel()
00255     loghost = self.__prefMan.preferences()["loghost"]
00256     local = socket.gethostname().lower() == loghost.lower() or socket.gethostbyname(loghost) == '127.0.0.1'
00257     if int(self.__prefMan.preferences()["lognbl"]) == 1:
00258       if local:
00259         if self.MSGLogger is not None:
00260           return
00261         self.MSGLogger = MSGLogGUIImpl()
00262         self.MSGLogger.startListenerThread()
00263       msgPath = self.__prefMan.preferences()["logdir"]
00264       # Note that if the file already exists, it will be appended to
00265       ts   = time.strftime('%y%m%d%H%M%S', self.__startGMT)
00266       fileName = "msg" + ts + ".log"
00267       # Hack until the log handler goes in its own class -ST # revisit
00268       self.__prefMan.preferences()["logfilename"] = fileName
00269       fmt = log.Formatter("%(asctime)s %(filename)s:%(lineno)d %(levelname)-5s - %(message)s")
00270       self.fileHdlr = RunControlFileHandler(msgPath + os.sep + fileName, "a")
00271       self.fileHdlr.setFormatter(fmt)
00272       log.getLogger("").addHandler(self.fileHdlr)
00273       self.sockHdlr = RunControlSocketHandler(loghost,
00274                                               logging.handlers.DEFAULT_TCP_LOGGING_PORT)
00275       self.sockHdlr.setFormatter(fmt)
00276       log.getLogger("").addHandler(self.sockHdlr)
00277       try:
00278         log.info('Trying to connect to the message logger')
00279       except:
00280         log.getLogger("").removeHandler(self.sockHdlr)
00281         log.error("Can't connect to the message logger, disabling logging to socket")
00282       else:
00283         log.info('Successfully connected to the message logger')
00284     elif self.MSGLogger is not None:
00285       log.info('Disconnecting from the message logger')
00286       if local:
00287         self.MSGLogger.close()
00288         self.MSGLogger = None
00289       log.getLogger("").removeHandler(self.sockHdlr)
00290       log.getLogger("").removeHandler(self.fileHdlr)
00291       log.shutdown()
00292
00293   def options(self):
00294     return self.__options
00295
00296   def prefMan(self):
00297     return self.__prefMan
00298
00299   def prefGUI(self):
00300     if self.__prefGUI is None:
00301       self.__prefGUI = rcPreferencesGUIImpl(self)
00302     return self.__prefGUI
00303
00304   def getMSGLogger(self):
00305     return self.MSGLogger
00306
00307   def getDDS(self):
00308     return self.__dds
00309
00310   def getCmdCli(self):
00311     return self.__cmdCli
00312
00313   def getEvtCli(self):
00314     return self.__evtCli
00315
00316   def getLAT(self):
00317     return self.__lat
00318
00319   def getXBRD(self):
00320     return self.__xbrd
00321
00322   def getOCS(self):
00323     return self.__ocs
00324
00325   def getDBN(self):
00326     return self.__dbn
00327
00328   def getSecurityMan(self):
00329     return self.__securityMan
00330
00331   def getLoginId(self):
00332     """Returns the login id for the last successful login
00333     """
00334     return self.__loginId
00335
00336   def showLogin(self, parent):
00337     login = rcLoginImpl(parent=parent)
00338     status = login.exec_loop()
00339     if status == login.Accepted:
00340       loginId = str(login.txtLoginId.text()).strip()
00341       password = str(login.txtPassword.text()).strip()
00342       authResult = self.__securityMan.authenticateUser(loginId, password)
00343       if authResult == 0:
00344         self.__loginId = loginId
00345         log.info("User %s successfully logged in" % loginId)
00346         return 1
00347       elif authResult == -1:
00348         log.error("User authentication failed, loginId=%s" % loginId)
00349         return authResult
00350       else:
00351         log.error("Password database is not accessible.")
00352         return authResult
00353     else:
00354       return None
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlFSM.py Source File

runcontrol

RunControlFSM.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Finite State Machine class for Online Run Control"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/13/2002"
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import logging as     log
00020 from   FSM     import FSM
00021
00022
00023 class RunControlFSM(FSM):
00024   def __init__(self, app):
00025     FSM.__init__(self, 'RESET', None)
00026     self.set_default_transition(                        self.error,    None    )
00027     self.add_transition        ('SETUP',     'RESET',   self.setup,   'STOPPED')
00028     self.add_transition        ('TEARDOWN',  'STOPPED', self.teardown,'RESET'  )
00029     self.add_transition        ('START_RUN', 'STOPPED', self.startRun,'RUNNING')
00030     self.add_transition        ('STOP_RUN',  'RUNNING', self.stopRun, 'STOPPED')
00031     self.add_transition        ('PAUSE',     'RUNNING', self.pause,   'PAUSED' )
00032     self.add_transition        ('RESUME',    'PAUSED',  self.resume,  'RUNNING')
00033     self.add_transition        ('STOP',      'PAUSED',  self.stop,    'STOPPED')
00034     self.__app = app
00035
00036
00037   def error(self):
00038     log.error(self.__class__.__name__ + "Undefined transition: (%s, %s)" % \
00039               (str(self.input_symbol), str(self.current_state)))
00040
00041   def setup(self):
00042     return self.__app.rcSetup()
00043
00044   def teardown(self):
00045     return self.__app.rcTeardown()
00046
00047   def startRun(self):
00048     return self.__app.rcStartRun()
00049
00050   def stopRun(self):
00051     return self.__app.rcStopRun()
00052
00053   def pause(self):
00054     return self.__app.rcPause()
00055
00056   def resume(self):
00057     return self.__app.rcResume()
00058
00059   def stop(self):
00060     return self.__app.rcStop()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlGUIImpl.py Source File

runcontrol

RunControlGUIImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT GUI for Online Run Control"
00012 __author__   = """A. Kavelaars <AliciaK@SLAC.Stanford.edu>
00013                                SLAC - GLAST LAT I&T/Online"""
00014 __date__     = "11/13/2002"
00015 __version__  = "$Revision: 2.2 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 import sys, os
00022 from qt import *
00023 from RunControlGUI import RunControlGUI
00024 from ConfigParser  import ConfigParser
00025 from rcPreferencesGUIImpl import rcPreferencesGUIImpl
00026
00027
00028 class RunControlGUIImpl(RunControlGUI):
00029
00030   def __init__(self, common, parent = None, name = None, fl = 0):
00031     RunControlGUI.__init__(self, parent, name, fl)
00032
00033     self.connect(self.SetupButton,SIGNAL("clicked()"),self.SetupClicked)
00034     self.connect(self.TeardownButton,SIGNAL("clicked()"),self.TeardownClicked)
00035     self.connect(self.StartRunButton,SIGNAL("clicked()"),self.StartRunClicked)
00036     self.connect(self.StopRunButton,SIGNAL("clicked()"),self.StopRunClicked)
00037     self.connect(self.ResumeButton,SIGNAL("clicked()"),self.ResumeClicked)
00038     self.connect(self.PauseButton,SIGNAL("clicked()"),self.PauseClicked)
00039     self.connect(self.StopButton,SIGNAL("clicked()"),self.StopClicked)
00040
00041     self.connect(self.AppOpenButton,SIGNAL("clicked()"),self.load)
00042     self.connect(self.ExitButton,SIGNAL("clicked()"),self.ExitButtonClicked)
00043
00044     self.connect(self.fileSelect_SchemaAction,SIGNAL("activated()"),self.loadSchema)
00045     self.connect(self.fileConnectAction,SIGNAL("activated()"),self.connectClicked)
00046
00047     defaultDir = ""
00048     self.__prefs = common.prefMan().preferences()
00049     self.__common = common
00050
00051     self._currentSchema = self.__prefs['reposdir']
00052
00053   def common(self):
00054     return self.__common
00055
00056   def preferences(self):
00057     return self.__prefs
00058
00059   def getCommentWidget(self):
00060     return None
00061
00062   def PreferencesActivated(self):
00063     prefGUI = self.__common.prefGUI()
00064     prefGUI.loadConfig()
00065     status = prefGUI.exec_loop()
00066     if status == prefGUI.Accepted:
00067       pass
00068     elif status == prefGUI.Rejected:
00069       # Use "factory" defaults; cfg file not updated
00070       pass
00071
00072   def SetupClicked(self):
00073     print "Button pressed: %s" % 'SETUP'
00074
00075   def TeardownClicked(self):
00076     print "Button pressed: %s" % 'TEARDOWN'
00077
00078   def StartRunClicked(self):
00079     print "Button pressed: %s" % 'START_RUN'
00080
00081   def StopRunClicked(self):
00082     print "Button pressed: %s" % 'STOP_RUN'
00083
00084   def PauseClicked(self):
00085     print "Button pressed: %s" % 'PAUSE'
00086
00087   def ResumeClicked(self):
00088     print "Button pressed: %s" % 'RESUME'
00089
00090   def StopClicked(self):
00091     print "Button pressed: %s" % 'STOP'
00092
00093   def load(self):
00094     applName = QFileDialog.getOpenFileName(self.__prefs["appdir"], "(*.py)",
00095                                            self, "Application file dialog",
00096                                            "Choose an application")
00097     if applName.isEmpty():
00098       return None
00099
00100     self.__prefs["appdir"] = applName
00101
00102     self.OpenAppl.setText(applName)
00103
00104     return applName
00105
00106   def loadSchema(self):
00107     rcSchemaSel = rcFileSelector(self._currentSchema, "(*.xml)", self, "Select a schema")
00108     schemaName = rcSchemaSel.getValue()
00109     # Allow the C++ object to be deleted
00110     rcSchemaSel.deleteLater()
00111     if schemaName is None: return
00112     self._currentSchema = schemaName
00113     self.__common.readSchema(schemaName)
00114
00115   def ExitButtonClicked(self):
00116     self.close()
00117
00118   def fileNew(self):
00119     print "RunControlTempImpl.fileNew(): Not implemented yet"
00120
00121   def fileOpen(self):
00122     print "RunControlTempImpl.fileOpen(): Not implemented yet"
00123
00124   def fileSave(self):
00125     print "RunControlTempImpl.fileSave(): Not implemented yet"
00126
00127   def fileSaveAs(self):
00128     print "RunControlTempImpl.fileSaveAs(): Not implemented yet"
00129
00130   def filePrint(self):
00131     print "RunControlTempImpl.filePrint(): Not implemented yet"
00132
00133   def fileExit(self):
00134     print "RunControlTempImpl.fileExit(): Not implemented yet"
00135
00136   def editUndo(self):
00137     print "RunControlTempImpl.editUndo(): Not implemented yet"
00138
00139   def editRedo(self):
00140     print "RunControlTempImpl.editRedo(): Not implemented yet"
00141
00142   def editCut(self):
00143     print "RunControlTempImpl.editCut(): Not implemented yet"
00144
00145   def editCopy(self):
00146     print "RunControlTempImpl.editCopy(): Not implemented yet"
00147
00148   def editPaste(self):
00149     print "RunControlTempImpl.editPaste(): Not implemented yet"
00150
00151   def editFind(self):
00152     print "RunControlTempImpl.editFind(): Not implemented yet"
00153
00154   def helpIndex(self):
00155     print "RunControlTempImpl.helpIndex(): Not implemented yet"
00156
00157   def helpContents(self):
00158     print "RunControlTempImpl.helpContents(): Not implemented yet"
00159
00160   def helpAbout(self):
00161     print "RunControlTempImpl.helpAbout(): Not implemented yet"
00162
00163
00164 class rcFileSelector(QFileDialog):
00165   def __init__(self, startwith, filter, parent, name):
00166     QFileDialog.__init__(self, parent, name, 0)
00167     self.setMode(QFileDialog.ExistingFile)
00168     self.setFilter(filter)
00169     self.setDir(os.path.dirname(startwith))
00170     self.setCaption(name)
00171     self.setViewMode( QFileDialog.Detail)
00172     self.setSelection(startwith)
00173
00174   def getValue(self):
00175     if self.exec_loop() == QDialog.Accepted:
00176       return str(self.selectedFile())
00177     else:
00178       return None
00179
00180 if __name__ == "__main__":
00181   a = QApplication(sys.argv)
00182   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00183   w = RunControlGUI()
00184   a.setMainWidget(w)
00185   w.show()
00186   a.exec_loop()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlMain.py Source File

runcontrol

RunControlMain.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT main run control class"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/11 21:39:25 $").split(' ')[1]
00014 __version__  = "$Revision: 2.23.2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                              os
00021 import                              sys
00022 import                              atexit
00023 import                              threading
00024 import logging               as     log
00025 import types
00026 import time
00027 import gc
00028
00029 from   qt                    import *
00030
00031 from   Queue                 import Queue
00032 from   RunControlFSM         import RunControlFSM
00033 from   RunControlMainGUIImpl import RunControlMainGUIImpl
00034
00035 # Modules here are imported to prevent them from being reloaded
00036 # See rcUtil for more info
00037 import rcReportGen
00038 import rcRunIdHelper
00039 import rcArchiver
00040
00041 from LATTE.tools.taskEngine   import TaskEngine
00042 from LATTE.tools.guiBridges   import GUIbridge, QtThreadBridge, PyThreadBridge
00043 from LATTE.client.gLog        import logException
00044 from LATTE.database.gVersions import Gversions, ROOT_DIR_ENVS
00045
00046
00047 class ConnectState:
00048   Disconnected = 0
00049   Waiting      = 1
00050   Connected    = 2
00051
00052 class RunControlMain(RunControlMainGUIImpl):
00053   """Class for providing a run control framework
00054   """
00055   GUI_CMD_INST    = QEvent.User + 1
00056   GUI_CMD_FUNC    = QEvent.User + 2
00057   GUI_CMD_FUNC_NR = QEvent.User + 3
00058
00059   def __init__(self, common, parent = None, name = "RunControl", fl = 0):
00060     RunControlMainGUIImpl.__init__(self, common, parent, name, fl)
00061
00062     self.__common       = common
00063     self.__fsm          = None
00064     self.__actionEngine = None
00065     self.__app          = None
00066     self.__browser      = None
00067     self.__hwVersions   = None
00068     self.__queue        = None
00069     self.__engine       = None
00070     self.__guiThread    = threading.currentThread()
00071     self.__guiBridge    = GUIbridge(self.__guiThread)
00072
00073     # Set this object to be the client handler
00074     common.getCmdCli().handler(self)
00075     self.__connection_state = ConnectState.Disconnected
00076     self.ResetButton.setEnabled(False)
00077     self.StopButton.setEnabled(False)
00078     self.RunButton.setEnabled(False)
00079     self.PauseButton.setEnabled(False)
00080
00081     self.__actionEngine = TaskEngine("FSMactionEngine")
00082     self.__actionEngine.start()
00083
00084     self.commandSynch = TaskEngine("CommandSynch")
00085     self.commandSynch.start()
00086
00087     self.eventHandler = TaskEngine("EventHandler")
00088     self.eventHandler.start()
00089
00090     # Pick an operator
00091     operator = common.prefMan().preferences()["operatorobj"]
00092     self.cmbOperator.setCurrentText(operator.getName())
00093
00094     # Clean up at exit
00095     self.inShutdown = False
00096     atexit.register(self.__shutdown)
00097
00098   def disconnected(self):
00099     self.__disconnect()
00100
00101   def timedout(self):
00102     self.__disconnect()
00103
00104   def __connection_notthere(self): # GUI thread
00105     if self.__connection_state == ConnectState.Connected:
00106       self.StopButton.setEnabled(False)
00107       self.RunButton.setEnabled(False)
00108       self.PauseButton.setEnabled(False)
00109       log.error("OCS server disconnected, trying to reconnect")
00110       self.__connection_state = ConnectState.Waiting
00111       self.__common.disconnect() # RiC
00112       self.__connect()
00113
00114   def __connection_established(self): # GUI thread
00115     log.info("OCS server is now connected")
00116     if self.__app is not None:
00117       self.StopButton.setEnabled(True)
00118       self.RunButton.setEnabled(True)
00119       self.PauseButton.setEnabled(True)
00120     self.__connection_state = ConnectState.Connected
00121
00122   def __connection_failed(self, msg): # GUI thread
00123     if self.__tries == 0:
00124       log.error(msg)
00125     self.__tries += 1
00126     return self.__connection_state
00127
00128   def connectClicked(self): # GUI thread
00129     if self.__connection_state is ConnectState.Disconnected:
00130       self.fileConnectAction.setMenuText("Disconnect")
00131       self.__connection_state = ConnectState.Waiting
00132       self.__tries = 0
00133       self.__connect()
00134     else:
00135       self.fileConnectAction.setMenuText("Connect")
00136       self.__connection_state = ConnectState.Disconnected
00137       self.__disconnect()
00138
00139   def __connect(self):
00140     connecthdlr = threading.Thread(None, self.__connection_handler, 'ConnectHandler',())
00141     connecthdlr.setDaemon(True)
00142     connecthdlr.start()
00143
00144   def __disconnect(self):
00145     self.execGUImethod(self.__connection_notthere)
00146
00147   def __connection_handler(self):
00148     while (True):
00149       try:
00150         self.__common.connect()
00151         self.execGUImethod(self.__connection_established)
00152         break
00153       except RuntimeError, msg:
00154         state = self.execGUImethod(self.__connection_failed, msg)
00155         if state == ConnectState.Disconnected: break
00156         time.sleep(3)
00157
00158   def applyPermissions(self, operator):
00159     adminOverride = operator.isAdministrator()
00160     if adminOverride:
00161       self.fileExitAction.setEnabled(1)
00162     else:
00163       self.fileExitAction.setEnabled(0)
00164     if 'allow_python_shell' in operator.getPermissions() or adminOverride:
00165       self.viewPythonShell.setEnabled(1)
00166     else:
00167       self.viewPythonShell.setEnabled(0)
00168     if 'set_particle_type' in operator.getPermissions() or adminOverride:
00169       self.comboParticleType.setEnabled(1)
00170     else:
00171       self.comboParticleType.setEnabled(0)
00172     if 'set_orientation' in operator.getPermissions() or adminOverride:
00173       self.comboOrientation.setEnabled(1)
00174     else:
00175       self.comboOrientation.setEnabled(0)
00176
00177     if 'edit_preferences' in operator.getPermissions() or adminOverride:
00178       self.editPreferencesAction.setEnabled(1)
00179     else:
00180       self.editPreferencesAction.setEnabled(0)
00181
00182     for (panelLabel, panel) in self.panels().items():
00183       if 'enable_' + panelLabel.lower() + '_panel' in operator.getPermissions() or adminOverride:
00184         self.setEnabledTabPage(panelLabel, 1)
00185       else:
00186         self.setEnabledTabPage(panelLabel, 0)
00187       if "applyPermissions" in dir(panel):
00188         panel.applyPermissions(operator)
00189
00190     if self.__common.getMSGLogger() is not None:
00191       if adminOverride:
00192         self.__common.getMSGLogger().setSecure(0)
00193       else:
00194         self.__common.getMSGLogger().setSecure(1)
00195         self.__common.getMSGLogger().show()
00196
00197     self.__common.prefGUI().applyPermissions(operator)
00198
00199
00200   def setEnabledTabPage(self, panelLabel, enable):
00201     """Find the tabPage belonging to panel identified by panelLabel
00202     """
00203     for i in range(self.RunControlTab.count()):
00204       tabPage = self.RunControlTab.page(i)
00205       if panelLabel == str(self.RunControlTab.tabLabel(tabPage)):
00206         tabPage.setEnabled(enable)
00207         break
00208
00209   def setOperator(self, operator):
00210     self.cmbOperator.setCurrentText(operator)
00211     self.__common.prefMan().setOperator(operator)
00212
00213   def setParticleType(self, particleType):
00214     self.__common.prefMan().setParticleType(particleType)
00215
00216   def setOrientation(self, orientation):
00217     self.__common.prefMan().setOrientation(orientation)
00218
00219   def getName(self): return "RunControlMain"
00220
00221   def __statusMsg(self, msg, tmo):
00222     self.execGUImethodNR(self.statusBar().message, msg, tmo)
00223
00224   def __shutdown(self):
00225     """\brief Clean up and shut down the various threads.
00226     """
00227     # This method expects to be executed from the GUI thread.
00228
00229     self.inShutdown = True
00230
00231     # Bring the system into the RESET state
00232     self.doReset()
00233
00234     # Use the following non-NR call to wait for the reset to finish
00235     self.execGUImethod(self.statusBar().message, "Exiting")
00236
00237     # Shut down the task engines
00238     self.__actionEngine.shutdown()
00239     self.eventHandler.shutdown()  # RiC: timeout not needed with above wait
00240     self.commandSynch.shutdown()
00241
00242     # After the FSM Action Engine has shut down we can delete the FSM
00243     if self.__fsm:
00244       del self.__fsm
00245       self.__fsm = None
00246
00247     # Disconnect from the command and event servers
00248     self.__common.disconnect()
00249
00250     # Stop the data distribution server
00251     dds = self.__common.getDDS()
00252     if dds is not None:
00253       dds.disconnect()
00254
00255     # Stop the GUI bridge
00256     #self.__qtBridge.terminate()
00257     self.__guiBridge.shutdown()
00258
00259
00260   def initApp(self):
00261     """\brief Method usually invoked by the GUI to load a new application
00262     """
00263     applName = self.OpenAppl.currentText()
00264     if str(applName) == "":  return     # Operator cancelled
00265     self.loadApp(str(applName))
00266
00267   def loadApp(self, applName):
00268     """\brief Method that can be invoked from code to load a new application
00269
00270     \param applName  Name of an application to load
00271     """
00272     if self.__fsm is not None:
00273       self.ResetClicked()
00274     if applName is None:
00275       self.__statusMsg('Loading aborted', 0)
00276       return
00277
00278     # Start the application in its own thread after the reset from above
00279     # (if any) completes.
00280     self.__actionEngine.spawn(self.__start, str(applName))
00281
00282     self.ResetButton.setEnabled(True)
00283     self.StopButton.setEnabled(True)
00284     self.RunButton.setEnabled(True)
00285     self.PauseButton.setEnabled(True)
00286
00287   def __initAppCommon(self, appType, app, appName, filename):
00288     msg = "%s %s loaded from %s" % (appType, app.getName(), filename)
00289     log.info(msg)
00290
00291     # Update the application history list box.
00292     self.execGUImethod(self.__updateAppListBox, appName)
00293
00294     return msg
00295
00296   def __updateAppListBox(self, appName):
00297     if self.OpenAppl.listBox().findItem(appName) is None:
00298       self.OpenAppl.insertItem(appName)
00299
00300   def __start(self, appName):
00301     # Moved the import here so that all startup modules would
00302     # already have been imported by the time we come here.
00303
00304     import rcUtil
00305     try:
00306       self.execGUImethod(self.statusMonitor().stopWatch)
00307       dontReloadList = self.__common.options().noreload
00308       (module, filename) = rcUtil.importModule(appName=appName, reload=1, dontReloadList=dontReloadList)
00309     except Exception, e:
00310       logException()
00311       if type(e) == types.ListType:
00312         self.__statusMsg(e[0], 0)
00313       else:
00314         self.__statusMsg(str(e), 0)
00315       return
00316
00317     del self.__app
00318     self.__app = None
00319     gc.collect()
00320     if len(gc.garbage) != 0:
00321       log.error("RunControlMain: Found garbage: %s" % gc.garbage)
00322
00323     # Instantiate the application
00324     if 'userApplication' in dir(module):
00325       self.__app = module.userApplication(self, self.__common.prefMan().userId(),
00326                                           self.__common.options().evtdebug is not None)
00327       msg = self.__initAppCommon('Application', self.__app, appName, filename)
00328
00329
00330       # Set up the Finite State Machine and the transition engine
00331       self.__fsm = RunControlFSM(self.__app)
00332
00333       self.execGUImethodNR(self.__updateGUI, self.__fsm.current_state, False)
00334       self.execGUImethodNR(self.handleComments, None, self.__fsm.current_state)
00335
00336     elif 'userSuite' in dir(module):
00337       self.__app = module.userSuite(self, self.__common.prefMan().userId(),
00338                                     self.__common.options().evtdebug is not None)
00339       msg = self.__initAppCommon('Suite', self.__app, appName, filename)
00340
00341       self.__setupSuite(self.__app.getName())
00342     else:
00343       msg = '%s is not a recognized user script.  userApplication or userSuite class is missing.' % appName
00344       log.error(msg)
00345
00346     self.execGUImethod(self.statusMonitor().startWatch)
00347
00348     self.__statusMsg(msg, 0)
00349
00350
00351   def __setupSuite(self, appName):
00352     if self.__app.rcSetupSuite() is None:
00353       msg = "Suite setup failed...Aborting suite %s" % appName
00354       log.error(msg)
00355     else:
00356       self.execGUImethodNR(self.State.setText, "SUITE SETUP")
00357
00358
00359   def __updateGUI(self, state, enabled):
00360     """\brief Method for updating the GUI
00361     """
00362     # This method may complete asynchronously to the application's activities
00363     # since the application doesn't depend on the results.  Should this ever
00364     # change, be sure to change the execGUImethodNR() calls below to
00365     # execGUImethod() calls so that the fsmActionEngine waits for __updateGUI()
00366     # to complete before continuing.
00367     self.State.setText(state)
00368     operator = self.__common.prefMan().preferences()["operatorobj"]
00369     if self.__common.options().securedir is not None and 'administrator' not in operator.getRoles():
00370       permissions = operator.getPermissions()
00371       self.cmbOperator.setEnabled(0)
00372       if 'set_particle_type' in permissions:
00373         self.comboParticleType.setEnabled(enabled)
00374       if 'set_orientation' in permissions:
00375         self.comboOrientation.setEnabled(enabled)
00376     else:
00377       self.cmbOperator.setEnabled(enabled)
00378       self.comboParticleType.setEnabled(enabled)
00379       self.comboOrientation.setEnabled(enabled)
00380
00381   def ResetClicked(self):
00382     RunControlMainGUIImpl.ResetClicked(self)
00383
00384     self.waitCursor()
00385     self.__actionEngine.spawn(self.__reset)
00386     self.normalCursor()
00387
00388   def __reset(self):
00389     if self.__fsm is not None:
00390       curState = self.__fsm.current_state
00391       if curState == "STOPPED":
00392         self.execGUImethodNR(self.State.setText, "TEARING DOWN")
00393         self.__fsm.process('TEARDOWN')
00394         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00395
00396       elif curState == "RUNNING":
00397         self.execGUImethodNR(self.State.setText, "STOPPING RUN")
00398         status = self.__fsm.process('STOP_RUN')
00399         if status is None:
00400           self.execGUImethodNR(self.State.setText, "TEARING DOWN")
00401           self.__fsm.process('TEARDOWN')
00402         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00403
00404       elif curState == "PAUSED":
00405         self.execGUImethodNR(self.State.setText, "STOPPING RUN")
00406         self.execGUImethodNR(QToolTip.add, self.PauseButton, "Pause")
00407         self.execGUImethodNR(QToolTip.add, self.RunButton, "Run")
00408         status = self.__fsm.process('STOP')
00409         if status is None:
00410           self.execGUImethodNR(self.State.setText, "TEARING DOWN")
00411           self.__fsm.process('TEARDOWN')
00412         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00413
00414       self.execGUImethodNR(self.__updateGUI, self.__fsm.current_state, True)
00415
00416   def StopClicked(self):
00417     if self.__app.__class__.__name__ == 'userSuite':
00418       self.execGUImethodNR(self.State.setText, "STOPPING SUITE")
00419       self.__app.rcStopSuite()
00420       self.execGUImethodNR(self.State.setText, "SUITE STOPPED")
00421     else:
00422       RunControlMainGUIImpl.StopClicked(self)
00423
00424       self.waitCursor()
00425       self.__actionEngine.spawn(self.__stop)
00426       self.normalCursor()
00427
00428   def __stop(self):
00429     if self.__fsm is not None:
00430       curState = self.__fsm.current_state
00431       if curState == "PAUSED":
00432         self.execGUImethodNR(self.State.setText, "STOPPING RUN")
00433         self.execGUImethodNR(QToolTip.add, self.PauseButton, "Pause")
00434         self.execGUImethodNR(QToolTip.add, self.RunButton, "Run")
00435         self.__fsm.process('STOP')
00436         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00437
00438       elif curState == "RUNNING":
00439         self.execGUImethodNR(self.State.setText, "STOPPING RUN")
00440         self.__fsm.process('STOP_RUN')
00441         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00442
00443       elif curState == "RESET":
00444         self.execGUImethodNR(self.State.setText, "SETTING UP")
00445         self.__fsm.process('SETUP')
00446         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00447
00448       self.execGUImethodNR(self.__updateGUI, self.__fsm.current_state, True)
00449
00450   def RunClicked(self):
00451     if self.__app.__class__.__name__ == 'userSuite':
00452       if self.__app.isRunning() and not self.__app.isPaused():
00453         return
00454       text = self.execGUImethod(self.State.text)
00455       if self.__app.isPaused():
00456         self.execGUImethodNR(self.State.setText, "RESUMING SUITE")
00457       else:
00458         self.execGUImethodNR(self.State.setText, "STARTING SUITE")
00459       if self.__app.rcStartSuite() is not None:
00460         self.execGUImethodNR(self.State.setText, text)
00461       else:
00462         self.execGUImethodNR(self.State.setText, "SUITE RUNNING")
00463     else:
00464       RunControlMainGUIImpl.RunClicked(self)
00465
00466       self.waitCursor()
00467       self.__actionEngine.spawn(self.__run)
00468       self.normalCursor()
00469
00470   def __run(self):
00471     if self.__fsm is not None:
00472       curState = self.__fsm.current_state
00473       if curState == "PAUSED":
00474         self.execGUImethodNR(self.State.setText, "RESUMING RUN")
00475         self.execGUImethodNR(QToolTip.add, self.PauseButton, "Pause")
00476         self.execGUImethodNR(QToolTip.add, self.RunButton, "Run")
00477         self.__fsm.process('RESUME')
00478
00479       elif curState == "STOPPED":
00480         self.execGUImethodNR(self.State.setText, "STARTING RUN")
00481         self.__fsm.process('START_RUN')
00482
00483       elif curState == "RESET":
00484         self.execGUImethodNR(self.State.setText, "SETTING UP")
00485         status = self.__fsm.process('SETUP')
00486         if status is None:
00487           self.execGUImethodNR(self.State.setText, "STARTING RUN")
00488           self.execGUImethodNR(self.State.setText, self.__fsm.current_state)
00489           self.__fsm.process('START_RUN')
00490       self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00491
00492       self.execGUImethodNR(self.__updateGUI, self.__fsm.current_state, False)
00493
00494   def PauseClicked(self):
00495     if self.__app.__class__.__name__ == 'userSuite':
00496       text = self.execGUImethod(self.State.text)
00497       if self.__app.isPaused():
00498         return
00499       self.execGUImethodNR(self.State.setText, "PAUSING SUITE")
00500       if self.__app.rcPauseSuite() is None:
00501         self.execGUImethodNR(self.State.setText, "SUITE PAUSED")
00502       else:
00503         self.execGUImethodNR(self.State.setText, text)
00504     else:
00505       RunControlMainGUIImpl.PauseClicked(self)
00506
00507       self.waitCursor()
00508       self.__actionEngine.spawn(self.__pause)
00509       self.normalCursor()
00510
00511   def __pause(self):
00512     if self.__fsm is not None:
00513       curState = self.__fsm.current_state
00514       if curState == "RUNNING":
00515         self.execGUImethodNR(self.State.setText, "PAUSING RUN")
00516         self.execGUImethodNR(QToolTip.add, self.PauseButton, "Resume")
00517         self.execGUImethodNR(QToolTip.add, self.RunButton, "Resume")
00518         self.__fsm.process('PAUSE')
00519         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00520       elif curState == "PAUSED":
00521         self.execGUImethodNR(self.State.setText, "RESUMING UP")
00522         self.execGUImethodNR(QToolTip.add, self.PauseButton, "Pause")
00523         self.execGUImethodNR(QToolTip.add, self.RunButton, "Run")
00524         self.__fsm.process('RESUME')
00525         self.execGUImethodNR(self.handleComments, curState, self.__fsm.current_state)
00526
00527       self.execGUImethodNR(self.State.setText, self.__fsm.current_state)
00528
00529   def doReset(self):
00530     """Emit a Reset button click under program control.
00531     Can be done from a subthread."""
00532     self.doEmit(self.ResetButton)
00533
00534   def doStop(self):
00535     """Emit a Stop button click under program control.
00536     Can be done from a subthread."""
00537     self.doEmit(self.StopButton)
00538
00539   def doStopRun(self):
00540     """Depricated version of doStop()."""
00541     self.doStop()
00542
00543   def doRun(self):
00544     """Emit a Run button click under program control.
00545     Can be done from a subthread."""
00546     self.doEmit(self.RunButton)
00547
00548   def doPause(self):
00549     """Emit a Pause button click under program control.
00550     Can be done from a subthread."""
00551     self.doEmit(self.PauseButton)
00552
00553   def doEmit(self, obj, signal = SIGNAL("clicked()"), args = ()):
00554     """Emit a signal, possibly from a subthread.
00555     By default the signal is 'clicked()' with no arguments."""
00556     if self.isGUIthread():
00557       obj.emit(signal, args)
00558     else:
00559       self.execGUImethodNR(obj.emit, signal, args)
00560
00561   def normalCursor(self):
00562     self.execGUImethodNR(self.setCursor, QCursor(QWidget.ArrowCursor))
00563
00564   def waitCursor(self):
00565     self.execGUImethodNR(self.setCursor, QCursor(QWidget.WaitCursor))
00566
00567   def handleComments(self, fromState, toState):
00568     cw = self.getCommentWidget()
00569     if toState == 'STOPPED' and fromState != 'RESET':
00570       if cw.isReadOnly():
00571         cw.setReadOnly(0)
00572         self.showComments()
00573         cw.enterComment("Comment entry enabled.")
00574       cw.enterComment("Note: Comments entered after this point will apply to the next run",0)
00575       cw.clearHistory()
00576     elif toState == 'RUNNING':
00577       if cw.isReadOnly():
00578         cw.setReadOnly(0)
00579         self.showComments()
00580         cw.enterComment("Comment entry enabled.")
00581       #if fromState != 'PAUSED' and fromState != 'RESET':
00582       #  cw.clearDisplay()
00583     elif toState == 'RESET':
00584       if fromState is None: # Application has been loaded
00585         cw.clearHistory()
00586         cw.setReadOnly(0)
00587         self.showComments()
00588         cw.enterComment("Comment entry enabled.")
00589       else:
00590         if not self.inShutdown:
00591           cw.clearHistory()
00592           cw.setReadOnly(1)
00593           self.hideComments()
00594           cw.enterComment("Comment entry disabled.")
00595
00596   def showHidePythonShell(self):
00597     if self.viewPythonShell.isOn():
00598       self.showPythonShell()
00599       if self.__fsm is None:
00600         self.getPythonShellWidget().redirectIO()
00601       elif self.__fsm.current_state != 'RUNNING':
00602           self.getPythonShellWidget().redirectIO()
00603     else:
00604       self.hidePythonShell()
00605       if self.__fsm is None:
00606         self.getPythonShellWidget().restoreIO()
00607       elif self.__fsm.current_state == 'RUNNING':
00608         self.getPythonShellWidget().restoreIO()
00609
00610   def verifySoftware(self):
00611     (release, failedFiles) = Gversions.verifyFileDigests()
00612     strFailed = ""
00613     i = 0
00614     for filename in failedFiles:
00615       i += 1
00616       if i % 5 == 0:
00617         strFailed += '\n'
00618       strFailed += filename + ' '
00619     if len(failedFiles) == 0:
00620       QMessageBox.information( None, "Software Verification Results",
00621                                      "Release = " + release + "\n\n"
00622                                      "Verification completed successfully",
00623                                      QMessageBox.Ok + QMessageBox.Default )
00624     else:
00625       QMessageBox.warning    ( None, "Software Verification Results",
00626                                      "Release = " + release + "\n\n" +
00627                                      "Verification found the following " +
00628                                      "inconsistent files:\n" + strFailed,
00629                                      QMessageBox.Ok + QMessageBox.Default )
00630
00631   def elogWebsite(self):
00632     self.__common.elogWebsite()
00633
00634   def warnFreeSpace(self, warn_level):
00635     mess = "Low Disk Space Warning!\n" + \
00636            "The space available for data writing\n" + \
00637            "is below %u Megabytes.  Continue?" % (warn_level / (1024*1024))
00638     mb = QMessageBox.warning(None, '', mess,
00639                              QMessageBox.Yes | QMessageBox.Default,
00640                              QMessageBox.No  | QMessageBox.Escape,
00641                              QMessageBox.NoButton );
00642     return mb is not QMessageBox.No
00643
00644   def aboutRunControl(self):
00645     release = Gversions.getReleaseFromDigest()
00646     message = "RunControl System\n\nLATTE Release: %s" % release
00647     if sys.modules.has_key('sihippo'):
00648       message = message + "\n\nHippoDraw Release: %s" % sys.modules['sihippo'].__version__
00649     message = message + "\n\nQt Version: %s" % qVersion()
00650     message = message + "\n\nPyQt Version: %s" % PYQT_VERSION_STR
00651     subsysReleases = {}
00652     for subsysRoot in ROOT_DIR_ENVS:
00653       if subsysRoot != 'LATTE_ROOT' and os.environ.has_key(subsysRoot):
00654         release = Gversions.getReleaseFromDigest(digestDataFile=None, rootDirEnv=subsysRoot)
00655         subsysReleases[subsysRoot[:subsysRoot.find("_ROOT")]] = release
00656     if len(subsysReleases) > 0:
00657       message = message + "\n\nSubsystem Releases:"
00658       for (subSys, release) in subsysReleases.items():
00659         message = message + "\n  %s\t%s" % (subSys, release)
00660     QMessageBox.about(self,'LATTE RunControl', message)
00661
00662
00663   def fileLogout(self):
00664    if not self.login():
00665      self.inShutdown = True
00666      self.close()
00667
00668   def closeEvent(self, e):
00669     if self.__common.options().securedir is not None and not self.inShutdown and \
00670        not self.__common.prefMan().preferences()["operatorobj"].isAdministrator():
00671       e.ignore()
00672     else:
00673       RunControlMainGUIImpl.closeEvent(self, e)
00674
00675   def login(self):
00676     # Write the modified preferences to the cfg file
00677     loginResult = -1
00678     while loginResult == -1:
00679       loginResult = self.__common.showLogin(self)
00680       if loginResult == -1:
00681         QMessageBox.critical(self, "Authentication Failed",
00682                                    "Invalid user id or password")
00683       elif loginResult == -2:
00684         QMessageBox.critical(self, "Authentication Failed",
00685                                    "Password database is not available")
00686       if loginResult == -1:
00687         continue
00688       elif loginResult != 1:
00689         return loginResult
00690       # Set the operator based on login
00691       operator = self.__common.prefMan().preferences()["users"].getUserByLoginId(self.__common.getLoginId())
00692       if operator is None:
00693         QMessageBox.critical(self, "Authentication Failed",
00694                                   "Can not find the user under preferences")
00695         log.error("User authentication failed, can not find the user %s under preferences"
00696                   % self.__common.getLoginId())
00697         loginResult = -1
00698         continue
00699       else:
00700         self.cmbOperator.setCurrentText(operator.getName())
00701         self.cmbOperator.setEnabled(0)
00702         self.__common.prefMan().setOperator(operator.getName())
00703         self.applyPermissions(operator)
00704         return 1
00705
00706   def getHardwareVersions(self, lat=None, xbrd=None):
00707     if self.__hwVersions is None:
00708       if lat is None: lat = self.__common.getLAT()
00709       if xbrd is None: xbrd = self.__common.getXBRD()
00710       self.__hwVersions = Gversions.getHardwareVersions(lat, xbrd)
00711     return self.__hwVersions
00712
00713   def clearHardwareVersionsCache(self):
00714     self.__hwVersions = None
00715
00716   def getFSM(self):
00717     return self.__fsm
00718
00719   def getApp(self):
00720     return self.__app
00721
00722   def isGUIthread(self):
00723     """Returns True if this method is being called from the GUI thread.
00724     """
00725     return threading.currentThread() == self.__guiThread
00726
00727   def customEvent(self, e):
00728     """This method overrides the QObject base class's.  There is generally
00729     no reason to call this method directly.  It is called by the Qt
00730     infrastructure whenever the custom event is posted, e.g. by the following
00731     three methods of this class: createGUI, execGUImethodNR and execGUImethod.
00732     """
00733     self.__guiBridge.handleCustomEvent(e)
00734
00735   def createGUI(self, obj, *args, **kwargs):
00736     """Method used for instantiating a GUI from a non-GUI subthread"""
00737     return self.__guiBridge.createGUI(self, obj, *args, **kwargs)
00738
00739   def execGUImethodNR(self, func, *args, **kwargs):
00740     """Method used for executing a GUI function from a non-GUI thread.
00741     Use this method when no (useful) response is expected or
00742     when waiting for one could cause a deadlock.  Any response from the
00743     function is lost."""
00744     if self.inShutdown:  return # Don't try to update the GUI during shutdown
00745
00746     return self.__guiBridge.execGUImethodNR(self, func, *args, **kwargs)
00747
00748   def execGUImethod(self, func, *args, **kwargs):
00749     """Method used for executing a GUI function from a non-GUI thread.
00750     Use this method when a response is expected from the function and
00751     when it is appropriate to wait for it (no deadlock arises)"""
00752     if self.inShutdown:  return # Don't try to update the GUI during shutdown
00753
00754     return self.__guiBridge.execGUImethod(self, func, *args, **kwargs)
00755
00756   def getSecurityMan(self):
00757     return self.__common.getSecurityMan()
00758
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: RunControlMainGUIImpl.py Source File

runcontrol

RunControlMainGUIImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT GUI for Online Run Control and Systems Main Window"
00012 __author__   = """A. Kavelaars <AliciaK@SLAC.Stanford.edu>
00013                                SLAC - GLAST LAT I&T/Online"""
00014 __date__     = ("$Date: 2004/11/05 00:47:19 $").split(' ')[1]
00015 __version__  = "$Revision: 2.9 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021
00022 import sys
00023 import logging            as log
00024 from qt                   import *
00025
00026 from RunControlMainGUI    import RunControlMainGUI
00027 from rcStatusMonitor      import *
00028 from rcCommentPanel       import *
00029 from rcPythonShell        import *
00030
00031 import rcParamVerifier
00032
00033 import LATTE.client.gLog as gLog
00034
00035 class RunControlMainGUIImpl(RunControlMainGUI):
00036
00037   class ListBoxToolTip(QToolTip):
00038     def __init__(self, listbox):
00039       QToolTip.__init__(self, listbox.viewport())
00040       self.__listbox = listbox
00041
00042     def maybeTip(self, pos):
00043       item = self.__listbox.itemAt(pos)
00044       tipString = item.text()
00045       cr = self.__listbox.itemRect(item)
00046       cr.moveTopLeft(self.__listbox.contentsToViewport(cr.topLeft()))
00047       QToolTip(self).tip(cr, tipString)
00048
00049   class DockableTab(QDockWindow):
00050     def __init__(self, parent, name, panel, tabPage, flags = 0):
00051       QDockWindow.__init__(self, parent, name, flags)
00052       self.__parent = parent
00053       self.__panel = panel
00054       self.__tabPage = tabPage
00055       self.__name = name
00056       self.setCaption(name)
00057       self.connect(self,SIGNAL("visibilityChanged(bool)"), self.visibilityChanged)
00058
00059     def visibilityChanged(self, visible):
00060       if not visible:
00061         self.__parent.showPage(self.__tabPage)
00062         self.__panel.reparent(self.__tabPage, 0, QPoint(0,0), 1)
00063         self.__tabPage.layout().addWidget(self.__panel,0,1)
00064         self.disconnect(self,SIGNAL("visibilityChanged(bool)"), self.visibilityChanged)
00065
00066   def __init__(self, common, parent = None, name = None, fl = 0):
00067     RunControlMainGUI.__init__(self, parent, name, fl)
00068
00069     self.connect(self.AppOpenButton,SIGNAL("clicked()"),self.loadScript)
00070     self.connect(self.OpenAppl,SIGNAL("activated(const QString &)"),self.initApp)
00071     self.OpenApplTip = RunControlMainGUIImpl.ListBoxToolTip(self.OpenAppl.listBox())
00072
00073     self.connect(self.ResetButton,SIGNAL("clicked()"),self.ResetClicked)
00074     self.connect(self.StopButton,SIGNAL("clicked()"),self.StopClicked)
00075     self.connect(self.RunButton,SIGNAL("clicked()"),self.RunClicked)
00076     self.connect(self.PauseButton,SIGNAL("clicked()"),self.PauseClicked)
00077
00078     self.connect(self.fileOpen_ApplicationAction,SIGNAL("activated()"),self.loadScript)
00079     self.connect(self.fileSelect_SchemaAction,SIGNAL("activated()"),self.loadSchema)
00080     self.connect(self.fileConnectAction,SIGNAL("activated()"),self.connectClicked)
00081     self.connect(self.fileExitAction,SIGNAL("activated()"),self.fileExit)
00082     self.connect(self.fileLogoutAction,SIGNAL("activated()"),self.fileLogout)
00083     self.connect(self.controlResetAction,SIGNAL("activated()"),self.ResetClicked)
00084     self.connect(self.controlStopAction,SIGNAL("activated()"),self.StopClicked)
00085     self.connect(self.controlRunAction,SIGNAL("activated()"),self.RunClicked)
00086     self.connect(self.controlPauseAction,SIGNAL("activated()"),self.PauseClicked)
00087     self.connect(self.editPreferencesAction,SIGNAL("activated()"),self.PreferencesActivated)
00088
00089     self.connect(self.helpVerifyAction,SIGNAL("activated()"),self.verifySoftware)
00090     self.connect(self.helpELogAction,SIGNAL("activated()"),self.elogWebsite)
00091     self.connect(self.helpAboutAction,SIGNAL("activated()"),self.aboutRunControl)
00092     self.connect(self.viewStatusPanel,SIGNAL("activated()"),self.showHideStatusPanel)
00093     self.connect(self.viewComments,SIGNAL("activated()"),self.showHideComments)
00094     #self.connect(self.viewRunCond,SIGNAL("activated()"),self.showHideRunCond)
00095     self.connect(self.viewPythonShell,SIGNAL("activated()"),self.showHidePythonShell)
00096     self.connect(self.cmbOperator,SIGNAL("activated(const QString&)"),self.setOperator)
00097     self.connect(self.comboParticleType, SIGNAL("activated(const QString&)"), self.setParticleType)
00098     self.connect(self.comboOrientation, SIGNAL("activated(const QString&)"), self.setOrientation)
00099     self.connect(self.RunControlTab, SIGNAL("currentChanged(QWidget*)"), self.activateTab)
00100
00101
00102     self.__dwStatusPanel = QDockWindow()
00103     self.__dwStatusPanel.setResizeEnabled(1)
00104     self.__dwStatusPanel.setCloseMode(QDockWindow.Always)
00105     self.__statusPanel = rcStatusPanel(self.__dwStatusPanel)
00106     self.__dwStatusPanel.setWidget(self.__statusPanel)
00107     self.__dwStatusPanel.setCaption('Status Panel')
00108     self.statusView = self.__statusPanel.statusView
00109     self.statusView.setSorting(-1)
00110     self.statusView.setColumnWidth(1, 200)
00111     self.setDockEnabled(self.__dwStatusPanel, Qt.DockTop, 0)
00112     self.setDockEnabled(self.__dwStatusPanel, Qt.DockBottom, 0)
00113     self.setDockEnabled(self.__dwStatusPanel, Qt.DockLeft, 0)
00114     self.addDockWindow(self.__dwStatusPanel, Qt.DockRight)
00115     self.__dwStatusPanel.setFixedExtentWidth(321)
00116     #self.__dwStatusPanel.setFixedExtentHeight(250)
00117     self.connect(self.__dwStatusPanel,SIGNAL("visibilityChanged(bool)"),self.viewStatusPanel, SLOT("setOn(bool)"))
00118
00119     self.__dwComments = QDockWindow()
00120     self.__dwComments.setResizeEnabled(1)
00121     self.__dwComments.setCloseMode(QDockWindow.Always)
00122     self.__comments = rcCommentPanel(self.__dwComments)
00123     self.__dwComments.setWidget(self.__comments)
00124     self.__dwComments.setCaption('Comments')
00125     self.__teComments = self.__comments.getWidget()
00126     self.setDockEnabled(self.__dwComments, Qt.DockTop, 0)
00127     self.setDockEnabled(self.__dwComments, Qt.DockBottom, 1)
00128     self.setDockEnabled(self.__dwComments, Qt.DockLeft, 0)
00129     self.addDockWindow(self.__dwComments, Qt.DockBottom)
00130     self.__dwComments.setFixedExtentWidth(0)
00131     self.__dwComments.setFixedExtentHeight(50)
00132     self.connect(self.__dwComments,SIGNAL("visibilityChanged(bool)"),self.viewComments, SLOT("setOn(bool)"))
00133     self.__dwComments.hide()
00134
00135     #self.__dwRunCond = QDockWindow()
00136     #self.__dwRunCond.setResizeEnabled(1)
00137     #self.__dwRunCond.setVerticallyStretchable(0)
00138     #self.__dwRunCond.setCloseMode(QDockWindow.Always)
00139     #self.__runCond = rcRunConditions(self.__dwRunCond)
00140     #self.__dwRunCond.setWidget(self.__runCond)
00141     #self.__dwRunCond.setCaption('Run Conditions')
00142     #self.setDockEnabled(self.__dwRunCond, Qt.DockTop, 0)
00143     #self.setDockEnabled(self.__dwRunCond, Qt.DockBottom, 1)
00144     #self.setDockEnabled(self.__dwRunCond, Qt.DockLeft, 0)
00145     #self.setDockEnabled(self.__dwRunCond, Qt.DockRight, 1)
00146     #self.addDockWindow(self.__dwRunCond, Qt.DockRight)
00147     #self.__dwRunCond.setFixedExtentWidth(0)
00148     #self.__dwRunCond.setFixedExtentHeight(0)
00149     #self.connect(self.__dwRunCond,SIGNAL("visibilityChanged(bool)"),self.viewRunCond, SLOT("setOn(bool)"))
00150     #self.connect(self.__runCond.comboParticleType, SIGNAL("activated(const QString&)"), self.setParticleType)
00151     #self.connect(self.__runCond.comboInstrumentType, SIGNAL("activated(const QString&)"), self.setInstrumentType)
00152     #self.connect(self.__runCond.comboOrientation, SIGNAL("activated(const QString&)"), self.setOrientation)
00153     #self.connect(self.__runCond.comboPhase, SIGNAL("activated(const QString&)"), self.setPhase)
00154
00155     self.__dwPythonShell = QDockWindow()
00156     self.__dwPythonShell.setResizeEnabled(1)
00157     self.__dwPythonShell.setVerticallyStretchable(0)
00158     self.__dwPythonShell.setCloseMode(QDockWindow.Always)
00159     self.__pythonShell = rcPythonShell(self.__dwPythonShell)
00160     self.__dwPythonShell.setWidget(self.__pythonShell)
00161     self.__dwPythonShell.setCaption('Python Shell')
00162     self.__tePythonShell = self.__pythonShell.getWidget()
00163     self.setDockEnabled(self.__dwPythonShell, Qt.DockTop, 0)
00164     self.setDockEnabled(self.__dwPythonShell, Qt.DockBottom, 1)
00165     self.setDockEnabled(self.__dwPythonShell, Qt.DockLeft, 0)
00166     self.setDockEnabled(self.__dwPythonShell, Qt.DockRight, 1)
00167     self.addDockWindow(self.__dwPythonShell, Qt.DockRight)
00168     self.__dwPythonShell.undock()
00169     #self.__dwPythonShell.setFixedExtentWidth(0)
00170     self.__dwPythonShell.setFixedExtentHeight(50)
00171     self.connect(self.__dwPythonShell,SIGNAL("visibilityChanged(bool)"),self.viewPythonShell, SLOT("setOn(bool)"))
00172     self.hidePythonShell()
00173
00174     self.__prefs = common.prefMan().preferences()
00175
00176     if self.__prefs.has_key('particle type'):
00177       for (item, val) in self.__prefs['particle type'].items():
00178         self.comboParticleType.insertItem(item)
00179       if self.__prefs.has_key('lastparticletype'):
00180         self.comboParticleType.setCurrentText(self.__prefs['lastparticletype'])
00181       else:
00182         self.__prefs["lastparticletype"]= str(self.comboParticleType.currentText())
00183
00184     #if self.__prefs.has_key('instrument type'):
00185     #  list = self.__prefs['instrument type'].keys()
00186     #  list.sort()
00187     #  for item in list:
00188     #    self.__runCond.comboInstrumentType.insertItem(item)
00189     #  self.__prefs["sel_instrument_type"] = str(self.__runCond.comboInstrumentType.currentText())
00190
00191     if self.__prefs.has_key('orientation'):
00192       keyList = self.__prefs['orientation'].keys()
00193       keyList.sort()
00194       for item in keyList:
00195         self.comboOrientation.insertItem(item)
00196       if self.__prefs.has_key('lastorientation'):
00197         self.comboOrientation.setCurrentText(self.__prefs['lastorientation'])
00198       else:
00199         self.__prefs["lastorientation"] = str(self.comboOrientation.currentText())
00200
00201     #if self.__prefs.has_key('phase'):
00202     #  list = self.__prefs['phase'].keys()
00203     #  list.sort()
00204     #  for item in list:
00205     #    self.__runCond.comboPhase.insertItem(item)
00206     #  self.__prefs["sel_phase"] = str(self.__runCond.comboPhase.currentText())
00207
00208
00209     self._currentApp = self.__prefs['appdir']
00210     self._currentSchema = self.__prefs['reposdir']
00211     self.__common = common
00212     self.__statMon = rcStatusMonitor(1000, self)
00213     self.__statMon.addWatchItem('Operator', self.getOperator)
00214     self.__statMon.addWatchItem('Operator Id', self.__prefs, 'userid')
00215     #self.__statMon.addWatchItem('FITS Enabled', self.__prefs, 'fitsnbl', alarmExpr='==0')
00216     #self.__statMon.addWatchItem('FITS Compressed', self.__prefs, 'fitscompress')
00217     self.__statMon.addWatchItem('Data Dir', self.__prefs, 'datadir')
00218     self.__statMon.addWatchItem('Log Dir', self.__prefs, 'logdir')
00219     self.__statMon.addWatchItem('App Dir', self.__prefs, 'appdir')
00220     self.__statMon.addWatchItem('Repos Dir', self.__prefs, 'reposdir')
00221     self.__statMon.addWatchItem('Report Dir', self.__prefs, 'reportdir')
00222     self.__statMon.addWatchItem('FITS Dir', self.__prefs, 'fitsdir')
00223     self.__statMon.addWatchItem('Export Dir', self.__prefs, 'exportdir')
00224     self.__statMon.addWatchItem('Snapshot Dir', self.__prefs, 'snapshotdir')
00225     self.__statMon.addWatchItem('Message Log Enabled', self.__prefs, 'lognbl')
00226     self.__statMon.addWatchItem('Message Log Level', self.__prefs, 'loglevel')
00227     self.__statMon.addWatchItem('Message Log File', self.__prefs, 'logfilename')
00228     self.__statMon.addWatchItem('Archive On', self.__prefs, 'datasave',alarmExpr='==0')
00229     self.__statMon.addWatchItem('Export On', self.__prefs, 'dataexport',alarmExpr='==0')
00230     self.__statMon.addWatchItem('Env Monitoring On', self.__prefs, 'envmonnbl',alarmExpr='==0')
00231     self.__statMon.addWatchItem('Snapshots On', self.__prefs, 'snapnbl', alarmExpr='==0')
00232     self.__statMon.addWatchItem('Schema Config File', self.getSchemaConfigFile)
00233
00234     self.__statMon.startWatch()
00235
00236     self.__paramVerifier = rcParamVerifier.rcParamVerifier(self.common(), self)
00237
00238     self.refreshUsers()
00239
00240     self.__panels = {}
00241
00242     self.RunControlTab.mouseDoubleClickEvent = self.mouseDblClick
00243
00244     for i in range(self.RunControlTab.count()):
00245       tabPage = self.RunControlTab.page(i)
00246       label = str(self.RunControlTab.tabLabel(tabPage))
00247       if   label == 'Global':
00248         try:
00249           import GlobalPanelImpl
00250         except:
00251           gLog.logException()
00252         else:
00253           GlobalPanelLayout = QGridLayout(tabPage,1,1,0,6,"GlobalPanelLayout")
00254           panel = GlobalPanelImpl.GlobalPanelImpl(self, self.common(), tabPage)
00255           self.__panels[label] = panel
00256           GlobalPanelLayout.addWidget(panel,0,1)
00257       elif label == 'Power':
00258         try:
00259           import PowerPanelImpl
00260         except:
00261           gLog.logException()
00262         else:
00263           PowerPanelLayout = QGridLayout(tabPage,1,1,0,6,"PowerPanelLayout")
00264           panel = PowerPanelImpl.PowerPanelImpl(self, self.common(), tabPage)
00265           self.__panels[label] = panel
00266           PowerPanelLayout.addWidget(panel,0,1)
00267       elif label == 'ACD':
00268         try:
00269           import AcdPanelImpl
00270         except ImportError:
00271           pass
00272         except:
00273           gLog.logException()
00274           log.warning("*** Unable to load ACD sub-system panel...bypassing ***")
00275         else:
00276           AcdPanelLayout = QGridLayout(tabPage,1,1,0,6,"AcdPanelLayout")
00277           panel = AcdPanelImpl.AcdPanelImpl(self, self.common(), tabPage)
00278           self.__panels[label] = panel
00279           AcdPanelLayout.addWidget(panel,0,1)
00280       elif label == 'CAL':
00281         try:
00282           import CalPanelImpl
00283         except ImportError:
00284           pass
00285         except:
00286           gLog.logException()
00287           log.warning("*** Unable to load CAL sub-system panel...bypassing ***")
00288         else:
00289           CalPanelLayout = QGridLayout(tabPage,1,1,0,6,"CalPanelLayout")
00290           panel = CalPanelImpl.CalPanelImpl(self, self.common(), tabPage)
00291           self.__panels[label] = panel
00292           CalPanelLayout.addWidget(panel,0,1)
00293       elif label == 'TKR':
00294         try:
00295           import TkrPanelImpl
00296         except ImportError:
00297           pass
00298         except:
00299           gLog.logException()
00300           log.warning("*** Unable to load TKR sub-system panel...bypassing ***")
00301         else:
00302           TkrPanelLayout = QGridLayout(tabPage,1,1,0,6,"TkrPanelLayout")
00303           panel = TkrPanelImpl.TkrPanelImpl(self, self.common(), tabPage)
00304           self.__panels[label] = panel
00305           TkrPanelLayout.addWidget(panel,0,1)
00306
00307   def refreshUsers(self, operator=None):
00308     self.cmbOperator.clear()
00309     userList = self.__prefs['users'].getIdNameDict().values()
00310     userList.sort()
00311     for userName in userList:
00312       self.cmbOperator.insertItem(userName)
00313     if operator is not None:
00314       self.cmbOperator.setCurrentText(operator.getName())
00315
00316   def mouseDblClick(self, event):
00317     tabPage = self.RunControlTab.currentPage()
00318     label = str(self.RunControlTab.tabLabel(tabPage))
00319     if label in self.__panels:
00320       panel = self.__panels[label]
00321       dwPanel = self.DockableTab(self.RunControlTab, label, panel, tabPage)
00322       dwPanel.setResizeEnabled(1)
00323       dwPanel.setVerticallyStretchable(0)
00324       dwPanel.setCloseMode(QDockWindow.Always)
00325       panel.reparent(dwPanel, 0, QPoint(0, 0), 1)
00326       dwPanel.setWidget(panel)
00327       dwPanel.undock()
00328       dwPanel.show()
00329
00330   def activateTab(self, tabPage):
00331     label = str(self.RunControlTab.tabLabel(tabPage))
00332     if label in self.__panels:
00333       panel = self.__panels[label]
00334       if "activate" in dir(panel):
00335         panel.activate()
00336
00337   def panels(self):
00338     return self.__panels
00339
00340   def common(self):
00341     return self.__common
00342
00343   def preferences(self):
00344     return self.__prefs
00345
00346   def statusMonitor(self):
00347     return self.__statMon
00348
00349   def parameterVerifier(self):
00350     return self.__paramVerifier
00351
00352   def getSchemaConfigFile(self):
00353     dbn = self.common().getDBN()
00354     if dbn.has_key('_LATSchemaFile'):
00355       return dbn['_LATSchemaFile']
00356
00357   def getOperator(self):
00358     if 'operatorobj' in self.__prefs:
00359       return self.__prefs['operatorobj'].getName()
00360
00361   def getCommentWidget(self):
00362     return self.__comments.getWidget()
00363
00364   def getPythonShellWidget(self):
00365     return self.__pythonShell.getWidget()
00366
00367   def showHideStatusPanel(self):
00368     if self.viewStatusPanel.isOn():
00369       self.__dwStatusPanel.show()
00370     else:
00371       self.__dwStatusPanel.hide()
00372
00373   def showHideComments(self):
00374     if self.viewComments.isOn():
00375       self.__dwComments.show()
00376     else:
00377       self.__dwComments.hide()
00378
00379   def showComments(self):
00380     self.__dwComments.show()
00381
00382   def hideComments(self):
00383     self.__dwComments.hide()
00384
00385   #def showHideRunCond(self):
00386   #  if self.viewRunCond.isOn():
00387   #    self.__dwRunCond.show()
00388   #  else:
00389   #    self.__dwRunCond.hide()
00390
00391   def showHidePythonShell(self):
00392     pass
00393
00394   def showPythonShell(self):
00395     self.__dwPythonShell.show()
00396     self.__tePythonShell.setFocus()
00397
00398   def hidePythonShell(self):
00399     self.__dwPythonShell.hide()
00400
00401   def isPythonShellHidden(self):
00402     return not self.viewPythonShell.isOn()
00403
00404   def PreferencesActivated(self):
00405     prefGUI = self.__common.prefGUI()
00406     prefGUI.loadConfig()
00407     status = prefGUI.exec_loop()
00408     if status == prefGUI.Accepted:
00409       self.__common.EBFdistribution()
00410       self.__common.startLogger()
00411       operator = self.__common.prefMan().preferences()["operatorobj"]
00412       self.refreshUsers(operator)
00413
00414
00415   def ResetClicked(self):
00416     pass
00417
00418   def StopClicked(self):
00419     pass
00420
00421   def RunClicked(self):
00422     pass
00423
00424   def PauseClicked(self):
00425     pass
00426
00427   def loadScript(self):
00428     rcAppSel = rcFileSelector(self._currentApp, "(*.py)", self, "Select an application")
00429     applName = rcAppSel.getValue()
00430     # Allow the C++ object to be deleted
00431     rcAppSel.deleteLater()
00432     if applName is None: return
00433     self._currentApp = applName
00434     self.OpenAppl.clearEdit()
00435     self.OpenAppl.setCurrentText(applName)
00436     self.initApp()
00437
00438   def loadSchema(self):
00439     rcSchemaSel = rcFileSelector(self._currentSchema, "(*.xml)", self, "Select a schema")
00440     schemaName = rcSchemaSel.getValue()
00441     # Allow the C++ object to be deleted
00442     rcSchemaSel.deleteLater()
00443     if schemaName is None: return
00444     self._currentSchema = schemaName
00445     self.__common.readSchema(schemaName)
00446     self.__panels['Power'].activate()
00447     if self.getApp() is not None:
00448       self.getApp().lat  = self.__common.getLAT()
00449       self.getApp().xbrd = self.__common.getXBRD()
00450     self.ResetClicked()
00451
00452   def getApp(self):
00453     # Overridden in RunControlMain
00454     return None
00455
00456   def fileExit(self):
00457     # Write the modified preferences to the cfg file
00458     self.close()
00459
00460   def connectClicked(self):
00461     log.warning("RunControlMainGUIImpl.connectClicked(): Not implemented yet")
00462
00463   def fileLogout(self):
00464     log.warning("RunControlMainGUIImpl.fileLogout(): Not implemented yet")
00465
00466   def closeEvent(self, e):
00467     e.accept()
00468
00469   def filePrint(self):
00470     log.warning("RunControlMainGUIImpl.filePrint(): Not implemented yet")
00471
00472   def setOperator(self, operator):
00473     pass
00474
00475   def setParticleType(self, particleType):
00476     pass
00477
00478   def setInstrumentType(self, instrumentType):
00479     pass
00480
00481   def setOrientation(self, orientation):
00482     pass
00483
00484   def setPhase(self, phase):
00485     pass
00486
00487   def verifySoftware(self):
00488     pass
00489
00490   def elogWebsite(self):
00491     pass
00492
00493   def aboutRunControl(self):
00494     pass
00495
00496 class rcFileSelector(QFileDialog):
00497   def __init__(self, startwith, filter, parent, name):
00498     QFileDialog.__init__(self, parent, name, 0)
00499     self.setMode(QFileDialog.ExistingFile)
00500     self.setFilter(filter)
00501     self.setDir(os.path.dirname(startwith))
00502     self.setCaption(name)
00503     self.setViewMode( QFileDialog.Detail)
00504     self.setSelection(startwith)
00505
00506   def getValue(self):
00507     if self.exec_loop() == QDialog.Accepted:
00508       return str(self.selectedFile())
00509     else:
00510       return None
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: saferef.py Source File

dispatch

saferef.py

00001 """Refactored "safe reference" from dispatcher.py"""
00002 import weakref, traceback
00003
00004 def safeRef(target, onDelete = None):
00005     """Return a *safe* weak reference to a callable target
00006
00007     target -- the object to be weakly referenced, if it's a
00008         bound method reference, will create a BoundMethodWeakref,
00009         otherwise creates a simple weakref.
00010     onDelete -- if provided, will have a hard reference stored
00011         to the callable to be called after the safe reference
00012         goes out of scope with the reference object, (either a
00013         weakref or a BoundMethodWeakref) as argument.
00014     """
00015     if hasattr(target, 'im_self'):
00016         if target.im_self is not None:
00017             # Turn a bound method into a BoundMethodWeakref instance.
00018             # Keep track of these instances for lookup by disconnect().
00019             assert hasattr(target, 'im_func'), """safeRef target %r has im_self, but no im_func, don't know how to create reference"""%( target,)
00020             reference = BoundMethodWeakref(
00021                 target=target,
00022                 onDelete=onDelete
00023             )
00024             return reference
00025     if callable(onDelete):
00026         return weakref.ref(target, onDelete)
00027     else:
00028         return weakref.ref( target )
00029
00030 class BoundMethodWeakref(object):
00031     """'Safe' and reusable weak references to instance methods
00032
00033     BoundMethodWeakref objects provide a mechanism for
00034     referencing a bound method without requiring that the
00035     method object itself (which is normally a transient
00036     object) is kept alive.  Instead, the BoundMethodWeakref
00037     object keeps weak references to both the object and the
00038     function which together define the instance method.
00039
00040     Attributes:
00041         key -- the identity key for the reference, calculated
00042             by the class's calculateKey method applied to the
00043             target instance method
00044         deletionMethods -- sequence of callable objects taking
00045             single argument, a reference to this object which
00046             will be called when *either* the target object or
00047             target function is garbage collected (i.e. when
00048             this object becomes invalid).  These are specified
00049             as the onDelete parameters of safeRef calls.
00050         weakSelf -- weak reference to the target object
00051         weakFunc -- weak reference to the target function
00052
00053     Class Attributes:
00054         _allInstances -- class attribute pointing to all live
00055             BoundMethodWeakref objects indexed by the class's
00056             calculateKey(target) method applied to the target
00057             objects.  This weak value dictionary is used to
00058             short-circuit creation so that multiple references
00059             to the same (object, function) pair produce the
00060             same BoundMethodWeakref instance.
00061
00062     """
00063     _allInstances = weakref.WeakValueDictionary()
00064     def __new__( cls, target, onDelete=None, *arguments,**named ):
00065         """Create new instance or return current instance
00066
00067         Basically this method of construction allows us to
00068         short-circuit creation of references to already-
00069         referenced instance methods.  The key corresponding
00070         to the target is calculated, and if there is already
00071         an existing reference, that is returned, with its
00072         deletionMethods attribute updated.  Otherwise the
00073         new instance is created and registered in the table
00074         of already-referenced methods.
00075         """
00076         key = cls.calculateKey(target)
00077         current =cls._allInstances.get(key)
00078         if current is not None:
00079             current.deletionMethods.append( onDelete)
00080             return current
00081         else:
00082             base = super( BoundMethodWeakref, cls).__new__( cls )
00083             cls._allInstances[key] = base
00084             base.__init__( target, onDelete, *arguments,**named)
00085             return base
00086     def __init__(self, target, onDelete=None):
00087         """Return a weak-reference-like instance for a bound method
00088
00089         target -- the instance-method target for the weak
00090             reference, must have im_self and im_func attributes
00091             and be reconstructable via:
00092                 target.im_func.__get__( target.im_self )
00093             which is true of built-in instance methods.
00094         onDelete -- optional callback which will be called
00095             when this weak reference ceases to be valid
00096             (i.e. either the object or the function is garbage
00097             collected).  Should take a single argument,
00098             which will be passed a pointer to this object.
00099         """
00100         def remove(weak, self=self):
00101             """Set self.isDead to true when method or instance is destroyed"""
00102             methods = self.deletionMethods[:]
00103             del self.deletionMethods[:]
00104             try:
00105                 del self.__class__._allInstances[ self.key ]
00106             except KeyError:
00107                 pass
00108             for function in methods:
00109                 try:
00110                     if callable( function ):
00111                         function( self )
00112                 except Exception:
00113                     traceback.print_exc()
00114         self.deletionMethods = [onDelete]
00115         self.key = self.calculateKey( target )
00116         self.weakSelf = weakref.ref(target.im_self, remove)
00117         self.weakFunc = weakref.ref(target.im_func, remove)
00118     def calculateKey( cls, target ):
00119         """Calculate the reference key for this reference
00120
00121         Currently this is a two-tuple of the id()'s of the
00122         target object and the target function respectively.
00123         """
00124         return (id(target.im_self),id(target.im_func))
00125     calculateKey = classmethod( calculateKey )
00126     def __str__(self):
00127         """Give a friendly representation of the object"""
00128         return """%s( %s.%s )"""%(
00129             self.__class__.__name__,
00130             self.weakSelf(),
00131             self.weakFunc().__name__,
00132         )
00133     __repr__ = __str__
00134     def __nonzero__( self ):
00135         """Whether we are still a valid reference"""
00136         return self() is not None
00137     def __cmp__( self, other ):
00138         """Compare with another reference"""
00139         if not isinstance (other,self.__class__):
00140             return cmp( self.__class__, type(other) )
00141         return cmp( self.key, other.key)
00142     def __call__(self):
00143         """Return a strong reference to the bound method
00144
00145         If the target cannot be retrieved, then will
00146         return None, otherwise returns a bound instance
00147         method for our object and function.
00148
00149         Note:
00150             You may call this method any number of times,
00151             as it does not invalidate the reference.
00152         """
00153         target = self.weakSelf()
00154         if target is not None:
00155             function = self.weakFunc()
00156             if function is not None:
00157                 return function.__get__(target)
00158         return None
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: searchTextBrowserImpl.py Source File

browser

searchTextBrowserImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 import LATTE.copyright_SLAC
00011
00012 import os
00013 import sys
00014 import time
00015 import math
00016 import string
00017 from qt import *
00018 from gLAT import *
00019 from gSchemaConfig import *
00020 from cmdCli import *
00021 from Browser import Browser
00022 from browserPreferencesImpl import browserPreferencesImpl
00023
00024 # Pix map of OPEN FOLDER to shown an element of the hierarchy loaded
00025 image0_data = [
00026 "16 13 7 1",
00027 "d c #000000",
00028 "# c #a0a000",
00029 "c c #c0c080",
00030 "e c #e0c080",
00031 "b c #e0e080",
00032 "a c #fffbf0",
00033 ". c #ffffff",
00034 "...#####........",
00035 "..#aaaaa#.......",
00036 ".#abbbbba######.",
00037 ".#abbbbbbbaaaacd",
00038 ".#abbbbbbbbbbbcd",
00039 "############cbcd",
00040 "#abbbbbbebecdccd",
00041 "#abbbbebbebcdccd",
00042 ".#abbbbbebee#d#d",
00043 ".#abbebebeeecd#d",
00044 "..#aebebeeeec#dd",
00045 "..############dd",
00046 "...ddddddddddddd"
00047 ]
00048
00049
00050 class BrowserImpl(Browser):
00051
00052   def __init__(self,lat = None,cmd = None,parent = None,name = None,fl = 0):
00053     Browser.__init__(self,parent,name,fl)
00054
00055     self.__image0 = QPixmap(image0_data)
00056
00057     # Initialize file parameters
00058     self.printer = QPrinter()
00059     self.filename = QString.null
00060
00061     # Initialize LAT and Hierarchy Dictionary
00062     self.__lat     = None
00063
00064     # Initialize Hierarchy Dictionary
00065     self.__treeMap = {}
00066
00067     # Establish connection with the server
00068     if cmd is None:
00069       self.__cmd = CmdCli(123)
00070       self.__cmd.connect()
00071     else:
00072       self.__cmd = cmd
00073
00074     # Set GUI defaults
00075
00076     #~ self.explicitBroadcastNodes = 0
00077
00078     self.Hierarchy.setSorting(-1)
00079     #~ self.Hierarchy.sort()
00080     self.Hierarchy.setEnabled(0)
00081     self.TEMTab.setEnabled(0)
00082
00083     self.Conversion.setText("RAW")
00084     self.__base = 1
00085
00086     self.browserPreferences = browserPreferencesImpl()
00087     self.browserPreferences.hexButton.setChecked(1)
00088     self.browserPreferences.rawButton.setChecked(1)
00089
00090     self.Browsing.setText("TEM All, GCCC All, GCRC All, GCFE All")
00091
00092     # Set the Timer
00093     self.__timer = QTimer(self)
00094     #~ QObject.connect(self.__timer, SIGNAL("timeout()"), self.updateView)
00095
00096     # Set connections
00097     self.connect(self.Hierarchy, SIGNAL('clicked(QListViewItem*)'), \
00098       self.selectItem)
00099
00100     # Load Schema if LAT has been created
00101     if lat is not None:
00102       self.setupSchema(lat)
00103
00104   def loadSchema(self, filename):
00105     """ This function reads the xml file and creates the hierarchy tree in
00106         the Hierarchy window. To do so It calls the loadHierarchy function"""
00107
00108     lat = readSchema(filename)
00109     print "lat SchemaConfig File read"
00110
00111     # Load Schema if LAT has been created
00112     self.setupSchema(lat)
00113
00114     self.TEMTab.setEnabled(1)
00115
00116     self.Hierarchy.setEnabled(1)
00117
00118   def setupSchema(self, lat):
00119     ''' This function creates the Hierarchy tree and treeMap from the selected
00120         Schema.xml file '''
00121
00122     if lat.getCmd() is None:
00123       lat.setCmd(self.__cmd)
00124
00125     self.Hierarchy.clear()
00126
00127     self.loadHierarchy(lat)
00128
00129     self.populateRegs(lat)
00130     print "Schema Loaded"
00131
00132     #self.Hierarchy.setSorting(-1, 1)
00133
00134     self.__ApplyChanges = 0
00135     self.explicitBroadcastNodes = 0
00136
00137     self.__lat = lat
00138
00139     options = self.__lat._GLAT__declarations['options']
00140     self.explicitBroadcastNodes = options['explicitbroadcastnodes']
00141
00142   def loadHierarchy(self, lat):
00143
00144     latItem = QListViewItem(self.Hierarchy)
00145     latItem.setPixmap(0, self.__image0)
00146     latItem.setText(0,self.trUtf8("GLAT"))
00147     latItem.setExpandable(1)
00148     latItem.setOpen(1)
00149
00150     self.Hierarchy.setCurrentItem(latItem)
00151
00152     #~ AEM Leg
00153     aem = lat.downAEM()
00154     if aem is not None:
00155       self.TEMTab.setCurrentPage(0)
00156
00157       aemItem = QListViewItem(latItem)
00158       aemItem.setText(0,"GAEM")
00159       aemItem.setPixmap(0, self.__image0)
00160       aemItem.setOpen(1)
00161
00162       self.__treeMap[aemItem] = aem
00163
00164       #~ print "GARC Ids in Schema: ", aem._GAEM__childrenARC.keys()
00165       arcItem = None
00166       afeItem = None
00167
00168       for (arcId, arc) in aem._GAEM__childrenARC.items():
00169         if arcId != 255:
00170           arcNewItem = QListViewItem(aemItem, arcItem)
00171           arcNewItem.setPixmap(0, self.__image0)
00172           arcNewItem.setText(0, "GARC " + str(arcId))
00173
00174           self.__treeMap[arcNewItem] = arc
00175
00176           for (afeId, afe) in arc._GARC__childrenAFE.items():
00177             if afeId != 255:
00178               afeNewItem = QListViewItem(arcNewItem, afeItem)
00179               afeNewItem.setPixmap(0, self.__image0)
00180               afeNewItem.setText(0,"GAFE " + str(afeId))
00181
00182               self.__treeMap[afeNewItem] = afe
00183
00184               afeItem = afeNewItem
00185           arcItem = arcNewItem
00186
00187
00188       #~ aeq = aem.downAEQ()
00189       #~ lat.AEM.existsAEQ()
00190       if aem.existsAEQ():
00191         aeq = aem.downAEQ()
00192         aeqItem = QListViewItem(aemItem)
00193         aeqItem.setText(0,"GAEQ")
00194         aeqItem.setPixmap(0, self.__image0)
00195
00196         self.__treeMap[aeqItem] = aeq
00197
00198     # Initialize this parameters to store the list view items in the right order:
00199     # after the previous item. For example tccNewItem = QListViewItem(temNewItem, tccItem)
00200     temItem = None
00201     cccItem = None
00202     crcItem = None
00203     cfeItem = None
00204     tccItem = None
00205     trcItem = None
00206     tfeItem = None
00207
00208     for (temId, tem) in lat._GLAT__childrenTEM.items():
00209       print "TEM ID: ", temId
00210
00211       temNewItem = QListViewItem(latItem, temItem)
00212       temNewItem.setText(0,"GTEM " + str(temId))
00213       temNewItem.setPixmap(0, self.__image0)
00214
00215       self.__treeMap[temNewItem] = tem
00216
00217       for (tccId, tcc) in tem._GTEM__childrenTCC.items():
00218         if tccId != 255:
00219           tccNewItem = QListViewItem(temNewItem, tccItem)
00220           tccNewItem.setPixmap(0, self.__image0)
00221           tccNewItem.setText(0,"GTCC " + str(tccId))
00222
00223           self.__treeMap[tccNewItem] = tcc
00224
00225           for (trcId, trc) in tcc._GTCC__childrenTRC.items():
00226             if trcId != 255:
00227               trcNewItem = QListViewItem(tccNewItem, trcItem)
00228               trcNewItem.setPixmap(0, self.__image0)
00229               trcNewItem.setText(0,"GTRC " + str(trcId))
00230
00231               self.__treeMap[trcNewItem] = trc
00232
00233               for (tfeId, tfe) in trc._GTRC__childrenTFE.items():
00234                 if tfeId != 255:
00235                   tfeNewItem = QListViewItem(trcNewItem, tfeItem)
00236                   tfeNewItem.setPixmap(0, self.__image0)
00237                   tfeNewItem.setText(0,"GTFE " + str(tfeId))
00238
00239                   self.__treeMap[tfeNewItem] = tfe
00240
00241                   tfeItem = tfeNewItem
00242               trcItem = trcNewItem
00243           tccItem = tccNewItem
00244       temItem = temNewItem
00245
00246       for (cccId, ccc) in tem._GTEM__childrenCCC.items():
00247         if cccId != 255:
00248           cccNewItem = QListViewItem(temNewItem, cccItem)
00249           cccNewItem.setPixmap(0, self.__image0)
00250           cccNewItem.setText(0,"GCCC " + str(cccId))
00251
00252           self.__treeMap[cccNewItem] = ccc
00253
00254           for (crcId, crc) in ccc._GCCC__childrenCRC.items():
00255             if crcId != 255:
00256               crcNewItem = QListViewItem(cccNewItem, crcItem)
00257               crcNewItem.setPixmap(0, self.__image0)
00258               crcNewItem.setText(0,"GCRC " + str(crcId))
00259
00260               self.__treeMap[crcNewItem] = crc
00261
00262               for (cfeId, cfe) in crc._GCRC__childrenCFE.items():
00263                 if cfeId != 255:
00264                   cfeNewItem = QListViewItem(crcNewItem, cfeItem)
00265                   cfeNewItem.setPixmap(0, self.__image0)
00266                   cfeNewItem.setText(0,"GCFE " + str(cfeId))
00267
00268                   self.__treeMap[cfeNewItem] = cfe
00269
00270                   cfeItem = cfeNewItem
00271               crcItem = crcNewItem
00272           cccItem = cccNewItem
00273       temItem = temNewItem
00274
00275     #~ pdu = lat.downPDU()
00276     #~ if pdu is not None:
00277       #~ pduItem = QListViewItem(latItem)
00278       #~ pduItem.setText(0,self.trUtf8("GPDU"))
00279       #~ pduItem.setPixmap(0, self.__image0)
00280       #~ pduItem.setOpen(1)
00281
00282       #~ for twrId in pdu._GPDU__childrenTWR.items():
00283         #~ twrNewItem = QListViewItem(pduItem)
00284         #~ twrNewItem.setPixmap(0, self.__image0)
00285         #~ twrNewItem.setText(0,self.trUtf8("GTWR " + str(twrId)))
00286
00287   def populateRegs(self, lat):
00288     #~ lat = self.__lat
00289     self.TEMTab.setCurrentPage(1)
00290
00291     aem = lat.downAEM()
00292     if aem is not None:
00293       self.TEMTab.setCurrentPage(0)
00294       self.updateList(aem, aem.regs.keys(), self.AEM_Regs)
00295
00296       aeq = aem.downAEQ()
00297       if aeq is not None:
00298         self.updateList(aeq, aeq.regs.keys(), self.GAEQ_Regs)
00299
00300       for (arcId, arc) in aem._GAEM__childrenARC.items():
00301         self.updateList(arc, arc.regs.keys(), self.GARC_Regs)
00302         break
00303
00304       for (afeId, afe) in arc._GARC__childrenAFE.items():
00305         self.updateList(afe, afe.regs.keys(), self.GAFE_Regs)
00306         break
00307
00308     tem = None
00309     #if lat._GLAT__childrenTEM.keys() is not None:
00310     for (temId, tem) in lat._GLAT__childrenTEM.keys():
00311       self.updateList(tem, tem.regs.keys(), self.TEM_Regs)
00312       self.updateList(tem, tem.regs.keys(), self.TEM_Regs2)
00313       break
00314
00315     #~ tem = lat.downTEM(temId)
00316     if tem is not None:
00317       for (cccId, ccc) in tem._GTEM__childrenCCC.items():
00318         self.updateList(ccc, ccc.regs.keys(), self.GCCC_Regs)
00319         break
00320
00321       if ccc is not None:
00322         for (crcId, crc) in ccc._GCCC__childrenCRC.items():
00323           self.updateList(crc, crc.regs.keys(), self.GCRC_Regs)
00324           break
00325
00326         if crc is not None:
00327           for (cfeId, cfe) in crc._GCRC__childrenCFE.items():
00328             self.updateList(cfe, cfe.regs.keys(), self.GCFE_Regs)
00329             break
00330
00331       for (tccId, tcc) in tem._GTEM__childrenTCC.items():
00332         self.updateList(tcc, tcc.regs.keys(), self.GTCC_Regs)
00333         break
00334
00335       if tcc is not None:
00336         for (trcId, trc) in tcc._GTCC__childrenTRC.items():
00337           self.updateList(trc, trc.regs.keys(), self.GTRC_Regs)
00338           break
00339
00340         if trc is not None:
00341           for (tfeId, tfe) in trc._GTRC__childrenTFE.items():
00342             self.updateList(tfe, tfe.regs.keys(), self.GTFE_Regs)
00343             break
00344
00345   def updateList(self, parent, regList, listView):
00346     listView.header().setMovingEnabled(0)
00347     #~ listView.setColumnWidth(0,150)
00348     #~ listView.setColumnWidth(1,40)
00349     #~ listView.setColumnWidth(2,100)
00350
00351     regList.sort()
00352
00353     for reg in regList:
00354       reg = reg.upper()
00355       if parent.regs[str(reg)].size() != 0:
00356         item = QListViewItem(listView)
00357         item.setText(0, str(reg))
00358
00359   def selectItem(self, item):
00360     """ This function calls the clearViews function to clear all the register lists
00361         from the Tab window and then shows the registers of the selected Hierarchy
00362         node as well as upper level nodes """
00363
00364     # Setup Defaults
00365     self.setDefaults()
00366
00367     # Update selected Item
00368     self.updateSelection()
00369
00370     node = self.__treeMap[self.__currentItem]
00371     #~ parentNode = self.__treeMap[self.__currentParent]
00372     #~ grandParentNode = self.__treeMap[self.__currentGrandParent]
00373     #~ greatGrandParentNode = self.__treeMap[self.__currentGreatGrandParent]
00374
00375
00376     if self.__currentItem.text(0).startsWith("GAEM"):
00377       self.fillRegsView(node, self.AEM_Regs)
00378
00379     elif self.__currentItem.text(0).startsWith("GAEQ"):
00380       parentNode = self.__treeMap[self.__currentParent]
00381       self.fillRegsView(node, self.GAEQ_Regs)
00382       self.fillRegsView(parentNode, self.AEM_Regs)
00383
00384     elif self.__currentItem.text(0).startsWith("GARC"):
00385       parentNode = self.__treeMap[self.__currentParent]
00386       self.fillRegsView(node, self.GARC_Regs)
00387       self.fillRegsView(parentNode, self.AEM_Regs)
00388
00389     elif self.__currentItem.text(0).startsWith("GAFE"):
00390       parentNode = self.__treeMap[self.__currentParent]
00391       grandParentNode = self.__treeMap[self.__currentGrandParent]
00392       self.fillRegsView(node, self.GAFE_Regs)
00393       self.fillRegsView(parentNode, self.GARC_Regs)
00394       self.fillRegsView(grandParentNode, self.AEM_Regs)
00395
00396     elif self.__currentItem.text(0).startsWith("GTEM"):
00397       self.fillRegsView(node, self.TEM_Regs)
00398       self.fillRegsView(node, self.TEM_Regs2)
00399
00400     elif self.__currentItem.text(0).startsWith("GTCC"):
00401       parentNode = self.__treeMap[self.__currentParent]
00402       self.fillRegsView(node, self.GTCC_Regs)
00403       self.fillRegsView(parentNode, self.TEM_Regs)
00404       self.fillRegsView(parentNode, self.TEM_Regs2)
00405
00406     elif self.__currentItem.text(0).startsWith("GTRC"):
00407       parentNode = self.__treeMap[self.__currentParent]
00408       grandParentNode = self.__treeMap[self.__currentGrandParent]
00409       self.fillRegsView(node, self.GTRC_Regs)
00410       self.fillRegsView(parentNode, self.GTCC_Regs)
00411       self.fillRegsView(grandParentNode, self.TEM_Regs)
00412       self.fillRegsView(grandParentNode, self.TEM_Regs2)
00413
00414     elif self.__currentItem.text(0).startsWith("GTFE"):
00415       parentNode = self.__treeMap[self.__currentParent]
00416       grandParentNode = self.__treeMap[self.__currentGrandParent]
00417       greatGrandParentNode = self.__treeMap[self.__currentGreatGrandParent]
00418       self.fillRegsView(node, self.GTFE_Regs)
00419       self.fillRegsView(parentNode, self.GTRC_Regs)
00420       self.fillRegsView(grandParentNode, self.GTCC_Regs)
00421       self.fillRegsView(greatGrandParentNode, self.TEM_Regs)
00422       self.fillRegsView(greatGrandParentNode, self.TEM_Regs2)
00423
00424     elif self.__currentItem.text(0).startsWith("GCCC"):
00425       parentNode = self.__treeMap[self.__currentParent]
00426       self.fillRegsView(node, self.GCCC_Regs)
00427       self.fillRegsView(parentNode, self.TEM_Regs)
00428       self.fillRegsView(parentNode, self.TEM_Regs2)
00429
00430     elif self.__currentItem.text(0).startsWith("GCRC"):
00431       parentNode = self.__treeMap[self.__currentParent]
00432       grandParentNode = self.__treeMap[self.__currentGrandParent]
00433       self.fillRegsView(node, self.GCRC_Regs)
00434       self.fillRegsView(parentNode, self.GCCC_Regs)
00435       self.fillRegsView(grandParentNode, self.TEM_Regs)
00436       self.fillRegsView(grandParentNode, self.TEM_Regs2)
00437
00438     elif self.__currentItem.text(0).startsWith("GCFE"):
00439       parentNode = self.__treeMap[self.__currentParent]
00440       grandParentNode = self.__treeMap[self.__currentGrandParent]
00441       greatGrandParentNode = self.__treeMap[self.__currentGreatGrandParent]
00442       self.fillRegsView(node, self.GCFE_Regs)
00443       self.fillRegsView(parentNode, self.GCRC_Regs)
00444       self.fillRegsView(grandParentNode, self.GCCC_Regs)
00445       self.fillRegsView(greatGrandParentNode, self.TEM_Regs)
00446       self.fillRegsView(greatGrandParentNode, self.TEM_Regs2)
00447
00448
00449
00450
00451
00452     # Browse and update Registers
00453     #~ self.browseAEM()
00454     #~ self.browseTEM()
00455
00456     #~ pdu = lat.downPDU()
00457
00458   def browseAEM(self):
00459     #Load LAT
00460     lat = self.__lat
00461     aem = lat.downAEM()
00462
00463     if aem is not None:
00464       if self.__currentItem.text(0).contains("GAEM"):
00465
00466         """Connect AEM"""
00467         self.TEMTab.setCurrentPage(0)
00468         self.fillRegsView(aem, self.AEM_Regs)
00469         self.AEMLabel.setText("Browsing AEM")
00470         self.statusBar().message("Browsing", 2000)
00471
00472       aeq = aem.downAEQ()
00473       if aeq is not None and self.__currentItem.text(0).contains("GAEQ"):
00474         self.TEMTab.setCurrentPage(0)
00475         self.fillRegsView(aem, self.AEM_Regs)
00476         self.fillRegsView(aeq, self.GAEQ_Regs)
00477         self.GAEQLabel.setText("Browsing GAEQ")
00478         self.statusBar().message("Browsing", 2000)
00479
00480       for arcId in aem._GAEM__childrenARC.keys():
00481         arc = aem.downARC(arcId)
00482         if QString.compare(self.__currentItem.text(0), "GARC " + str(arcId)) == 0:
00483           self.TEMTab.setCurrentPage(0)
00484           self.fillRegsView(aem, self.AEM_Regs)
00485           self.fillRegsView(arc, self.GARC_Regs)
00486           self.Browsing.setText("AEM , GARC " + str(arcId))
00487           self.GARCLabel.setText("Browsing GARC " + str(arcId))
00488           self.statusBar().message("Browsing", 2000)
00489
00490         elif  QString.compare(self.__currentParent.text(0), "GARC " + str(arcId)) == 0:
00491           self.fillRegsView(aem, self.AEM_Regs)
00492           self.fillRegsView(arc, self.GARC_Regs)
00493           self.GARCLabel.setText("GARC " + str(arcId))
00494
00495           for afeId in arc._GARC__childrenAFE.keys():
00496             if QString.compare(self.__currentItem.text(0), "GAFE " + str(afeId)) == 0:
00497               self.TEMTab.setCurrentPage(0)
00498               afe = arc.downAFE(afeId)
00499               self.TEMTab.setCurrentPage(0)
00500               self.fillRegsView(afe, self.GAFE_Regs)
00501               self.Browsing.setText("AEM , GARC " + str(arcId) + ", GAFE " + str(afeId))
00502               self.GAFELabel.setText("Browsing GAFE " + str(afeId))
00503               self.statusBar().message("Browsing", 2000)
00504
00505   def browseTEM(self):
00506     # Load LAT
00507     lat = self.__lat
00508
00509     for temId in lat._GLAT__childrenTEM.keys():
00510
00511       # TEM Selected
00512       if QString.compare(self.__currentItem.text(0), "GTEM " + str(temId)) == 0:
00513         tem = lat.downTEM(temId)
00514         self.TEMTab.setCurrentPage(1)
00515         self.fillRegsView(tem, self.TEM_Regs)
00516         self.fillRegsView(tem, self.TEM_Regs2)
00517         self.TEMLabel.setText("Browsing TEM " + str(temId))
00518         self.TEMLabel2.setText("Browsing TEM " + str(temId))
00519         self.Browsing.setText("TEM " + str(temId))
00520         self.statusBar().message("Browsing", 2000)
00521         break
00522
00523       # GCCC selected:
00524       if QString.compare(self.__currentParent.text(0), "GTEM " + str(temId)) == 0:
00525         tem = lat.downTEM(temId)
00526         self.TEMLabel.setText("TEM " + str(temId))
00527         self.TEMLabel2.setText("TEM " + str(temId))
00528         self.fillRegsView(tem, self.TEM_Regs)
00529         self.fillRegsView(tem, self.TEM_Regs2)
00530
00531         for cccId in tem._GTEM__childrenCCC.keys():
00532           if QString.compare(self.__currentItem.text(0), "GCCC " + str(cccId)) == 0:
00533             ccc = tem.downCCC(cccId)
00534             self.TEMTab.setCurrentPage(1)
00535             self.fillRegsView(ccc, self.GCCC_Regs)
00536             self.GCCCLabel.setText("Browsing GCCC " + str(cccId))
00537             self.Browsing.setText("TEM " + str(temId) + ", GCCC " + str(cccId))
00538             self.statusBar().message("Browsing", 2000)
00539             break
00540
00541         # GTCC selected:
00542
00543         for tccId in tem._GTEM__childrenTCC.keys():
00544           if QString.compare(self.__currentItem.text(0), "GTCC " + str(tccId)) == 0:
00545             tcc = tem.downTCC(tccId)
00546             self.TEMTab.setCurrentPage(2)
00547             self.fillRegsView(tcc, self.GTCC_Regs)
00548             self.GTCCLabel.setText("Browsing GTCC " + str(tccId))
00549             self.Browsing.setText("TEM " + str(temId) + ", GTCC " + str(tccId))
00550             self.statusBar().message("Browsing", 2000)
00551             break
00552
00553       # GCRC selected:
00554     for temId in lat._GLAT__childrenTEM.keys():
00555       if QString.compare(self.__currentGrandParent.text(0), "GTEM " + str(temId)) == 0:
00556         tem = lat.downTEM(temId)
00557         self.TEMLabel.setText("TEM " + str(temId))
00558         self.TEMLabel2.setText("TEM " + str(temId))
00559         self.fillRegsView(tem, self.TEM_Regs)
00560         self.fillRegsView(tem, self.TEM_Regs2)
00561         for cccId in tem._GTEM__childrenCCC.keys():
00562           if QString.compare(self.__currentParent.text(0), "GCCC " + str(cccId)) == 0  :
00563             ccc = tem.downCCC(cccId)
00564             self.TEMTab.setCurrentPage(1)
00565             self.GCCCLabel.setText("GCCC " + str(cccId))
00566             self.fillRegsView(ccc, self.GCCC_Regs)
00567             for crcId in ccc._GCCC__childrenCRC.keys():
00568               if QString.compare(self.__currentItem.text(0), "GCRC " + str(crcId)) == 0:
00569                 crc = ccc.downCRC(crcId)
00570                 self.fillRegsView(crc, self.GCRC_Regs)
00571                 self.GCRCLabel.setText("Browsing GCRC " + str(crcId))
00572                 self.Browsing.setText("TEM " + str(temId) + ", GCCC " + str(cccId) + \
00573                         ", GCRC " + str(crcId))
00574                 self.statusBar().message("Browsing", 2000)
00575                 break
00576
00577     # GCFE selected:
00578     for temId in lat._GLAT__childrenTEM.keys():
00579       if QString.compare(self.__currentGreatGrandParent.text(0), "GTEM " + str(temId)) == 0:
00580         tem = lat.downTEM(temId)
00581         #~ self.__selectedItem4 = tem
00582         for cccId in tem._GTEM__childrenCCC.keys():
00583           if QString.compare(self.__currentGrandParent.text(0), "GCCC " + str(cccId)) == 0:
00584             ccc = tem.downCCC(cccId)
00585             #~ self.__parent = ccc
00586             for crcId in ccc._GCCC__childrenCRC.keys():
00587               if QString.compare(self.__currentParent.text(0), "GCRC " + str(crcId)) == 0:
00588                 crc = ccc.downCRC(crcId)
00589
00590                 #~ self.__
00591                 for cfeId in crc._GCRC__childrenCFE.keys():
00592                   if QString.compare(self.__currentItem.text(0), "GCFE " + str(cfeId)) == 0:
00593                     cfe = crc.downCFE(cfeId)
00594                     self.TEMTab.setCurrentPage(1)
00595                     self.Browsing.setText("TEM " + str(temId) + ", GCCC " + str(cccId) + \
00596                       ", GCRC " + str(crcId) + ", GCFE " + str(cfeId))
00597                     self.statusBar().message("Browsing", 2000)
00598
00599                     self.fillRegsView(cfe, self.GCFE_Regs)
00600                     self.fillRegsView(tem, self.TEM_Regs)
00601                     self.fillRegsView(tem, self.TEM_Regs2)
00602                     self.fillRegsView(ccc, self.GCCC_Regs)
00603
00604                     self.TEMLabel.setText("TEM " + str(temId))
00605                     self.TEMLabel2.setText("TEM " + str(temId))
00606                     self.GCCCLabel.setText("GCCC " + str(cccId))
00607                     self.GCRCLabel.setText("GCRC " + str(crcId))
00608                     self.GCFELabel.setText("Browsing GCFE " + str(cfeId))
00609                     self.fillRegsView(crc, self.GCRC_Regs)
00610                     break
00611
00612
00613
00614       # GTRC selected:
00615       for tccId in tem._GTEM__childrenTCC.keys():
00616         tcc = tem.downTCC(tccId)
00617         if QString.compare(self.__currentGrandParent.text(0), "GTEM " + str(temId)) == 0:
00618           self.TEMLabel.setText("TEM " + str(temId))
00619           self.TEMLabel2.setText("TEM " + str(temId))
00620           self.fillRegsView(tem, self.TEM_Regs)
00621           self.fillRegsView(tem, self.TEM_Regs2)
00622           if QString.compare(self.__currentParent.text(0), "GTCC " + str(tccId)) == 0  :
00623             self.TEMTab.setCurrentPage(2)
00624             self.GTCCLabel.setText("GTCC " + str(tccId))
00625             self.fillRegsView(tcc, self.GTCC_Regs)
00626             for trcId in tcc._GTCC__childrenTRC.keys():
00627               trc = tcc.downTRC(trcId)
00628               if QString.compare(self.__currentItem.text(0), "GTRC " + str(trcId)) == 0:
00629                 self.fillRegsView(trc, self.GTRC_Regs)
00630                 self.GTRCLabel.setText("Browsing GTRC " + str(trcId))
00631                 self.Browsing.setText("TEM " + str(temId) + ", GTCC " + str(tccId) + \
00632                         ", GTRC " + str(trcId))
00633                 self.statusBar().message("Browsing", 2000)
00634                 break
00635
00636             #~ node = self.treeMap[self.__currentItem]
00637             #~ if self.__currentItem.text(0).startsWith("GTRC"):
00638               #~ self.fillRegsView(node, self.GTRC_Regs)
00639             #~ elif self.__currentItem.text(0).startsWith("GTFE"):
00640               #~ self.fillRegsView(node, self.GTFE_Regs)
00641
00642         # GTFE selected:
00643         for trcId in tcc._GTCC__childrenTRC.keys():
00644           trc = tcc.downTRC(trcId)
00645           if QString.compare(self.__currentGreatGrandParent.text(0), "GTEM " + str(temId)) == 0:
00646             self.TEMLabel.setText("TEM " + str(temId))
00647             self.TEMLabel2.setText("TEM " + str(temId))
00648             self.fillRegsView(tem, self.TEM_Regs)
00649             self.fillRegsView(tem, self.TEM_Regs2)
00650             if QString.compare(self.__currentGrandParent.text(0), "GTCC " + str(tccId)) == 0:
00651               self.TEMTab.setCurrentPage(2)
00652               self.GTCCLabel.setText("GTCC " + str(tccId))
00653               self.fillRegsView(tcc, self.GTCC_Regs)
00654               if QString.compare(self.__currentParent.text(0), "GTRC " + str(trcId)) == 0:
00655                 self.GTRCLabel.setText("GTRC " + str(trcId))
00656                 for tfeId in trc._GTRC__childrenTFE.keys():
00657                   tfe = trc.downTFE(tfeId)
00658                   if QString.compare(self.__currentItem.text(0), "GTFE " + str(tfeId)) == 0:
00659                     self.GTFELabel.setText("Browsing GTFE " + str(tfeId))
00660                     self.__parent = tfe
00661                     self.__view = self.GTFE_Regs
00662                     self.fillRegsView(trc, self.GTRC_Regs)
00663                     self.fillRegsView(tfe, self.GTFE_Regs)
00664                     self.Browsing.setText("TEM " + str(temId) + ", GTCC " + str(tccId) + \
00665                       ", GTRC " + str(trcId) + ", GTFE " + str(tfeId))
00666                     self.statusBar().message("Browsing", 2000)
00667                     break
00668
00669   #~ def browseCC(self, temId, branch):
00670     #~ if branch == 'CAL':
00671       #~ range = tem._GTEM__childrenCCC.keys()
00672
00673   def updateSelection(self):
00674     self.__currentItem = self.Hierarchy.currentItem()
00675     print "Item selected: " + str(self.__currentItem.text(0))
00676
00677     if self.__currentItem.parent() is not None:
00678       self.__currentParent = self.__currentItem.parent()
00679     else:
00680       self.__currentParent = self.Hierarchy.firstChild()
00681
00682     if self.__currentParent.parent() is not None:
00683       self.__currentGrandParent = self.__currentParent.parent()
00684     else:
00685       self.__currentGrandParent = self.Hierarchy.firstChild()
00686
00687     if self.__currentGrandParent.parent() is not None:
00688       self.__currentGreatGrandParent = self.__currentGrandParent.parent()
00689     else:
00690       self.__currentGreatGrandParent = self.Hierarchy.firstChild()
00691
00692     if self.__currentItem.text(0).contains("GLAT"):
00693       print "Selected GLAT"
00694
00695   #~ def updateView(self):
00696     #~ self.fillRegsView(treeMap[self.__currentItem()],)
00697
00698   def fillRegsView(self, parent, listView):
00699     listItem = listView.firstChild()
00700     listItem.setText(2,"Hola")
00701     while listItem != None:
00702       #for i in range(self.AEM_Regs.childCount()-1):
00703       # value = aem.regs(AEMRegList[i]).get()
00704       #~ if parent.regs[str(listItem.text(0))].size() != 0:
00705
00706       if QString.compare(self.Conversion.text(), "EGU") == 0:
00707         value = parent.regs[str(listItem.text(0))].get(bypass = 1)
00708       else:
00709         value = parent.regs[str(listItem.text(0))].get()
00710
00711       if self.__base == 1:
00712         listItem.setText(3,str(hex(value)))
00713       else:
00714         listItem.setText(3,str(value))
00715
00716       size = parent.regs[str(listItem.text(0))].size()
00717       listItem.setText(1,str(size))
00718
00719       tstamp = parent.regs[str(listItem.text(0))].getTimeStamp()
00720       if tstamp == -1:
00721         strTime = ''
00722       else:
00723         strTime = time.strftime('%H:%M:%S', time.gmtime(tstamp)) + " + %03d" % (math.modf(tstamp)[0]*1000)
00724       listItem.setText(2,strTime)
00725
00726
00727
00728       #~ else:
00729         #~ listItem.setText(2,'DATALESS')
00730         #~ listItem.setText(1,'0')
00731
00732       listItem = listItem.nextSibling()
00733
00734   def setDefaults(self):
00735
00736     self.TEMTab.setEnabled(1)
00737
00738     #~ self.AEM_Regs.setEnabled(0)
00739     #~ self.GARC_Regs.setEnabled(0)
00740     #~ self.GAFE_Regs.setEnabled(0)
00741
00742     #~ self.TEM_Regs.setEnabled(0)
00743     #~ self.GCCC_Regs.setEnabled(0)
00744     #~ self.GCRC_Regs.setEnabled(0)
00745     #~ self.GCFE_Regs.setEnabled(0)
00746
00747     #~ self.TEM_Regs2.setEnabled(0)
00748     #~ self.GTCC_Regs.setEnabled(0)
00749     #~ self.GTRC_Regs.setEnabled(0)
00750     #~ self.GTFE_Regs.setEnabled(0)
00751
00752
00753     #~ self.TEMTab.page(0).setEnabled(0)
00754     #~ self.TEMTab.page(1).setEnabled(0)
00755     #~ self.TEMTab.page(2).setEnabled(0)
00756
00757     self.TEMTab.setTabLabel(self.TEMTab.page(0), self.trUtf8("ACD") )
00758     self.TEMTab.setTabLabel(self.TEMTab.page(1), self.trUtf8("CAL") )
00759     self.TEMTab.setTabLabel(self.TEMTab.page(2), self.trUtf8("TKR") )
00760
00761     self.AEMLabel.setText("AEM")
00762     self.GAEQLabel.setText("GAEQ")
00763     self.GARCLabel.setText("GARC")
00764     self.GAFELabel.setText("GAFE")
00765
00766     self.TEMLabel.setText("TEM")
00767     self.TEMLabel2.setText("TEM")
00768
00769     self.GCCCLabel.setText("GCCC")
00770     self.GCRCLabel.setText("GCRC")
00771     self.GCFELabel.setText("GCFE")
00772
00773     self.GTCCLabel.setText("GTCC")
00774     self.GTRCLabel.setText("GTRC")
00775     self.GTFELabel.setText("GTFE")
00776
00777     self.clearViews()
00778
00779   def clearViews(self):
00780
00781     self.clearValues(self.AEM_Regs)
00782     self.clearValues(self.GAEQ_Regs)
00783
00784     self.clearValues(self.GARC_Regs)
00785     self.clearValues(self.GAFE_Regs)
00786
00787     self.clearValues(self.TEM_Regs)
00788     self.clearValues(self.TEM_Regs2)
00789
00790     self.clearValues(self.GCCC_Regs)
00791     self.clearValues(self.GCRC_Regs)
00792     self.clearValues(self.GCFE_Regs)
00793
00794     self.clearValues(self.GTCC_Regs)
00795     self.clearValues(self.GTRC_Regs)
00796     self.clearValues(self.GTFE_Regs)
00797
00798   def clearValues(self, listView):
00799     regItem = listView.firstChild()
00800     while regItem != None:
00801       regItem.setText(1, "" )
00802       regItem.setText(2, "" )
00803       regItem.setText(3, "" )
00804       regItem = regItem.nextSibling()
00805
00806   def browserPreferences(self):
00807
00808     self.browserPreferences.exec_loop()
00809     if self.browserPreferences.decButton.isChecked():
00810       self.__base = 0
00811     elif self.browserPreferences.hexButton.isChecked():
00812       self.__base = 1
00813
00814     if self.browserPreferences.rawButton.isChecked():
00815       self.Conversion.setText("RAW")
00816     elif self.browserPreferences.eguButton.isChecked():
00817       self.Conversion.setText("EGU")
00818
00819     if QString.compare(self.filename, QString.null) != 0:
00820       self.selectItem(self.Hierarchy.currentItem())
00821
00822   def selectFile(self):
00823     fn = QFileDialog.getOpenFileName( QString.null, "(*.xml)", self )
00824     if not fn.isEmpty():
00825       self.filename = fn
00826       self.loadSchema(str(self.filename))
00827
00828   def fileNew(self):
00829     print "BrowserImpl.fileNew(): Not implemented yet"
00830   # public slot
00831
00832   def fileOpen(self):
00833     #~ self.ce = QCloseEvent()
00834     #~ if self.__ApplyChanges == 1:
00835     #~ rc = QMessageBox.information(self,'GLAT Schema Editor',
00836                 #~ 'Save changes to this Schema before opening a new Schema file?.',
00837                 #~ 'Yes','No','Cancel',0,1)
00838     #~ if rc == 0:
00839       #~ self.fileSave()
00840       #~ self.ce.accept()
00841       #~ self.selectFile()
00842     #~ elif rc == 1:
00843       #~ self.ce.accept()
00844       #~ self.selectFile()
00845     #~ else:
00846       #~ self.ce.ignore()
00847   #~ else:
00848     self.clearViews()
00849     self.selectFile()
00850
00851   def fileSave(self):
00852     print "BrowserImpl.fileSave(): Not implemented yet"
00853   # public slot
00854
00855   def fileSaveAs(self):
00856     print "BrowserImpl.fileSaveAs(): Not implemented yet"
00857   # public slot
00858
00859   def filePrint(self):
00860     Margin = 50
00861     self.__pageNo = 1
00862     #~ self.__column = [0, 130, 180]#, 180, 260, 400]#, 325] # Magic numbers
00863
00864     # If there are no items, don't try to print
00865     if QString.compare(str(self.filename), "") == 0:
00866     #~ if not self.Hierarchy.firstChild():
00867       print "Can't print a non-loaded Browser"
00868       return
00869
00870     if self.printer.setup(self):
00871       self.statusBar().message('Printing...')
00872
00873       self.__p = QPainter()
00874       self.__p.begin(self.printer)
00875       self.__p.setFont(self.AEM_Regs.font())
00876       self.__yPos = 0
00877       self.__fm = self.__p.fontMetrics()
00878       self.__metrics = QPaintDeviceMetrics(self.printer)
00879
00880       self.__header = "GLAT Browser. Browsing: " + str(self.filename)
00881
00882       page = "Page: 1"
00883       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
00884                 Qt.ExpandTabs | Qt.DontClip, self.__header)
00885       self.__yPos = self.__yPos + self.__fm.lineSpacing()
00886       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
00887                 Qt.ExpandTabs | Qt.DontClip, page)
00888       self.__yPos = self.__yPos + self.__fm.lineSpacing()
00889
00890       #~ self.__currentItem = self.Hierarchy.self.__currentItem()
00891
00892       #~ if self.__currentItem.parent() is not None:
00893         #~ self.__currentParent = self.__currentItem.parent()
00894       #~ else:
00895         #~ self.__currentParent = self.Hierarchy.firstChild()
00896
00897       #~ if self.__currentParent.parent() is not None:
00898         #~ self.__currentGrandParent = self.__currentParent.parent()
00899       #~ else:
00900         #~ self.__currentGrandParent = self.Hierarchy.firstChild()
00901
00902       #~ if self.__currentGrandParent.parent() is not None:
00903         #~ self.__currentGreatGrandParent = self.__currentGrandParent.parent()
00904       #~ else:
00905         #~ self.__currentGreatGrandParent = self.Hierarchy.firstChild()
00906
00907       self.printRegList(self.AEM_Regs, "AEM Registers")
00908       self.printRegList(self.GAEQ_Regs, "GAEQ Registers")
00909       self.printRegList(self.GARC_Regs, str(self.GARCLabel.text()) + " Registers")
00910       self.printRegList(self.GAFE_Regs, str(self.GAFELabel.text()) + " Registers")
00911
00912       self.printRegList(self.TEM_Regs, str(self.TEMLabel.text()) + " Registers")
00913       self.printRegList(self.GCCC_Regs, str(self.GCCCLabel.text()) + " Registers")
00914       self.printRegList(self.GCRC_Regs, str(self.GCRCLabel.text()) + " Registers")
00915       self.printRegList(self.GCFE_Regs, str(self.GCFELabel.text()) + " Registers")
00916
00917       self.printRegList(self.GTCC_Regs, str(self.GTCCLabel.text()) + " Registers")
00918       self.printRegList(self.GTRC_Regs, str(self.GTRCLabel.text()) + " Registers")
00919       self.printRegList(self.GTFE_Regs, str(self.GTFELabel.text()) + " Registers")
00920
00921       self.__p.end()
00922       self.statusBar().message('Printing completed',2000)
00923     else:
00924       self.statusBar().message('Printing aborted',2000)
00925
00926   def printRegList(self, regList, listHeader):
00927       Margin = 50
00928
00929       # If there are no items, don't try to print
00930       if not regList.firstChild():
00931         return
00932
00933       # If the selected node is a broadcast node or is not selected, don't print:
00934       if QString.compare(regList.firstChild().text(1),"") == 0 :
00935         return
00936
00937       column = [50, 220, 280]
00938       columnHeader = ['Register','Size','Value']#,'Time','Source','Message']
00939
00940       self.__yPos = self.__yPos + self.__fm.lineSpacing()
00941       self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),\
00942                 Qt.ExpandTabs | Qt.DontClip, listHeader)
00943       self.__yPos = self.__yPos + self.__fm.lineSpacing()
00944
00945       for i in range (0,3):
00946           self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00947                     Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00948       self.__yPos = self.__yPos + self.__fm.lineSpacing()
00949
00950       item = regList.firstChild()
00951       for j in range(regList.childCount()):
00952         if Margin + self.__yPos > self.__metrics.height() - Margin:
00953           self.__pageNo = self.__pageNo + 1
00954           page = "Page: " + str(self.__pageNo)
00955           self.statusBar().message('Printing (page %d)...' % (self.__pageNo))
00956           self.printer.newPage()
00957           self.__yPos = 0
00958           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00959                   Qt.ExpandTabs | Qt.DontClip, self.__header)
00960           self.__yPos = self.__yPos + self.__fm.lineSpacing()
00961           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00962                   Qt.ExpandTabs | Qt.DontClip, page)
00963           self.__yPos = self.__yPos + 2*self.__fm.lineSpacing()
00964
00965           self.__p.drawText(Margin,Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00966                   Qt.ExpandTabs | Qt.DontClip, listHeader)
00967           self.__yPos = self.__yPos + self.__fm.lineSpacing()
00968
00969           for i in range (0,3):
00970             self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00971                       Qt.ExpandTabs | Qt.DontClip, columnHeader[i])
00972           self.__yPos = self.__yPos + self.__fm.lineSpacing()
00973
00974         for i in range (0,3):
00975           self.__p.drawText(column[i],Margin + self.__yPos,self.__metrics.width(),self.__fm.lineSpacing(),
00976                     Qt.ExpandTabs | Qt.DontClip,item.text(i))
00977         self.__yPos = self.__yPos + self.__fm.lineSpacing()
00978         item = item.nextSibling()
00979
00980   def fileExit(self):
00981     self.__cmd.disconnect()
00982     self.close()
00983
00984   def editUndo(self):
00985     print "BrowserImpl.editUndo(): Not implemented yet"
00986   # public slot
00987
00988   def editRedo(self):
00989     print "BrowserImpl.editRedo(): Not implemented yet"
00990   # public slot
00991
00992   def editCut(self):
00993     print "BrowserImpl.editCut(): Not implemented yet"
00994   # public slot
00995
00996   def editCopy(self):
00997     print "BrowserImpl.editCopy(): Not implemented yet"
00998   # public slot
00999
01000   def editPaste(self):
01001     print "BrowserImpl.editPaste(): Not implemented yet"
01002   # public slot
01003
01004   def editFind(self):
01005     print "BrowserImpl.editFind(): Not implemented yet"
01006   # public slot
01007
01008   def helpIndex(self):
01009     print "BrowserImpl.helpIndex(): Not implemented yet"
01010   # public slot
01011
01012   def helpContents(self):
01013     print "BrowserImpl.helpContents(): Not implemented yet"
01014   # public slot
01015
01016   def helpAbout(self):
01017     print "BrowserImpl.helpAbout(): Not implemented yet"
01018
01019
01020
01021 if __name__ == "__main__":
01022   a = QApplication(sys.argv)
01023   QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
01024   w = BrowserImpl()
01025   a.setMainWidget(w)
01026   w.show()
01027   a.exec_loop()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: ServerPreferencesImpl.py Source File

gosed

ServerPreferencesImpl.py

00001 # -*- coding: utf-8 -*-
00002
00003 import sys
00004 import os
00005 from qt import *
00006 from ServerPreferences import ServerPreferences
00007 import ConfigParser
00008
00009
00010
00011 class ServerPreferencesImpl(ServerPreferences):
00012
00013   def __init__(self, confParser, parent = None,name = None,modal = 0,fl = 0):
00014     ServerPreferences.__init__(self,parent,name,modal,fl)
00015
00016     self.connect(self.selectServerBox, SIGNAL('clicked(int)'), self.selectServer)
00017     self.connect(self.buttonOk, SIGNAL('clicked()'), self.saveServer)
00018
00019     self.__confParser = confParser
00020     self.__configFile = os.path.join(os.environ['ONLINE_ROOT'],
00021                                      'LATTE/gosed/gosed.cfg')
00022
00023     if os.path.exists(self.__configFile):
00024       self.__confParser.read(self.__configFile)
00025       self.selectedServer.setText(self.__confParser.get("server options", "server"))
00026     else:
00027       self.selectedServer.setText('1')
00028       self.__confParser.add_section("server options")
00029       self.__confParser.set("server options", "server", '1')
00030
00031     self.defaultServerButton.setChecked(1)
00032
00033   def selectServer(self):
00034     if self.customServerButton.isChecked():
00035       self.comboSelectServer.setEnabled(1)
00036       #~ self.comboSelectServerLbl.setEnabled(1)
00037     else:
00038       self.comboSelectServer.setEnabled(0)
00039       #~ self.comboSelectServerLbl.setEnabled(0)
00040
00041   def saveServer(self):
00042     self.__confParser.set("server options", "server", str(self.selectedServer.text()))
00043     self.__confParser.write(file(self.__configFile, "w+"))
00044
00045
00046 if __name__ == "__main__":
00047     a = QApplication(sys.argv)
00048     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
00049     w = ServerPreferencesImpl()
00050     a.setMainWidget(w)
00051     w.show()
00052     a.exec_loop()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: setup.py Source File

ext / cfitsio_swig

setup.py

00001 from distutils.core import setup, Extension
00002 import os
00003 cfitsio_dir = os.environ['CFITSIO_DIR']
00004 swig_lib = os.path.join(os.environ['SWIG_DIR'], 'Lib')
00005 setup(
00006     name        = 'cfitsio',
00007     version     = '2.470',
00008     packages    = ['cfitsio'],
00009     package_dir = {'cfitsio' : 'src'},
00010     ext_modules = [Extension(
00011         'cfitsio._cfitsio',
00012         ['src/cfitsio.i'],
00013         libraries=['cfitsio'],
00014         library_dirs=[swig_lib, cfitsio_dir],
00015         include_dirs=[cfitsio_dir])],
00016     data_files=[('Lib/site-packages/cfitsio',[os.path.join(cfitsio_dir, 'cfitsio.dll')])]
00017     )
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: SimpleGasuExample.py Source File

tests / apps / support

SimpleGasuExample.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 1.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # This class uses
00021 from LATTE.trigger.TrgUsingTiles      import TrgUsingTiles
00022 from LATTE.trigger.NullObjects        import NoInputsEnabled
00023 from LATTE.trigger.rcTrgFunctions     import rcTrgEngines
00024 from LATTE.trigger.TrgEngines         import *
00025 from LATTE.trigger.TrgConditionsValue import TrgConditionsValue
00026
00027 """\brief Interface for Coincidence based Trigger System"""
00028
00029 class SimpleGasuExample(TrgUsingTiles):
00030   """\brief SimpleGASU example interface to GEM
00031   """
00032   def __init__(self):
00033     """\brief SimpleGasuExample constructor
00034     """
00035     TrgUsingTiles.__init__(self)
00036     self.__inputEnables             = SGETrgInputEnables()
00037     self.__engines                  = SGETrgEngines()
00038     self.__conditions               = SolicitedCondition()
00039
00040   # Pure Virtual function implementation
00041   def conditions(self):
00042     return self.__conditions
00043
00044   def coincidences(self):
00045     """\brief Implementation of coincdences 'pure virtual' method from TrgUsingTiles
00046     """
00047     # it just so happens that the roi is exactly the same as the coincidences object
00048     return self.roi()
00049
00050   def inputEnables(self):
00051     """\brief Implementation of inputEnables 'pure virtual' method from TrgAbstract
00052     """
00053     return self.__inputEnables
00054
00055   def engines(self):
00056     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00057     """
00058     return self.__engines
00059
00060   def useAcdAsTrigger(self):
00061     """Use ACD as a trigger source.
00062     """
00063     return True
00064
00065 # implementaions of user-level trigger classes
00066
00067 class SGETrgInputEnables(NoInputsEnabled):
00068   """Class SGETrgInputEnables:
00069      Empty Input enables.
00070   """
00071   def __init__(self):
00072     NoInputsEnabled.__init__(self)
00073
00074
00075 # class MiniTowerEnabled(TrgTowerEnables):
00076 #   """ One tower enabled
00077 #   """
00078 #   def __init__(self):
00079 #     TrgTowerEnables.__init__(self)
00080 #     self.__towers = [MiniTower()] + [NullTower()] * 15
00081 #   def tower(self,towerNumber):
00082 #     return self.__towers[towerNumber]
00083 #
00084 # class MiniTower(TrgTower):
00085 #   """ One tower enabled, tracker and calorimeter
00086 #   """
00087 #   def __init__(self):
00088 #     TrgTower.__init__(self)
00089 #     self.__cal = MiniTowerCal()
00090 #     self.__tkr = MiniTowerTkr()
00091 #   def calorimeter(self):
00092 #     return self.__cal
00093 #   def tracker(self):
00094 #     return self.__tkr
00095 #
00096 # class MiniTowerCal(TrgCalorimeter):
00097 #   def __init__(self):
00098 #     TrgCalorimeter.__init__(self)
00099 #   def useHighEnergy(self):
00100 #     return True
00101 #   def useLowEnergy(self):
00102 #     return True
00103 #
00104 # class MiniTowerTkr(TrgTracker):
00105 #   def __init__(self):
00106 #     TrgTracker.__init__(self)
00107 #   def use(self):
00108 #     return True
00109 #
00110
00111 # class AllConditions(TrgConditionsValue):
00112 #   def __init__(self):
00113 #     TrgConditionsValue.__init__(self)
00114 #   def roi(self):
00115 #     return True
00116 #   def calLow(self):
00117 #     return True
00118 #   def calHigh(self):
00119 #     return True
00120 #   def tkr(self):
00121 #     return True
00122 #   def periodic(self):
00123 #     return True
00124 #   def solicited(self):
00125 #     return True
00126 #   def cno(self):
00127 #     return True
00128
00129 class SGETrgEngines(rcTrgEngines):
00130   """Class MyTrgEngines:
00131      Initialize the trigger engines list class.
00132   """
00133   def __init__(self):
00134     rcTrgEngines.__init__(self)
00135     eng1 = SolicitedEngine()
00136     self.replaceEngine(0,eng1)
00137
00138 class SolicitedEngine(TrgEngine):
00139   """This class defines an engine which reads out the detector
00140      whenever there is a solicited trigger.
00141      This engine is not prescaled.
00142   """
00143   def __init__(self):
00144     TrgEngine.__init__(self)
00145     self.__request = TrgReadout()
00146   def participate(self,conditionsValue):
00147     # This function relies on the programmer's knowledge that the
00148     # conditionsValue is a bitfield.
00149     cond = SolicitedCondition()
00150     if conditionsValue & cond.value():
00151       return True
00152     return False
00153   def prescale(self):
00154     return 0
00155   def request(self):
00156     return self.__request
00157
00158 class SolicitedCondition(TrgConditionsValue):
00159   """ Define a condition where only the solicited trigger is asserted
00160   """
00161   def __init__(self):
00162     TrgConditionsValue.__init__(self)
00163   def solicited(self):
00164     return True
00165
00166 class ZsupTrgReadout(TrgReadout):
00167   """\brief ZsupTrgReadout class definition
00168
00169   Directs a module to send to its Front-End Electronics a command sequence
00170   which is composed only of the TACK command. This command will trigger
00171   a readout of the module's Front-End Electronics.
00172   Zero suppression is turned on.
00173   """
00174   def __init__(self):
00175     """\brief TrgReadout constructor
00176     """
00177     TrgReadout.__init__(self)
00178
00179   def zeroSuppress(self):
00180     return True
00181
00182 # class PeriodicEngine(TrgEngine):
00183 #   """This class defines an engine which reads out the detector
00184 #      whenever there is a solicited trigger.
00185 #      This engine is not prescaled.
00186 #   """
00187 #   def __init__(self):
00188 #     TrgEngine.__init__(self)
00189 #     self.__request = TrgReadout()
00190 #   def participate(self,conditionsValue):
00191 #     # This function relies on the programmer's knowledge that the
00192 #     # conditionsValue is a bitfield.
00193 #     cond = PeriodicCondition()
00194 #     if conditionsValue == cond.value():
00195 #       return True
00196 #     return False
00197 #   def prescale(self):
00198 #     return 0
00199 #   def request(self):
00200 #     return self.__request
00201 #
00202 # class PeriodicCondition(TrgConditionsValue):
00203 #   """ Define a condition where only the solicited trigger is asserted
00204 #   """
00205 #   def __init__(self):
00206 #     TrgConditionsValue.__init__(self)
00207 #   def periodic(self):
00208 #     return True
00209 #
00210
00211
00212
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: cfitsio.py Source File

ext / cfitsio_swig / src

src/cfitsio.py

00001 # This file was created automatically by SWIG.
00002 # Don't modify this file, modify the SWIG interface instead.
00003 # This file is compatible with both classic and new-style classes.
00004 import _cfitsio
00005 def _swig_setattr(self,class_type,name,value):
00006     if (name == "this"):
00007         if isinstance(value, class_type):
00008             self.__dict__[name] = value.this
00009             if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
00010             del value.thisown
00011             return
00012     method = class_type.__swig_setmethods__.get(name,None)
00013     if method: return method(self,value)
00014     self.__dict__[name] = value
00015
00016 def _swig_getattr(self,class_type,name):
00017     method = class_type.__swig_getmethods__.get(name,None)
00018     if method: return method(self)
00019     raise AttributeError,name
00020
00021 import types
00022 try:
00023     _object = types.ObjectType
00024     _newclass = 1
00025 except AttributeError:
00026     class _object : pass
00027     _newclass = 0
00028
00029
00030 new_longp = _cfitsio.new_longp
00031
00032 copy_longp = _cfitsio.copy_longp
00033
00034 delete_longp = _cfitsio.delete_longp
00035
00036 longp_assign = _cfitsio.longp_assign
00037
00038 longp_value = _cfitsio.longp_value
00039
00040 FLEN_FILENAME = _cfitsio.FLEN_FILENAME
00041 FLEN_KEYWORD = _cfitsio.FLEN_KEYWORD
00042 FLEN_CARD = _cfitsio.FLEN_CARD
00043 FLEN_VALUE = _cfitsio.FLEN_VALUE
00044 FLEN_COMMENT = _cfitsio.FLEN_COMMENT
00045 FLEN_ERRMSG = _cfitsio.FLEN_ERRMSG
00046 FLEN_STATUS = _cfitsio.FLEN_STATUS
00047 TBIT = _cfitsio.TBIT
00048 TBYTE = _cfitsio.TBYTE
00049 TLOGICAL = _cfitsio.TLOGICAL
00050 TSTRING = _cfitsio.TSTRING
00051 TUSHORT = _cfitsio.TUSHORT
00052 TSHORT = _cfitsio.TSHORT
00053 TUINT = _cfitsio.TUINT
00054 TINT = _cfitsio.TINT
00055 TULONG = _cfitsio.TULONG
00056 TLONG = _cfitsio.TLONG
00057 TINT32BIT = _cfitsio.TINT32BIT
00058 TFLOAT = _cfitsio.TFLOAT
00059 TLONGLONG = _cfitsio.TLONGLONG
00060 TDOUBLE = _cfitsio.TDOUBLE
00061 TCOMPLEX = _cfitsio.TCOMPLEX
00062 TDBLCOMPLEX = _cfitsio.TDBLCOMPLEX
00063 TYP_STRUC_KEY = _cfitsio.TYP_STRUC_KEY
00064 TYP_CMPRS_KEY = _cfitsio.TYP_CMPRS_KEY
00065 TYP_SCAL_KEY = _cfitsio.TYP_SCAL_KEY
00066 TYP_NULL_KEY = _cfitsio.TYP_NULL_KEY
00067 TYP_DIM_KEY = _cfitsio.TYP_DIM_KEY
00068 TYP_RANG_KEY = _cfitsio.TYP_RANG_KEY
00069 TYP_UNIT_KEY = _cfitsio.TYP_UNIT_KEY
00070 TYP_DISP_KEY = _cfitsio.TYP_DISP_KEY
00071 TYP_HDUID_KEY = _cfitsio.TYP_HDUID_KEY
00072 TYP_CKSUM_KEY = _cfitsio.TYP_CKSUM_KEY
00073 TYP_WCS_KEY = _cfitsio.TYP_WCS_KEY
00074 TYP_REFSYS_KEY = _cfitsio.TYP_REFSYS_KEY
00075 TYP_COMM_KEY = _cfitsio.TYP_COMM_KEY
00076 TYP_CONT_KEY = _cfitsio.TYP_CONT_KEY
00077 TYP_USER_KEY = _cfitsio.TYP_USER_KEY
00078 BYTE_IMG = _cfitsio.BYTE_IMG
00079 SHORT_IMG = _cfitsio.SHORT_IMG
00080 LONG_IMG = _cfitsio.LONG_IMG
00081 LONGLONG_IMG = _cfitsio.LONGLONG_IMG
00082 FLOAT_IMG = _cfitsio.FLOAT_IMG
00083 DOUBLE_IMG = _cfitsio.DOUBLE_IMG
00084 IMAGE_HDU = _cfitsio.IMAGE_HDU
00085 ASCII_TBL = _cfitsio.ASCII_TBL
00086 BINARY_TBL = _cfitsio.BINARY_TBL
00087 ANY_HDU = _cfitsio.ANY_HDU
00088 READONLY = _cfitsio.READONLY
00089 READWRITE = _cfitsio.READWRITE
00090 MAX_COMPRESS_DIM = _cfitsio.MAX_COMPRESS_DIM
00091 RICE_1 = _cfitsio.RICE_1
00092 GZIP_1 = _cfitsio.GZIP_1
00093 PLIO_1 = _cfitsio.PLIO_1
00094 HCOMPRESS_1 = _cfitsio.HCOMPRESS_1
00095 CASESEN = _cfitsio.CASESEN
00096 CASEINSEN = _cfitsio.CASEINSEN
00097 GT_ID_ALL_URI = _cfitsio.GT_ID_ALL_URI
00098 GT_ID_REF = _cfitsio.GT_ID_REF
00099 GT_ID_POS = _cfitsio.GT_ID_POS
00100 GT_ID_ALL = _cfitsio.GT_ID_ALL
00101 GT_ID_REF_URI = _cfitsio.GT_ID_REF_URI
00102 GT_ID_POS_URI = _cfitsio.GT_ID_POS_URI
00103 OPT_RM_GPT = _cfitsio.OPT_RM_GPT
00104 OPT_RM_ENTRY = _cfitsio.OPT_RM_ENTRY
00105 OPT_RM_MBR = _cfitsio.OPT_RM_MBR
00106 OPT_RM_ALL = _cfitsio.OPT_RM_ALL
00107 OPT_GCP_GPT = _cfitsio.OPT_GCP_GPT
00108 OPT_GCP_MBR = _cfitsio.OPT_GCP_MBR
00109 OPT_GCP_ALL = _cfitsio.OPT_GCP_ALL
00110 OPT_MCP_ADD = _cfitsio.OPT_MCP_ADD
00111 OPT_MCP_NADD = _cfitsio.OPT_MCP_NADD
00112 OPT_MCP_REPL = _cfitsio.OPT_MCP_REPL
00113 OPT_MCP_MOV = _cfitsio.OPT_MCP_MOV
00114 OPT_MRG_COPY = _cfitsio.OPT_MRG_COPY
00115 OPT_MRG_MOV = _cfitsio.OPT_MRG_MOV
00116 OPT_CMT_MBR = _cfitsio.OPT_CMT_MBR
00117 OPT_CMT_MBR_DEL = _cfitsio.OPT_CMT_MBR_DEL
00118 SKIP_TABLE = _cfitsio.SKIP_TABLE
00119 SKIP_IMAGE = _cfitsio.SKIP_IMAGE
00120 SKIP_NULL_PRIMARY = _cfitsio.SKIP_NULL_PRIMARY
00121 USE_MEM_BUFF = _cfitsio.USE_MEM_BUFF
00122 OVERFLOW_ERR = _cfitsio.OVERFLOW_ERR
00123 PREPEND_PRIMARY = _cfitsio.PREPEND_PRIMARY
00124 SAME_FILE = _cfitsio.SAME_FILE
00125 TOO_MANY_FILES = _cfitsio.TOO_MANY_FILES
00126 FILE_NOT_OPENED = _cfitsio.FILE_NOT_OPENED
00127 FILE_NOT_CREATED = _cfitsio.FILE_NOT_CREATED
00128 WRITE_ERROR = _cfitsio.WRITE_ERROR
00129 END_OF_FILE = _cfitsio.END_OF_FILE
00130 READ_ERROR = _cfitsio.READ_ERROR
00131 FILE_NOT_CLOSED = _cfitsio.FILE_NOT_CLOSED
00132 ARRAY_TOO_BIG = _cfitsio.ARRAY_TOO_BIG
00133 READONLY_FILE = _cfitsio.READONLY_FILE
00134 MEMORY_ALLOCATION = _cfitsio.MEMORY_ALLOCATION
00135 BAD_FILEPTR = _cfitsio.BAD_FILEPTR
00136 NULL_INPUT_PTR = _cfitsio.NULL_INPUT_PTR
00137 SEEK_ERROR = _cfitsio.SEEK_ERROR
00138 BAD_URL_PREFIX = _cfitsio.BAD_URL_PREFIX
00139 TOO_MANY_DRIVERS = _cfitsio.TOO_MANY_DRIVERS
00140 DRIVER_INIT_FAILED = _cfitsio.DRIVER_INIT_FAILED
00141 NO_MATCHING_DRIVER = _cfitsio.NO_MATCHING_DRIVER
00142 URL_PARSE_ERROR = _cfitsio.URL_PARSE_ERROR
00143 RANGE_PARSE_ERROR = _cfitsio.RANGE_PARSE_ERROR
00144 SHARED_ERRBASE = _cfitsio.SHARED_ERRBASE
00145 SHARED_BADARG = _cfitsio.SHARED_BADARG
00146 SHARED_NULPTR = _cfitsio.SHARED_NULPTR
00147 SHARED_TABFULL = _cfitsio.SHARED_TABFULL
00148 SHARED_NOTINIT = _cfitsio.SHARED_NOTINIT
00149 SHARED_IPCERR = _cfitsio.SHARED_IPCERR
00150 SHARED_NOMEM = _cfitsio.SHARED_NOMEM
00151 SHARED_AGAIN = _cfitsio.SHARED_AGAIN
00152 SHARED_NOFILE = _cfitsio.SHARED_NOFILE
00153 SHARED_NORESIZE = _cfitsio.SHARED_NORESIZE
00154 HEADER_NOT_EMPTY = _cfitsio.HEADER_NOT_EMPTY
00155 KEY_NO_EXIST = _cfitsio.KEY_NO_EXIST
00156 KEY_OUT_BOUNDS = _cfitsio.KEY_OUT_BOUNDS
00157 VALUE_UNDEFINED = _cfitsio.VALUE_UNDEFINED
00158 NO_QUOTE = _cfitsio.NO_QUOTE
00159 BAD_KEYCHAR = _cfitsio.BAD_KEYCHAR
00160 BAD_ORDER = _cfitsio.BAD_ORDER
00161 NOT_POS_INT = _cfitsio.NOT_POS_INT
00162 NO_END = _cfitsio.NO_END
00163 BAD_BITPIX = _cfitsio.BAD_BITPIX
00164 BAD_NAXIS = _cfitsio.BAD_NAXIS
00165 BAD_NAXES = _cfitsio.BAD_NAXES
00166 BAD_PCOUNT = _cfitsio.BAD_PCOUNT
00167 BAD_GCOUNT = _cfitsio.BAD_GCOUNT
00168 BAD_TFIELDS = _cfitsio.BAD_TFIELDS
00169 NEG_WIDTH = _cfitsio.NEG_WIDTH
00170 NEG_ROWS = _cfitsio.NEG_ROWS
00171 COL_NOT_FOUND = _cfitsio.COL_NOT_FOUND
00172 BAD_SIMPLE = _cfitsio.BAD_SIMPLE
00173 NO_SIMPLE = _cfitsio.NO_SIMPLE
00174 NO_BITPIX = _cfitsio.NO_BITPIX
00175 NO_NAXIS = _cfitsio.NO_NAXIS
00176 NO_NAXES = _cfitsio.NO_NAXES
00177 NO_XTENSION = _cfitsio.NO_XTENSION
00178 NOT_ATABLE = _cfitsio.NOT_ATABLE
00179 NOT_BTABLE = _cfitsio.NOT_BTABLE
00180 NO_PCOUNT = _cfitsio.NO_PCOUNT
00181 NO_GCOUNT = _cfitsio.NO_GCOUNT
00182 NO_TFIELDS = _cfitsio.NO_TFIELDS
00183 NO_TBCOL = _cfitsio.NO_TBCOL
00184 NO_TFORM = _cfitsio.NO_TFORM
00185 NOT_IMAGE = _cfitsio.NOT_IMAGE
00186 BAD_TBCOL = _cfitsio.BAD_TBCOL
00187 NOT_TABLE = _cfitsio.NOT_TABLE
00188 COL_TOO_WIDE = _cfitsio.COL_TOO_WIDE
00189 COL_NOT_UNIQUE = _cfitsio.COL_NOT_UNIQUE
00190 BAD_ROW_WIDTH = _cfitsio.BAD_ROW_WIDTH
00191 UNKNOWN_EXT = _cfitsio.UNKNOWN_EXT
00192 UNKNOWN_REC = _cfitsio.UNKNOWN_REC
00193 END_JUNK = _cfitsio.END_JUNK
00194 BAD_HEADER_FILL = _cfitsio.BAD_HEADER_FILL
00195 BAD_DATA_FILL = _cfitsio.BAD_DATA_FILL
00196 BAD_TFORM = _cfitsio.BAD_TFORM
00197 BAD_TFORM_DTYPE = _cfitsio.BAD_TFORM_DTYPE
00198 BAD_TDIM = _cfitsio.BAD_TDIM
00199 BAD_HEAP_PTR = _cfitsio.BAD_HEAP_PTR
00200 BAD_HDU_NUM = _cfitsio.BAD_HDU_NUM
00201 BAD_COL_NUM = _cfitsio.BAD_COL_NUM
00202 NEG_FILE_POS = _cfitsio.NEG_FILE_POS
00203 NEG_BYTES = _cfitsio.NEG_BYTES
00204 BAD_ROW_NUM = _cfitsio.BAD_ROW_NUM
00205 BAD_ELEM_NUM = _cfitsio.BAD_ELEM_NUM
00206 NOT_ASCII_COL = _cfitsio.NOT_ASCII_COL
00207 NOT_LOGICAL_COL = _cfitsio.NOT_LOGICAL_COL
00208 BAD_ATABLE_FORMAT = _cfitsio.BAD_ATABLE_FORMAT
00209 BAD_BTABLE_FORMAT = _cfitsio.BAD_BTABLE_FORMAT
00210 NO_NULL = _cfitsio.NO_NULL
00211 NOT_VARI_LEN = _cfitsio.NOT_VARI_LEN
00212 BAD_DIMEN = _cfitsio.BAD_DIMEN
00213 BAD_PIX_NUM = _cfitsio.BAD_PIX_NUM
00214 ZERO_SCALE = _cfitsio.ZERO_SCALE
00215 NEG_AXIS = _cfitsio.NEG_AXIS
00216 NOT_GROUP_TABLE = _cfitsio.NOT_GROUP_TABLE
00217 HDU_ALREADY_MEMBER = _cfitsio.HDU_ALREADY_MEMBER
00218 MEMBER_NOT_FOUND = _cfitsio.MEMBER_NOT_FOUND
00219 GROUP_NOT_FOUND = _cfitsio.GROUP_NOT_FOUND
00220 BAD_GROUP_ID = _cfitsio.BAD_GROUP_ID
00221 TOO_MANY_HDUS_TRACKED = _cfitsio.TOO_MANY_HDUS_TRACKED
00222 HDU_ALREADY_TRACKED = _cfitsio.HDU_ALREADY_TRACKED
00223 BAD_OPTION = _cfitsio.BAD_OPTION
00224 IDENTICAL_POINTERS = _cfitsio.IDENTICAL_POINTERS
00225 BAD_GROUP_ATTACH = _cfitsio.BAD_GROUP_ATTACH
00226 BAD_GROUP_DETACH = _cfitsio.BAD_GROUP_DETACH
00227 BAD_I2C = _cfitsio.BAD_I2C
00228 BAD_F2C = _cfitsio.BAD_F2C
00229 BAD_INTKEY = _cfitsio.BAD_INTKEY
00230 BAD_LOGICALKEY = _cfitsio.BAD_LOGICALKEY
00231 BAD_FLOATKEY = _cfitsio.BAD_FLOATKEY
00232 BAD_DOUBLEKEY = _cfitsio.BAD_DOUBLEKEY
00233 BAD_C2I = _cfitsio.BAD_C2I
00234 BAD_C2F = _cfitsio.BAD_C2F
00235 BAD_C2D = _cfitsio.BAD_C2D
00236 BAD_DATATYPE = _cfitsio.BAD_DATATYPE
00237 BAD_DECIM = _cfitsio.BAD_DECIM
00238 NUM_OVERFLOW = _cfitsio.NUM_OVERFLOW
00239 BAD_DATE = _cfitsio.BAD_DATE
00240 PARSE_SYNTAX_ERR = _cfitsio.PARSE_SYNTAX_ERR
00241 PARSE_BAD_TYPE = _cfitsio.PARSE_BAD_TYPE
00242 PARSE_LRG_VECTOR = _cfitsio.PARSE_LRG_VECTOR
00243 PARSE_NO_OUTPUT = _cfitsio.PARSE_NO_OUTPUT
00244 PARSE_BAD_COL = _cfitsio.PARSE_BAD_COL
00245 PARSE_BAD_OUTPUT = _cfitsio.PARSE_BAD_OUTPUT
00246 ANGLE_TOO_BIG = _cfitsio.ANGLE_TOO_BIG
00247 BAD_WCS_VAL = _cfitsio.BAD_WCS_VAL
00248 WCS_ERROR = _cfitsio.WCS_ERROR
00249 BAD_WCS_PROJ = _cfitsio.BAD_WCS_PROJ
00250 NO_WCS_KEY = _cfitsio.NO_WCS_KEY
00251 APPROX_WCS_KEY = _cfitsio.APPROX_WCS_KEY
00252 NO_CLOSE_ERROR = _cfitsio.NO_CLOSE_ERROR
00253 NGP_ERRBASE = _cfitsio.NGP_ERRBASE
00254 NGP_OK = _cfitsio.NGP_OK
00255 NGP_NO_MEMORY = _cfitsio.NGP_NO_MEMORY
00256 NGP_READ_ERR = _cfitsio.NGP_READ_ERR
00257 NGP_NUL_PTR = _cfitsio.NGP_NUL_PTR
00258 NGP_EMPTY_CURLINE = _cfitsio.NGP_EMPTY_CURLINE
00259 NGP_UNREAD_QUEUE_FULL = _cfitsio.NGP_UNREAD_QUEUE_FULL
00260 NGP_INC_NESTING = _cfitsio.NGP_INC_NESTING
00261 NGP_ERR_FOPEN = _cfitsio.NGP_ERR_FOPEN
00262 NGP_EOF = _cfitsio.NGP_EOF
00263 NGP_BAD_ARG = _cfitsio.NGP_BAD_ARG
00264 NGP_TOKEN_NOT_EXPECT = _cfitsio.NGP_TOKEN_NOT_EXPECT
00265 fits_get_token = _cfitsio.fits_get_token
00266
00267 fits_parse_input_url = _cfitsio.fits_parse_input_url
00268
00269 fits_parse_rootname = _cfitsio.fits_parse_rootname
00270
00271 fits_parse_extspec = _cfitsio.fits_parse_extspec
00272
00273 fits_parse_extnum = _cfitsio.fits_parse_extnum
00274
00275 fits_url_type = _cfitsio.fits_url_type
00276
00277 fits_parse_binspec = _cfitsio.fits_parse_binspec
00278
00279 fits_parse_binrange = _cfitsio.fits_parse_binrange
00280
00281 ffimport_file = _cfitsio.ffimport_file
00282
00283 fits_parse_range = _cfitsio.fits_parse_range
00284
00285 fits_open_memfile = _cfitsio.fits_open_memfile
00286
00287 fits_open_file = _cfitsio.fits_open_file
00288
00289 fits_open_data = _cfitsio.fits_open_data
00290
00291 fits_open_table = _cfitsio.fits_open_table
00292
00293 fits_open_image = _cfitsio.fits_open_image
00294
00295 fits_reopen_file = _cfitsio.fits_reopen_file
00296
00297 fits_create_file = _cfitsio.fits_create_file
00298
00299 fits_create_memfile = _cfitsio.fits_create_memfile
00300
00301 fits_create_template = _cfitsio.fits_create_template
00302
00303 fits_flush_file = _cfitsio.fits_flush_file
00304
00305 fits_flush_buffer = _cfitsio.fits_flush_buffer
00306
00307 fits_close_file = _cfitsio.fits_close_file
00308
00309 fits_delete_file = _cfitsio.fits_delete_file
00310
00311 fits_file_name = _cfitsio.fits_file_name
00312
00313 fits_file_mode = _cfitsio.fits_file_mode
00314
00315 fits_get_version = _cfitsio.fits_get_version
00316
00317 fits_uppercase = _cfitsio.fits_uppercase
00318
00319 fits_get_errstatus = _cfitsio.fits_get_errstatus
00320
00321 fits_write_errmsg = _cfitsio.fits_write_errmsg
00322
00323 fits_write_errmark = _cfitsio.fits_write_errmark
00324
00325 fits_read_errmsg = _cfitsio.fits_read_errmsg
00326
00327 fits_clear_errmsg = _cfitsio.fits_clear_errmsg
00328
00329 fits_clear_errmark = _cfitsio.fits_clear_errmark
00330
00331 fits_report_error = _cfitsio.fits_report_error
00332
00333 fits_compare_str = _cfitsio.fits_compare_str
00334
00335 fits_test_keyword = _cfitsio.fits_test_keyword
00336
00337 fits_test_record = _cfitsio.fits_test_record
00338
00339 fits_null_check = _cfitsio.fits_null_check
00340
00341 fits_make_keyn = _cfitsio.fits_make_keyn
00342
00343 fits_make_nkey = _cfitsio.fits_make_nkey
00344
00345 fits_get_keyclass = _cfitsio.fits_get_keyclass
00346
00347 fits_get_keytype = _cfitsio.fits_get_keytype
00348
00349 fits_parse_value = _cfitsio.fits_parse_value
00350
00351 fits_get_keyname = _cfitsio.fits_get_keyname
00352
00353 fits_parse_template = _cfitsio.fits_parse_template
00354
00355 fits_ascii_tform = _cfitsio.fits_ascii_tform
00356
00357 fits_binary_tform = _cfitsio.fits_binary_tform
00358
00359 fits_get_tbcol = _cfitsio.fits_get_tbcol
00360
00361 fits_get_section_range = _cfitsio.fits_get_section_range
00362
00363 fits_write_key = _cfitsio.fits_write_key
00364
00365 fits_write_record = _cfitsio.fits_write_record
00366
00367 fits_write_comment = _cfitsio.fits_write_comment
00368
00369 fits_write_key_unit = _cfitsio.fits_write_key_unit
00370
00371 fits_write_history = _cfitsio.fits_write_history
00372
00373 fits_write_date = _cfitsio.fits_write_date
00374
00375 fits_get_system_time = _cfitsio.fits_get_system_time
00376
00377 fits_get_system_date = _cfitsio.fits_get_system_date
00378
00379 fits_date2str = _cfitsio.fits_date2str
00380
00381 fits_time2str = _cfitsio.fits_time2str
00382
00383 fits_str2date = _cfitsio.fits_str2date
00384
00385 fits_str2time = _cfitsio.fits_str2time
00386
00387 fits_write_key_null = _cfitsio.fits_write_key_null
00388
00389 fits_write_key_str = _cfitsio.fits_write_key_str
00390
00391 fits_write_key_longstr = _cfitsio.fits_write_key_longstr
00392
00393 fits_write_key_longwarn = _cfitsio.fits_write_key_longwarn
00394
00395 fits_write_key_log = _cfitsio.fits_write_key_log
00396
00397 fits_write_key_lng = _cfitsio.fits_write_key_lng
00398
00399 fits_write_key_fixflt = _cfitsio.fits_write_key_fixflt
00400
00401 fits_write_key_flt = _cfitsio.fits_write_key_flt
00402
00403 fits_write_key_fixdbl = _cfitsio.fits_write_key_fixdbl
00404
00405 fits_write_key_dbl = _cfitsio.fits_write_key_dbl
00406
00407 fits_write_key_cmp = _cfitsio.fits_write_key_cmp
00408
00409 fits_write_key_dblcmp = _cfitsio.fits_write_key_dblcmp
00410
00411 fits_write_key_fixcmp = _cfitsio.fits_write_key_fixcmp
00412
00413 fits_write_key_fixdblcmp = _cfitsio.fits_write_key_fixdblcmp
00414
00415 fits_write_key_triple = _cfitsio.fits_write_key_triple
00416
00417 fits_write_tdim = _cfitsio.fits_write_tdim
00418
00419 fits_write_keys_str = _cfitsio.fits_write_keys_str
00420
00421 fits_write_keys_log = _cfitsio.fits_write_keys_log
00422
00423 fits_write_keys_lng = _cfitsio.fits_write_keys_lng
00424
00425 fits_write_keys_fixflt = _cfitsio.fits_write_keys_fixflt
00426
00427 fits_write_keys_flt = _cfitsio.fits_write_keys_flt
00428
00429 fits_write_keys_fixdbl = _cfitsio.fits_write_keys_fixdbl
00430
00431 fits_write_keys_dbl = _cfitsio.fits_write_keys_dbl
00432
00433 fits_copy_key = _cfitsio.fits_copy_key
00434
00435 fits_write_imghdr = _cfitsio.fits_write_imghdr
00436
00437 fits_write_grphdr = _cfitsio.fits_write_grphdr
00438
00439 fits_write_atblhdr = _cfitsio.fits_write_atblhdr
00440
00441 fits_write_btblhdr = _cfitsio.fits_write_btblhdr
00442
00443 fits_write_key_template = _cfitsio.fits_write_key_template
00444
00445 fits_get_hdrspace = _cfitsio.fits_get_hdrspace
00446
00447 fits_get_hdrpos = _cfitsio.fits_get_hdrpos
00448
00449 fits_movabs_key = _cfitsio.fits_movabs_key
00450
00451 fits_movrel_key = _cfitsio.fits_movrel_key
00452
00453 fits_find_nextkey = _cfitsio.fits_find_nextkey
00454
00455 fits_read_record = _cfitsio.fits_read_record
00456
00457 fits_read_card = _cfitsio.fits_read_card
00458
00459 fits_read_key_unit = _cfitsio.fits_read_key_unit
00460
00461 fits_read_keyn = _cfitsio.fits_read_keyn
00462
00463 fits_read_keyword = _cfitsio.fits_read_keyword
00464
00465 fits_read_key = _cfitsio.fits_read_key
00466
00467 fits_read_key_str = _cfitsio.fits_read_key_str
00468
00469 fits_read_key_longstr = _cfitsio.fits_read_key_longstr
00470
00471 fits_read_key_log = _cfitsio.fits_read_key_log
00472
00473 fits_read_key_lng = _cfitsio.fits_read_key_lng
00474
00475 fits_read_key_flt = _cfitsio.fits_read_key_flt
00476
00477 fits_read_key_dbl = _cfitsio.fits_read_key_dbl
00478
00479 fits_read_key_cmp = _cfitsio.fits_read_key_cmp
00480
00481 fits_read_key_dblcmp = _cfitsio.fits_read_key_dblcmp
00482
00483 fits_read_key_triple = _cfitsio.fits_read_key_triple
00484
00485 fits_read_tdim = _cfitsio.fits_read_tdim
00486
00487 fits_decode_tdim = _cfitsio.fits_decode_tdim
00488
00489 fits_read_keys_str = _cfitsio.fits_read_keys_str
00490
00491 fits_read_keys_log = _cfitsio.fits_read_keys_log
00492
00493 fits_read_keys_lng = _cfitsio.fits_read_keys_lng
00494
00495 fits_read_keys_flt = _cfitsio.fits_read_keys_flt
00496
00497 fits_read_keys_dbl = _cfitsio.fits_read_keys_dbl
00498
00499 fits_header2str = _cfitsio.fits_header2str
00500
00501 fits_read_imghdr = _cfitsio.fits_read_imghdr
00502
00503 fits_read_atblhdr = _cfitsio.fits_read_atblhdr
00504
00505 fits_read_btblhdr = _cfitsio.fits_read_btblhdr
00506
00507 fits_update_key = _cfitsio.fits_update_key
00508
00509 fits_update_card = _cfitsio.fits_update_card
00510
00511 fits_update_key_null = _cfitsio.fits_update_key_null
00512
00513 fits_update_key_str = _cfitsio.fits_update_key_str
00514
00515 fits_update_key_longstr = _cfitsio.fits_update_key_longstr
00516
00517 fits_update_key_log = _cfitsio.fits_update_key_log
00518
00519 fits_update_key_lng = _cfitsio.fits_update_key_lng
00520
00521 fits_update_key_fixflt = _cfitsio.fits_update_key_fixflt
00522
00523 fits_update_key_flt = _cfitsio.fits_update_key_flt
00524
00525 fits_update_key_fixdbl = _cfitsio.fits_update_key_fixdbl
00526
00527 fits_update_key_dbl = _cfitsio.fits_update_key_dbl
00528
00529 fits_update_key_cmp = _cfitsio.fits_update_key_cmp
00530
00531 fits_update_key_dblcmp = _cfitsio.fits_update_key_dblcmp
00532
00533 fits_update_key_fixcmp = _cfitsio.fits_update_key_fixcmp
00534
00535 fits_update_key_fixdblcmp = _cfitsio.fits_update_key_fixdblcmp
00536
00537 fits_modify_record = _cfitsio.fits_modify_record
00538
00539 fits_modify_card = _cfitsio.fits_modify_card
00540
00541 fits_modify_name = _cfitsio.fits_modify_name
00542
00543 fits_modify_comment = _cfitsio.fits_modify_comment
00544
00545 fits_modify_key_null = _cfitsio.fits_modify_key_null
00546
00547 fits_modify_key_str = _cfitsio.fits_modify_key_str
00548
00549 fits_modify_key_longstr = _cfitsio.fits_modify_key_longstr
00550
00551 fits_modify_key_log = _cfitsio.fits_modify_key_log
00552
00553 fits_modify_key_lng = _cfitsio.fits_modify_key_lng
00554
00555 fits_modify_key_fixflt = _cfitsio.fits_modify_key_fixflt
00556
00557 fits_modify_key_flt = _cfitsio.fits_modify_key_flt
00558
00559 fits_modify_key_fixdbl = _cfitsio.fits_modify_key_fixdbl
00560
00561 fits_modify_key_dbl = _cfitsio.fits_modify_key_dbl
00562
00563 fits_modify_key_cmp = _cfitsio.fits_modify_key_cmp
00564
00565 fits_modify_key_dblcmp = _cfitsio.fits_modify_key_dblcmp
00566
00567 fits_modify_key_fixcmp = _cfitsio.fits_modify_key_fixcmp
00568
00569 fits_modify_key_fixdblcmp = _cfitsio.fits_modify_key_fixdblcmp
00570
00571 fits_insert_record = _cfitsio.fits_insert_record
00572
00573 fits_insert_card = _cfitsio.fits_insert_card
00574
00575 fits_insert_key_null = _cfitsio.fits_insert_key_null
00576
00577 fits_insert_key_str = _cfitsio.fits_insert_key_str
00578
00579 fits_insert_key_longstr = _cfitsio.fits_insert_key_longstr
00580
00581 fits_insert_key_log = _cfitsio.fits_insert_key_log
00582
00583 fits_insert_key_lng = _cfitsio.fits_insert_key_lng
00584
00585 fits_insert_key_fixflt = _cfitsio.fits_insert_key_fixflt
00586
00587 fits_insert_key_flt = _cfitsio.fits_insert_key_flt
00588
00589 fits_insert_key_fixdbl = _cfitsio.fits_insert_key_fixdbl
00590
00591 fits_insert_key_dbl = _cfitsio.fits_insert_key_dbl
00592
00593 fits_insert_key_cmp = _cfitsio.fits_insert_key_cmp
00594
00595 fits_insert_key_dblcmp = _cfitsio.fits_insert_key_dblcmp
00596
00597 fits_insert_key_fixcmp = _cfitsio.fits_insert_key_fixcmp
00598
00599 fits_insert_key_fixdblcmp = _cfitsio.fits_insert_key_fixdblcmp
00600
00601 fits_delete_key = _cfitsio.fits_delete_key
00602
00603 fits_delete_record = _cfitsio.fits_delete_record
00604
00605 fits_get_hdu_num = _cfitsio.fits_get_hdu_num
00606
00607 fits_get_hdu_type = _cfitsio.fits_get_hdu_type
00608
00609 fits_get_hduaddr = _cfitsio.fits_get_hduaddr
00610
00611 fits_get_hduoff = _cfitsio.fits_get_hduoff
00612
00613 fits_get_img_param = _cfitsio.fits_get_img_param
00614
00615 fits_get_img_type = _cfitsio.fits_get_img_type
00616
00617 fits_get_img_dim = _cfitsio.fits_get_img_dim
00618
00619 fits_get_img_size = _cfitsio.fits_get_img_size
00620
00621 fits_movabs_hdu = _cfitsio.fits_movabs_hdu
00622
00623 fits_movrel_hdu = _cfitsio.fits_movrel_hdu
00624
00625 fits_movnam_hdu = _cfitsio.fits_movnam_hdu
00626
00627 fits_get_num_hdus = _cfitsio.fits_get_num_hdus
00628
00629 fits_create_hdu = _cfitsio.fits_create_hdu
00630
00631 fits_create_img = _cfitsio.fits_create_img
00632
00633 fits_create_tbl = _cfitsio.fits_create_tbl
00634
00635 fits_insert_img = _cfitsio.fits_insert_img
00636
00637 fits_insert_atbl = _cfitsio.fits_insert_atbl
00638
00639 fits_insert_btbl = _cfitsio.fits_insert_btbl
00640
00641 fits_resize_img = _cfitsio.fits_resize_img
00642
00643 fits_delete_hdu = _cfitsio.fits_delete_hdu
00644
00645 fits_copy_hdu = _cfitsio.fits_copy_hdu
00646
00647 fits_copy_file = _cfitsio.fits_copy_file
00648
00649 fits_copy_header = _cfitsio.fits_copy_header
00650
00651 fits_copy_data = _cfitsio.fits_copy_data
00652
00653 ffchfl = _cfitsio.ffchfl
00654
00655 ffcdfl = _cfitsio.ffcdfl
00656
00657 fits_set_hdustruc = _cfitsio.fits_set_hdustruc
00658
00659 fits_set_hdrsize = _cfitsio.fits_set_hdrsize
00660
00661 fits_write_theap = _cfitsio.fits_write_theap
00662
00663 ffcsum = _cfitsio.ffcsum
00664
00665 fits_encode_chksum = _cfitsio.fits_encode_chksum
00666
00667 fits_decode_chksum = _cfitsio.fits_decode_chksum
00668
00669 fits_write_chksum = _cfitsio.fits_write_chksum
00670
00671 fits_update_chksum = _cfitsio.fits_update_chksum
00672
00673 fits_verify_chksum = _cfitsio.fits_verify_chksum
00674
00675 fits_get_chksum = _cfitsio.fits_get_chksum
00676
00677 fits_set_bscale = _cfitsio.fits_set_bscale
00678
00679 fits_set_imgnull = _cfitsio.fits_set_imgnull
00680
00681 fits_set_tscale = _cfitsio.fits_set_tscale
00682
00683 fits_set_btblnull = _cfitsio.fits_set_btblnull
00684
00685 fits_set_atblnull = _cfitsio.fits_set_atblnull
00686
00687 fits_get_colnum = _cfitsio.fits_get_colnum
00688
00689 fits_get_colname = _cfitsio.fits_get_colname
00690
00691 fits_get_coltype = _cfitsio.fits_get_coltype
00692
00693 fits_get_num_cols = _cfitsio.fits_get_num_cols
00694
00695 fits_get_num_rows = _cfitsio.fits_get_num_rows
00696
00697 fits_get_acolparms = _cfitsio.fits_get_acolparms
00698
00699 fits_get_bcolparms = _cfitsio.fits_get_bcolparms
00700
00701 fits_get_rowsize = _cfitsio.fits_get_rowsize
00702
00703 fits_get_col_display_width = _cfitsio.fits_get_col_display_width
00704
00705 fits_read_pix = _cfitsio.fits_read_pix
00706
00707 fits_read_pixnull = _cfitsio.fits_read_pixnull
00708
00709 fits_read_subset = _cfitsio.fits_read_subset
00710
00711 fits_read_img = _cfitsio.fits_read_img
00712
00713 fits_read_imgnull = _cfitsio.fits_read_imgnull
00714
00715 fits_read_img_byt = _cfitsio.fits_read_img_byt
00716
00717 fits_read_img_usht = _cfitsio.fits_read_img_usht
00718
00719 fits_read_img_sht = _cfitsio.fits_read_img_sht
00720
00721 fits_read_img_ulng = _cfitsio.fits_read_img_ulng
00722
00723 fits_read_img_lng = _cfitsio.fits_read_img_lng
00724
00725 fits_read_img_lnglng = _cfitsio.fits_read_img_lnglng
00726
00727 fits_read_img_uint = _cfitsio.fits_read_img_uint
00728
00729 fits_read_img_int = _cfitsio.fits_read_img_int
00730
00731 fits_read_img_flt = _cfitsio.fits_read_img_flt
00732
00733 fits_read_img_dbl = _cfitsio.fits_read_img_dbl
00734
00735 fits_read_imgnull_byt = _cfitsio.fits_read_imgnull_byt
00736
00737 fits_read_imgnull_usht = _cfitsio.fits_read_imgnull_usht
00738
00739 fits_read_imgnull_sht = _cfitsio.fits_read_imgnull_sht
00740
00741 fits_read_imgnull_ulng = _cfitsio.fits_read_imgnull_ulng
00742
00743 fits_read_imgnull_lng = _cfitsio.fits_read_imgnull_lng
00744
00745 fits_read_imgnull_lnglng = _cfitsio.fits_read_imgnull_lnglng
00746
00747 fits_read_imgnull_uint = _cfitsio.fits_read_imgnull_uint
00748
00749 fits_read_imgnull_int = _cfitsio.fits_read_imgnull_int
00750
00751 fits_read_imgnull_flt = _cfitsio.fits_read_imgnull_flt
00752
00753 fits_read_imgnull_dbl = _cfitsio.fits_read_imgnull_dbl
00754
00755 fits_read_2d_byt = _cfitsio.fits_read_2d_byt
00756
00757 fits_read_2d_usht = _cfitsio.fits_read_2d_usht
00758
00759 fits_read_2d_sht = _cfitsio.fits_read_2d_sht
00760
00761 fits_read_2d_ulng = _cfitsio.fits_read_2d_ulng
00762
00763 fits_read_2d_lng = _cfitsio.fits_read_2d_lng
00764
00765 fits_read_2d_lnglng = _cfitsio.fits_read_2d_lnglng
00766
00767 fits_read_2d_uint = _cfitsio.fits_read_2d_uint
00768
00769 fits_read_2d_int = _cfitsio.fits_read_2d_int
00770
00771 fits_read_2d_flt = _cfitsio.fits_read_2d_flt
00772
00773 fits_read_2d_dbl = _cfitsio.fits_read_2d_dbl
00774
00775 fits_read_3d_byt = _cfitsio.fits_read_3d_byt
00776
00777 fits_read_3d_usht = _cfitsio.fits_read_3d_usht
00778
00779 fits_read_3d_sht = _cfitsio.fits_read_3d_sht
00780
00781 fits_read_3d_ulng = _cfitsio.fits_read_3d_ulng
00782
00783 fits_read_3d_lng = _cfitsio.fits_read_3d_lng
00784
00785 fits_read_3d_lnglng = _cfitsio.fits_read_3d_lnglng
00786
00787 fits_read_3d_uint = _cfitsio.fits_read_3d_uint
00788
00789 fits_read_3d_int = _cfitsio.fits_read_3d_int
00790
00791 fits_read_3d_flt = _cfitsio.fits_read_3d_flt
00792
00793 fits_read_3d_dbl = _cfitsio.fits_read_3d_dbl
00794
00795 fits_read_subset_byt = _cfitsio.fits_read_subset_byt
00796
00797 fits_read_subset_usht = _cfitsio.fits_read_subset_usht
00798
00799 fits_read_subset_sht = _cfitsio.fits_read_subset_sht
00800
00801 fits_read_subset_ulng = _cfitsio.fits_read_subset_ulng
00802
00803 fits_read_subset_lng = _cfitsio.fits_read_subset_lng
00804
00805 fits_read_subset_lnglng = _cfitsio.fits_read_subset_lnglng
00806
00807 fits_read_subset_uint = _cfitsio.fits_read_subset_uint
00808
00809 fits_read_subset_int = _cfitsio.fits_read_subset_int
00810
00811 fits_read_subset_flt = _cfitsio.fits_read_subset_flt
00812
00813 fits_read_subset_dbl = _cfitsio.fits_read_subset_dbl
00814
00815 fits_read_subsetnull_byt = _cfitsio.fits_read_subsetnull_byt
00816
00817 fits_read_subsetnull_usht = _cfitsio.fits_read_subsetnull_usht
00818
00819 fits_read_subsetnull_sht = _cfitsio.fits_read_subsetnull_sht
00820
00821 fits_read_subsetnull_ulng = _cfitsio.fits_read_subsetnull_ulng
00822
00823 fits_read_subsetnull_lng = _cfitsio.fits_read_subsetnull_lng
00824
00825 fits_read_subsetnull_lnglng = _cfitsio.fits_read_subsetnull_lnglng
00826
00827 fits_read_subsetnull_uint = _cfitsio.fits_read_subsetnull_uint
00828
00829 fits_read_subsetnull_int = _cfitsio.fits_read_subsetnull_int
00830
00831 fits_read_subsetnull_flt = _cfitsio.fits_read_subsetnull_flt
00832
00833 fits_read_subsetnull_dbl = _cfitsio.fits_read_subsetnull_dbl
00834
00835 fits_read_grppar_byt = _cfitsio.fits_read_grppar_byt
00836
00837 fits_read_grppar_usht = _cfitsio.fits_read_grppar_usht
00838
00839 fits_read_grppar_sht = _cfitsio.fits_read_grppar_sht
00840
00841 fits_read_grppar_ulng = _cfitsio.fits_read_grppar_ulng
00842
00843 fits_read_grppar_lng = _cfitsio.fits_read_grppar_lng
00844
00845 fits_read_grppar_lnglng = _cfitsio.fits_read_grppar_lnglng
00846
00847 fits_read_grppar_uint = _cfitsio.fits_read_grppar_uint
00848
00849 fits_read_grppar_int = _cfitsio.fits_read_grppar_int
00850
00851 fits_read_grppar_flt = _cfitsio.fits_read_grppar_flt
00852
00853 fits_read_grppar_dbl = _cfitsio.fits_read_grppar_dbl
00854
00855 fits_read_col = _cfitsio.fits_read_col
00856
00857 fits_read_colnull = _cfitsio.fits_read_colnull
00858
00859 fits_read_col_str = _cfitsio.fits_read_col_str
00860
00861 ffgcl = _cfitsio.ffgcl
00862
00863 fits_read_col_log = _cfitsio.fits_read_col_log
00864
00865 fits_read_col_byt = _cfitsio.fits_read_col_byt
00866
00867 fits_read_col_usht = _cfitsio.fits_read_col_usht
00868
00869 fits_read_col_sht = _cfitsio.fits_read_col_sht
00870
00871 fits_read_col_ulng = _cfitsio.fits_read_col_ulng
00872
00873 fits_read_col_lng = _cfitsio.fits_read_col_lng
00874
00875 fits_read_col_lnglng = _cfitsio.fits_read_col_lnglng
00876
00877 fits_read_col_uint = _cfitsio.fits_read_col_uint
00878
00879 fits_read_col_int = _cfitsio.fits_read_col_int
00880
00881 fits_read_col_flt = _cfitsio.fits_read_col_flt
00882
00883 fits_read_col_dbl = _cfitsio.fits_read_col_dbl
00884
00885 fits_read_col_cmp = _cfitsio.fits_read_col_cmp
00886
00887 fits_read_col_dblcmp = _cfitsio.fits_read_col_dblcmp
00888
00889 fits_read_col_bit = _cfitsio.fits_read_col_bit
00890
00891 fits_read_col_bit_usht = _cfitsio.fits_read_col_bit_usht
00892
00893 fits_read_col_bit_uint = _cfitsio.fits_read_col_bit_uint
00894
00895 fits_read_colnull_str = _cfitsio.fits_read_colnull_str
00896
00897 fits_read_colnull_log = _cfitsio.fits_read_colnull_log
00898
00899 fits_read_colnull_byt = _cfitsio.fits_read_colnull_byt
00900
00901 fits_read_colnull_usht = _cfitsio.fits_read_colnull_usht
00902
00903 fits_read_colnull_sht = _cfitsio.fits_read_colnull_sht
00904
00905 fits_read_colnull_ulng = _cfitsio.fits_read_colnull_ulng
00906
00907 fits_read_colnull_lng = _cfitsio.fits_read_colnull_lng
00908
00909 fits_read_colnull_lnglng = _cfitsio.fits_read_colnull_lnglng
00910
00911 fits_read_colnull_uint = _cfitsio.fits_read_colnull_uint
00912
00913 fits_read_colnull_int = _cfitsio.fits_read_colnull_int
00914
00915 fits_read_colnull_flt = _cfitsio.fits_read_colnull_flt
00916
00917 fits_read_colnull_dbl = _cfitsio.fits_read_colnull_dbl
00918
00919 fits_read_colnull_cmp = _cfitsio.fits_read_colnull_cmp
00920
00921 fits_read_colnull_dblcmp = _cfitsio.fits_read_colnull_dblcmp
00922
00923 fits_read_descript = _cfitsio.fits_read_descript
00924
00925 fits_read_descripts = _cfitsio.fits_read_descripts
00926
00927 fits_test_heap = _cfitsio.fits_test_heap
00928
00929 fits_compress_heap = _cfitsio.fits_compress_heap
00930
00931 fits_read_tblbytes = _cfitsio.fits_read_tblbytes
00932
00933 fits_write_pix = _cfitsio.fits_write_pix
00934
00935 fits_write_pixnull = _cfitsio.fits_write_pixnull
00936
00937 fits_write_img = _cfitsio.fits_write_img
00938
00939 fits_write_img_byt = _cfitsio.fits_write_img_byt
00940
00941 fits_write_img_usht = _cfitsio.fits_write_img_usht
00942
00943 fits_write_img_sht = _cfitsio.fits_write_img_sht
00944
00945 fits_write_img_ulng = _cfitsio.fits_write_img_ulng
00946
00947 fits_write_img_lng = _cfitsio.fits_write_img_lng
00948
00949 fits_write_img_uint = _cfitsio.fits_write_img_uint
00950
00951 fits_write_img_int = _cfitsio.fits_write_img_int
00952
00953 fits_write_img_flt = _cfitsio.fits_write_img_flt
00954
00955 fits_write_img_dbl = _cfitsio.fits_write_img_dbl
00956
00957 fits_write_img_lnglng = _cfitsio.fits_write_img_lnglng
00958
00959 fits_write_img_null = _cfitsio.fits_write_img_null
00960
00961 fits_write_null_img = _cfitsio.fits_write_null_img
00962
00963 fits_write_imgnull = _cfitsio.fits_write_imgnull
00964
00965 fits_write_imgnull_byt = _cfitsio.fits_write_imgnull_byt
00966
00967 fits_write_imgnull_usht = _cfitsio.fits_write_imgnull_usht
00968
00969 fits_write_imgnull_sht = _cfitsio.fits_write_imgnull_sht
00970
00971 fits_write_imgnull_lng = _cfitsio.fits_write_imgnull_lng
00972
00973 fits_write_imgnull_ulng = _cfitsio.fits_write_imgnull_ulng
00974
00975 fits_write_imgnull_uint = _cfitsio.fits_write_imgnull_uint
00976
00977 fits_write_imgnull_int = _cfitsio.fits_write_imgnull_int
00978
00979 fits_write_imgnull_flt = _cfitsio.fits_write_imgnull_flt
00980
00981 fits_write_imgnull_dbl = _cfitsio.fits_write_imgnull_dbl
00982
00983 fits_write_imgnull_lnglng = _cfitsio.fits_write_imgnull_lnglng
00984
00985 fits_write_2d_byt = _cfitsio.fits_write_2d_byt
00986
00987 fits_write_2d_usht = _cfitsio.fits_write_2d_usht
00988
00989 fits_write_2d_sht = _cfitsio.fits_write_2d_sht
00990
00991 fits_write_2d_ulng = _cfitsio.fits_write_2d_ulng
00992
00993 fits_write_2d_lng = _cfitsio.fits_write_2d_lng
00994
00995 fits_write_2d_uint = _cfitsio.fits_write_2d_uint
00996
00997 fits_write_2d_int = _cfitsio.fits_write_2d_int
00998
00999 fits_write_2d_flt = _cfitsio.fits_write_2d_flt
01000
01001 fits_write_2d_dbl = _cfitsio.fits_write_2d_dbl
01002
01003 fits_write_2d_lnglng = _cfitsio.fits_write_2d_lnglng
01004
01005 fits_write_3d_byt = _cfitsio.fits_write_3d_byt
01006
01007 fits_write_3d_usht = _cfitsio.fits_write_3d_usht
01008
01009 fits_write_3d_sht = _cfitsio.fits_write_3d_sht
01010
01011 fits_write_3d_ulng = _cfitsio.fits_write_3d_ulng
01012
01013 fits_write_3d_lng = _cfitsio.fits_write_3d_lng
01014
01015 fits_write_3d_uint = _cfitsio.fits_write_3d_uint
01016
01017 fits_write_3d_int = _cfitsio.fits_write_3d_int
01018
01019 fits_write_3d_flt = _cfitsio.fits_write_3d_flt
01020
01021 fits_write_3d_dbl = _cfitsio.fits_write_3d_dbl
01022
01023 fits_write_3d_lnglng = _cfitsio.fits_write_3d_lnglng
01024
01025 fits_write_subset = _cfitsio.fits_write_subset
01026
01027 fits_write_subset_byt = _cfitsio.fits_write_subset_byt
01028
01029 fits_write_subset_usht = _cfitsio.fits_write_subset_usht
01030
01031 fits_write_subset_sht = _cfitsio.fits_write_subset_sht
01032
01033 fits_write_subset_ulng = _cfitsio.fits_write_subset_ulng
01034
01035 fits_write_subset_lng = _cfitsio.fits_write_subset_lng
01036
01037 fits_write_subset_uint = _cfitsio.fits_write_subset_uint
01038
01039 fits_write_subset_int = _cfitsio.fits_write_subset_int
01040
01041 fits_write_subset_flt = _cfitsio.fits_write_subset_flt
01042
01043 fits_write_subset_dbl = _cfitsio.fits_write_subset_dbl
01044
01045 fits_write_subset_lnglng = _cfitsio.fits_write_subset_lnglng
01046
01047 fits_write_grppar_byt = _cfitsio.fits_write_grppar_byt
01048
01049 fits_write_grppar_usht = _cfitsio.fits_write_grppar_usht
01050
01051 fits_write_grppar_sht = _cfitsio.fits_write_grppar_sht
01052
01053 fits_write_grppar_ulng = _cfitsio.fits_write_grppar_ulng
01054
01055 fits_write_grppar_lng = _cfitsio.fits_write_grppar_lng
01056
01057 fits_write_grppar_uint = _cfitsio.fits_write_grppar_uint
01058
01059 fits_write_grppar_int = _cfitsio.fits_write_grppar_int
01060
01061 fits_write_grppar_flt = _cfitsio.fits_write_grppar_flt
01062
01063 fits_write_grppar_dbl = _cfitsio.fits_write_grppar_dbl
01064
01065 fits_write_grppar_lnglng = _cfitsio.fits_write_grppar_lnglng
01066
01067 fits_iter_set_by_name = _cfitsio.fits_iter_set_by_name
01068
01069 fits_iter_set_by_num = _cfitsio.fits_iter_set_by_num
01070
01071 fits_iter_set_file = _cfitsio.fits_iter_set_file
01072
01073 fits_iter_set_colname = _cfitsio.fits_iter_set_colname
01074
01075 fits_iter_set_colnum = _cfitsio.fits_iter_set_colnum
01076
01077 fits_iter_set_datatype = _cfitsio.fits_iter_set_datatype
01078
01079 fits_iter_set_iotype = _cfitsio.fits_iter_set_iotype
01080
01081 fits_iter_get_file = _cfitsio.fits_iter_get_file
01082
01083 fits_iter_get_colname = _cfitsio.fits_iter_get_colname
01084
01085 fits_iter_get_colnum = _cfitsio.fits_iter_get_colnum
01086
01087 fits_iter_get_datatype = _cfitsio.fits_iter_get_datatype
01088
01089 fits_iter_get_iotype = _cfitsio.fits_iter_get_iotype
01090
01091 fits_iter_get_array = _cfitsio.fits_iter_get_array
01092
01093 fits_iter_get_tlmin = _cfitsio.fits_iter_get_tlmin
01094
01095 fits_iter_get_tlmax = _cfitsio.fits_iter_get_tlmax
01096
01097 fits_iter_get_repeat = _cfitsio.fits_iter_get_repeat
01098
01099 fits_iter_get_tunit = _cfitsio.fits_iter_get_tunit
01100
01101 fits_iter_get_tdisp = _cfitsio.fits_iter_get_tdisp
01102
01103 fits_iterate_data = _cfitsio.fits_iterate_data
01104
01105 fits_write_col = _cfitsio.fits_write_col
01106
01107 fits_write_col_str = _cfitsio.fits_write_col_str
01108
01109 fits_write_col_log = _cfitsio.fits_write_col_log
01110
01111 fits_write_col_byt = _cfitsio.fits_write_col_byt
01112
01113 fits_write_col_usht = _cfitsio.fits_write_col_usht
01114
01115 fits_write_col_sht = _cfitsio.fits_write_col_sht
01116
01117 fits_write_col_ulng = _cfitsio.fits_write_col_ulng
01118
01119 fits_write_col_lng = _cfitsio.fits_write_col_lng
01120
01121 fits_write_col_uint = _cfitsio.fits_write_col_uint
01122
01123 fits_write_col_int = _cfitsio.fits_write_col_int
01124
01125 fits_write_col_flt = _cfitsio.fits_write_col_flt
01126
01127 fits_write_col_dbl = _cfitsio.fits_write_col_dbl
01128
01129 fits_write_col_cmp = _cfitsio.fits_write_col_cmp
01130
01131 fits_write_col_dblcmp = _cfitsio.fits_write_col_dblcmp
01132
01133 fits_write_col_null = _cfitsio.fits_write_col_null
01134
01135 fits_write_col_bit = _cfitsio.fits_write_col_bit
01136
01137 fits_write_col_lnglng = _cfitsio.fits_write_col_lnglng
01138
01139 fits_write_colnull = _cfitsio.fits_write_colnull
01140
01141 fits_write_colnull_str = _cfitsio.fits_write_colnull_str
01142
01143 fits_write_colnull_log = _cfitsio.fits_write_colnull_log
01144
01145 fits_write_colnull_byt = _cfitsio.fits_write_colnull_byt
01146
01147 fits_write_colnull_usht = _cfitsio.fits_write_colnull_usht
01148
01149 fits_write_colnull_sht = _cfitsio.fits_write_colnull_sht
01150
01151 fits_write_colnull_ulng = _cfitsio.fits_write_colnull_ulng
01152
01153 fits_write_colnull_lng = _cfitsio.fits_write_colnull_lng
01154
01155 fits_write_colnull_uint = _cfitsio.fits_write_colnull_uint
01156
01157 fits_write_colnull_int = _cfitsio.fits_write_colnull_int
01158
01159 fits_write_colnull_flt = _cfitsio.fits_write_colnull_flt
01160
01161 fits_write_colnull_dbl = _cfitsio.fits_write_colnull_dbl
01162
01163 fits_write_colnull_lnglng = _cfitsio.fits_write_colnull_lnglng
01164
01165 fits_write_descript = _cfitsio.fits_write_descript
01166
01167 fits_write_tblbytes = _cfitsio.fits_write_tblbytes
01168
01169 fits_insert_rows = _cfitsio.fits_insert_rows
01170
01171 fits_delete_rows = _cfitsio.fits_delete_rows
01172
01173 fits_delete_rowrange = _cfitsio.fits_delete_rowrange
01174
01175 fits_delete_rowlist = _cfitsio.fits_delete_rowlist
01176
01177 fits_insert_col = _cfitsio.fits_insert_col
01178
01179 fits_insert_cols = _cfitsio.fits_insert_cols
01180
01181 fits_modify_vector_len = _cfitsio.fits_modify_vector_len
01182
01183 fits_delete_col = _cfitsio.fits_delete_col
01184
01185 fits_copy_col = _cfitsio.fits_copy_col
01186
01187 fits_read_img_coord = _cfitsio.fits_read_img_coord
01188
01189 fits_read_tbl_coord = _cfitsio.fits_read_tbl_coord
01190
01191 fits_pix_to_world = _cfitsio.fits_pix_to_world
01192
01193 fits_world_to_pix = _cfitsio.fits_world_to_pix
01194
01195 fits_test_expr = _cfitsio.fits_test_expr
01196
01197 fits_find_rows = _cfitsio.fits_find_rows
01198
01199 fits_find_first_row = _cfitsio.fits_find_first_row
01200
01201 fits_find_rows_cmp = _cfitsio.fits_find_rows_cmp
01202
01203 fits_select_rows = _cfitsio.fits_select_rows
01204
01205 fits_calc_rows = _cfitsio.fits_calc_rows
01206
01207 fits_calculator_rng = _cfitsio.fits_calculator_rng
01208
01209 fits_calculator = _cfitsio.fits_calculator
01210
01211 ffhist = _cfitsio.ffhist
01212
01213 fits_select_image_section = _cfitsio.fits_select_image_section
01214
01215 fits_create_group = _cfitsio.fits_create_group
01216
01217 fits_insert_group = _cfitsio.fits_insert_group
01218
01219 fits_change_group = _cfitsio.fits_change_group
01220
01221 fits_remove_group = _cfitsio.fits_remove_group
01222
01223 fits_copy_group = _cfitsio.fits_copy_group
01224
01225 fits_merge_groups = _cfitsio.fits_merge_groups
01226
01227 fits_compact_group = _cfitsio.fits_compact_group
01228
01229 fits_verify_group = _cfitsio.fits_verify_group
01230
01231 fits_open_group = _cfitsio.fits_open_group
01232
01233 fits_add_group_member = _cfitsio.fits_add_group_member
01234
01235 fits_get_num_members = _cfitsio.fits_get_num_members
01236
01237 fits_get_num_groups = _cfitsio.fits_get_num_groups
01238
01239 fits_open_member = _cfitsio.fits_open_member
01240
01241 fits_copy_member = _cfitsio.fits_copy_member
01242
01243 fits_transfer_member = _cfitsio.fits_transfer_member
01244
01245 fits_remove_member = _cfitsio.fits_remove_member
01246
01247 fits_execute_template = _cfitsio.fits_execute_template
01248
01249 fits_set_compression_type = _cfitsio.fits_set_compression_type
01250
01251 fits_set_tile_dim = _cfitsio.fits_set_tile_dim
01252
01253 fits_set_noise_bits = _cfitsio.fits_set_noise_bits
01254
01255 fits_get_compression_type = _cfitsio.fits_get_compression_type
01256
01257 fits_get_tile_dim = _cfitsio.fits_get_tile_dim
01258
01259 fits_get_noise_bits = _cfitsio.fits_get_noise_bits
01260
01261 fits_compress_img = _cfitsio.fits_compress_img
01262
01263 fits_is_compressed_image = _cfitsio.fits_is_compressed_image
01264
01265 fits_decompress_img = _cfitsio.fits_decompress_img
01266
01267
Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardLDF.py Source File

consumer

standardLDF.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "LDF Interface for standardPlotter"
00013 __author__   = "Lester Miller"
00014 __date__     = "11/18/2003"
00015 __version__  = "$Revision: 1.7 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import LDF
00020 import Numeric as numarray
00021 import time
00022
00023 class LATcomponentIterator(LDF.LATcomponentIterator):
00024   def __init__(self):
00025     LDF.LATcomponentIterator.__init__(self)
00026     self.eventMarker  = None
00027     self.ntDefinitions = self.declareNtDefinitions()
00028     self.ntDescriptions = self.declareNtDescriptions()
00029     # protect against failure to have dictionaries and pedestals
00030     self.ntDict = {}
00031     self.numarrayDict = {}
00032     self.acdPeds = None
00033     self.calPeds = None
00034     self.sparsify = False
00035     # other needed internal variables
00036     self.nEvtSeen = 0
00037     self.prevPpcTime = 0
00038     self.prevGmTime = 0
00039     self.markerPpcTime = 0
00040     self.markerGmTime = 0
00041     self.ppcTimeInSec = 0.
00042     self.gemTimeInSec = 0.
00043     self.prevGemTime = 0.
00044     self.collectingPedestals = False
00045
00046   def UDFcomponent(self, event, ebfContribution):
00047     return 0
00048
00049   def OSWcomponent(self, event, oswContribution):
00050     oswContribIter = OSWcontributionIterator(event, oswContribution, self)
00051     oswContribIter.iterate()
00052     self.nEvtSeen+=1
00053     return 0
00054
00055   def ACDcomponent(self, event, aemContribution):
00056     acdContrib = AEMcontributionIterator(event, aemContribution, self)
00057     acdContrib.fill()
00058     return 0
00059
00060   def GEMcomponent(self, event, gemContribution):
00061     gemContrib = GEMcontribution(event, gemContribution, self)
00062     gemContrib.fill()
00063     return 0
00064
00065   def CALcomponent(self, event, calContribution):
00066     calContrib = CALcontributionIterator(event, calContribution, self)
00067     calContrib.fill()
00068     return 0
00069
00070   def TKRcomponent(self, event, tkrContribution):
00071     tkrContrib = TKRcontributionIterator(event, tkrContribution, self)
00072     tkrContrib.fill()
00073     return 0
00074
00075   def diagnostic(self, event, contribution):
00076     if not LDF.EventSummary.diagnostic(contribution.summary()):
00077       return
00078     diagContrib = DIAGcontributionIterator(event,contribution,self.TKRend(),self)
00079     diagContrib.iterateCAL()
00080     diagContrib.iterateTKR()
00081     self.diagnosticEnd(self.TKRend() + diagContrib.size())
00082     return 0
00083
00084   def error(self, event, contribution):
00085     if  not LDF.EventSummary.error(contribution.summary()):
00086       return
00087     if self.diagnosticEnd() != 0:
00088       offset=self.diagnosticEnd()
00089     else:
00090       offset=self.TKRend()
00091     errorContrib = LDF.ERRcontributionIterator(event,contribution,offset)
00092     theError = errorContrib.theError()
00093     if 'evt_error' in self.ntDict:
00094       cRow = [0,theError.tmo(),theError.phs(),theError.cal()<<8|theError.tkr(),self.ppcTimeInSec]
00095       cNt = self.ntDict['evt_error']
00096       cNt.addRow(cRow)
00097     self.errorEnd(offset + errorContrib.size())
00098     return 0
00099
00100   def getEventMarker(self):
00101     return self.eventMarker
00102
00103   def declareNtDefinitions(self):
00104     definitions = {}
00105     definitions['osw_time']  = ["eventnum","evtsize","dtppc","gmtime","ppctime"]
00106     definitions['tkr_trig']  = ["tower", "layer", "end","chanindex","ppctime"]
00107     definitions['tkr_hit']   = ["tower", "layer", "fenum", "hit","chanindex","ppctime"]
00108     definitions['tkr_tot']   = ["tower", "layer", "end", "tot","chanindex","ppctime"]
00109     definitions['tkr_layer'] = ["tower", "layer", "nhit","chanindex","ppctime"]
00110     definitions['cal_trig']  = ["tower", "layer", "end", "le", "he","chanindex","ppctime"]
00111     definitions['cal_lac']   = ["tower", "layer", "col", "end","lac","chanindex","ppctime"]
00112     definitions['cal_accept']= ["tower", "layer", "col", "end","adc","chanindex","ppctime"]
00113     definitions['cal_log']   = ["tower", "layer", "col", "adcp", "adcn", "adcmean", "adcdiff","chanindex","ppctime"]
00114     definitions['acd_hit']   = ["arc", "afe", "tile", "side","chanindex","ppctime"]
00115     definitions['acd_accept']= ["arc", "afe", "tile", "side", "pha","chanindex","ppctime"]
00116     definitions['acd_tile']  = ["tile", "pha1", "pha2", "phamean", "phadiff", "hit1", "hit2", "hitor","chanindex","ppctime"]
00117     definitions['gem_event'] = ["dtreg", "dtcalc", "condsum", "ntile", "live", "gtime", "prescale", "discarded", "sent","ppctime"]
00118     definitions['gem_input'] = ["cno","tileXY","tileXZM","tileXZP","tileYZM","tileYZP","tileRBN","tileNA","roi", "tkr", "callo", "calhe","ppctime"]
00119     definitions['evt_error'] = ["tower", "phasing", "timeout","cc","ppctime"]
00120     return definitions
00121
00122   def declareNtDescriptions(self):
00123     descriptions = {}
00124     descriptions['osw_time']  = ["Event Number","Event Size","PPC Delta t","G.M. time","PPC time"]
00125     descriptions['tkr_trig']  = ["Tower", "Layer (0-35)", "End","Channel: Tower, Layer(0-35), End(0-1)","PPC time"]
00126     descriptions['tkr_hit']   = ["Tower", "Layer (0-35)", "TFE number (0-23)", "Strip Number","Channel: Tower, Layer (0-35), TFE (0-23)","PPC time"]
00127     descriptions['tkr_tot']   = ["Tower", "Layer (0-35)", "End", "TOT","Channel: Tower, Layer(0-35), End(0-1)","PPC time"]
00128     descriptions['tkr_layer'] = ["Tower", "Layer (0-35)", "Number Strips Hit","Layer: Tower, Layer(0-35)","PPC time"]
00129     descriptions['cal_trig']  = ["Tower", "Layer", "End", "FLE fired", "FHE fired","Channel: Tower, Layer(0-7), End(0-1)","PPC time"]
00130     descriptions['cal_lac']   = ["Tower", "Layer", "Column", "End","LAC fired","Channel: Tower, Layer(0-7), Column(0-11), End(0-1)","PPC time"]
00131     descriptions['cal_accept']= ["Tower", "Layer", "Column", "End","ADC Value","Channel: Tower, Layer(0-7), Column(0-11), End(0-1)","PPC time"]
00132     descriptions['cal_log']   = ["Tower", "Layer", "Column", "ADC+", "ADC-", "ADC Mean", "ADC Relative Difference","Log: Tower, Layer(0-7), Column(0-11)","PPC time"]
00133     descriptions['acd_hit']   = ["ARC (cable)", "AFE (channel)", "Tile Number", "Tile Side","Channel: Tile (0-107), Side(0-1)","PPC time"]
00134     descriptions['acd_accept']= ["ARC (cable)", "AFE (channel)", "Tile Number", "Tile Side","ADC Value","Channel: Tile Number(0-107), Side(0-1)","PPC time"]
00135     descriptions['acd_tile']  = ["Tile Number", "ADC Side A", "ADC Side B", "ADC Mean", "ADC Relative Difference", "Veto A Fired", "Veto B Fired", "Veto Fired","Channel: Tile (0-107)","PPC time"]
00136     descriptions['gem_event'] = ["Delta T Register", "Delta T Calculated", "Condition Summary", "Number Tiles Fired", "Live Time", "Gem Time", "Prescaled Register", "Discarded Register", "Sent Register","PPC time"]
00137     descriptions['gem_input'] = ["CNO Vector","ACD Tile XY","ACD Tile XZ-","ACD tile XZ+","ACD Tile YZ-","ACD Tile YZ+","ACD Fiber","ACD NA","Roi Vector", "Tkr Vector", "Cal Low Vector", "Cal High Vector","PPC time"]
00138     descriptions['evt_error'] = ["Tower", "Phasing Error bit", "Timeout bit","CC Bit Field","PPC time"]
00139     return descriptions
00140
00141   def getColumnDescription(self,ntName,columnName):
00142     index = 0
00143     result = ''
00144     if ntName not in self.ntDefinitions or ntName not in self.ntDescriptions:
00145       return result
00146     descriptionList = self.ntDescriptions[ntName]
00147     for column in self.ntDefinitions[ntName]:
00148       if column == columnName:
00149         result = descriptionList[index]
00150       index+=1
00151     return result
00152
00153   def getChanIndexDescription(self,ntName,value):
00154     result = 'chanindex'
00155     if ntName == 'cal_accept':
00156       tower  = value/(8*12*2)
00157       value  = value%(8*12*2)
00158       layer  = value/(12*2)
00159       value  = value%(12*2)
00160       column = value/(2)
00161       value  = value%(2)
00162       end    = value
00163       result = 'Tower %d Layer %d Column %d End %d'%(tower,layer,column,end)
00164     if ntName == 'cal_log':
00165       tower  = value/(8*12)
00166       value  = value%(8*12)
00167       layer  = value/(12)
00168       value  = value%(12)
00169       column = value
00170       result = 'Tower %d Layer %d Column %d'%(tower,layer,column)
00171     if ntName == 'cal_lac':
00172       tower  = value/(8*12*2)
00173       value  = value%(8*12*2)
00174       layer  = value/(12*2)
00175       value  = value%(12*2)
00176       column = value/(2)
00177       value  = value%(2)
00178       end    = value
00179       result = 'Tower %d Layer %d Column %d End %d'%(tower,layer,column,end)
00180     if ntName == 'cal_trig':
00181       tower  = value/(8*2)
00182       value  = value%(8*2)
00183       layer  = value/(2)
00184       value  = value%(2)
00185       end    = value
00186       result = 'Tower %d Layer %d End %d'%(tower,layer,end)
00187
00188     if ntName == 'tkr_layer':
00189       tower  = value/(36)
00190       value  = value%(36)
00191       layer  = value
00192       result = 'Tower %d Layer %d'%(tower,layer)
00193     if ntName == 'tkr_hit':
00194       tower  = value/(36*24)
00195       value  = value%(36*24)
00196       layer  = value/(24)
00197       value  = value%(24)
00198       fenum  = value
00199       result = 'Tower %d Layer %d TFE %d'%(tower,layer,fenum)
00200     if ntName == 'tkr_tot':
00201       tower  = value/(36*2)
00202       value  = value%(36*2)
00203       layer  = value/(2)
00204       value  = value%(2)
00205       end    = value
00206       result = 'Tower %d Layer %d End %d'%(tower,layer,end)
00207     if ntName == 'tkr_trig':
00208       tower  = value/(36*2)
00209       value  = value%(36*2)
00210       layer  = value/(2)
00211       value  = value%(2)
00212       end    = value
00213       result = 'Tower %d Layer %d End %d'%(tower,layer,end)
00214
00215     if ntName == 'acd_accept':
00216       tileRemap = value/(2)
00217       value     = value%(2)
00218       side      = value
00219       tile = self.getTileNumber(int(tileRemap))
00220       result = 'Tile %d Side %d'%(tile,side)
00221     if ntName == 'acd_tile':
00222       tileRemap = value
00223       tile = self.getTileNumber(int(tileRemap))
00224       result = 'Tile %d'%(tile)
00225     return result
00226
00227   def getTileNumber(self,remapTileNumber):
00228     # remap: top has 25, sides 16, 8 fibers and last 11 unassigned
00229     # three digits of tilenumber are [side][xcoord][yxoord]
00230     result = None
00231     if remapTileNumber<25:
00232       result = 10*(remapTileNumber/5) + remapTileNumber%5
00233     elif remapTileNumber<(25+4*16):
00234       result = 100+100*((remapTileNumber-25)/16)
00235       remainder = (remapTileNumber-25)%16
00236       result += 10*(remainder/5) + remapTileNumber%5
00237     elif remapTileNumber<(25+4*16+8):
00238       division = (remapTileNumber-25-4*16)/4
00239       remainder = (remapTileNumber-25-4*16)%4
00240       result = 500+100*division+10*remainder
00241     else:
00242       result = 700+(remapTileNumber-25-4*16-8)
00243     return result
00244
00245   def getNtupleDefinition(self,ntName):
00246     # this returns the string of column names if it is known of here
00247     if ntName in self.ntDefinitions:
00248       return self.ntDefinitions[ntName]
00249     else:
00250       return None
00251
00252 class CALcontributionIterator(LDF.CALcontributionIterator):
00253   def __init__(self, event, contribution,lci):
00254     LDF.CALcontributionIterator.__init__(self, event, contribution)
00255     self.lci     = lci
00256
00257   def fill(self):
00258     length = self.contribution().numLogAccepts()
00259     if length == 0:
00260       return
00261     self.iterate()
00262
00263   def log(self, tower, layer, theLog):
00264     column = theLog.column()
00265     positive = theLog.positive()
00266     negative = theLog.negative()
00267     posRange = positive.range()
00268     posValue = positive.value()
00269     negRange = negative.range()
00270     negValue = negative.value()
00271     if self.lci.calPeds is not None:
00272       posValue -= self.lci.calPeds[tower,layer,column,0,posRange,0]
00273       negValue -= self.lci.calPeds[tower,layer,column,1,negRange,0]
00274       # to translate from range to range, lo to hi is 8, with area between diodes of 6
00275       rangeMultiplier = [1.,8.,6.*8.,6.*8.*8.]
00276       posValue *= rangeMultiplier[posRange]
00277       negValue *= rangeMultiplier[negRange]
00278       # until I decide to get four range pedestals, this will kludge
00279       if posRange>0: posValue = 4096.
00280       if negRange>0: negValue = 4096.
00281       negRange = 0
00282       posRange = 0
00283       if self.lci.sparsify:
00284         if negValue < 3.*self.lci.calPeds[tower,layer,column,0,posRange,1]:
00285           negValue = None
00286         if posValue < 3.*self.lci.calPeds[tower,layer,column,1,posRange,1]:
00287           posValue = None
00288     else:
00289       # can't relate ranges without peds so just fill overflow for other ranges
00290       if not self.lci.collectingPedestals:
00291         if posRange>0: posValue = 4096.
00292         if negRange>0: negValue = 4096.
00293     if 'cal_accept' in self.lci.ntDict:
00294       cNt = self.lci.ntDict['cal_accept']
00295       if negValue is not None:
00296         chanIndex = tower*8*12*2 + layer*12*2 + column*2
00297         cRow = [tower,layer,column,0,negValue,chanIndex,self.lci.ppcTimeInSec]
00298         cNt.addRow(cRow)
00299       if posValue is not None:
00300         chanIndex = tower*8*12*2 + layer*12*2 + column*2 + 1
00301         cRow = [tower,layer,column,1,posValue,chanIndex,self.lci.ppcTimeInSec]
00302         cNt.addRow(cRow)
00303     if 'cal_log' in self.lci.numarrayDict:
00304       cNumarray = self.lci.numarrayDict['cal_log']
00305       if negValue is not None:
00306         cNumarray[tower,layer,column,0,negRange] = negValue
00307       if posValue is not None:
00308         cNumarray[tower,layer,column,1,posRange] = posValue
00309     if posValue is None or negValue is None:
00310       return
00311     average = (posValue+negValue)/2.
00312     if average!=0:
00313       difference = (posValue-negValue)/(2.*average)
00314     else:
00315       difference = 0
00316     if 'cal_log' in self.lci.ntDict:
00317       cNt = self.lci.ntDict["cal_log"]
00318       chanIndex = tower*8*12 + layer*12 + column
00319       cRow = [tower,layer,column,posValue,negValue,average,difference,chanIndex,self.lci.ppcTimeInSec]
00320       cNt.addRow(cRow)
00321
00322 class TKRcontributionIterator(LDF.TKRcontributionIterator):
00323   def __init__(self, event, contribution, lci):
00324     LDF.TKRcontributionIterator.__init__(self, event, contribution)
00325     self.lci     = lci
00326     self.__debug      = 0
00327
00328   def fill(self):
00329     length  = self.contribution().numAccepts(self.event())
00330     if length == 0:
00331       return
00332     self.layerHits = [0] * 16 * 36
00333     self.iterateStrips()
00334     self.iterateTOTs()
00335     # fill layer hits ntuple
00336     if 'tkr_layer' in self.lci.ntDict:
00337       cNt = self.lci.ntDict['tkr_layer']
00338       for tower in range(16):
00339         for layer in range(36):
00340           chanIndex = tower*36+layer
00341           if self.layerHits[chanIndex]>0:
00342             cRow = [tower,layer,self.layerHits[layer],chanIndex,self.lci.ppcTimeInSec]
00343             cNt.addRow(cRow)
00344
00345   def strip(self, tower, layerEnd, hit):
00346     layer = layerEnd >> 1
00347     fenum = int(hit/64)
00348     self.layerHits[tower*36+layer]+=1;
00349     if 'tkr_hit' in self.lci.ntDict:
00350       cNt = self.lci.ntDict['tkr_hit']
00351       chanIndex = tower*36*24+layer*24+fenum
00352       cRow = [tower,layer,fenum,hit,chanIndex,self.lci.ppcTimeInSec]
00353       cNt.addRow(cRow)
00354
00355   def TOT(self, tower, layerEnd, tot):
00356     layer = layerEnd>>1
00357     end = layerEnd%2
00358     if 'tkr_tot' in self.lci.ntDict:
00359       cNt = self.lci.ntDict['tkr_tot']
00360       chanIndex = tower*36*2+layer*2+end
00361       cRow = [tower,layer,end,tot,chanIndex,self.lci.ppcTimeInSec]
00362       cNt.addRow(cRow)
00363
00364 class AEMcontributionIterator(LDF.AEMcontributionIterator):
00365   def __init__(self,event,contribution, lci):
00366     LDF.AEMcontributionIterator.__init__(self,event,contribution)
00367     self.lci = lci
00368   def fill(self):
00369     if 'acd_tile' in self.lci.ntDict:
00370       self.acdAdc0 = {}
00371       self.acdAdc1 = {}
00372       self.acdHit0 = {}
00373       self.acdHit1 = {}
00374     self.iterate()
00375     if 'acd_tile' in self.lci.ntDict:
00376       for tileNumber in self.acdAdc0.keys():
00377         pha0 = self.acdAdc0[tileNumber]
00378         pha1 = self.acdAdc1[tileNumber]
00379         hit0=0
00380         hit1=0
00381         if tileNumber in self.acdHit0:
00382           hit0 = self.acdHit0[tileNumber]
00383           if hit0 is None:
00384             hit0 = 0
00385         if tileNumber in self.acdHit1:
00386           hit1 = self.acdHit1[tileNumber]
00387           if hit1 is None:
00388             hit1 = 0
00389         if pha0 is not None and pha1 is not None:
00390           # have both read out so make it a tile...
00391           average = (pha0+pha1)/2.
00392           if average!=0:
00393             difference = (pha0-pha1)/(2.*average)
00394           else:
00395             difference = 0
00396           cNt = self.lci.ntDict['acd_tile']
00397           chanIndex = self.getRemappedTileNumber(tileNumber)
00398           cRow = [tileNumber,pha0,pha1,average,difference,hit0,hit1,hit0|hit1,chanIndex,self.lci.ppcTimeInSec]
00399           cNt.addRow(cRow)
00400
00401   def header(self, cable, hdr):
00402     for channel in range(18):
00403       if (hdr.hitMap()>>channel)&0x1:
00404         tileNumber = self.getMiniAcdTileNumber(cable,channel)
00405         remappedTileNumber = self.getRemappedTileNumber(tileNumber)
00406         side = self.getMiniAcdSide(cable,channel)
00407         if 'acd_hit' in self.lci.ntDict:
00408           cNt = self.lci.ntDict['acd_hit']
00409           chanIndex = remappedTileNumber*2+side
00410           cRow = [cable,channel,tileNumber,side,chanIndex,self.lci.ppcTimeInSec]
00411           cNt.addRow(cRow)
00412         if 'acd_tile' in self.lci.ntDict:
00413           if side==0:
00414             self.acdHit0[tileNumber]=1
00415             if not tileNumber in self.acdHit1:
00416               self.acdHit1[tileNumber]=None
00417           if side==1:
00418             self.acdHit1[tileNumber]=1
00419             if not tileNumber in self.acdHit0:
00420               self.acdHit0[tileNumber]=None
00421
00422   def pha(self, cable, channel, p):
00423     adcValue = p.ADCvalue()
00424     adcRange = p.ADCrange()
00425     if self.lci.acdPeds is not None:
00426       adcValue -= self.lci.acdPeds[cable,channel,p.ADCrange(),0]
00427       rangeMultiplier = [1.,100.]
00428       adcValue*=rangeMultiplier[p.ADCrange()]
00429       # until second range pedestals are available, just overflow the other range
00430       if adcRange>0: adcValue = 4096.
00431       adcRange = 0
00432       if self.lci.sparsify:
00433         if adcValue < 3.*self.lci.acdPeds[cable,channel,adcRange,1]:
00434           return # don't fill if we're sparsifying
00435     else:
00436       # overflow the second range if no pedestals
00437       if not self.lci.collectingPedestals:
00438         if adcRange>0: adcValue = 4096.
00439     tileNumber = self.getMiniAcdTileNumber(cable,channel)
00440     remapTileNumber = self.getRemappedTileNumber(tileNumber)
00441     # side
00442     side = self.getMiniAcdSide(cable,channel)
00443     if 'acd_accept' in self.lci.ntDict:
00444       cNt = self.lci.ntDict["acd_accept"]
00445       chanIndex = remapTileNumber*2+side
00446       cRow = [cable,channel,tileNumber,side,adcValue,chanIndex,self.lci.ppcTimeInSec]
00447       cNt.addRow(cRow)
00448     if 'acd_tile' in self.lci.ntDict:
00449       if side==0:
00450         self.acdAdc0[tileNumber]=adcValue
00451         if not tileNumber in self.acdAdc1:
00452           self.acdAdc1[tileNumber]=None
00453       if side==1:
00454         self.acdAdc1[tileNumber]=adcValue
00455         if not tileNumber in self.acdAdc0:
00456           self.acdAdc0[tileNumber]=None
00457     if 'acd_pha' in self.lci.numarrayDict:
00458       cNumarray = self.lci.numarrayDict["acd_pha"]
00459       cNumarray[cable,channel,adcRange] = adcValue
00460
00461   def getSide(self,cable,channel):
00462     id   = self.event().identity()
00463     tbl  = self.map().lookup(id, cable, channel)
00464     if tbl.a() == 'A':
00465       side = 0
00466     else:
00467       side = 1
00468     return side
00469
00470   def getIntegerTileNumber(self,cable,channel):
00471     id   = self.event().identity()
00472     tbl  = self.map().lookup(id, cable, channel)
00473     tileName  = tbl.name()
00474     if tileName[0:2] == 'NA':
00475       tileNumber = int(tileName[2:])
00476       tileNumber += 700
00477     else:
00478       tileNumber = int(tileName)
00479     return tileNumber
00480
00481   def getMiniAcdSide(self,cable,channel):
00482     # special kludged version for miniAcd
00483     id   = self.event().identity()
00484     tbl  = self.map().lookup(id, cable, channel)
00485     if tbl.a() == 'A':
00486       side = 0
00487     else:
00488       side = 1
00489
00490     # special remaps
00491     if cable==10 and channel==6:
00492       side = 1
00493     if cable==10 and channel==7:
00494       side = 1
00495     if cable==10 and channel==11:
00496       side = 0
00497     if cable==10 and channel==12:
00498       side = 0
00499
00500     return side
00501
00502   def getMiniAcdTileNumber(self,cable,channel):
00503     # special kludged version for miniAcd
00504     id   = self.event().identity()
00505     tbl  = self.map().lookup(id, cable, channel)
00506     tileName  = tbl.name()
00507     if tileName[0:2] == 'NA':
00508       tileNumber = int(tileName[2:])
00509       tileNumber += 700
00510     else:
00511       tileNumber = int(tileName)
00512
00513     # special remaps
00514     if cable==10 and channel==6:
00515       tileNumber = 0
00516     if cable==10 and channel==7:
00517       tileNumber = 1
00518     if cable==10 and channel==11:
00519       tileNumber = 0
00520     if cable==10 and channel==12:
00521       tileNumber = 1
00522
00523     return tileNumber
00524
00525   def getRemappedTileNumber(self,tileNumber):
00526     # remap: top has 25, sides 16, 8 fibers and last 11 unassigned
00527     # three digits of tilenumber are [side][xcoord][yxoord]
00528     remainder = tileNumber%100
00529     division  = tileNumber/100
00530     remapTileNumber = 5*(remainder/10)+remainder%10
00531     if division>=1 and division<5:
00532       remapTileNumber+=25+16*(division-1)
00533     elif division==5 or division==6:
00534       remapTileNumber=25+16*4+(remainder/10)
00535     elif division==7:
00536       remapTileNumber=25+16*4+8+remainder
00537     return remapTileNumber
00538
00539 class OSWcontributionIterator(LDF.OSWcontributionIterator):
00540   def __init__(self, event, contribution, lci):
00541     LDF.OSWcontributionIterator.__init__(self, event, contribution)
00542     self.lci  = lci
00543     # these are for filling ntuple (in OSWtime)
00544     self.eventNumber = LDF.EventSummary.eventNumber(event.summary())*4+LDF.EventSummary.tag(event.summary())
00545     self.eventSize = event.length()
00546     # marker is kept by the lci for access from scripts
00547     self.lci.eventMarker = LDF.EventSummary.marker(event.summary())
00548
00549   def OSWtime(self, timeStamp, timebase):
00550     ts = LDF.OSWtimeSpec(timeStamp)
00551     gmTime = ts.sec()+1.e-9*ts.nsec()
00552     # get around the sign bit problem
00553     lowerTime = long(timebase.lower())
00554     if lowerTime<0: lowerTime += 0x100000000L-1
00555     upperTime = long(timebase.upper())
00556     if upperTime<0: upperTime += 0x100000000L-1
00557     ppcTime = upperTime<<32 | lowerTime
00558     if self.lci.eventMarker==5:
00559       self.lci.markerPpcTime = ppcTime
00560       self.lci.markerGmTime  = gmTime
00561     # convert to seconds since marker for ntuple
00562     # at 64 bits don't have to worry about rolling over...
00563     dtPpc = 0.
00564     if self.lci.prevPpcTime!=0:
00565       dtPpc = ppcTime - self.lci.prevPpcTime
00566     dtPpcInSec = (1.*dtPpc)/20.e6
00567     ppcTimeInSec = 1.*(ppcTime - self.lci.markerPpcTime)/20.e6
00568     gmTimeInSec  = 1.*(gmTime - self.lci.markerGmTime)
00569     self.lci.ppcTimeInSec = ppcTimeInSec
00570     if 'osw_time' in self.lci.ntDict:
00571       cRow = [self.eventNumber,self.eventSize,dtPpcInSec,gmTimeInSec,ppcTimeInSec]
00572       cNt = self.lci.ntDict['osw_time']
00573       cNt.addRow(cRow)
00574     self.lci.prevPpcTime = ppcTime
00575     self.lci.prevGmTime  = gmTime
00576     return 0
00577
00578   def OSW_UDF(self, event, contribution):
00579     return 0
00580
00581 class DIAGcontributionIterator(LDF.DIAGcontributionIterator):
00582   __gtccEndMap    = [0,1,1,0,1,0,0,1]
00583   __gtccLayerStart= [0,0,1,1,3,3,2,2]
00584   def __init__(self,event,contribution,dataStart,lci):
00585     LDF.DIAGcontributionIterator.__init__(self,event,contribution)
00586     self.offset(dataStart)  # Set the start of the diagnostic data
00587     self.lci=lci
00588
00589   def CALdiag(self, tower, layer, diag):
00590     if 'cal_lac' in self.lci.ntDict:
00591       cNt = self.lci.ntDict['cal_lac']
00592       for column in range(12):
00593         for end in range(2):
00594           lac = (diag.logAccepts(end)>>column)&0x1
00595           if lac:
00596             realEnd = (end+1)%2
00597             chanIndex = tower*8*12*2 + layer*12*2 + column*2 + realEnd
00598             cRow = [tower,layer,column,realEnd,lac,chanIndex,self.lci.ppcTimeInSec]
00599             cNt.addRow(cRow)
00600     if 'cal_trig' in self.lci.ntDict:
00601       cNt = self.lci.ntDict['cal_trig']
00602       for end in range(2):
00603         le = diag.low(end)
00604         he = diag.high(end)
00605         if le or he:
00606           realEnd = (end+1)%2
00607           chanIndex = tower*8*2 + layer*2 + realEnd
00608           cRow = [tower,layer,realEnd,le,he,chanIndex,self.lci.ppcTimeInSec]
00609           cNt.addRow(cRow)
00610     return 0
00611
00612   def TKRdiag(self, tower, gtcc, diag):
00613     if 'tkr_trig' in self.lci.ntDict:
00614       cNt = self.lci.ntDict['tkr_trig']
00615       for gtrc in range(9):
00616         if (diag.datum()>>gtrc)&0x1:
00617           layer = self.__gtccLayerStart[gtcc]+4*gtrc
00618           end = self.__gtccEndMap[gtcc]
00619           chanIndex = tower*36*2+layer*2+end
00620           cRow = [tower,layer,end,chanIndex,self.lci.ppcTimeInSec]
00621           cNt.addRow(cRow)
00622     return 0
00623
00624 class GEMcontribution(object):
00625   def __init__(self, event, contribution,lci):
00626     self.lci = lci
00627     self.__event        = event
00628     self.__contribution = contribution
00629
00630   def __getattr__(self, attr):
00631     """This method fakes up inheritance from an LDF.GEMcontribution.
00632     When a called method can not be found to belong to this class, this
00633     method is called.  We use it to redirect the call to the 'base' class.
00634     """
00635     return getattr(self.__contribution, attr)
00636
00637   def fill(self, prefix = ""):
00638     tl  = self.tileList()
00639     dtCalc = self.triggerTime()-self.lci.prevGemTime
00640     if (self.triggerTime()<self.lci.prevGemTime):
00641       # it rolled (happens every 1.7 seconds)
00642       dtCalc += 1<<25
00643     dtCalcInSec = dtCalc/20.e6
00644     gemTimeInSec = dtCalcInSec+self.lci.gemTimeInSec+dtCalcInSec
00645     dtRegInSec = self.deltaEventTime()/20.e6
00646     if 'gem_event' in self.lci.ntDict:
00647       livetimeInSec = self.liveTime()/20.e6
00648       prescale = self.prescaled()
00649       discarded = self.discarded()
00650       send = self.sent()
00651       numberTiles = 0
00652       for tileIndex in range(16):
00653         if (tl.XZM()>>tileIndex)&0x1: numberTiles+=1
00654         if (tl.XZP()>>tileIndex)&0x1: numberTiles+=1
00655         if (tl.YZM()>>tileIndex)&0x1: numberTiles+=1
00656         if (tl.YZP()>>tileIndex)&0x1: numberTiles+=1
00657       for tileIndex in range(25):
00658         if (tl.XY()>>tileIndex)&0x1: numberTiles+=1
00659       for tileIndex in range(8):
00660         if (tl.RBN()>>tileIndex)&0x1: numberTiles+=1
00661       for tileIndex in range(11):
00662         if (tl.NA()>>tileIndex)&0x1: numberTiles+=1
00663       cNt = self.lci.ntDict['gem_event']
00664       cRow = [dtRegInSec,dtCalcInSec,self.conditionSummary(),numberTiles,livetimeInSec,gemTimeInSec,prescale,discarded,send,self.lci.ppcTimeInSec]
00665       cNt.addRow(cRow)
00666     if 'gem_input' in self.lci.ntDict:
00667       cNt = self.lci.ntDict['gem_input']
00668       cRow = [self.cnoVector(),tl.XY(),tl.XZM(),tl.XZP(),tl.YZM(),tl.YZP(),tl.RBN(),tl.NA(),self.roiVector(),self.tkrVector(),self.calLEvector(),self.calHEvector(),self.lci.ppcTimeInSec]
00669       cNt.addRow(cRow)
00670     self.lci.prevGemTime = self.triggerTime()
00671     self.lci.gemTimeInSec = gemTimeInSec
00672
00673 class LATcontributionIterator(LDF.LDBI_LATcontributionIterator):
00674   def __init__(self, eei):
00675     LDF.LDBI_LATcontributionIterator.__init__(self, eei)
00676     self.__udfDict = {}
00677
00678   #def EBF(self, start, end):          # Use the default
00679   #  return status
00680
00681   def UDF(self, start, end):
00682     # the raw data is a string with comma separated key=value pairs
00683     udfString = str(start.rawData())
00684     # strip null characters
00685     import string
00686     udfString = string.strip(udfString,'\000')
00687
00688     # now split and see what you get
00689     udfList = string.split(udfString,',')
00690     for udfItem in udfList:
00691       udfSplitItem = string.split(udfItem,'=')
00692       if len(udfSplitItem) == 2:
00693         udfKey = string.strip(udfSplitItem[0])
00694         string.strip(udfSplitItem[1])
00695         udfValue = udfSplitItem[1]
00696         self.__udfDict[udfKey] = udfValue
00697     return 0
00698
00699   def getUdfDict(self):
00700     return self.__udfDict
00701
00702   def clearUdfDict(self):
00703     self.__udfDict.clear()
00704
00705 class EBFeventIterator(LDF.LDBI_EBFeventIterator):
00706   def __init__(self, lci):
00707     LDF.LDBI_EBFeventIterator.__init__(self, lci)
00708     self.__lci = lci
00709
00710   def process(self, evt):
00711     self.__lci.iterate(evt)
00712     return self.__lci.status()
00713
00714
00715 def hexdump( chars, sep, width ):
00716   while chars:
00717     line = chars[0:width]
00718     chars = chars[width:]
00719     line = line + '\000' * (width - len(line))
00720     print "%s%s%s" % ( sep.join( map( lambda c: "%02x" % ord(c), line )),sep, quotechars( line ))
00721
00722
00723 def quotechars( chars ):
00724   return ''.join( map( lambda c: ['.', c][c.isalnum()], chars ))
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardPlotter.py Source File

consumer

standardPlotter.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "LDF Plotter for consumer"
00013 __author__   = "Lester Miller"
00014 __date__     = "11/18/2003"
00015 __version__  = "$Revision: 1.10 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 import sihippo
00020 import os
00021 import time
00022 import Numeric as numarray
00023 import string
00024 import ConfigParser
00025 import logging       as     myLog
00026 from LATTE.consumer.standardPlotterGuiImpl import standardPlotterGuiImpl
00027 import qt
00028 from   LATTE.runcontrol.rcTestReport           import rcTestReport
00029
00030 class standardPlotter(object):
00031   def __init__(self,lci,gui=None):
00032     self.gui = gui
00033     self.lci = lci
00034
00035   def initializePlotter(self):
00036     # get configuration file from GUI
00037     if self.gui is not None:
00038       self.configGui = self.gui.createGUI(standardPlotterGuiImpl, self.gui, 'test1', 1)
00039       configFile = self.gui.execGUImethod(self.configGui.getConfigFile,self.configFile)
00040     else:
00041       self.configGui = standardPlotterGuiImpl(self, 'test1', 1)
00042       configFile = self.configGui.getConfigFile(self.configFile)
00043     if configFile is None:
00044       raise AssertionError,'User Cancelled: No config file given'
00045     self.setConfigFile(configFile)
00046
00047   def setDataType(self,dataType):
00048     self.dataType = dataType
00049
00050   def setConfigFile(self,configFile):
00051     myLog.info("Configuring with file %s"%(configFile))
00052     self.configFile = os.path.expandvars(configFile)
00053     # lci owns ntuples and numarrays
00054     self.lci.ntDict = {}
00055     self.lci.numarrayDict = {}
00056     # next we find what's been requested from config
00057     self.histDict = {}
00058     self.limits = {}
00059     self.cuts = {}
00060     self.options = {}
00061     self.ntRequests = {}
00062     self.plotRequests = {}
00063     self.limitRequests = {}
00064     self.cutRequests = {}
00065     self.getRequests()
00066     # these are the options fields
00067     self.reportPath = None
00068     if self.gui is not None:
00069       self.reportPath = self.gui.preferences()["reportdir"]
00070       self.reportPath = os.path.expandvars(self.reportPath)
00071     elif 'reportpath' in self.options:
00072       self.reportPath = self.options['reportpath']
00073       self.reportPath = os.path.expandvars(self.reportPath)
00074       if not os.path.isabs(self.reportPath):
00075         self.reportPath = os.path.join(os.getcwd(),self.reportPath)
00076     self.checkInterval = 1000
00077     if 'checkinterval' in self.options:
00078       self.checkInterval = eval(self.options['checkinterval'])
00079     self.plotUpdateRate = 2
00080     if 'plotupdaterate' in self.options:
00081       self.plotUpdateRate = eval(self.options['plotupdaterate'])
00082     self.dataType = 'All'
00083     if 'datatype' in self.options:
00084       self.dataType = self.options['datatype']
00085     pedSubtract = True
00086     self.lci.acdPeds = None
00087     self.lci.calPeds = None
00088     if 'pedsubtract' in self.options:
00089       pedSubtract = eval(self.options['pedsubtract'])
00090     if pedSubtract:
00091       self.readPedestals()
00092     if 'pedsparsify' in self.options:
00093       self.lci.sparsify = eval(self.options['pedsparsify'])
00094     # init hippo as requested
00095     if self.gui is not None:
00096       self.gui.execGUImethod(self.initHippo)
00097     else:
00098       self.initHippo()
00099
00100   def getName(self):
00101     return 'standardPlotter'
00102
00103   def initHippo(self):
00104     self.lci.nEvtSeen=0
00105     # setup with canvas
00106     ntc = sihippo.NTupleController.instance()
00107     wc = sihippo.WindowController.instance()
00108     self.canvas = wc.currentCanvas()
00109     if self.canvas is None:
00110       wc.createInspector()
00111       self.window = sihippo.CanvasWindow()
00112       self.window.show()
00113       self.canvas = wc.currentCanvas()
00114     self.canvas.clear()
00115     self.dc = sihippo.DisplayController.instance()
00116     self.canvas.show()
00117     self.qtTimer = qt.QTime.currentTime()
00118     qt.QTime.start(self.qtTimer)
00119     # book ntuples
00120     for ntuple in self.ntRequests.keys():
00121       ntupleColumns = self.lci.getNtupleDefinition(ntuple)
00122       if ntupleColumns is not None:
00123         if self.ntRequests[ntuple]>0:
00124           cNt = ntc.createCircularBuffer( ntupleColumns )
00125           cNt.reserve ( self.ntRequests[ntuple] )
00126         else:
00127           cNt = ntc.createNTuple( ntupleColumns )
00128         cNt.setName(ntuple)
00129         cNt.setTitle(ntuple)
00130         cNt.setIntervalEnabled ( 1 )
00131         cNt.setIntervalCount ( 1000000 )
00132         self.lci.ntDict[ntuple] = cNt
00133       else:
00134         myLog.warn('StandardPlotter:initHippo: Unknown ntuple \'%s\' in requested ntuples'%(ntuple))
00135     # book plots
00136     # expect that the config comes in form
00137     # Ntuple name, Plot Type, Plot Title, column list [, xbinlow xbinhi xbinwidth, ybinlow ybinhi ybinwidth]
00138     for plot in self.plotRequests.keys():
00139       declarationList = string.split(self.plotRequests[plot],',')
00140       if len(declarationList)>=4:
00141         ntupleName = string.strip(declarationList[0]).lower()
00142         if ntupleName in self.lci.ntDict:
00143           cNt = self.lci.ntDict[ntupleName]
00144           hColumnList = string.split(declarationList[3])
00145           hColumns = []
00146           cNtColumns = self.lci.getNtupleDefinition(ntupleName)
00147           foundColumns = True
00148           for column in hColumnList:
00149             normalColumn = string.strip(column).lower()
00150             if normalColumn in cNtColumns:
00151               hColumns.append(normalColumn)
00152             else:
00153               foundColumns = False
00154               myLog.warn('StandardPlotter:initHippo: Requested plot \'%s\' has column \'%s\' not in ntuple \'%s\' with columns %s'%(plot,normalColumn,ntupleName,cNtColumns))
00155           if foundColumns:
00156             # finally have everything we need to declare the plot
00157             hType = string.strip(declarationList[1])
00158             hTitle = string.strip(declarationList[2])
00159             cHist = self.dc.createDisplay(hType,cNt,hColumns)
00160             cHist.setTitle(hTitle)
00161             # check for binning information
00162             if len(declarationList)>4:
00163               # x
00164               xBinPars = string.split(declarationList[4])
00165               if len(xBinPars)==3:
00166                 xLower = float(xBinPars[0])
00167                 xUpper = float(xBinPars[1])
00168                 xWidth = float(xBinPars[2])
00169                 if xUpper>xLower:
00170                   cHist.setRange('x', xLower , xUpper )
00171                 if xWidth>0:
00172                   cHist.setBinWidth('x', xWidth)
00173                 else:
00174                   myLog.warn('StandardPlotter:initHippo: Requested plot \'%s\' ignoring extra binning parameters for x, saw %s'%(plot,xBinPars))
00175             if len(declarationList)>5:
00176               # y
00177               yBinPars = string.split(declarationList[5])
00178               if len(yBinPars)==3:
00179                 yLower = float(yBinPars[0])
00180                 yUpper = float(yBinPars[1])
00181                 yWidth = float(yBinPars[2])
00182                 if yUpper>yLower:
00183                   cHist.setRange('y', yLower , yUpper )
00184                 if yWidth>0:
00185                   cHist.setBinWidth('y', yWidth)
00186                 else:
00187                   myLog.warn('StandardPlotter:initHippo: Requested plot \'%s\' ignoring extra binning parameters for y, saw %s'%(plot,yBinPars))
00188             self.histDict[plot]=cHist
00189             self.canvas.addDisplay(cHist)
00190         else:
00191           myLog.warn('StandardPlotter:initHippo: Requested plot \'%s\' error in declaration: ntuple \'%s\' unknown or not requested'%\
00192                      (plot,ntupleName))
00193       else:
00194         myLog.warn('StandardPlotter:initHippo: Requested plot \'%s\' error in declaration:\n expect: Ntuple name, Plot Type, Plot Title, column list, [lowerx upperx binwidthx, lowery uppery binwidthy]\n    got: %s'%(plot,declarationList))
00195     # now apply the cuts
00196     for (plot,variable) in self.cuts.keys():
00197       if not plot in self.histDict:
00198         myLog.warn('StandardPlotter:initHippo: Requested cut on plot \'%s\' variable \'%s\' but plot not requested'%(plot,variable))
00199         continue
00200       ntuple = self.getPlotNtuple(plot)
00201       if not ntuple in self.lci.ntDict:
00202         myLog.warn('StandardPlotter:initHippo: Requested cut on plot \'%s\' variable \'%s\' but ntuple not \'%s\' not requested'%(plot,variable,ntuple))
00203         continue
00204       if not variable in self.lci.getNtupleDefinition(ntuple):
00205         myLog.warn('StandardPlotter:initHippo: Requested cut on plot \'%s\' variable \'%s\' but ntuple \'%s\' has variables: %s'%\
00206                    (plot,variable,ntuple,self.lci.getNtupleDefinition(ntuple)))
00207         continue
00208       cc = sihippo.CutController.instance()
00209       (cutLower,cutUpper) = self.cuts[(plot,variable)]
00210       cut = cc.addCut ( self.histDict[plot], variable )
00211       cut.setCutRange ( cutLower,cutUpper )
00212
00213   def clearPlots(self):
00214     for nt in self.lci.ntDict.values():
00215       nt.clear()
00216     self.lci.nEvtSeen=0
00217     self.forceUpdatePlots()
00218
00219   def updatePlots(self):
00220     if qt.QTime.elapsed(self.qtTimer)>int(1000/self.plotUpdateRate):
00221       self.forceUpdatePlots()
00222       qt.QTime.restart(self.qtTimer)
00223
00224   def forceUpdatePlots(self):
00225     for nt in self.lci.ntDict.values():
00226       nt.setIntervalEnabled(0)
00227       nt.setIntervalEnabled(1)
00228
00229   def getPlotColumns(self,plot):
00230     result = []
00231     if plot in self.histDict and plot in self.plotRequests:
00232       declarationList = string.split(self.plotRequests[plot],',')
00233       if len(declarationList)>=4:
00234         hColumnList = string.split(declarationList[3])
00235         for column in hColumnList:
00236           result.append(string.strip(column).lower())
00237     return result
00238   def getPlotNtuple(self,plot):
00239     result = ''
00240     if plot in self.histDict and plot in self.plotRequests:
00241       declarationList = string.split(self.plotRequests[plot],',')
00242       if len(declarationList)>=4:
00243         result = string.strip(declarationList[0]).lower()
00244     return result
00245   def getPlotTitle(self,plot):
00246     result = ''
00247     if plot in self.histDict and plot in self.plotRequests:
00248       declarationList = string.split(self.plotRequests[plot],',')
00249       if len(declarationList)>=4:
00250         result = string.strip(declarationList[2])
00251     return result
00252   def getPlotCuts(self,plot):
00253     result = []
00254     if plot in self.histDict and plot in self.plotRequests:
00255       for (plotCut,variable) in self.cuts.keys():
00256         if plot == plotCut:
00257           (cutLower,cutUpper) = self.cuts[(plot,variable)]
00258           result.append((variable,cutLower,cutUpper))
00259     return result
00260   def getPlotType(self,plot):
00261     result = ''
00262     if plot in self.histDict and plot in self.plotRequests:
00263       declarationList = string.split(self.plotRequests[plot],',')
00264       if len(declarationList)>=4:
00265         result = string.strip(declarationList[1])
00266     return result
00267
00268   def getRequests(self):
00269     # try reading from a config file
00270     if self.configFile is not None:
00271       parser = ConfigParser.ConfigParser()
00272       if os.path.exists(self.configFile):
00273         parser.read(self.configFile)
00274         sections = parser.sections()
00275         for section in sections:
00276           options = parser.options(section)
00277           # don't evaluate plots, cuts or limits, those are parsed
00278           if section == 'plots':
00279             for option in options:
00280               self.plotRequests[option] = parser.get(section,option)
00281           elif section == 'limits':
00282             for option in options:
00283               self.limitRequests[option] = parser.get(section,option)
00284           elif section == 'cuts':
00285             for option in options:
00286               self.cutRequests[option] = parser.get(section,option)
00287           elif section == 'ntuples':
00288             for option in options:
00289               self.ntRequests[option] = eval(parser.get(section,option))
00290           elif section == 'options':
00291             for option in options:
00292               self.options[option] = parser.get(section,option)
00293           else:
00294             myLog.warn("%s.getRequests: unrecognized section \'%s\'\n" %(self.getName(),section))
00295     self.parseLimits()
00296     self.parseCuts()
00297
00298   def parseLimits(self):
00299     for limit in self.limitRequests.values():
00300       # limits are plot name, lower upper sigma
00301       # TKRocc_ped    = TKRocc,    0.0    1.5
00302       declarationList = string.split(limit,',')
00303       if len(declarationList)>=2:
00304         plotName = string.strip(declarationList[0]).lower()
00305         limitPars = string.split(declarationList[1])
00306         if len(limitPars)>=2:
00307           limitLower = float(limitPars[0])
00308           limitUpper = float(limitPars[1])
00309           if len(limitPars)>=3:
00310             limitWidth = float(limitPars[2])
00311           else:
00312             limitWidth = -1.
00313           self.limits[plotName] = (limitLower,limitUpper,limitWidth)
00314         else:
00315           myLog.warn("%s.parseLimits: error in limit parameters for \'%s\' need two or three numbers saw %s\n" %(self.getName(),limit,limitPars))
00316       else:
00317         myLog.warn("%s.parseLimits: error in limit declaration of \'%s\':\n expect: Plot name, lowerLimit upperLimit [rmsLimit]\n    got: %s\n"\
00318                    %(self.getName(),limit,declarationList))
00319
00320   def parseCuts(self):
00321     for cut in self.cutRequests.values():
00322       # cuts are plot name, ntuple variable, cut value low high
00323       # TKRocc_ped    = TKRocc,   tower,    -0.5    0.5
00324       declarationList = string.split(cut,',')
00325       if len(declarationList)>=3:
00326         plotName = string.strip(declarationList[0]).lower()
00327         plotVariable = string.strip(declarationList[1]).lower()
00328         cutPars = string.split(declarationList[2])
00329         if len(cutPars)>=2:
00330           cutLower = float(cutPars[0])
00331           cutUpper = float(cutPars[1])
00332           self.cuts[(plotName,plotVariable)] = (cutLower,cutUpper)
00333         else:
00334           myLog.warn("%s.parseCuts: error in cut parameters for \'%s\' need two numbers saw %s\n" %(self.getName(),cut,cutPars))
00335       else:
00336         myLog.warn("%s.parseCuts: error in cut declaration of \'%s\':\n expect: Plot name, Data Type, lowerCut upperCut\n    got: %s\n"\
00337                    %(self.getName(),cut,declarationList))
00338
00339   def readPedestals(self):
00340     if 'ANCILLARY_ROOT' in os.environ:
00341       ifname = os.path.join(os.environ['ANCILLARY_ROOT'],'Consumer/acdPeds.txt')
00342       try:
00343         infile = open(ifname)
00344       except:
00345         return
00346       self.lci.acdPeds = numarray.zeros((12,18,2,2))
00347       for line in infile.xreadlines():
00348         if line[0]=='!':
00349           continue
00350         # cable channel range mean rms
00351         entries = string.split(line)
00352         if len(entries)==5:
00353           self.lci.acdPeds[int(entries[0]),int(entries[1]),int(entries[2]),0] = float(entries[3])
00354           self.lci.acdPeds[int(entries[0]),int(entries[1]),int(entries[2]),1] = float(entries[4])
00355       infile.close()
00356       myLog.info('StandardPlotter:readPedestals: Read in ACD pedestals from %s'%(ifname))
00357
00358       ifname = os.path.join(os.environ['ANCILLARY_ROOT'],'Consumer/calPeds.txt')
00359       try:
00360         infile = open(ifname)
00361       except:
00362         return
00363       self.lci.calPeds = numarray.zeros((16,8,12,2,4,2))
00364       for line in infile.xreadlines():
00365         if line[0]=='!':
00366           continue
00367         # tower layer column end range mean rms
00368         entries = string.split(line)
00369         if len(entries)==7:
00370           self.lci.calPeds[int(entries[0]),int(entries[1]),int(entries[2]),int(entries[3]),int(entries[4]),0] = float(entries[5])
00371           self.lci.calPeds[int(entries[0]),int(entries[1]),int(entries[2]),int(entries[3]),int(entries[4]),1] = float(entries[6])
00372       infile.close()
00373       myLog.info('StandardPlotter:readPedestals: Read in CAL pedestals from %s'%(ifname))
00374
00375   def checkLimit(self,plot,limit):
00376     # check the given limit against the given plot
00377     # returns a tuple of (limitColumnName,limitLabelList,limitList,errorLabelList,errorList)
00378     limitLabelList = []
00379     limitFailList = []
00380     errorLabelList = []
00381     errorFailList = []
00382     originalLimitColumnName = None
00383     if plot in self.histDict:
00384       # get columns wanted from plot declaration
00385       plotColumns = self.getPlotColumns(plot)
00386       xColumnName = None
00387       yColumnName = None
00388       errorColumnName = None
00389       limitColumnName = plotColumns[len(plotColumns)-1] # limit column is always last or entries/bin
00390       originalLimitColumnName = limitColumnName
00391       if len(plotColumns)>=1:
00392         xColumnName = plotColumns[0]
00393       if len(plotColumns)>=2:
00394         yColumnName = plotColumns[1]
00395       # match these to the plot ntuple columns
00396       xColumn = None
00397       yColumn = None
00398       limitColumn = None
00399       errorColumn = None
00400       cHist = self.histDict[plot]
00401       histNtuple = cHist.createNTuple()
00402       for columnIndex in range(histNtuple.columns()):
00403         columnName = histNtuple.getLabelAt(columnIndex)
00404         if columnName == xColumnName:
00405           xColumn = histNtuple.getColumn(columnName)
00406         if columnName == yColumnName:
00407           yColumn = histNtuple.getColumn(columnName)
00408         if columnName == limitColumnName:
00409           limitColumn = histNtuple.getColumn(columnName)
00410         if columnName == 'Error':
00411           errorColumn = histNtuple.getColumn(columnName)
00412           errorColumnName = columnName
00413         # special case of Histogram or 2Dhist: limit column is entries per bin
00414         if columnName == 'Density' or columnName == 'Entries / bin':
00415           limitColumn = histNtuple.getColumn(columnName)
00416           limitColumnName = columnName
00417       # if the limit is same as one of the dependent variables, remove them
00418       if limitColumnName == yColumnName:
00419         yColumn = None
00420         yColumnName = None
00421       # if the y column doesn't exist, put a dummy column in place
00422       if yColumn is None:
00423         yColumn = numarray.zeros((len(limitColumn)))
00424       # now we have the Label Lists
00425       limitLabelList = [xColumnName,yColumnName,limitColumnName]
00426       (limitLower,limitUpper,limitWidth) = limit
00427       # check this limit
00428       # if we're not ring buffered, assume the limits are rates in histogram bins
00429       if limitColumnName == 'Density' or limitColumnName == 'Entries / bin':
00430         if self.ntRequests[self.getPlotNtuple(plot)]<=0:
00431           limitUpper *= self.lci.nEvtSeen
00432           limitLower *= self.lci.nEvtSeen
00433       for binIndex in range(len(limitColumn)):
00434         if limitColumn[binIndex]<limitLower or limitColumn[binIndex]>limitUpper:
00435           limitFailList.append([xColumn[binIndex],yColumn[binIndex],limitColumn[binIndex]])
00436       # next the width if applicable
00437       if limitWidth>0 and errorColumn is not None:
00438         errorLabelList = [xColumnName,yColumnName,errorColumnName]
00439         for binIndex in range(len(errorColumn)):
00440           if errorColumn[binIndex]>limitWidth:
00441             errorFailList.append([xColumn[binIndex],yColumn[binIndex],errorColumn[binIndex]])
00442     else:
00443       myLog.warn('%s.checkLimit: error in limit \'%s\': plot \'%s\' unknown or not requested. Known plots: %s\n'\
00444                  %(self.getName(),limit,plot,self.histDict.keys()))
00445
00446     return (originalLimitColumnName,limitLabelList,limitFailList,errorLabelList,errorFailList)
00447
00448   def reportResults(self):
00449     if self.reportPath is not None and self.getRunId() != '':
00450       self.startReport()
00451       self.reportLimits()
00452       self.reportPlots()
00453       reportName = self.getName() + "_" + self.getRunId() + ".html"
00454       myLog.info('Creating report %s'%(reportName))
00455       self.writeReport(os.path.join(self.reportPath,reportName))
00456
00457
00458   def startSummary(self):
00459     self.summarySection = self.report.addSection('Summary of Results',insert=0)
00460     configFileName = os.path.basename(self.configFile)
00461     itemString = "<a href = '%s'>%s</a>"%(configFileName,configFileName)
00462     self.report.addSectionItem(self.summarySection,'Plotter Configuration File',itemString)
00463     self.addExportedFile(self.configFile,delete = False)
00464     # a table of results
00465     self.summaryTable = self.report.addSectionTable(self.summarySection)
00466     self.report.beginTableRow(self.summaryTable)
00467     self.report.addTableHeader(self.summaryTable,'Plot Name')
00468     self.report.addTableHeader(self.summaryTable,'Data Type')
00469     self.report.addTableHeader(self.summaryTable,'Limit Type')
00470     self.report.addTableHeader(self.summaryTable,'Status')
00471
00472   def reportLimits(self):
00473     sectionID = None
00474     for plot in self.limits.keys():
00475       if plot in self.histDict:
00476         cLimit = self.limits[plot]
00477         # check ringBuffer for completion
00478         if self.ntRequests[self.getPlotNtuple(plot)]>0 and self.lci.ntDict[self.getPlotNtuple(plot)].rows()<self.ntRequests[self.getPlotNtuple(plot)]:
00479           # append this to the summary table
00480           (limitLower,limitUpper,limitWidth) = cLimit
00481           status = 'INSUFFICIENT'
00482           if limitWidth>0:
00483             limitType = 'range/sigma limit'
00484           else:
00485             limitType = 'range limit'
00486           if self.getCompletionStatusStr()=='PASSED':
00487             self.setCompletionStatus(self.COMPL_STATUS_PASSED_CONDITIONALLY)
00488           self.addSummaryTableRow(plot,limitType,status)
00489           continue
00490         (limitName,limitLabelList,limitFailList,errorLabelList,errorFailList)  = self.checkLimit(plot,cLimit)
00491         if limitName is not None:
00492           # print out a plot section
00493           itemStartString = 'Limit Check for Plot:'
00494           if sectionID is None:
00495             sectionID = self.report.addSection('%s Data Limit Checks'%(self.dataType))
00496             if self.firstBodySection is None:
00497               self.firstBodySection = sectionID
00498           self.reportPlotItem(sectionID,plot,itemStartString)
00499           # get limit descriptor
00500           (limitLower,limitUpper,limitWidth) = cLimit
00501           xName = limitLabelList[0]
00502           yName = limitLabelList[1]
00503           zName = limitLabelList[2]
00504           limitDesc = self.lci.getColumnDescription(self.getPlotNtuple(plot),limitName)
00505           if zName == 'Density' or zName == 'Entries / bin':
00506             if self.ntRequests[self.getPlotNtuple(plot)]>0:
00507               limitDesc = 'Entries per bin'
00508             else:
00509               limitDesc = 'Entries per bin per event'
00510           itemString = '%s between %f and %f'%(limitDesc,limitLower,limitUpper)
00511           self.report.addSectionItem(sectionID,'Limit',itemString)
00512           # check this limit
00513           status = 'PASSED'
00514           if len(limitFailList)>0:
00515             status = 'FAILED'
00516             self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00517           self.report.addSectionItem(sectionID,'Status',self.report.statusString(status))
00518           # append this to the summary table
00519           self.addSummaryTableRow(plot,'range limit',status)
00520           # list out failures
00521           self.listFailed(limitLabelList,limitFailList,plot,limitDesc,sectionID)
00522           # next the error limit if requested
00523           if len(errorLabelList)>0:
00524             itemString = '%s sigma less than %f'%(limitDesc,limitWidth)
00525             self.report.addSectionItem(sectionID,'Limit',itemString)
00526             # check this limit
00527             status = 'PASSED'
00528             if len(errorFailList)>0:
00529               status = 'FAILED'
00530               self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00531             self.report.addSectionItem(sectionID,'Status',self.report.statusString(status))
00532             # append this to the summary table
00533             self.addSummaryTableRow(plot,'sigma limit',status)
00534             # list out failures
00535             self.listFailed(errorLabelList,errorFailList,plot,limitDesc,sectionID)
00536     return sectionID
00537
00538   def addSummaryTableRow(self,plot,limitType,status):
00539     if self.summarySection is None:
00540       self.startSummary()
00541     self.report.beginTableRow(self.summaryTable)
00542     self.report.addTableData(self.getPlotTitle(plot))
00543     self.report.addTableData(self.dataType)
00544     self.report.addTableData(limitType)
00545     self.report.addTableData(self.report.statusString(status))
00546
00547   def reportPlotItem(self,sectionID,plot,itemStartString):
00548     self.reportedPlots.append((plot,self.dataType))
00549     if self.gui is not None:
00550       pngFile = self.gui.execGUImethod(self.capturePlot,plot)
00551     else:
00552       pngFile = self.capturePlot(plot)
00553     axisLabelString = ''
00554     first = True
00555     for label in self.getPlotColumns(plot):
00556       if first:
00557         axisLabelString+=self.lci.getColumnDescription(self.getPlotNtuple(plot),label)
00558         first = False
00559       else:
00560         axisLabelString+=' <b>Vs.</b> '+self.lci.getColumnDescription(self.getPlotNtuple(plot),label)
00561     itemString = '<hr/>%s %s'%(itemStartString,self.getPlotTitle(plot))
00562     self.report.addSectionImage(sectionID,itemString,pngFile)
00563     self.report.addSectionItem(sectionID,'Plot Type',self.getPlotType(plot))
00564     self.report.addSectionItem(sectionID,'Plot Axes',axisLabelString)
00565     if self.ntRequests[self.getPlotNtuple(plot)]>0:
00566       ntEntries = self.lci.ntDict[self.getPlotNtuple(plot)].rows()
00567       bufferSize = self.ntRequests[self.getPlotNtuple(plot)]
00568       if ntEntries < bufferSize:
00569         eventItemString = '%s (Ring Buffer has %d of %d rows filled)'\
00570                           %(str(self.lci.nEvtSeen),ntEntries,bufferSize)
00571       else:
00572         eventItemString = '%s (Ring Buffer of %d is full)'\
00573                           %(str(self.lci.nEvtSeen),bufferSize)
00574     else:
00575       eventItemString = str(self.lci.nEvtSeen)
00576     self.report.addSectionItem(sectionID,'Number of Events',eventItemString)
00577     cutList = self.getPlotCuts(plot)
00578     if len(cutList)>0:
00579       itemString = '<ul>'
00580       for (variable,low,high) in cutList:
00581         itemString+='<li>%s between %f and %f</li>'%(self.lci.getColumnDescription(self.getPlotNtuple(plot),variable),low,high)
00582       itemString += '</ul>'
00583       self.report.addSectionItem(sectionID,'Cuts Applied',itemString)
00584
00585   def listFailed(self,names,failList,plot,limitDesc,sectionID):
00586     xName = names[0]
00587     yName = names[1]
00588     zName = names[2]
00589     if (len(failList)==0): return
00590     # make this a table
00591     tableID = self.report.addSectionTable(sectionID)
00592     self.report.beginTableRow(tableID)
00593     self.report.addTableHeader(tableID,self.lci.getColumnDescription(self.getPlotNtuple(plot),xName))
00594     if yName is not None:
00595       self.report.addTableHeader(tableID,self.lci.getColumnDescription(self.getPlotNtuple(plot),yName))
00596     if zName == 'Error':
00597       self.report.addTableHeader(tableID,limitDesc+' sigma')
00598     else:
00599       self.report.addTableHeader(tableID,limitDesc)
00600     for binIndex in range(len(failList)):
00601       self.report.beginTableRow(tableID)
00602       entry = failList[binIndex]
00603       if xName == 'chanindex':
00604         self.report.addTableData('%s (Channel %d)'%(self.lci.getChanIndexDescription(self.getPlotNtuple(plot),entry[0]),entry[0]))
00605       else:
00606         self.report.addTableData('%0.1f'%(entry[0]))
00607       if yName is not None:
00608         if yName == 'chanindex':
00609           self.report.addTableData('%s (Channel %d)'%(self.lci.getChanIndexDescription(self.getPlotNtuple(plot),entry[1]),entry[1]))
00610         else:
00611           self.report.addTableData('%0.1f'%(entry[1]))
00612       # value compared depends on if its per event or not
00613       limitValueString = '%f'%(entry[2])
00614       if zName == 'Density' or zName == 'Entries / bin':
00615         if self.ntRequests[self.getPlotNtuple(plot)]<=0:
00616           if self.lci.nEvtSeen>0:
00617             limitValueString = '%f'%(entry[2]/self.lci.nEvtSeen)
00618           else:
00619             limitValueString = '0.0'
00620       self.report.addTableData(limitValueString)
00621
00622   def capturePlot(self,plot):
00623     plotFileName = plot+"_"+self.dataType+ "_" + self.getRunId() + ".png"
00624     plotFileFull = os.path.join(self.reportPath,plotFileName)
00625     self.canvas.saveAsImage(self.histDict[plot], plotFileFull)
00626     self.addExportedFile(plotFileFull, delete=True)
00627     return plotFileName
00628
00629   def startReport(self):
00630     self.report = standardTestReport()
00631     self.summarySection = None
00632     self.firstBodySection = None
00633     self.reportedPlots = []
00634
00635   def writeReport(self, reportFileName):
00636     # write out plots and report on noticed anomalies
00637     if self.gui is not None:
00638       testInfoSection = self.report.writeTestInformation(Operator = self.gui.preferences()["operator"],
00639                                                          Site     = self.gui.preferences()["lastsite"],
00640                                                          TestName = self.getName(),
00641                                                          runId    = self.getRunId(),
00642                                                          Device   = self.gui.preferences()["lastinstrumenttype"],
00643                                                          Phase    = self.gui.preferences()["lastphase"],
00644                                                          Status   = self.getCompletionStatusStr() )
00645     else:
00646       testInfoSection = self.report.writeTestInformation(TestName = self.getName(),
00647                                                          runId    = self.getRunId(),
00648                                                          Status   = self.getCompletionStatusStr() )
00649     if self.firstBodySection is not None:
00650       self.report.insertSection(testInfoSection,self.firstBodySection)
00651       if self.summarySection is not None:
00652         self.report.insertSection(self.summarySection,self.firstBodySection)
00653     else:
00654       self.report.insertSection(testInfoSection)
00655       if self.summarySection is not None:
00656         self.report.insertSection(self.summarySection)
00657     import os
00658     self.report.closeTestReport(reportFileName)
00659     self.addExportedFile(reportFileName,delete = True)
00660
00661   def reportPlots(self):
00662     if len(self.reportedPlots)>0:
00663       sectionString = 'Additional %s Data Plots'%(self.dataType)
00664     else:
00665       sectionString = '%s Data Plots'%(self.dataType)
00666     sectionID = self.report.addSection(sectionString)
00667     if self.firstBodySection is None:
00668       self.firstBodySection = sectionID
00669     for plot in self.histDict:
00670       if not (plot,self.dataType) in self.reportedPlots:
00671         itemStartString = 'Plot:'
00672         self.reportPlotItem(sectionID,plot,itemStartString)
00673
00674 class standardTestReport(rcTestReport):
00675   """
00676   This class provide a standard Test Report HTML file
00677   for plotter results.
00678   """
00679   def __init__(self):
00680     "Init the TestReport and Write Heading"
00681     rcTestReport.__init__(self)
00682     rcTestReport.initReport(self,title='Plotter Report')
00683     rcTestReport.addHTML(self,"""
00684     <STYLE TYPE="text/css">
00685     H1 { font-size: x-large; color: blue }
00686     H2 { font-size: large; color: blue }
00687     H3 { font-size: medium; color: blue }
00688     </STYLE>
00689     """)
00690     rcTestReport.addHeading(self,'GLAST LAT Integration and Test')
00691     rcTestReport.addHeading(self,'Test Report')
00692
00693   def writeTestInformation(self, runId, TestName=None, Operator=None, Site=None, Device=None, Phase=None, Status=None):
00694     """Write standard information about test routine.
00695
00696       \param
00697          Operator  : name of the operator who perform the test
00698       \param
00699          Site      : test site
00700       \param
00701          TestName  : test name
00702       \param
00703          runID     : run ID given by RunControl
00704       \param
00705          Device    : device under test (i.e. MCM, tray, stack, tower)
00706     """
00707     infoPage = rcTestReport.addSection(self, 'Test identification',insert=0)
00708     rcTestReport.addSectionItem(self, infoPage, 'Date', time.asctime() )
00709     rcTestReport.addSectionItem(self, infoPage, 'Run ID', runId)
00710     rcTestReport.addSectionItem(self, infoPage, 'Application', TestName )
00711     if Site is not None:
00712       rcTestReport.addSectionItem(self, infoPage, 'Site', Site, )
00713     if Operator is not None:
00714       rcTestReport.addSectionItem(self, infoPage, 'Operator', Operator, )
00715     if Device is not None:
00716       rcTestReport.addSectionItem(self, infoPage, 'Instrument Type', Device )
00717     if Phase is not None:
00718       rcTestReport.addSectionItem(self, infoPage, 'Phase', Phase )
00719     if Status is not None:
00720       rcTestReport.addSectionItem(self, infoPage, 'Status', self.statusString(Status) )
00721     return infoPage
00722
00723   def statusString(self, status):
00724     """Write test status (Passed/Failed or Aborted) in the report
00725       \param
00726          status  : Test status ('Passed', 'Failed' or 'Aborted' if script is stopped before end).
00727     """
00728     if status.upper() == 'PASSED':
00729       string = self.getColorText('Passed', 'green', Bold=True)
00730     elif status.upper() == 'PASSED_CONDITIONALLY':
00731       string = self.getColorText('Passed Conditionally', 'yellow', Bold=True)
00732     elif status.upper() == 'FAILED':
00733       string = self.getColorText('Failed', 'red', Bold=True)
00734     elif status.upper() == 'ABORTED':
00735       string = self.getColorText('Aborted', 'yellow', Bold=True)
00736     elif status.upper() == 'UNDEFINED':
00737       string = self.getColorText('Undefined', 'yellow', Bold=True)
00738     elif status.upper() == 'INSUFFICIENT':
00739       string = self.getColorText('Insufficient Data', 'yellow', Bold=True)
00740     else:
00741       myLog.warn("%s is an invalid status in statusString" % (status))
00742       return
00743     return string
00744
00745   def getColorText(self, Text, Color='black', Bold=False):
00746     ColorTable = { 'red'   : '#FF0000',
00747                    'green' : '#33CC33',
00748                    'yellow': '#FFAA33',
00749                    'black' : '#000000'
00750                   }
00751     if ColorTable.has_key(Color):
00752       Color = ColorTable[Color]
00753     string = '<font color ="' + Color + '">' + Text + '</font>'
00754     if Bold:
00755       string = '<b>' + string + '</b>'
00756     return string
00757
00758   def closeTestReport(self, FileName):
00759     "Close the HTML file and save it"
00760     rcTestReport.transformToFile(self, os.environ.get('ONLINE_ROOT') + "/LATTE/consumer/reportStyle.xsl", FileName)
00761
00762
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: standardPlotterGuiImpl.py Source File

consumer

standardPlotterGuiImpl.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Standard Plotter Gui Implementation"
00012 __author__   = "Lester Miller <lmiller@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/13/04"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018 from LATTE.consumer.standardPlotterGui import standardPlotterGui
00019 from qt import *
00020 import os
00021
00022 class standardPlotterGuiImpl(standardPlotterGui):
00023
00024   def __init__(self,parent = None,name = None,modal = 0,fl = 0):
00025     standardPlotterGui.__init__(self,parent,name,modal,fl)
00026
00027     self.lat = None
00028     self.params = None
00029     self.connect(self.buttonOk,SIGNAL("clicked()"),self.OKButtonClicked)
00030     self.connect(self.buttonCancel,SIGNAL("clicked()"),self.CancelButtonClicked)
00031     self.connect(self.buttonBrowse,SIGNAL("clicked()"),self.configFileBrowser)
00032
00033   def OKButtonClicked(self):
00034     self.fileName = self.cfgFile.text().latin1()
00035     self.close()
00036
00037   def getConfigFile(self,fileName):
00038     if fileName is not None:
00039       self.cfgFile.setText(QString(fileName))
00040     self.fileName = fileName
00041     self.show()
00042     self.exec_loop()
00043     return self.fileName
00044
00045   def CancelButtonClicked(self):
00046     self.fileName = None
00047     self.close()
00048
00049   def configFileBrowser(self):
00050     try:
00051       (filepath,filename) = os.path.split(self.fileName)
00052     except:
00053       filepath = os.getcwd()
00054       filename = ''
00055     fnPath = QString(filepath)
00056     fn = QFileDialog.getOpenFileName(fnPath, '*.cfg', self,"Configuration File Browser", "Choose configuration file")
00057     if fn.isEmpty():
00058       return
00059     filename = str(fn)
00060     self.cfgFile.setText(QString(filename))
00061
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: startupGUI.py Source File

start

startupGUI.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Online main program"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/12/2002"
00014 __version__  = "$Revision: 1.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import sys, threading
00020 from qt import *
00021 from sihippo import *
00022
00023 from LATTE.runcontrol.RunControlCommon import RunControlCommon
00024 from LATTE.runcontrol.RunControl       import RunControl
00025
00026 def startup():
00027   # Start up run control
00028
00029   rcCommon = RunControlCommon()
00030
00031   app    = QApplication(sys.argv)
00032   QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
00033
00034   rcCommon.initialize()
00035   rcCommon.EBFdistribution()
00036
00037   runCtl = RunControl(rcCommon)
00038   runCtl.connectClicked()
00039   app.setMainWidget(runCtl)
00040   runCtl.show()
00041
00042   WindowController.instance().createInspector()
00043   canvas = CanvasWindow()
00044   canvas.show()
00045   ntc = NTupleController.instance()
00046   nt  = ntc.createNTuple()
00047   nt.setLabels(['Event Size'])
00048   nt.setTitle('Event Size')
00049   nt.setIntervalCount ( 1000000 )
00050   nt.setIntervalEnabled(1)
00051
00052   DBN = rcCommon.getDBN()
00053   DBN['_canvas']          = canvas
00054   DBN['_event_size']      = 0
00055   DBN['_EventSizeNTuple'] = nt
00056   DBN['_prefs']           = rcCommon.prefMan().preferences()
00057
00058   threading.currentThread().setName("LATTE_GUI")
00059   app.exec_loop()
00060
00061
00062 if __name__ == '__main__':
00063   startup()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: startupMainGUI.py Source File

start

startupMainGUI.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Main GUI startup code"
00013 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/27 22:28:22 $").split(' ')[1]
00015 __version__  = "$Revision: 2.8 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import os, threading
00022 from qt import *
00023 from sihippo import CanvasWindow, NTupleController, WindowController
00024
00025 from LATTE.runcontrol.RunControlCommon import RunControlCommon
00026 from LATTE.runcontrol.RunControlMain   import RunControlMain
00027
00028 def startupMainGui():
00029   """Start up run control."""
00030
00031   #Declare DBN as global so that we can access it from the Python Shell
00032   global DBN
00033
00034   rcCommon = RunControlCommon()
00035
00036   app = QApplication([])
00037   QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
00038   app.setLibraryPaths(QStringList(os.path.join(os.environ['ONLINE_ROOT'], 'LATTE/ext/plugins')))
00039
00040   rcCommon.initialize()
00041   rcCommon.startLogger()
00042   rcCommon.EBFdistribution()
00043
00044   initstyle(rcCommon)
00045   runCtl = RunControlMain(rcCommon)
00046   runCtl.connectClicked()
00047   app.setMainWidget(runCtl)
00048   runCtl.show()
00049
00050   if rcCommon.options().securedir is not None:
00051     login = runCtl.login()
00052     if login == None or login == -2:
00053       app.quit()
00054       return
00055   else:
00056     runCtl.fileLogoutAction.setEnabled(0)
00057
00058   if rcCommon.options().schema is None:
00059     runCtl.loadSchema()
00060
00061   WindowController.instance().createInspector()
00062   canvas = CanvasWindow()
00063   ntc = NTupleController.instance()
00064   nt  = ntc.createNTuple()
00065   nt.setLabels(['Event Size'])
00066   nt.setTitle('Event Size')
00067   nt.setIntervalCount(1000000)
00068   nt.setIntervalEnabled(1)
00069
00070   DBN = rcCommon.getDBN()
00071   DBN['_canvas'] = canvas
00072   DBN['_event_size'] = 0
00073   DBN['_EventSizeNTuple'] = nt
00074   DBN['_prefs'] = rcCommon.prefMan().preferences()
00075
00076   threading.currentThread().setName("LATTE_GUI")
00077   app.exec_loop()
00078
00079 def initstyle(rcCommon):
00080   prefs = rcCommon.prefMan().preferences()
00081   if prefs.has_key('style'):
00082     style = prefs['style']
00083     if style in QStyleFactory.keys():
00084       qApp.setStyle(QStyleFactory.create(style))
00085   font = QApplication.font()
00086   if prefs.has_key('fontfamily'):
00087     font.setFamily(prefs['fontfamily'])
00088   if prefs.has_key('fontsize'):
00089     font.setPointSize(int(prefs['fontsize']))
00090   if prefs.has_key('fontweight'):
00091     font.setWeight(int(prefs['fontweight']))
00092   if prefs.has_key('fontitalic'):
00093     font.setItalic(int(prefs['fontitalic']))
00094   qApp.setFont(font)
00095
00096 if __name__ == '__main__':
00097   startupMainGui()
Generated on Fri Jan 21 18:00:52 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: taskEngine.py Source File

tools

taskEngine.py

00001 #!/usr/bin/env python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Task Engine class"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "1/21/2004"
00014 __version__  = "$Revision: 2.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 from   Queue         import Queue
00020 from   threading     import Thread, currentThread
00021 import logging       as     log
00022
00023
00024 class TaskEngine(Thread):
00025   """A class for setting up and queueing tasks to a task engine.
00026
00027   A task engine is a thread that polls a task queue and runs tasks found on
00028   the queue.  Tasks are functions or class methods accompanied with their
00029   arguments and keyword arguments.  Each task must run to completion before
00030   the next task is pulled from the queue.  Returning a return value from the
00031   task to the caller is currently not supported (easy to add, if the need
00032   arises).  The queue is a FIFO queue and there is currently no way to jam
00033   a task to the head of the queue.
00034   """
00035   def __init__(self, name = None):
00036     Thread.__init__(self)
00037
00038     if name is None:
00039       name = self.__class__.__name__
00040     self.__name  = name
00041     self.__queue = Queue()
00042
00043   def name(self):
00044     """\brief Method for querying the task engine's name
00045
00046     \return The task engine's name
00047     """
00048     return self.__name
00049
00050   def spawn(self, task, *args, **kwargs):
00051     """\brief Method used to queue a task to the task engine.
00052
00053     \param task    The task routine to queue
00054     \param args    The arguments for the task routine
00055     \param kwargs  The keyword arguments for the task routine
00056     """
00057     assert self.__queue is not None, (self.name + ".spawn: " + \
00058                                       "TaskEngine.__init__() was not called")
00059     self.__queue.put((task,) + args + (kwargs,))
00060
00061   def run(self):
00062     """\brief The task engine main routine.
00063
00064     This method is invoked by the Thread class and should be considered
00065     'protected'.  Do not call it.
00066     """
00067     self.setName(self.name())
00068
00069     while True:
00070       taskArgsKwargs = self.__queue.get(True) # Blocks
00071       if taskArgsKwargs[0] is None:  break    # Quit signal is None
00072
00073       try:
00074         taskArgsKwargs[0](*taskArgsKwargs[1:-1], **taskArgsKwargs[-1])
00075       except:
00076         import types
00077         if isinstance(taskArgsKwargs[0], types.MethodType):
00078           log.exception(self.name()                               + \
00079                         ": Trapped exception from spawned task "  + \
00080                         taskArgsKwargs[0].im_class.__name__ + '.' + \
00081                         taskArgsKwargs[0].__name__ + '()')
00082         else:
00083           log.exception(self.name()                               + \
00084                         ": Trapped exception from spawned task "  + \
00085                         taskArgsKwargs[0].__name__ + '()')
00086
00087       # Drop references to this object to allow it to be garbage collected
00088       taskArgsKwargs = None
00089
00090     log.info(self.name() + ": terminating")
00091
00092   def shutdown(self, tmo = 2.0):
00093     """\brief Method for shutting down the task engine
00094
00095     This method blocks (with a timeout) until the task engine has exited.
00096     It makes no sense to spawn this method to the task engine since it waits
00097     for the task engine to exit.
00098
00099     \param tmo  The amount of time (seconds) to wait for the task engine to exit
00100     \return  0 for success,
00101            -1 if the task engine didn't exit,
00102            -2 if the task engine exited prematurely
00103     """
00104     # This method can not be called from the taskEngine thread on purpose.
00105     # If it could, there would be no way for the instigator to synchronize.
00106     if currentThread() is self:
00107       raise RuntimeError, "A task engine can't be shut down by its own thread"
00108     if self.isAlive():                  # Thread still there or did it crash?
00109       self.spawn(None)                  # Signal to quit
00110       self.join(tmo)                    # Let engine exit
00111       if self.isAlive():                # Timed out?
00112         log.error(self.name() + ".shutdown: " + \
00113                   "Task engine did not exit when expected")
00114         return -1
00115     else:
00116       log.warn(self.name() + ":.shutdown: " + \
00117                "Task engine unexpectedly disappeared")
00118       return -2
00119
00120     return 0
00121
00122
00123 #-------------------------------------------------------------------------------
00124 # Unit testing follows:
00125
00126 if __debug__ and __name__ == '__main__':
00127   import unittest
00128   import time
00129
00130   results = [None, None, None, None, None, None]
00131   status  = None
00132
00133   class TaskEngineTestCase(unittest.TestCase):
00134     def __init__(self, arg):
00135       unittest.TestCase.__init__(self, arg)
00136
00137     def checkInstantiation(self):
00138       """Test class instantiation"""
00139       engine = None
00140       engine = TaskEngine("TestEngine")
00141       assert engine != None, "Could not instantiate a TaskEngine"
00142
00143     def checkStartup(self):
00144       """Test whether the thread starts up"""
00145       engine = TaskEngine("TestEngine")
00146       engine.start()
00147       time.sleep(0.1)                   # Let it start
00148       assert engine.isAlive(), "Could not start TaskEngine"
00149       engine.shutdown()
00150       time.sleep(.1)
00151
00152     def __task_1(self, a, b, c, x, y, z):
00153       self.__a = a
00154       self.__b = b
00155       self.__c = c
00156       self.__x = x
00157       self.__y = y
00158       self.__z = z
00159
00160     def checkSpawn(self):
00161       """
00162       Test whether we can spawn a class method task to the engine and
00163       have the arguments handled correctly
00164       """
00165       self.__a = None
00166       self.__b = None
00167       self.__c = None
00168       self.__x = None
00169       self.__y = None
00170       self.__z = None
00171
00172       a = "Hello world"
00173       b = 3.1415926
00174       c = 0xabadcafeL
00175       engine = TaskEngine("TestEngine")
00176       engine.start()
00177       time.sleep(0.1)                   # Let it start
00178       engine.spawn(self.__task_1, a, b, c, z = a, x = b, y = c)
00179       time.sleep(0.1)                   # Let it run
00180       assert engine.isAlive(), "TaskEngine prematurely disappeared"
00181       assert self.__a is a, "TaskEngine did not correctly handle args[0]"
00182       assert self.__b is b, "TaskEngine did not correctly handle args[1]"
00183       assert self.__c is c, "TaskEngine did not correctly handle args[2]"
00184       assert self.__x is b, "TaskEngine did not correctly handle kwargs[0]"
00185       assert self.__y is c, "TaskEngine did not correctly handle kwargs[1]"
00186       assert self.__z is a, "TaskEngine did not correctly handle kwargs[2]"
00187       engine.shutdown()
00188       time.sleep(.1)
00189
00190     def checkUnboundSpawn(self):
00191       """
00192       Test whether we can spawn an unbound function task to the engine and
00193       have the arguments handled correctly
00194       """
00195       a = "Test of an unbound function"
00196       b = 2.718281828
00197       c = 0xdeadbeefL
00198
00199       engine = TaskEngine("TestEngine")
00200       engine.start()
00201       time.sleep(0.1)                   # Let it start
00202       engine.spawn(_unbound1, a, b, c, y = a, z = b, x = c)
00203       time.sleep(0.1)                   # Let it run
00204       assert engine.isAlive(), "TaskEngine prematurely disappeared"
00205       assert results[0] is a, "TaskEngine did not correctly handle args[0]"
00206       assert results[1] is b, "TaskEngine did not correctly handle args[1]"
00207       assert results[2] is c, "TaskEngine did not correctly handle args[2]"
00208       assert results[3] is c, "TaskEngine did not correctly handle kwargs[0]"
00209       assert results[4] is a, "TaskEngine did not correctly handle kwargs[1]"
00210       assert results[5] is b, "TaskEngine did not correctly handle kwargs[2]"
00211       engine.shutdown()
00212       time.sleep(.1)
00213
00214     def __doException(self):  # 2nd level to give traceback some depth
00215       raise RuntimeError, "Raising RuntimeError to test exception handling"
00216       return True
00217
00218     def __task_2(self):
00219       self.__status = False
00220       self.__status = self.__doException()
00221
00222     def checkException1(self):
00223       """
00224       Test that the engine doesn't die if a class method task throws an
00225       exception
00226       """
00227       print ""
00228       print "##############################################################################"
00229       print "#                                                                            #"
00230       print "#  This test should cause a 'Trapped exception from spawned task' exception  #"
00231       print "#                                                                            #"
00232       print "##############################################################################"
00233       engine = TaskEngine("TestEngine")
00234       engine.start()
00235       time.sleep(0.1)                   # Let it start
00236       engine.spawn(self.__task_2)
00237       time.sleep(0.1)                   # Let it run
00238       assert engine.isAlive(), "TaskEngine died from exception"
00239       assert self.__status == False, "Exception didn't abort task as expected"
00240       engine.shutdown()
00241       time.sleep(.1)
00242
00243     def checkException2(self):
00244       """
00245       Test that the engine doesn't die if an unbound function task throws an
00246       exception
00247       """
00248       print ""     # Expecting an exception: add space for readability
00249       print "##############################################################################"
00250       print "#                                                                            #"
00251       print "#  This test should cause a 'Trapped exception from spawned task' exception  #"
00252       print "#                                                                            #"
00253       print "##############################################################################"
00254       engine = TaskEngine("TestEngine")
00255       engine.start()
00256       time.sleep(0.1)                   # Let it start
00257       engine.spawn(_unbound2)
00258       time.sleep(0.1)                   # Let it run
00259       assert engine.isAlive(), "TaskEngine died from exception"
00260       assert status == False, "Exception didn't abort task as expected"
00261       engine.shutdown()
00262       time.sleep(.1)
00263
00264     def checkSelfShutdown(self):
00265       """Test that attempts to shut down an engine via a task fails"""
00266       print ""     # Expecting an exception: add space for readability
00267       print "##############################################################################"
00268       print "#                                                                            #"
00269       print "#  This test should cause a 'Trapped exception from spawned task' exception  #"
00270       print "#                                                                            #"
00271       print "##############################################################################"
00272       engine = TaskEngine("TestEngine")
00273       engine.start()
00274       time.sleep(0.1)                   # Let it start
00275       engine.spawn(engine.shutdown)
00276       time.sleep(0.1)                   # Let it run
00277       assert engine.isAlive(), "TaskEngine died from exception"
00278       engine.shutdown()
00279       time.sleep(.1)
00280
00281     def checkShutdown1(self):
00282       """
00283       Test that attempting to shut down an engine from an unrelated thread
00284       succeeds
00285       """
00286       engine = TaskEngine("TestEngine")
00287       engine.start()
00288       time.sleep(0.1)                   # Let it start
00289       status = engine.shutdown()
00290       time.sleep(0.1)                   # Let it shut down
00291       assert not engine.isAlive(), "TaskEngine didn't shut down"
00292       assert status == 0, "Bad status %d returned from shutdown()" % (status)
00293
00294     def checkShutdown2(self):
00295       """Test that attempts to shut down an engine that wasn't started fails"""
00296       print ""
00297       print "#############################################################################"
00298       print "#                                                                           #"
00299       print "#  This test should cause a 'Task engine unexpectedly disappeared' warning  #"
00300       print "#                                                                           #"
00301       print "#############################################################################"
00302       engine = TaskEngine("TestEngine")
00303       status = engine.shutdown()
00304       assert status != 0, "TaskEngine didn't shut down as expected"
00305
00306   def _unbound1(a, b, c, x, y, z):
00307     results[0] = a
00308     results[1] = b
00309     results[2] = c
00310     results[3] = x
00311     results[4] = y
00312     results[5] = z
00313
00314   def _doException():
00315     raise RuntimeError, "Raising RuntimeError to test exception handling"
00316     return True
00317
00318   def _unbound2():
00319     global status
00320     status = False
00321     status = _doException()
00322
00323   def suite():
00324     loader = unittest.TestLoader()
00325     testSuite = loader.loadTestsFromNames(
00326       ["checkInstantiation", "checkStartup", "checkSpawn", "checkUnboundSpawn",
00327        "checkException1", "checkException2", "checkSelfShutdown",
00328        "checkShutdown1", "checkShutdown2"], TaskEngineTestCase)
00329     return testSuite
00330
00331   def test():
00332     print "########################################################"
00333     print "#                                                      #"
00334     print "#  Exceptions are expected from this test.  These can  #"
00335     print "#  be ignored if the test completes with status 'OK'   #"
00336     print "#                                                      #"
00337     print "########################################################"
00338     print ""
00339
00340     # Initialize logging
00341     log.basicConfig()
00342
00343     runner = unittest.TextTestRunner()
00344     runner.run(suite())
00345
00346     # Shut down the logger
00347     log.shutdown()
00348
00349   # Now run the tests
00350   test()
00351
00352
00353 #-------------------------------------------------------------------------------
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_aem.py Source File

tests

test_aem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "AEM test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:55 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gAEM as gAEM
00024
00025 def test_aem():
00026   options = gOptions.Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = gCmdCli.CmdCli()
00033   aem = gAEM.GAEM(cmdcli, None)
00034
00035   cmdcli.connect(options.server)
00036
00037   rdvalue = aem.trgseq
00038   print "aem.trgseq returned 0x%x" %(rdvalue)
00039
00040   aem.cmd_reset = 1
00041   print "aem.trgseq reset done"
00042
00043   rdvalue = aem.trgseq
00044   print "aem.trgseq returned 0x%x" %(rdvalue)
00045
00046   cmdcli.disconnect()
00047
00048 if __name__ == '__main__':
00049   test_aem()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_aeq.py Source File

tests

test_aeq.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "AEM environmental quantity test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:55 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gAEM as gAEM
00024
00025 def test_aeq():
00026   options = gOptions.Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = gCmdCli.CmdCli()
00033   aeq = gAEM.GAEQ(cmdcli, None)
00034
00035   cmdcli.connect(options.server)
00036
00037   aeq.env_free_1LA = 0
00038   print "aeq.env_free_1LA set"
00039
00040   rdvalue = aeq.env_free_1LA
00041   print "aeq.env_free_1LA returned 0x%x" %(rdvalue)
00042
00043   cmdcli.disconnect()
00044
00045 if __name__ == '__main__':
00046   test_aeq()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_cmd.py Source File

tests

test_cmd.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for commanding
00011 Contents:
00012 Sample script for testing write command throughput
00013 """
00014 __facility__ = "Online"
00015 __abstract__ = "Test script for testing write command throughput"
00016 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00017 __date__     = ("$Date: 2004/08/27 03:05:03 $").split(' ')[1]
00018 __version__  = "$Revision: 2.1 $"
00019 __release__  = "$Name: P04-06-05 $"
00020 __credits__  = "SLAC"
00021
00022 import LATTE.copyright_SLAC
00023
00024 from LATTE.client.gOptions import Options
00025 from LATTE.client.gCmdCli import CmdCli
00026 from LATTE.database.gLAT import GLAT
00027
00028 import os
00029 import time
00030
00031
00032 def test(cmd=None, disconnectOnExit=True):
00033   global tem, glt
00034
00035   options = Options(['server', 'schema'])
00036   try:
00037     options.parse()
00038   except Exception, msg:
00039     options.usage(str(msg))
00040     return
00041
00042   if cmd == None:
00043     cmd = CmdCli()
00044     cmd.connect(options.server)
00045
00046   lat = GLAT(cmd)
00047
00048   lat.readSchema(options.schema)
00049
00050   tem = lat.downTEM(0)
00051
00052   cnt = 10000
00053   start = time.time()
00054   for i in xrange(cnt):
00055     tem.COMMAND_RESPONSE = 1234            # clear TEM stats reg
00056     #cmd.gTEMload(0, 3, 1234)  # ~18500 writes/second
00057     #if i % 1000 == 0: print i
00058   end = time.time()
00059   et = end-start
00060   if et == 0: et = 0.000001
00061   print "Finished in %f seconds (%.1f write commands/second)" %(et, (cnt/et))
00062
00063   if disconnectOnExit:
00064     cmd.disconnect()
00065
00066 if __name__ == '__main__':
00067   test()
00068
00069 # RiC 6/16/04: Measured 10298 +/- ~150 writes/sec on D600 laptop (1.7 GHz,
00070 #              600 MHz bus, 1 GB) in local mode with prints commented out,
00071 #              without cmdRelayer.
00072 # RiC 6/17/04: Measured 5841 +- ~50 writes/sec on same setup as above but with
00073 #              SocketServer based cmdRelayer.
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_cmdrsp.py Source File

tests

test_cmdrsp.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Command/Response test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:55 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.client.gOptions import Options
00022 from LATTE.client.gCmdCli import CmdCli
00023 from LATTE.client.gNode import Node
00024
00025 def test_cmdrsp():
00026   options = Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032
00033   cmdcli = CmdCli()
00034   node = Node(cmdcli)
00035
00036   cmdcli.connect(options.opts['server'])
00037   response = node.cmdrsp('AEM_CC_read_sync', 'slh', 'LADR_AEM', 0, '!I')
00038   print "status is 0x%x value is 0x%x" \
00039         %(response.status(), response.payloads()[0])
00040   cmdcli.disconnect()
00041
00042 if __name__ == '__main__':
00043   test_cmdrsp()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_db.py Source File

tests

test_db.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for commanding
00011 Contents:
00012 Sample script for testing commanding throughput
00013 """
00014 __facility__ = "Online"
00015 __abstract__ = "GLAST Test command database"
00016 __author__   = "Ric Claus <claus@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00017 __date__     = "Sun Aug 08 18:14:33 2004"
00018 __version__  = "$Revision: 1.5 $"
00019 __release__  = "$Name: P04-06-05 $"
00020 __credits__  = "SLAC"
00021
00022 import LATTE.copyright_SLAC
00023
00024 import struct
00025 import time
00026 import gc
00027 from   LATTE.client.gOptions   import Options
00028 from   LATTE.client.gCmdCli    import CmdCli
00029 import LATTE.database.gDb      as gDb
00030 import LATTE.database.gAttr    as gAttr
00031 import LATTE.client.gRegister  as gRegister
00032 import LATTE.client.gException as gException
00033
00034 class GTest(gDb.Gdb):
00035   """
00036   """
00037
00038   __attrs = [
00039     gAttr.GattrRaw('raw', 0, 4),
00040     gAttr.GattrReg('reg', 1, 4),
00041     gAttr.GattrDlc('dlc', 2),
00042     gAttr.GattrBF('bf1', 0,  0,  4),
00043     gAttr.GattrBF('bf2', 0,  4,  8),
00044     gAttr.GattrBF('bf3', 0,  8, 12),
00045     gAttr.GattrBF('bf4', 0, 12, 16),
00046     ]
00047
00048   def __init__(self, client):
00049     """
00050     """
00051     gDb.Gdb.__init__(self, client, None, 0, self.__attrs)
00052
00053   def read(self, reg):
00054     return self.cmdrsp('TEM_CC_read_sync', 'slh', self.addr(), reg, '!I')
00055
00056   def load(self, reg, value):
00057     return self.cmdrsp('TEM_CC_load_sync', 'slh', self.addr(), reg, value)
00058
00059   def send(self, cmd):
00060     return self.cmdrsp('TEM_CC_cmd_sync', 'slh', self.addr(), cmd)
00061
00062
00063 def test(cmd=None, disconnectOnExit=True):
00064   global tst, cmdCli
00065
00066   options = Options(['server'])
00067   try:
00068     options.parse()
00069   except Exception, msg:
00070     options.usage(str(msg))
00071     return
00072
00073   if cmd == None:
00074     cmd = CmdCli()
00075     cmd.connect(options.server)
00076
00077   tst = GTest(cmd)
00078
00079   # The following rates were measured on a D600 laptop (1.7 GHz, 600 MHz bus,
00080   # 1 GB memory) in local mode with prints commented out
00081   # 2nd rate column is for optimized set/getattr in which lower is called once
00082   cmdStrs = [                                             #   Hz
00083     "cmd.cmdrsp('TEM_CC_load_sync', 'slh', 0, 3, 4567L)", # Garbage - Why? GC?
00084     "cmd.cmdrsp('TEM_CC_load_sync', 'slh', 0, 3, 4567L)", # 11098.8 10858
00085     "tst.cmdrsp('TEM_CC_load_sync', 'slh', 0, 3, 7654L)", # 10741.1 10515
00086     "tst.dlc = 1",                                        #  9242.1  9606
00087     "tst.dlc",                                            #  9416.2  9506
00088     "tst.raw = 1234",                                     #  9000.9  9416
00089     "tst.raw",                                            #  8605.9  8764
00090     "tst.reg = 4321",                                     #  8841.7  9158
00091     "tst.reg",                                            #  8460.2  8532
00092     "tst.bf4",                                            #  8460.2  8613
00093     "tst.bf4 = 5",                                        #  4560.0  4645
00094     "tst.regs['reg'].set(3145)" ,                         #  9242.1  9328
00095     "tst.regs['reg'].set(9876, 1)",                       #  9425.1  9606
00096     "tst.regs['REG'].set(3145)" ,                         #  9157.5
00097     "tst.regs['REG'].set(9876, 1)",                       #  9425.1
00098     "tst.regs['reg'].get()" ,                             #  8680.6
00099     "tst.regs['reg'].get(1)",                             #  8841.7
00100     "tst.regs['REG'].get()" ,                             #  8605.9
00101     "tst.regs['REG'].get(1)",                             #  8833.9
00102     "tst.regs['reg'].set(3145, 0, tst)" ,                 #  9337.1  9328
00103     "tst.regs['reg'].set(9876, 1, tst)",                  #  9505.7  9606
00104     "tst.regs['REG'].set(3145, 0, tst)" ,                 #  9250.7
00105     "tst.regs['REG'].set(9876, 1, tst)",                  #  9416.2
00106     "tst.regs['reg'].get(0, tst)" ,                       #  8680.6
00107     "tst.regs['reg'].get(1, tst)",                        #  8841.7
00108     "tst.regs['REG'].get(0, tst)" ,                       #  8680.6
00109     "tst.regs['REG'].get(1, tst)",                        #  8833.9
00110     #"cmd.gTEMload(0, 3, 1234)",                           # ~18500 writes/sec
00111     ]
00112
00113   commands = []
00114   for cmdStr in cmdStrs:
00115     commands.append((cmdStr, compile(cmdStr, '', 'exec')))
00116
00117   cnt = 10000
00118   for cmdTuple in commands:
00119     command = cmdTuple[1]
00120     print 23*' ', cmdTuple[0],
00121     gc.collect()
00122     start = time.time()
00123     for i in xrange(cnt):
00124       exec(command)
00125     end = time.time()
00126     et = end-start
00127     if et == 0: et = 0.000001
00128     rate = cnt/et
00129     print "\r%4.2f sec (%7.1f Hz)   %s" % (et, rate, cmdTuple[0])
00130
00131   if disconnectOnExit:
00132     cmd.disconnect()
00133   else:
00134     cmdCli = cmd
00135
00136 if __name__ == '__main__':
00137   test()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_aem.py Source File

tests

test_evt_aem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for taking AEM events
00011 """
00012 __facility__ = "Online"
00013 __abstract__ = "Test script for AEM"
00014 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00015 __date__     = ("$Date: 2004/08/26 20:46:36 $").split(' ')[1]
00016 __version__  = "$Revision: 1.1 $"
00017 __release__  = "$Name: P04-06-05 $"
00018 __credits__  = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021
00022 from LATTE.client.gOptions import Options
00023 from LATTE.client.gCmdCli  import CmdCli
00024 from LATTE.database.gLAT   import GLAT
00025 from LATTE.client.gEvtCli  import EvtCli
00026
00027 from time import sleep
00028 import time
00029 import os
00030 import gc
00031
00032 from LATTE.tests.apps.support.SimpleGasuExample import *
00033
00034
00035 aem = None
00036 glt = None
00037
00038 def test(cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1):
00039   global aem, glt, ec
00040   gc.disable()
00041
00042   options = Options(['server', 'schema'], ['evtdebug'])
00043   try:
00044     options.parse()
00045   except Exception, msg:
00046     options.usage(str(msg))
00047     return
00048
00049   if cmd == None:
00050     cmd = CmdCli()
00051     cmd.connect(options.server)
00052   lat = GLAT(cmd)
00053   lat.readSchema(options.schema)
00054
00055   trigger = SimpleGasuExample()
00056   trigger.GEM(lat.GEM)
00057   trigger.commit()
00058
00059   aem = lat.downAEM()
00060
00061   arc0 = aem.downARC(11)
00062   arc0.cmd_reset = 1
00063
00064   # configure the AEM
00065   aem.configuration = 0x208ff
00066
00067   # The FREE-sim simulates 4 ADCs with fixed outputs of 1112, 1113, 1114, 1115 (decimal).
00068   # The FREE-sim simulates 4 ADCs with fixed outputs of 0x458, 0x459, 0x45a, 0x45b (hex).
00069   # adjust the PHA thresholds to turn these on/off.
00070
00071   # config all PHAs on
00072
00073   thresh_on  = 0x20
00074   thresh_off = 0xFFF
00075
00076   arc0.PHA_THRESHOLD_0  = thresh_on
00077   arc0.PHA_THRESHOLD_1  = thresh_on
00078   arc0.PHA_THRESHOLD_2  = thresh_on
00079   arc0.PHA_THRESHOLD_3  = thresh_on
00080   arc0.PHA_THRESHOLD_4  = thresh_on
00081   arc0.PHA_THRESHOLD_5  = thresh_on
00082   arc0.PHA_THRESHOLD_6  = thresh_on
00083   arc0.PHA_THRESHOLD_7  = thresh_on
00084   arc0.PHA_THRESHOLD_8  = thresh_on
00085   arc0.PHA_THRESHOLD_9  = thresh_on
00086   arc0.PHA_THRESHOLD_10 = thresh_on
00087   arc0.PHA_THRESHOLD_11 = thresh_on
00088   arc0.PHA_THRESHOLD_12 = thresh_on
00089   arc0.PHA_THRESHOLD_13 = thresh_on
00090   arc0.PHA_THRESHOLD_14 = thresh_on
00091   arc0.PHA_THRESHOLD_15 = thresh_on
00092   arc0.PHA_THRESHOLD_16 = thresh_on
00093   arc0.PHA_THRESHOLD_17 = thresh_on
00094   arc0.veto_width      = 5
00095
00096   # set MAX_PHA
00097   arc0.MAX_PHA = 18
00098
00099   # set PHA ENABLE bits
00100   arc0.PHA_EN_0 = 0xffff
00101   arc0.PHA_EN_1 = 0x3
00102
00103   # set VETO ENABLE bits
00104   arc0.VETO_EN_0 = 0xffff
00105   arc0.VETO_EN_1 = 0x3
00106
00107   afeb = arc0.allAFE()
00108   afeb.CONFIGURATION = 0x0032
00109   afeb.VETO_DAC = 0x20
00110   afeb.HLD_DAC = 0x30
00111   afeb.TCI_DAC = 0x20
00112   afeb.bias_dac     = 3
00113
00114   aem.TRGSEQ = 0x5f
00115
00116   ec = EvtCli(options.evtdebug)
00117   ec.connect(options.server)
00118
00119   trigger.enable()
00120
00121   cnt=0
00122   start = time.time()
00123   for i in range(count):
00124     cnt+=1
00125     #glt.CMD_SELF_TRIGGER = 1
00126     trigger.solicit()
00127     ec.readEvent()
00128     if parse:
00129       if ec.setCurrentContribution(ec.AEM) != -1:
00130         ec.evDumpEventAEM()
00131         #~ #print ""
00132         #~ #ec.evDumpTKR()
00133         #~ ec.evDumpTEM_Error()
00134         #~ ec.evDumpDiagnostic()
00135         #~ for acc in ec.evt.CAL_LogAccepts:
00136           #~ print "CAL Log Accept: 0x%08x" % acc.ui
00137
00138         #~ for data in ec.evt.CAL_LogData:
00139           #~ print "CAL Log Data: 0x%08x" % data.ui
00140         #~ sum = ec.evt.summary
00141         #~ ec.evDumpSummary()
00142         #~ if cnt % 100 == 0: print cnt
00143         #~ sleep(0.000300)
00144         print "AEM Veto Hit Vectors:"
00145         j = 0
00146         for hitVect in ec.evt.aem.vetoHitVectors:
00147           print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00148           j+=1
00149         print "\nAEM Accept Hit Vectors:"
00150         j = 0
00151         for hitVect in ec.evt.aem.acceptHitVectors:
00152           print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00153           j+=1
00154         print "\nAEM PHA Values:"
00155         j = 0
00156         for (cbl, phas) in ec.evt.aem.PHA.items():
00157           for pha in phas:
00158             print "\tCable: %02d - PHA Value: 0x%04x" % (cbl, pha.ui)
00159   ec.disconnect()
00160
00161   if disconnectOnExit == 1:
00162     cmd.disconnect()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_cal.py Source File

tests

test_evt_cal.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for measuring event taking throughput.
00011 """
00012 __facility__ = "Online"
00013 __abstract__ = "Test script for CAL"
00014 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00015 __date__     = ("$Date: 2004/10/29 02:13:21 $").split(' ')[1]
00016 __version__  = "$Revision: 2.11 $"
00017 __release__  = "$Name: P04-06-05 $"
00018 __credits__  = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021
00022 from LATTE.client.gOptions import Options
00023 from LATTE.client.gCmdCli  import CmdCli
00024 from LATTE.client.gEvtCli  import EvtCli
00025 from LATTE.database.gLAT   import GLAT
00026 from LATTE.database.gGLT   import GGLT
00027
00028 from time import sleep
00029 import gc
00030 import os
00031 import time
00032 import logging as log
00033
00034 from LATTE.trigger.TrgUsingTiles      import TrgUsingTiles
00035 from LATTE.trigger.NullObjects        import NoInputsEnabled
00036 from LATTE.trigger.rcTrgFunctions     import rcTrgEngines
00037 from LATTE.trigger.TrgEngines         import *
00038 from LATTE.trigger.rcTrgMiniGLT       import rcTrgMiniGLT
00039 from LATTE.trigger.TrgMiniGLT         import MiniGLTTrgConditionsValue
00040
00041 from LATTE.tests.apps.support.SimpleGasuExample import *
00042
00043
00044 tem = None
00045
00046
00047 class MiniGLTExample(rcTrgMiniGLT):
00048   """\brief MiniTower example interface to MiniGLT
00049   """
00050   def __init__(self):
00051     """\brief AcdTriggerExample constructor
00052     """
00053     rcTrgMiniGLT.__init__(self)
00054     self.__engines      = MiniGLTTrgEngines()
00055     self.__conditions   = MiniGLTSolicitedCondition()
00056
00057   def engines(self):
00058     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00059     """
00060     return self.__engines
00061
00062   def conditions(self):
00063     """\brief Implementation of conditions 'pure virtual' method from TrgAbstract
00064     """
00065     return self.__conditions
00066
00067 # implementaions of user-level trigger classes
00068 class MiniGLTTrgEngines(rcTrgEngines):
00069   def __init__(self):
00070     rcTrgEngines.__init__(self)
00071     # There are two engines in the MiniGLT.
00072     # 0) User defined engine
00073     # 15) Marker engine
00074
00075     eng = MiniGLTSolicitedEngine()
00076     self.replaceEngine(0,eng)
00077
00078 class MiniGLTSolicitedEngine(TrgEngine):
00079   """This class defines an engine which reads out the detector
00080      whenever there is a solicited trigger.
00081      This engine is not prescaled.
00082   """
00083   def __init__(self):
00084     TrgEngine.__init__(self)
00085     self.__request = ZsupTrgInjectChargeReadout()
00086   def participate(self,conditionsValue):
00087     # This function relies on the programmer's knowledge that the
00088     # conditionsValue is a bitfield.
00089     cond = MiniGLTSolicitedCondition()
00090     condValue = cond.value()
00091     if conditionsValue & condValue:
00092       return True
00093     return False
00094   def prescale(self):
00095     return 0
00096   def request(self):
00097     return self.__request
00098
00099 class MiniGLTSolicitedCondition(MiniGLTTrgConditionsValue):
00100   """ Define a condition where only the CNO trigger is asserted
00101   """
00102   def __init__(self):
00103     MiniGLTTrgConditionsValue.__init__(self)
00104   def solicited(self):
00105     return True
00106
00107 class ZsupTrgInjectChargeReadout(TrgInjectChargeReadout):
00108   """\brief ZsupTrgReadout class definition
00109
00110   Directs a module to send to its Front-End Electronics a command sequence
00111   which is composed only of the TACK command. This command will trigger
00112   a readout of the module's Front-End Electronics.
00113   Zero suppression is turned on.
00114   """
00115   def __init__(self):
00116     """\brief TrgReadout constructor
00117     """
00118     TrgInjectChargeReadout.__init__(self)
00119
00120   def zeroSuppress(self):
00121     return True
00122
00123 # redefine SolicitedEngine
00124 class ZsupSolicitedEngine(TrgEngine):
00125   """This class defines an engine which reads out the detector
00126      whenever there is a solicited trigger.  Zero suppression is on.
00127      This engine is not prescaled.
00128   """
00129   def __init__(self):
00130     TrgEngine.__init__(self)
00131     self.__request = ZsupTrgReadout()
00132   def participate(self,conditionsValue):
00133     # This function relies on the programmer's knowledge that the
00134     # conditionsValue is a bitfield.
00135     cond = SolicitedCondition()
00136     if conditionsValue & cond.value():
00137       return True
00138     return False
00139   def prescale(self):
00140     return 0
00141   def request(self):
00142     return self.__request
00143
00144
00145
00146 def test(cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1, lowlevel=0):
00147   global tem , glt
00148   gc.disable()
00149
00150   log.getLogger().setLevel(log.DEBUG)
00151
00152   options = Options(['server', 'schema'], ['evtdebug'])
00153   try:
00154     options.parse()
00155   except Exception, msg:
00156     options.usage(str(msg))
00157     return
00158
00159   if cmd == None:
00160     cmd = CmdCli()
00161     cmd.connect(options.server)
00162   lat = GLAT(cmd)
00163   lat.readSchema(options.schema)
00164   lat.applyConfig()
00165
00166   tem = lat.downTEM(0)
00167
00168   # reset the TEM since we are going to modify DATA_MASKS
00169   tem.CMD_RESET = 1
00170
00171   if lat.GEM is not None:
00172     trigger = SimpleGasuExample()
00173
00174     trigger.engines().replaceEngine(0,ZsupSolicitedEngine())
00175     trigger.GEM(lat.GEM)
00176   else:
00177     glt = GGLT(cmd)
00178     glt.initialize()
00179     trigger = MiniGLTExample()
00180     trigger.GLT(glt)
00181   trigger.commit()
00182
00183   #glt.disableMask()
00184   trigger.disable()
00185
00186   # clear TEM stats reg
00187   tem.COMMAND_RESPONSE = 0
00188
00189   # clear TEM status reg
00190   tem.STATUS = 0
00191
00192   # enable CAL, disable TKR, no diag #  0x10FF for diag
00193   tem.DATA_MASKS = 0x05FF
00194
00195   # TEM config reg # set TEM timeout
00196   tem.CONFIGURATION = 0
00197   tem.CAL_TRGSEQ = 0x40
00198
00199   #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00200   #printf("tem config reg = 0x%08x\n", payload);
00201
00202   # enable output in our GCCCs
00203   # broadcast load of GCCC_REG_CONFIGURATION
00204
00205   bcast_ccc = tem.allCCC()
00206   bcast_ccc.CONFIGURATION = 0x80000000L
00207
00208   #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00209   bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00210   bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00211   ccc2 = tem.downCCC(2) # O$GCCC_02
00212   ccc2.LAYER_MASK_1 = 0x3BFD3FFFL
00213
00214   # large timeouts for all GCCCs
00215   # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00216   bcast_ccc.EVENT_TIMEOUTS = 0x0
00217   #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00218   #printf("gccc register event timeouts = 0x%08x\n", payload);
00219
00220
00221 #  glt.INTERNAL_TRG = 0
00222
00223 #  glt.DESTINATION = 5
00224 #  glt.MARKER = 0
00225 #  glt.ZERO_SUPPRESS = 1
00226 #  glt.FOUR_RANGE_READOUT = 0
00227 #  glt.TACK = 1
00228 #  glt.CAL_STROBE = 0
00229
00230
00231   if options.evtdebug is not None:
00232     debug = options.evtdebug
00233   ec = EvtCli(debug)
00234   ec.connect(options.server)
00235
00236   trigger.enable()
00237
00238   cnt=0
00239   ces=0
00240   start = time.time()
00241   for i in range(count):
00242     cnt=cnt+1
00243     trigger.solicit()
00244     if lowlevel==1:
00245       (header, ec.dat) = ec.read()
00246     else:
00247       ec.readEvent()
00248     if parse==1:
00249       ec.setCurrentContribution(ec.TEM0)
00250       if ec.getContributionStatus() == 0:
00251         ec.evDumpCAL_LogAccepts()
00252         ec.evDumpCAL_Logs()
00253     #~ #print ""
00254     #~ #ec.evDumpTKR()
00255     #~ ec.evDumpTEM_Error()
00256     #~ ec.evDumpDiagnostic()
00257     #~ sum = ec.evt.summary
00258     #~ ec.evDumpSummary()
00259     if cnt % 100 == 0: print cnt
00260     ces = ces + len(ec.dat)
00261     #sleep(0.000300)
00262   end = time.time()
00263   et = end-start
00264   if et == 0: et = 0.000001
00265   print "Finished in %f seconds (%d events/second), average event size is %d" %(et,(cnt/et),(ces/cnt))
00266   if disconnectOnExit:
00267     cmd.disconnect()
00268   ec.disconnect()
00269
00270 # Benchmark results
00271 # 9/7/04
00272 #   server    : gitot
00273 #   teststand : COLUMBA
00274 #   event size: 80 bytes
00275 #     test():                    1327 events/second
00276 #     test(parse=0):             1491 events/second
00277 #     test(lowlevel=1, parse=0): 1823 events/second
00278 #   server    : localhost
00279 #   teststand : COLUMBA
00280 #   event size: 80 bytes
00281 #     test():                    1272 events/second
00282 #     test(parse=0):             2735 events/second
00283 #     test(lowlevel=1, parse=0): 4384 events/second
00284 # 9/30/04
00285 #   server    : gitot / GASU based with TEM0 attached.
00286 #   teststand : COLUMBA
00287 #   event size: 432 bytes
00288 #     test():                     440 events/second -- Note the slow performance is due to
00289 #                                                   -- increased event size and no zero-suppression
00290 #     test(parse=0):             1221 events/second
00291 #     test(lowlevel=1, parse=0): 1400 events/second
00292 #   server    : gitot / GASU based with TEM0 attached (Zero-Suppression on).
00293 #   teststand : COLUMBA
00294 #   event size: 304 bytes
00295 #     test():                    1035 events/second
00296 #     test(parse=0):             1285 events/second
00297 #     test(lowlevel=1, parse=0): 1485 events/second
00298 # 10/19/04
00299 #   server    : gitot / LCBD / GASU based with TEM0 attached (Zero-Suppression on).
00300 #   teststand : COLUMBA
00301 #   event size: 304 bytes
00302 #     test():                     945 events/second
00303 #     test(parse=0):             1153 events/second
00304 #     test(lowlevel=1, parse=0): 1344 events/second
00305 # 10/22/04
00306 #   server    : gitot / LCBD / XBRD based with TEM0 attached (Zero-Suppression on).
00307 #   teststand : COLUMBA
00308 #   event size: 80 bytes
00309 #     test():                    1084 events/second
00310 #     test(parse=0):             1327 events/second
00311 #     test(lowlevel=1, parse=0): 1576 events/second
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_exttrg.py Source File

tests

test_evt_exttrg.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for external trigger functionality.
00011 """
00012 __facility__ = "Online"
00013 __abstract__ = "Test script for external trigger"
00014 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T/Online"
00015 __date__     = ("$Date: 2004/10/20 02:40:04 $").split(' ')[1]
00016 __version__  = "$Revision: 1.1 $"
00017 __release__  = "$Name: P04-06-05 $"
00018 __credits__  = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021
00022 from LATTE.client.gOptions import Options
00023 from LATTE.client.gCmdCli  import CmdCli
00024 from LATTE.client.gEvtCli  import EvtCli
00025 from LATTE.database.gLAT   import GLAT
00026 from LATTE.database.gGLT   import GGLT
00027 from LATTE.database.gOCS   import GOCS
00028
00029 from time import sleep
00030 import gc
00031 import os
00032 import time
00033 import logging as log
00034
00035
00036 from LATTE.tests.apps.support.SimpleGasuExample import *
00037 from LATTE.tests.apps.support.MiniGLTExample    import *
00038
00039 tem = None
00040
00041 # Define a GASU impl of an external trigger engine
00042 class GasuExtTrg(SimpleGasuExample):
00043   def __init__(self):
00044     SimpleGasuExample.__init__(self)
00045     self.__cond = GasuExtTrgCond()
00046     self.engines().replaceEngine(0, GasuExtTrgEngine())
00047   def conditions(self): return self.__cond
00048
00049 class GasuExtTrgCond(TrgConditionsValue):
00050   def __init__(self):
00051     TrgConditionsValue.__init__(self)
00052   def external(self): return True
00053
00054 class GasuExtTrgEngine(TrgEngine):
00055   def __init__(self):
00056     TrgEngine.__init__(self)
00057     self.__request = TrgReadout()
00058     cond = GasuExtTrgCond()
00059     self.__cv = cond.value()
00060   def participate(self,conditionsValue):
00061     if conditionsValue & self.__cv:
00062       return True
00063     return False
00064   def prescale(self):   return 0
00065   def request(self):    return self.__request
00066
00067 # define a MiniGLT impl of an external trigger
00068 class MiniGltExtTrg(MiniGLTExample):
00069   def __init__(self):
00070     MiniGLTExample.__init__(self)
00071     self.__cond = MiniGltExtTrgCond()
00072     self.engines().replaceEngine(0, MiniGltTrgEngine())
00073   def conditions(self): return self.__cond
00074
00075 class MiniGltExtTrgCond(MiniGLTTrgConditionsValue):
00076   def __init__(self):
00077     MiniGLTTrgConditionsValue.__init__(self)
00078   def external(self): return True
00079
00080 class MiniGltTrgEngine(TrgEngine):
00081   def __init__(self):
00082     TrgEngine.__init__(self)
00083     self.__request = TrgReadout()
00084     cond = MiniGltExtTrgCond()
00085     self.__cv = cond.value()
00086   def participate(self,conditionsValue):
00087     if conditionsValue & self.__cv:
00088       return True
00089     return False
00090   def prescale(self):   return 0
00091   def request(self):    return self.__request
00092
00093
00094 def test(cmd=None, debug=0, disconnectOnExit=1, parse=1, lowlevel=0):
00095   global tem , glt
00096   gc.disable()
00097
00098   print "Test of external trigger."
00099   print "External trigger should be triggering at ~100Hz"
00100
00101   log.getLogger().setLevel(log.INFO)
00102
00103   options = Options(['server', 'schema'], ['evtdebug'])
00104   try:
00105     options.parse()
00106   except Exception, msg:
00107     options.usage(str(msg))
00108     return
00109
00110   if cmd == None:
00111     cmd = CmdCli()
00112     cmd.connect(options.server)
00113   lat = GLAT(cmd)
00114   lat.readSchema(options.schema)
00115   lat.applyConfig()
00116
00117   try:
00118     lat.LCB.setEvtEnable(True)
00119   except Exception, e:
00120     log.error(e)
00121     raise
00122
00123   if lat.GEM is not None:
00124     trigger = GasuExtTrg()
00125     trigger.GEM(lat.GEM)
00126   else:
00127     glt = GGLT(cmd)
00128     glt.initialize()
00129     trigger = MiniGltExtTrg()
00130     trigger.GLT(glt)
00131   trigger.commit()
00132
00133   trigger.disable()
00134
00135   if options.evtdebug is not None:
00136     debug = options.evtdebug
00137   ec = EvtCli(debug)
00138   ec.connect(options.server)
00139   ec.socket().settimeout(1)
00140
00141   ocs = GOCS(cmd)
00142   # ocs.evtHandlerSetVerbosity(0xf)
00143   ocs.evtHandlerSendAll()
00144
00145   # Make sure counters are reset
00146   trigger.triggerCounters().reset()
00147
00148   # Take 1 second of events
00149   trigger.enable()
00150   time.sleep(1)
00151   trigger.disable()
00152   time.sleep(1)
00153
00154   # get stats
00155   trgStats = trigger.triggerCounters().stats()
00156   nSent    = trgStats.sent()
00157   nDisc    = trgStats.discarded()
00158   nPre     = trgStats.prescaled()
00159
00160
00161   # loop over "sent"
00162   nSeen = 0
00163   for i in range(nSent):
00164     if lowlevel==1:
00165       (header, ec.dat) = ec.read()
00166     else:
00167       try:
00168         ec.readEvent()
00169       except IOError, e:
00170         pass
00171         print e
00172     if parse==1:
00173       ec.setCurrentContribution(ec.GEM)
00174       if ec.getContributionStatus() == 0:
00175         ec.evDumpGEM()
00176         if (ec.evt.gem.triggerSummary & 0x80):
00177           nSeen += 1
00178
00179   if nSent != nSeen:
00180     print
00181     print "  !!!!FAILED!!!!"
00182     print "  nSent (%d) not equal to nSeen (%d)" % ( nSent, nSeen )
00183     print "  GEM stats: nDiscarded= %d" % (nDisc)
00184     print "             nPrescaled= %d" % (nPre )
00185   else:
00186     print
00187     print "  TEST PASSED"
00188
00189   if disconnectOnExit:
00190     cmd.disconnect()
00191   ec.disconnect()
00192
00193
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_filters.py Source File

tests

test_evt_filters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test of callbacks in OES
00011 """
00012 __facility__ = "Online"
00013 __abstract__ = "Test script for event taking modes in FSW"
00014 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T/Online"
00015 __date__     = ("$Date: 2005/01/21 21:10:34 $").split(' ')[1]
00016 __created__  = "040908"
00017 __version__  = "$Revision: 1.3.2.1 $"
00018 __release__  = "$Name: P04-06-05 $"
00019 __credits__  = "SLAC"
00020
00021 import LATTE.copyright_SLAC
00022
00023 from LATTE.client.gOptions import Options
00024 from LATTE.client.gCmdCli  import CmdCli
00025 from LATTE.database.gLAT   import GLAT
00026 from LATTE.database.gOCS   import GOCS
00027 from LATTE.client.gEvtCli  import EvtCli
00028 from LATTE.tools.taskEngine import TaskEngine
00029
00030 from time import sleep
00031 import time
00032 import os
00033 import gc
00034 import math
00035 import logging as log
00036 import threading
00037
00038 from LATTE.tests.apps.support.SimpleGasuExample import *
00039 from LATTE.trigger.rcTrgFunctions import rcTrgInjectMarker
00040
00041
00042 aem     = None
00043 trigger = None
00044 ocs     = None
00045 task    = None
00046 ec      = None
00047
00048 def test(cmd=None, debug=0, count=10, disconnectOnExit=1):
00049   global aem, trigger, ec, ocs, task
00050   gc.disable()
00051
00052   options = Options(['server', 'schema'], ['evtdebug'])
00053   try:
00054     options.parse()
00055   except Exception, msg:
00056     options.usage(str(msg))
00057     return
00058
00059   task = TaskEngine("TestEngine")
00060   task.start()
00061
00062   if cmd == None:
00063     cmd = CmdCli()
00064     cmd.connect(options.server)
00065   lat = GLAT(cmd)
00066   lat.readSchema(options.schema)
00067   lat.applyConfig()
00068
00069   try:
00070     lat.LCB.setEvtEnable(True)
00071   except Exception, e:
00072     log.error(e)
00073     raise
00074
00075   ocs = GOCS(cmd)
00076   ocs.evtHandlerSetVerbosity(0xf)
00077
00078   trigger = SimpleGasuExample()
00079   trigger.GEM(lat.GEM)
00080   trigger.commit()
00081
00082   ec = EvtCli(options.evtdebug)
00083   ec.setTimeoutEnabled(True)
00084   ec.connect(options.server)
00085   ec.socket().settimeout(1)
00086
00087   trigger.enable()
00088
00089   cnt=0
00090   start = time.time()
00091
00092   nTest = 1
00093
00094   testEHSendAll(nTest, count);             nTest += 1
00095   testEHSendErrors(nTest, count);          nTest += 1
00096   testEHSendNothing(nTest, count);         nTest += 1
00097   testEHSendPrescale(nTest, count, 0);     nTest += 1
00098   testEHSendPrescale(nTest, count, 2);     nTest += 1
00099   testEHSendPrescale(nTest, count, 0);     nTest += 1
00100   testEHSendAcd(nTest, count, 5, 0);       nTest += 1
00101   testEHSendAcd(nTest, count, 5, 2);       nTest += 1
00102   testEHSendAcd(nTest, count, 5, 0);       nTest += 1
00103   testEHSendAll(nTest, count);             nTest += 1
00104
00105   trigger.disable()
00106   ec.disconnect()
00107   task.shutdown()
00108
00109   if disconnectOnExit == 1:
00110     cmd.disconnect()
00111
00112 def countEvents(count, printSize=False):
00113   lastEvt = -1
00114   nSeen = 0
00115   for i in range(count):
00116     trigger.solicit()
00117     try:
00118       ec.readEvent()
00119       summary = ec.evt.summary
00120       # Construct event number
00121       evtNumber = (summary.evNumber << 2) | (summary.tag)
00122       nSeen += 1
00123       lastEvt = evtNumber
00124       if printSize:
00125         print "Event number %d size = %X, summary=%x" % \
00126            (evtNumber, len(ec.dat), summary.ui)
00127     except IOError, e:
00128       pass
00129       print e
00130   return nSeen
00131
00132 def testEHSendErrors(test, count):
00133   print "test %d:  Take %d events, using evtHandlerSendErrorsOnly" % (test, count)
00134   trigger.disable()
00135   ocs.evtHandlerSendErrorsOnly()
00136   trigger.commit()
00137   trigger.enable()
00138   cnt = countEvents(count)
00139   print "evtHandlerSendErrorsOnly: Sent %d events, saw %d" % (count, cnt)
00140   if (cnt != 0):
00141     print "      FAILED"
00142   else:
00143     print "      PASSED"
00144
00145 def testEHSendNothing(test, count):
00146   print "test %d:  Take %d events, using evtHandlerSendNothing" % (test, count)
00147   trigger.disable()
00148   ocs.evtHandlerSendNothing()
00149   trigger.commit()
00150   trigger.enable()
00151   cnt = countEvents(count)
00152   print "evtHandlerSendNothing: Sent %d events, saw %d" % (count, cnt)
00153   if (cnt != 0):
00154     print "      FAILED"
00155   else:
00156     print "      PASSED"
00157
00158 def testEHSendPrescale(test, count, prescale):
00159   effPre = prescale+1
00160   print "test %d:  Take %d events, using evtHandlerSendPrescaled(%d)" % (test, count*effPre, prescale)
00161   trigger.disable()
00162   ocs.evtHandlerSendPrescaled(prescale)
00163   trigger.commit()
00164   trigger.enable()
00165   cnt = countEvents(count*effPre)
00166   print "evtHandlerSendPrescaled(%d): Sent %d events, saw %d" % (prescale, count*effPre, cnt)
00167   if (cnt != count):
00168     print "      FAILED, expected %d" % count
00169   else:
00170     print "      PASSED"
00171
00172 def testEHSendAcd(test, count, marker, prescale):
00173   effPre = prescale+1
00174   print "test %d:  Take %d events, using evtHandlerSendAcdScalers(%d,%d)" % \
00175         (test, count*effPre, marker, prescale)
00176
00177   trigger.disable()
00178   ocs.evtHandlerSendAcdScalers(marker, prescale)
00179   trigger.commit()
00180   trigger.enable()
00181
00182   cnt = countEvents(count*effPre)
00183   evt = threading.Event()
00184   task.spawn(trigger.shut, evt)
00185   time.sleep(0.1)
00186   evt.set()
00187
00188   ec.readEvent()
00189   datalen = len(ec.dat)
00190   print "evtHandlerSendAcdScalers(%d,%d): Sent %d events, saw %d" % \
00191         (marker, prescale,count*effPre, cnt)
00192   if (cnt != count):
00193     print "      FAILED, expected %d" % count
00194   elif (datalen < 0x4000):
00195     print "      FAILED, ASC event size = 0x%X, < 0x4000" % datalen
00196   else:
00197     print "      PASSED"
00198   time.sleep(1)  # let shut() above finish...
00199
00200 def testEHSendAll(test, count):
00201   print "test %d:  Take %d events, using evtHandlerSendAll:" % (test, count)
00202   trigger.disable()
00203   ocs.evtHandlerSendAll()
00204   trigger.commit()
00205   trigger.enable()
00206   cnt = countEvents(count)
00207   print "evtHandlerSendAll: Sent %d events, saw %d" % (count, cnt)
00208   if (cnt != count):
00209     print "      FAILED"
00210   else:
00211     print "      PASSED"
00212
00213 if __name__ == '__main__':
00214   test()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_evt_tkr.py Source File

tests

test_evt_tkr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """Test script for taking TKR events
00011 """
00012 __facility__ = "Online"
00013 __abstract__ = "Test script for TKR"
00014 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00015 __date__     = ("$Date: 2004/10/22 22:31:02 $").split(' ')[1]
00016 __version__  = "$Revision: 1.3 $"
00017 __release__  = "$Name: P04-06-05 $"
00018 __credits__  = "SLAC"
00019
00020 import LATTE.copyright_SLAC
00021
00022 from LATTE.client.gOptions import Options
00023 from LATTE.client.gCmdCli  import CmdCli
00024 from LATTE.database.gLAT   import GLAT
00025 from LATTE.client.gEvtCli  import EvtCli
00026 from LATTE.database.gGLT   import GGLT
00027
00028 from LATTE.tests.apps.support.MiniGLTExample import *
00029 from LATTE.tests.apps.support.SimpleGasuExample import *
00030
00031 import gc
00032 import os
00033 import time
00034 import logging as log
00035
00036 lat = None
00037 tem = None
00038
00039 # redefine SolicitedEngine
00040 class ZsupSolicitedEngine(TrgEngine):
00041   """This class defines an engine which reads out the detector
00042      whenever there is a solicited trigger.  Zero suppression is on.
00043      This engine is not prescaled.
00044   """
00045   def __init__(self):
00046     TrgEngine.__init__(self)
00047     self.__request = ZsupTrgReadout()
00048   def participate(self,conditionsValue):
00049     # This function relies on the programmer's knowledge that the
00050     # conditionsValue is a bitfield.
00051     cond = SolicitedCondition()
00052     if conditionsValue & cond.value():
00053       return True
00054     return False
00055   def prescale(self):
00056     return 0
00057   def request(self):
00058     return self.__request
00059
00060 def test(cmd=None, debug=0, count=10000, disconnectOnExit=1, parse=1, lowlevel=0):
00061   global tem, glt
00062   gc.disable()
00063
00064   log.getLogger().setLevel(log.DEBUG)
00065
00066   options = Options(['server', 'schema'], ['evtdebug'])
00067   try:
00068     options.parse()
00069   except Exception, msg:
00070     options.usage(str(msg))
00071     return
00072
00073   if cmd == None:
00074     cmd = CmdCli()
00075     cmd.connect(options.server)
00076   lat = GLAT(cmd)
00077   lat.readSchema(options.schema)
00078   lat.applyConfig()
00079
00080   tem = lat.downTEM(0)
00081
00082   # TEM needs to be reset before DATA_MASKS can be set
00083   tem.CMD_RESET = 1
00084
00085   if lat.GEM is not None:
00086     trigger = SimpleGasuExample()
00087
00088     trigger.engines().replaceEngine(0,ZsupSolicitedEngine())
00089     trigger.GEM(lat.GEM)
00090   else:
00091     glt = GGLT(cmd)
00092     glt.initialize()
00093     trigger = MiniGLTExample()
00094     trigger.GLT(glt)
00095   trigger.commit()
00096
00097   trigger.disable()
00098
00099   #
00100   # Configure TEM
00101   #
00102   # TEM config reg # set TEM timeout
00103   tem.CONFIGURATION = 0
00104
00105   ccc = tem.allCCC()
00106   # enable output in our GCCCs
00107   # broadcast load of GCCC_REG_CONFIGURATION
00108   ccc.CONFIGURATION = 0x80000000L
00109
00110   #  disable all GCRCs in all GCCCs via broadcast
00111   ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00112   ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00113
00114   # config TEM TKR calstrobe delay for ~ 5usec
00115   tem.TKR_TRGSEQ = 0x3C
00116
00117   # enable TKR, disable CAL, no diag #  0x1FF3 for diag
00118   # only enable GTCC 3
00119   tem.DATA_MASKS = 0x0FF3
00120
00121   tcc = tem.allTCC()
00122
00123   # broadcast load of GTCC_REG_CONFIGURATION
00124   # enable controller output and set cable length to 1
00125   # 0xC0000000 is for one layer
00126   # 0x80000000 is for two layers
00127   tcc.CONFIGURATION = 0xC0000000L
00128   x_tcc = tem.downTCC(0)
00129   # enable all masks
00130   tcc.INPUT_MASK = 0x0
00131
00132   # set maximum event timeout
00133   tcc.EVENT_TIMEOUTS = 0x03F
00134
00135   #
00136   # Configure GTRCs
00137   #
00138
00139   # our board is connected CC = 2, RC = 0 and CC = 3, RC = 0
00140   # reset GTRC # required before all triggers
00141
00142   trc = tcc.allTRC()
00143
00144   trc.CMD_RESET = 1
00145
00146   # number of GTFE to readout left
00147   nGTFEsLeft  = 7
00148   nGTFEsRight = 0
00149
00150   # max hits per GTRC # 31 max
00151   maxHits = 31
00152
00153   enMask  = 0x6
00154
00155   dLO = (enMask << 28) | ((nGTFEsRight << 7)& 0xF80) | (maxHits & 0x7F);
00156   print "dLO=", dLO, hex(dLO)
00157
00158   # cable controller 2, readout controller 0
00159   tcc = tem.downTCC(2)
00160   trc = tcc.downTRC(1)
00161
00162   trc.CSR = dLO
00163
00164   dLO = (enMask << 28) | ((nGTFEsLeft << 7)& 0xF80) | (maxHits & 0x7F);
00165   print "dLO=", dLO, hex(dLO)
00166
00167   # cable controller 3, readout controller 0
00168   tcc = tem.downTCC(3)
00169   trc = tcc.downTRC(1)
00170
00171   trc.CSR = dLO
00172
00173   #
00174   # Configure GTFEs
00175   #
00176
00177   tfe = trc.allTFE()
00178   tfe.TRIG_MASK = 0x0
00179   tfe.DATA_MASK = 0x0
00180   tfe.CALIB_MASK = 0x0
00181   tfe.DAC = 0x00001902
00182   # configure front ends # all listen to left
00183   tfe.MODE = 0
00184   #tfe = trc.downTFE(0)
00185
00186 # configure default DACs for threshold and calibration
00187 # Calibration DAC Range and Resolution
00188 # Low Range (B6=0):  DAC output voltage in mV = 1.57 + 1.53*DAC_Value
00189 # High Range (B6=1): DAC output voltage in mV = 15.0 + 14.6*DAC_Value
00190 # Discriminator Threshold DAC Range and Resolution
00191 # Low Range (B6=0):  DAC output voltage in mV = 4.5 + 4.5*DAC_Value
00192 # High Range (B6=1): DAC output voltage in mV = 12.9 + 12.9*DAC_Value
00193
00194
00195   # calRng = 1
00196   # thrRng = 0
00197   # calDAC = 60
00198   # thrDAC = 10
00199
00200   tfe.DAC = 0x00001952  # based on the above Rng and DAC values
00201
00202   # enable GTFE for data taking # all channels
00203   tfe.TRIG_MASK = 0xffffffffffffffff
00204   tfe.DATA_MASK = 0xffffffffffffffff
00205
00206   # Cal strobe channels 4 and 48 only
00207   tfe.CALIB_MASK = 0x0001000000000010
00208
00209   #~ #Mask of the following Registers
00210   #~ tfe = trc.downTFE(13)
00211   #~ tfe.DATA_MASK = 0x0L
00212   #~ tfe.CALIB_MASK = 0x0L
00213   #~ tfe.TRIG_MASK = 0x0L
00214
00215   #~ tfe = trc.downTFE(14)
00216   #~ tfe.DATA_MASK = 0x0L
00217   #~ tfe.CALIB_MASK = 0x0L
00218   #~ tfe.TRIG_MASK = 0x0L
00219
00220   #~ tfe = trc.downTFE(19)
00221   #~ #tfe.DATA_MASK = 0x0L
00222   #~ tfe.CALIB_MASK = 0x0L
00223   #~ tfe.TRIG_MASK = 0x0L
00224
00225   #~ tfe = trc.downTFE(20)
00226   #~ #tfe.DATA_MASK = 0x0L
00227   #~ tfe.CALIB_MASK = 0x0L
00228   #~ tfe.TRIG_MASK = 0x0L
00229
00230
00231   ec = EvtCli(options.evtdebug)
00232   ec.connect(options.server)
00233
00234   trigger.enable()
00235
00236   cnt=0
00237   ces=0
00238   start = time.time()
00239   for i in range(count):
00240     cnt=cnt+1
00241     trigger.solicit()
00242     if lowlevel==1:
00243       (header, ec.dat) = ec.read()
00244     else:
00245       ec.readEvent()
00246     if parse:
00247       ec.setCurrentContribution(ec.TEM0)
00248       if ec.getContributionStatus() == 0:
00249         ec.evDumpTKR()
00250     if cnt % 100 == 0: print cnt
00251     ces += len(ec.dat)
00252     #sleep(0.000300)
00253   end = time.time()
00254   et = end-start
00255   if et == 0: et = 0.000001
00256   print "Finished in %f seconds (%d events/second), average event size is %d" %(et,(cnt/et),(ces/cnt))
00257   if disconnectOnExit:
00258     cmd.disconnect()
00259   ec.disconnect()
00260
00261 # 10/22/04
00262 #   server    : gitot / LCBD / XBRD based with TEM0 attached (Zero-Suppression on).
00263 #   teststand : COLUMBA
00264 #   event size: 96 bytes
00265 #     test():                     939 events/second
00266 #     test(parse=0):             1338 events/second
00267 #     test(lowlevel=1, parse=0): 1580 events/second
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_gafe.py Source File

tests

test_gafe.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "ACD Front End ASIC test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:55 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gAEM as gAEM
00024
00025 def test_aem():
00026   options = gOptions.Options(['server', 'garcid', 'gafeid'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = gCmdCli.CmdCli()
00033
00034   cmdcli.connect(options.server)
00035
00036   garc = gAEM.GARC(cmdcli, None, int(options.garcid))
00037   garc.look_at_me = 0xeb90
00038   gafe = gAEM.GAFE(cmdcli, garc, int(options.gafeid))
00039
00040   value = gafe.configuration
00041   print "afe.value is 0x%x" %(value)
00042   value = gafe.veto_dac
00043   print "afe.value is 0x%x" %(value)
00044   value = gafe.veto_vernier
00045   print "afe.value is 0x%x" %(value)
00046   value = gafe.hld_dac
00047   print "afe.value is 0x%x" %(value)
00048   value = gafe.tci_dac
00049   print "afe.value is 0x%x" %(value)
00050   value = gafe.vers_addr
00051   print "afe.value is 0x%x" %(value)
00052   value = gafe.write_ctr
00053   print "afe.value is 0x%x" %(value)
00054   value = gafe.reject_ctr
00055   print "afe.value is 0x%x" %(value)
00056   value = gafe.loop_ctr
00057   print "afe.value is 0x%x" %(value)
00058   value = gafe.chip_addr
00059   print "afe.value is 0x%x" %(value)
00060
00061
00062   cmdcli.disconnect()
00063
00064 if __name__ == '__main__':
00065   test_aem()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_garc.py Source File

tests

test_garc.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "ACD Readout Controller ASIC test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:55 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gAEM as gAEM
00024
00025 def test_aem():
00026   options = gOptions.Options(['server', 'garcid'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = gCmdCli.CmdCli()
00033   cmdcli.connect(options.server)
00034
00035   garc = gAEM.GARC(cmdcli, None, int(options.garcid))
00036   garc.look_at_me = 0xeb90
00037   veto = 20
00038   garc.veto_delay = veto
00039   rdveto = garc.veto_delay
00040   print "arc.veto_delay wrote 0x%x returned 0x%x" %(veto, rdveto)
00041   garc.cmd_reset = 1
00042   rdveto = garc.veto_delay
00043   print "arc.veto_delay returned 0x%x after reset" %(rdveto)
00044
00045   cmdcli.disconnect()
00046
00047 if __name__ == '__main__':
00048   test_aem()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_glt.py Source File

tests

test_glt.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "AEM test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gGLT as gGLT
00024
00025 def test_glt():
00026   options = gOptions.Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = gCmdCli.CmdCli()
00033   glt = gGLT.GGLT(cmdcli)
00034
00035   cmdcli.connect(options.server)
00036
00037   rdvalue = glt.counter
00038   print "glt.counter returned 0x%x" %(rdvalue)
00039
00040   value = 100
00041   glt.counter = value
00042   print "glt.counter wrote 0x%x" %(value)
00043
00044   rdvalue = glt.counter
00045   print "glt.counter returned 0x%x" %(rdvalue)
00046
00047   glt.cmd_reset = 1
00048   print "glt.counter reset done"
00049
00050   rdvalue = glt.counter
00051   print "glt.counter returned 0x%x" %(rdvalue)
00052
00053   cmdcli.disconnect()
00054
00055 if __name__ == '__main__':
00056   test_glt()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_lat.py Source File

tests

test_lat.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "LAT staticistics node test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.client.gOptions import Options
00022 from LATTE.client.gCmdCli import CmdCli
00023 from LATTE.database.gLAT import GLAT
00024
00025 def test_lat():
00026   options = Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = CmdCli()
00033   lat = GLAT(cmdcli)
00034
00035   cmdcli.connect(options.server)
00036
00037   rdvalue = lat.stats_valid_events
00038   print "lat.stats_valid_events returned 0x%x" %(rdvalue)
00039
00040   value = 100
00041   lat.stats_valid_events = value
00042   print "lat.stats_valid_events wrote 0x%x" %(value)
00043
00044   rdvalue = lat.stats_valid_events
00045   print "lat.stats_valid_events returned 0x%x" %(rdvalue)
00046
00047   cmdcli.disconnect()
00048
00049 if __name__ == '__main__':
00050   test_lat()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_loopback.py Source File

tests

test_loopback.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Event loopback test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import threading
00022 import select
00023 import LATTE.client.gLoopback as gLoopback
00024
00025 class EvtCli(object):
00026   def __init__(self):
00027     self.__loopback = gLoopback.Loopback()
00028
00029   def read(self):
00030     print "readfunction"
00031     try:
00032       rd, wr, ex = select.select([self.__loopback.socket()], [], [], None)
00033       print "select done"
00034     except Exception, msg:
00035       print msg
00036       return
00037     for fd in rd:
00038       if fd == self.__loopback.socket():
00039         value = self.__loopback.acknowledge()
00040         print "shutdown!", value
00041
00042   def dontread(self):
00043     print "dont read called"
00044     self.__loopback.commit(0xbeef)
00045     print "dont read done"
00046
00047
00048 if __name__ == '__main__':
00049   evtcli = EvtCli()
00050   evtHandler = threading.Thread(None, evtcli.read, 'EventHandler',())
00051   evtHandler.start()
00052   evtcli.dontread()
00053   print "done with threads"
00054
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_mem.py Source File

tests

test_mem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "vxMemProbe test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/09/11 00:55:28 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.client.gOptions import Options
00022 from LATTE.client.gCmdCli import CmdCli
00023 from LATTE.database.gMem import GMem
00024
00025 def test_lat():
00026   options = Options(['server', 'address'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = CmdCli()
00033   mem = GMem(cmdcli)
00034   address = int(options.address, 0)
00035
00036   cmdcli.connect(options.server)
00037
00038   valuechar = 0x1a
00039   valueshort = 0x1a2b
00040   valueint = 0x1a2b3c4d
00041
00042   mem.gMEMload(address+0x00, valuechar,  1)
00043   mem.gMEMload(address+0x10, valueshort, 2)
00044   mem.gMEMload(address+0x20, valueint,   4)
00045
00046   print "gMem wrote 0x%x, 0x%x, 0x%x" %(valuechar, valueshort, valueint)
00047
00048   rvaluechar  = mem.gMEMread(address+0x00, 1).value()
00049   rvalueshort = mem.gMEMread(address+0x10, 2).value()
00050   rvalueint   = mem.gMEMread(address+0x20, 4).value()
00051
00052   print "gMem read  0x%x, 0x%x, 0x%x" %(rvaluechar, rvalueshort, rvalueint)
00053
00054   cmdcli.disconnect()
00055
00056 if __name__ == '__main__':
00057   test_lat()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_options.py Source File

tests

test_options.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Options class test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.client.gOptions import Options
00022
00023 def test_cmdrsp():
00024   options = Options(['server'],['schema'],['reload'])
00025   try:
00026     options.parse()
00027     print 'server name is %s' %(options.server)
00028     if options.schema is not None:
00029       print 'schema name is %s' %(options.schema)
00030     if options.reload is not None:
00031       print 'reaload switch is on'
00032   except Exception, msg:
00033     print msg
00034     options.usage()
00035
00036 if __name__ == '__main__':
00037   test_cmdrsp()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_playback.py Source File

tests

test_playback.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Event file playback test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.3 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from threading import Thread, Lock
00022
00023 import LATTE.client.gOptions as gOptions
00024 import LATTE.client.gCmdCli as gCmdCli
00025 import LATTE.client.gEvtCli as gEvtCli
00026 import LATTE.database.gGLT as gGLT
00027
00028 class Playback:
00029   __Debug = 0xf
00030
00031   def __init__(self, server):
00032     self.__server = server
00033     self.__cmdcli = gCmdCli.CmdCli()
00034     self.__evtcli = gEvtCli.EvtCli(Playback.__Debug)
00035     self.__glt = gGLT.GGLT(self.__cmdcli)
00036     self.__lock = Lock()
00037     self.__lock.acquire()
00038     self.__abort = False
00039
00040   def connect(self):
00041     self.__cmdcli.connect(self.__server)
00042     self.__evtcli.connect(self.__server)
00043
00044   def disconnect(self):
00045     self.__cmdcli.disconnect()
00046     self.__evtcli.disconnect()
00047
00048   def trigger(self, howmany):
00049     self.__glt.marker = 5
00050     self.__glt.cmd_self_trigger = 1
00051     self.__lock.acquire()
00052     for t in range(howmany):
00053       self.__glt.marker = 0
00054       self.__glt.cmd_self_trigger = 1
00055       self.__lock.acquire()
00056     self.__abort = True
00057     self.__glt.marker = 5
00058     self.__glt.cmd_self_trigger = 1
00059     self.__lock.acquire()
00060
00061   def listen(self):
00062     evtHandler = Thread(None, self.__listen)
00063     evtHandler.start()
00064
00065   def __listen(self):
00066     while self.__abort is False:
00067       status = self.__evtcli.readEvent()
00068       if status != 0:
00069         print "*** playback error in event"
00070       self.__lock.release()
00071
00072 def test_playback():
00073   options = gOptions.Options(['server', 'nevents'])
00074   try:
00075     options.parse()
00076   except Exception, msg:
00077     options.usage(str(msg))
00078     return
00079   playback = Playback(options.server)
00080   playback.connect()
00081   playback.listen()
00082   playback.trigger(int(options.nevents))
00083   playback.disconnect()
00084
00085
00086 if __name__ == '__main__':
00087   test_playback()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_rate.py Source File

tests

test_rate.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Commanding rate measurement test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import time
00022
00023 from LATTE.client.gOptions import Options
00024 from LATTE.client.gCmdCli import CmdCli
00025 from LATTE.client.gCommand import Command
00026 from LATTE.database.gLAT import GLAT
00027
00028 def test_rate():
00029   options = Options(['server'])
00030   try:
00031     options.parse()
00032   except Exception, msg:
00033     options.usage(str(msg))
00034     return
00035
00036   cmdcli = CmdCli()
00037   lat = GLAT(cmdcli)
00038   cmdcli.connect(options.server)
00039
00040   start = time.time()
00041   for counter in range(10000):
00042     lat.stats_failed_events = counter
00043   end = time.time()
00044
00045   counter += 1
00046   elapsed = end-start
00047   rate = 1.0/elapsed*counter
00048
00049   print "  elapsed %.4f counter %d rate %.2f [Hz]" %(elapsed, counter, rate)
00050
00051   start = time.time()
00052   for counter in range(10000):
00053     lat.cmdrsp('ggLATread', 8, '!I')
00054   end = time.time()
00055
00056   counter += 1
00057   elapsed = end-start
00058   rate = 1.0/elapsed*counter
00059
00060   print "  elapsed %.4f counter %d rate %.2f [Hz]" %(elapsed, counter, rate)
00061
00062   start = time.time()
00063   command = Command('ggLATread', 8, '!I')
00064   for counter in range(10000):
00065     cmdcli._CmdCli__command_response(command.packet())
00066   end = time.time()
00067
00068   counter += 1
00069   elapsed = end-start
00070   rate = 1.0/elapsed*counter
00071
00072   print "  elapsed %.4f counter %d rate %.2f [Hz]" %(elapsed, counter, rate)
00073
00074   cmdcli.disconnect()
00075
00076 if __name__ == '__main__':
00077   test_rate()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_schema.py Source File

tests

test_schema.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Schema reader test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.2 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 from LATTE.client.gOptions import Options
00022 from LATTE.client.gCmdCli import CmdCli
00023 from LATTE.database.gLAT import GLAT
00024
00025 def test_schema():
00026   options = Options(['server', 'schema'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032   cmdcli = CmdCli()
00033   lat = GLAT(cmdcli)
00034
00035   lat.readSchema(options.opts['schema'])
00036   aem = lat.AEM
00037
00038   cmdcli.connect(options.server)
00039
00040   rdvalue = aem.trgseq
00041   print "aem.trgseq returned 0x%x" %(rdvalue)
00042
00043   aem.cmd_reset = 1
00044   print "aem.trgseq reset done"
00045
00046   rdvalue = aem.trgseq
00047   print "aem.trgseq returned 0x%x" %(rdvalue)
00048
00049   aeq = aem.AEQ
00050   aeq.env_free_1la = 0
00051   print "aeq.env_free_1LA set"
00052   rdvalue = aeq.env_free_1la
00053   print "aeq.env_free_1LA returned 0x%x" %(rdvalue)
00054
00055   garcid = 11
00056   garc = aem.ARC[garcid]
00057   garc.look_at_me = 0xeb90
00058   veto = 20
00059   garc.veto_delay = veto
00060   rdveto = garc.veto_delay
00061   print "arc.veto_delay wrote 0x%x returned 0x%x" %(veto, rdveto)
00062   garc.cmd_reset = 1
00063   rdveto = garc.veto_delay
00064   print "arc.veto_delay returned 0x%x after reset" %(rdveto)
00065
00066   gafeid = 7
00067   gafe = garc.AFE[gafeid]
00068   value = gafe.configuration
00069   print "afe.configuration is 0x%x" %(value)
00070
00071   cmdcli.disconnect()
00072
00073 if __name__ == '__main__':
00074   test_schema()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_tem.py Source File

tests

test_tem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 """TEM test
00011 Contents:
00012 Script for testing TEM
00013 """
00014 __facility__ = "Online"
00015 __abstract__ = "Script for testing TEM"
00016 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00017 __date__     = ("$Date: 2004/09/10 20:42:57 $").split(' ')[1]
00018 __version__  = "$Revision: 2.5 $"
00019 __release__  = "$Name: P04-06-05 $"
00020 __credits__  = "SLAC"
00021
00022 import LATTE.copyright_SLAC
00023
00024 from LATTE.client.gOptions import Options
00025 from LATTE.client.gCmdCli  import CmdCli
00026 from LATTE.database.gLAT   import GLAT
00027 from LATTE.database.gGLT   import GGLT
00028 from LATTE.database.gXBR   import GXBRD
00029
00030 import os
00031 import logging as log
00032
00033 def test(c=None, disconnectOnExit=1):
00034   global tem, glt, lat, cmd, xbrd
00035
00036   log.getLogger("").setLevel(log.DEBUG)
00037
00038   options = Options(['server', 'schema'], ['cmddebug'])
00039   try:
00040     options.parse()
00041   except Exception, msg:
00042     options.usage(str(msg))
00043     return
00044
00045   if c == None:
00046     cmd = CmdCli()
00047     cmd.connect(options.server)
00048     if options.cmddebug is not None:
00049       cmd.setDebug(options.cmddebug)
00050   else:
00051     cmd = c
00052
00053   lat = GLAT(cmd)
00054
00055   lat.readSchema(options.schema)
00056   lat.applyConfig()
00057   tem = lat.downTEM(0)
00058
00059   xbrd = GXBRD(cmd)
00060   xbrd.readSchema(options.schema)
00061
00062   glt = GGLT(cmd)
00063   glt.initialize()
00064
00065   if disconnectOnExit:
00066     cmd.disconnect()
00067
00068 if __name__ == '__main__':
00069   test(None, 0)
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: test_twoclients.py Source File

tests

test_twoclients.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010
00011 __facility__ = "Online"
00012 __abstract__ = "Two command client test"
00013 __author__   = "A. Perazzo <perazzo@SLAC.Stanford.edu> SLAC - GLAST I&T/Online"
00014 __date__     = ("$Date: 2004/08/24 23:20:56 $").split(' ')[1]
00015 __version__  = "$Revision: 2.1 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__  = "SLAC"
00018
00019 import LATTE.copyright_SLAC
00020
00021 import LATTE.client.gOptions as gOptions
00022 import LATTE.client.gCmdCli as gCmdCli
00023 import LATTE.database.gAEM as gAEM
00024
00025 def test_twoclients():
00026   options = gOptions.Options(['server'])
00027   try:
00028     options.parse()
00029   except Exception, msg:
00030     options.usage(str(msg))
00031     return
00032
00033   clienta = gCmdCli.CmdCli()
00034   aema = gAEM.GAEM(clienta, None)
00035   clienta.connect(options.server)
00036
00037   clientb = gCmdCli.CmdCli()
00038   aemb = gAEM.GAEM(clientb, None)
00039   clientb.connect(options.server)
00040
00041   value = 0xbadbeef
00042   aema.trgseq = value
00043   aemb.trgseq = value
00044   print "aem.trgseq wrote 0x%x" %(value)
00045
00046   rdvaluea = aema.trgseq
00047   print "aem.trgseq returned 0x%x" %(rdvaluea)
00048
00049   clienta.disconnect()
00050
00051   rdvalueb = aemb.trgseq
00052   print "aem.trgseq returned 0x%x" %(rdvalueb)
00053
00054   clientb.disconnect()
00055
00056 if __name__ == '__main__':
00057   test_twoclients()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAcd.py Source File

tests / apps

testAppAcd.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example ACD test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.3 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import                      threading
00020 import logging       as     log
00021 import                      time
00022
00023 from   LATTE.runcontrol.rcTransitions import rcTransitions
00024 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00025
00026 from support.SimpleGasuExample   import *
00027
00028 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00029 #  the userApplication example to get the number of self triggers to take.
00030 class userArgument(ArgumentImpl):
00031   "GUI for getting the user to input some sort of value"
00032   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00033     ArgumentImpl.__init__(self, parent, name, modal, fl)
00034     self.__value = 0
00035     self.setCaption("Hello world!")
00036
00037   def OKButtonClicked(self):
00038     self.__value = int(self.ArgumentList.text().latin1())
00039     self.close()
00040
00041   def CancelButtonClicked(self):
00042     self.__value = None
00043     self.close()
00044
00045   def getValue(self, caption):
00046     self.setCaption(caption)
00047     self.show()
00048     self.exec_loop()
00049     return self.__value
00050
00051 class userArgText(object):
00052   "Text user interface for getting the user to input some sort of value"
00053   def __init__(self):
00054     pass
00055
00056   def getValue(self, caption):
00057     return int(raw_input("%s: " % (caption)))
00058
00059
00060 #  Example application implementation.
00061 #  Note that the name of the class must be userApplication.
00062 #  Look at rcTransitions for names of other transition methods that can be used.
00063 class userApplication(rcTransitions):
00064   "Implmentation class for a user application"
00065   def __init__(self, rc, userId, debug):
00066     rcTransitions.__init__(self, rc, userId, debug)
00067     log.debug("userApplication.__init__()")
00068     self.__eventSem    = threading.Semaphore(0)
00069     self.__cmdSynchSem = threading.Semaphore(0)
00070
00071   def getName(self):
00072     return __name__
00073
00074   def setup(self):
00075     log.debug("userApplication.setup()")
00076
00077     if self.rc is None:
00078       self.__arg = userArgText()
00079     else:
00080       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00081
00082     aem = self.lat.downAEM()
00083
00084     arc0 = aem.downARC(2)
00085     arc0.cmd_reset = 1
00086
00087     # configure the AEM
00088     aem.configuration = 0x20ffb
00089
00090     # The FREE-sim simulates 4 ADCs with fixed outputs of 1112, 1113, 1114, 1115 (decimal).
00091     # The FREE-sim simulates 4 ADCs with fixed outputs of 0x458, 0x459, 0x45a, 0x45b (hex).
00092     # adjust the PHA thresholds to turn these on/off.
00093
00094     # config all PHAs on
00095
00096     thresh_on  = 0x20
00097     thresh_off = 0xFFF
00098
00099     arc0.PHA_THRESHOLD_0  = thresh_on
00100     arc0.PHA_THRESHOLD_1  = thresh_on
00101     arc0.PHA_THRESHOLD_2  = thresh_on
00102     arc0.PHA_THRESHOLD_3  = thresh_on
00103     arc0.PHA_THRESHOLD_4  = thresh_on
00104     arc0.PHA_THRESHOLD_5  = thresh_on
00105     arc0.PHA_THRESHOLD_6  = thresh_on
00106     arc0.PHA_THRESHOLD_7  = thresh_on
00107     arc0.PHA_THRESHOLD_8  = thresh_on
00108     arc0.PHA_THRESHOLD_9  = thresh_on
00109     arc0.PHA_THRESHOLD_10 = thresh_on
00110     arc0.PHA_THRESHOLD_11 = thresh_on
00111     arc0.PHA_THRESHOLD_12 = thresh_on
00112     arc0.PHA_THRESHOLD_13 = thresh_on
00113     arc0.PHA_THRESHOLD_14 = thresh_on
00114     arc0.PHA_THRESHOLD_15 = thresh_on
00115     arc0.PHA_THRESHOLD_16 = thresh_on
00116     arc0.PHA_THRESHOLD_17 = thresh_on
00117     arc0.veto_width      = 5
00118
00119     # set MAX_PHA
00120     arc0.MAX_PHA = 18
00121
00122     # set PHA ENABLE bits
00123     arc0.PHA_EN_0 = 0xffff
00124     arc0.PHA_EN_1 = 0x3
00125
00126     # set VETO ENABLE bits
00127     arc0.VETO_EN_0 = 0xffff
00128     arc0.VETO_EN_1 = 0x3
00129
00130     afeb = arc0.allAFE()
00131     afeb.CONFIGURATION = 0x0032
00132     afeb.VETO_DAC = 0x20
00133     afeb.HLD_DAC = 0x30
00134     afeb.TCI_DAC = 0x20
00135     afeb.bias_dac     = 3
00136
00137     aem.TRGSEQ = 0x5f
00138
00139     # Two choices for the trigger, GEM and MiniGLT
00140     if self.lat.existsGEM():
00141       self.trigger( SimpleGasuExample() )
00142     else:
00143       raise AssertionError, "ACD cannot take meaningful triggers without a GEM"
00144
00145     # A state transition can be rejected by not returning None
00146     return None
00147
00148   def startRun(self):
00149     log.debug("userApplication.startRun()")
00150
00151     caption = "Enter number of triggers to take"
00152     if self.rc is None:
00153       cnt = self.__arg.getValue(caption)
00154     else:
00155       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00156
00157     # The user pressed 'Cancel'
00158     if cnt is None:  return -1
00159     self.__cnt = cnt
00160
00161     # Spawn a thread to synchronize commands with events
00162     self.__cmdSynchQuit = False
00163
00164     # A state transition can be rejected by not returning None
00165     return None
00166
00167   def stopRun(self):
00168     log.debug("userApplication.stopRun()")
00169
00170     self.__cmdSynchQuit = True
00171     self.__eventSem.release()
00172
00173    # The STOP_RUN transition can not be rejected
00174
00175   def resume(self):
00176     log.debug("userApplication.resume()")
00177
00178     # Issue self trigger to make up for the one that was lost during PAUSE
00179     self.trigger().solicit()
00180
00181     return None
00182
00183   def stop (self):
00184     log.debug("userApplication.stop()")
00185
00186     return self.stopRun()
00187
00188   def teardown(self):
00189     log.debug("userApplication.teardown()")
00190     # Allow the C++ object to be deleted
00191     if self.gui is not None and self.__arg is not None:
00192       self.__arg.deleteLater()
00193
00194   def process(self, (status, buffer)):
00195     "Method called back for each data event taken"
00196     ###log.debug("userApplication.process()")
00197
00198     evtCli = self.evtCli
00199
00200     if status != 0:
00201       if evtCli.isGGLTStatus():
00202         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00203       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00204         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00205       self.__eventSem.release()
00206       return
00207     try:
00208       # In the future this event may contain additional data
00209       if evtCli.isSweepEvent(): return
00210     except:
00211       # Event summary word inaccessible, handle the bad event here
00212       log.exception("")
00213       return
00214
00215     if evtCli.setCurrentContribution(evtCli.AEM) != -1:
00216       evtCli.evDumpEventAEM()
00217       print "AEM Veto Hit Vectors:"
00218       j = 0
00219       for hitVect in evtCli.evt.aem.vetoHitVectors:
00220         print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00221         j+=1
00222       print "\nAEM Accept Hit Vectors:"
00223       j = 0
00224       for hitVect in evtCli.evt.aem.acceptHitVectors:
00225         print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00226         j+=1
00227       print "\nAEM PHA Values:"
00228       j = 0
00229       for (cbl, phas) in evtCli.evt.aem.PHA.items():
00230         for pha in phas:
00231           print "\tCable: %02d - PHA Value: 0x%04x" % (cbl, pha.ui)
00232
00233     # Get next event triggered
00234     self.__eventSem.release()
00235
00236   #def __commandSynch(self, count):
00237   def commandSynch(self):
00238     "Method called by the command synchronization task"
00239     import time
00240     trigger  = self.trigger()
00241     eventSem = self.__eventSem
00242     # Drain the semaphore release count
00243     # Handles the case when the stop run release collided with a trigger release
00244     while eventSem.acquire(0):  pass
00245
00246     t0  = time.time()
00247
00248     # Compensate for the extra CMD_SELF_TRIGGER below
00249     cnt = 1
00250     count = self.__cnt
00251
00252     # Wait for START_RUN to enable triggers
00253     trigger.waitForMaskEnable()
00254
00255     trigger.solicit()                   # Issue an internal trigger
00256     eventSem.acquire()                  # Wait for the event to be processed
00257
00258     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00259
00260     while cnt < count and not self.__cmdSynchQuit:
00261       cnt += 1
00262       trigger.solicit()                 # Issue an internal trigger
00263       time.sleep(.0001)
00264       eventSem.acquire()                # Wait for the event to be processed
00265       #trigger.disable()                # Disable triggers
00266       # Do stuff
00267       #trigger.enable()                 # Enable triggers
00268
00269     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00270
00271     if t1 is None:
00272       t1 = t0
00273     if t2 is None:
00274       t2 = time.time()
00275     dT = t2 - t1
00276     if dT == 0.0:  dT = 0.000001
00277     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00278              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00279
00280     # Get out of waiting when in suite or standalone mode
00281     self.sync()
00282
00283     # execute the GUI functions for stopRun, just in case
00284     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00285       if self.rc is not None:
00286         self.rc.doStop()
00287
00288   def wait(self):
00289     self.__cmdSynchSem.acquire()
00290
00291   def sync(self):
00292     if __name__ == "__main__" or self.isRunFromSuite():
00293       self.__cmdSynchSem.release()
00294
00295
00296 # Standalone mode:
00297 if __name__ == "__main__":
00298   import os
00299   log.basicConfig()
00300   log.getLogger("").setLevel(log.DEBUG)
00301   ua = userApplication(None, 321, 0)
00302   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleAemSchema.xml'))
00303   ua.rcStartRun()
00304   ua.wait()
00305   ua.rcStopRun()
00306   ua.rcTeardown()
00307
00308 # History:
00309 #     $Log: testAppAcd.py,v $
00310 #     Revision 1.3  2004/10/22 20:32:48  stuvi
00311 #     Fixed log.exception()
00312 #
00313 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00314 #     Updated for LATTE 4.
00315 #     All hippo functions go through the Qt GUI bridge now.
00316 #
00317 #     Revision 1.1  2004/08/04 22:17:25  stuvi
00318 #     no message
00319 #
00320 #     Revision 1.19  2004/05/13 18:55:09  stuvi
00321 #     HLD_EN_0 and HLD_EN_1 no longer exist.
00322 #
00323 #     Revision 1.18  2004/05/03 21:19:47  stuvi
00324 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00325 #
00326 #     Revision 1.17  2004/04/20 22:09:34  stuvi
00327 #     Changed ACD to AEM.
00328 #
00329 #     Revision 1.16  2004/04/17 02:22:54  stuvi
00330 #     Added teardown() to delete the C++ object for the userArgument
00331 #
00332 #     Revision 1.15  2004/04/08 01:57:39  panetta
00333 #     make testAppAcd work with GASU
00334 #
00335 #     Revision 1.14  2004/03/20 03:45:26  stuvi
00336 #     Updated code to use the new PHA object.
00337 #
00338 #     Revision 1.13  2004/03/10 22:24:50  panetta
00339 #     Upgraded trigger interface.
00340 #     Removed dependencies on self.glt.
00341 #
00342 #     Revision 1.12  2004/02/20 03:20:23  stuvi
00343 #     Added handling of the sweep events and error checking to the process() method,
00344 #
00345 #     Revision 1.11  2004/02/04 03:42:14  stuvi
00346 #     Changes required to make the scripts work with the new FSM engine.
00347 #
00348 #     Revision 1.10  2003/12/11 19:54:45  stuvi
00349 #     Suite and standalone mode modifications
00350 #
00351 #     Revision 1.9  2003/11/04 18:30:52  panetta
00352 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00353 #
00354 #     Revision 1.8  2003/10/31 01:09:37  panetta
00355 #     1)  Moved register writes from startRun to setup
00356 #     2)  Added GLT enabling logic to __commandSynch
00357 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00358 #
00359 #     Revision 1.7  2003/08/14 02:36:03  stuvi
00360 #     Fixed aem ui value access
00361 #
00362 #     Revision 1.6  2003/07/17 00:01:35  stuvi
00363 #     no message
00364 #
00365 #     Revision 1.5  2003/04/01 21:04:59  stuvi
00366 #     Fixed event count discrepancy when the run is stopped in the middle.
00367 #
00368 #     Revision 1.4  2003/03/31 19:28:53  stuvi
00369 #     Fixed name
00370 #
00371 #     Revision 1.3  2003/03/26 21:59:36  stuvi
00372 #     Fixed standalone mode
00373 #
00374 #     Revision 1.2  2003/03/25 04:53:52  stuvi
00375 #     Made sure the semaphores are drained
00376 #
00377 #     Revision 1.1  2003/03/11 21:20:55  stuvi
00378 #     Moved from RunControl directory
00379 #
00380 #     Revision 1.10  2003/02/21 04:08:03  stuvi
00381 #     Updated for G2
00382 #
00383 #     Revision 1.9  2003/02/06 05:19:38  claus
00384 #     Added resume; StopRun bug fix
00385 #
00386 #     Revision 1.8  2002/12/11 21:18:07  stuvi
00387 #     Changed glt register assignments to bit field assignments
00388 #
00389 #     Revision 1.7  2002/12/10 01:09:58  claus
00390 #     Added path and changed schema/config file for stand-alone mode
00391 #
00392 #     Revision 1.6  2002/12/04 01:59:23  claus
00393 #     Added message logging
00394 #
00395 #     Revision 1.5  2002/12/02 17:17:09  claus
00396 #     Added provision to allow application to run stand-alone
00397 #
00398 #     Revision 1.4  2002/11/28 02:02:03  claus
00399 #     Shuffled constructor arguments
00400 #
00401 #     Revision 1.3  2002/11/27 23:49:27  claus
00402 #     Initialize semaphore with zero count
00403 #
00404 #     Revision 1.2  2002/11/27 23:37:17  stuvi
00405 #     Added semaphor release
00406 #
00407 #     Revision 1.1  2002/11/27 05:02:47  claus
00408 #     Initial version of Run Control
00409 #
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAcdScalers.py Source File

tests / apps

testAppAcdScalers.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/10/22 20:32:48 $").split(' ')[1]
00014 __version__  = "$Revision: 1.5 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import threading
00021 import logging        as     log
00022 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00023 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00024 import time
00025
00026 from LATTE.trigger.TrgUsingTiles      import TrgUsingTiles
00027 from LATTE.trigger.NullObjects        import NoInputsEnabled
00028 from LATTE.trigger.rcTrgFunctions     import rcTrgEngines
00029 from LATTE.trigger.TrgEngines         import *
00030 from LATTE.trigger.rcTrgMiniGLT       import rcTrgMiniGLT
00031 from LATTE.trigger.TrgMiniGLT         import MiniGLTTrgConditionsValue
00032 from LATTE.trigger.TrgConditionsValue import *
00033
00034 import LDF
00035 import LDF.LDFdumper as LD
00036
00037 TRUE  = (0 < 1)
00038 FALSE = not TRUE
00039
00040 ASC_CONTRIBUTION = 0x101f2010
00041
00042 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00043 #  the userApplication example to get the number of self triggers to take.
00044 class userArgument(ArgumentImpl):
00045   "GUI for getting the user to input some sort of value."
00046   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00047     ArgumentImpl.__init__(self, parent, name, modal, fl)
00048     self.__value = 0
00049     self.setCaption("Hello world!")
00050
00051   def OKButtonClicked(self):
00052     self.__value = int(self.ArgumentList.text().latin1())
00053     self.close()
00054
00055   def CancelButtonClicked(self):
00056     self.__value = None
00057     self.close()
00058
00059   def getValue(self, caption):
00060     self.setCaption(caption)
00061     self.show()
00062     self.exec_loop()
00063     return self.__value
00064
00065 class userArgText(object):
00066   "Text user interface for getting the user to input some sort of value"
00067   def __init__(self):
00068     pass
00069
00070   def getValue(self, caption):
00071     return int(raw_input("%s: " % (caption)))
00072
00073
00074 #  Example application implementation.
00075 #  Note that the name of the class must be userApplication.
00076 #  Look at rcTransitions for names of other transition methods that can be used.
00077 class userApplication(rcTransitions):
00078   "Implmentation class for a user application"
00079   def __init__(self, rc, userId, debug):
00080     rcTransitions.__init__(self, rc, userId, debug)
00081     log.debug("userApplication.__init__()")
00082     self.__eventSem    = threading.Semaphore(0)
00083     self.__cmdSynchSem = threading.Semaphore(0)
00084
00085     self.__lci         = LDF.LATcomponentIterator()
00086     self.__lconti      = LDBI_LATcontributionIterator(self.__lci)
00087     self.__ldbi        = LDF.LATdataBufferIterator(self.__lconti)
00088
00089   def getName(self):
00090     return __name__
00091
00092   def setup(self):
00093     log.debug("userApplication.setup()")
00094
00095     if self.rc is None:
00096       self.__arg = userArgText()
00097     else:
00098       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00099
00100     # Two choices for the trigger, GEM and MiniGLT
00101     if self.lat.existsGEM():
00102       self.trigger( SimpleGasuExample() )
00103     else:
00104       self.trigger( MiniGLTExample() )
00105
00106     self.rc.common().getOCS().evtHandlerSendAcdScalers(1,0)
00107
00108     # A state transition can be rejected by not returning None
00109     return None
00110
00111   def startRun(self):
00112     log.debug("userApplication.startRun()")
00113
00114     caption = "Enter number of triggers to take"
00115     if self.rc is None:
00116       cnt = self.__arg.getValue(caption)
00117     else:
00118       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00119
00120     # The user pressed 'Cancel'
00121     if cnt is None:  return -1
00122     self.__cnt = cnt
00123
00124     # Spawn a thread to synchronize commands with events
00125     self.__cmdSynchQuit = FALSE
00126
00127     # A state transition can be rejected by not returning None
00128     return None
00129
00130   def stopRun(self):
00131     log.debug("userApplication.stopRun()")
00132
00133     self.setCompletionStatus(rcTransitions.COMPL_STATUS_PASSED)
00134     self.__cmdSynchQuit = TRUE
00135     self.__eventSem.release()
00136
00137     # The STOP_RUN transition can not be rejected
00138
00139   def resume(self):
00140     log.debug("userApplication.resume()")
00141
00142     # Issue self trigger to make up for the one that was lost during PAUSE
00143     self.trigger().solicit()
00144
00145     return None
00146
00147   def stop(self):
00148     log.debug("userApplication.stop()")
00149
00150     return self.stopRun()
00151
00152   def teardown(self):
00153     log.debug("userApplication.teardown()")
00154     # Allow the C++ object to be deleted
00155     if self.gui is not None and self.__arg is not None:
00156       self.__arg.deleteLater()
00157
00158   def process(self, (status, buffer)):
00159     "Method called back for each data event taken"
00160     #log.debug("userApplication.process()")
00161
00162     evtCli = self.evtCli
00163
00164     if status != 0:
00165       if evtCli.isGGLTStatus():
00166         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00167       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00168         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00169       self.__eventSem.release()
00170       return
00171     try:
00172       # In the future this event may contain additional data
00173       if evtCli.isSweepEvent():
00174         print "SWEEP!!!"
00175         return
00176     except:
00177       # Event summary word inaccessible, handle the bad event here
00178       log.exception("")
00179       return
00180
00181     count = self.__ldbi.iterate(buffer, len(buffer))
00182
00183     self.__eventSem.release()
00184
00185
00186   #def __commandSynch(self, count):
00187   def commandSynch(self):
00188     "Method called by the command synchronization task"
00189     import time
00190     trigger  = self.trigger()
00191     eventSem = self.__eventSem
00192
00193     # Drain the semaphore release count
00194     # Handles the case when the stop run release collided with a trigger release
00195     while eventSem.acquire(0):  pass
00196
00197     t0  = time.time()
00198
00199     # Compensate for the extra CMD_SELF_TRIGGER below
00200     cnt   = 0
00201     count = self.__cnt
00202
00203     # Wait for START_RUN to enable triggers
00204     trigger.waitForMaskEnable()
00205
00206     while cnt < count and not self.__cmdSynchQuit:
00207       cnt += 1
00208       print "solicit"
00209       trigger.solicit()                 # Issue an internal trigger
00210       time.sleep(10)
00211
00212     # Get out of waiting when in suite or standalone mode
00213     self.sync()
00214
00215     # execute the GUI functions for stopRun, just in case
00216     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00217       if self.rc is not None:
00218         self.rc.doStop()
00219
00220   def wait(self):
00221     self.__cmdSynchSem.acquire()
00222
00223   def sync(self):
00224     if __name__ == "__main__" or self.isRunFromSuite():
00225       self.__cmdSynchSem.release()
00226
00227
00228 class MiniGLTExample(rcTrgMiniGLT):
00229   """\brief MiniTower example interface to MiniGLT
00230   """
00231   def __init__(self):
00232     """\brief AcdTriggerExample constructor
00233     """
00234     rcTrgMiniGLT.__init__(self)
00235     self.__engines      = MiniGLTTrgEngines()
00236     self.__conditions   = MiniGLTSolicitedCondition()
00237
00238   def engines(self):
00239     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00240     """
00241     return self.__engines
00242
00243   def conditions(self):
00244     """\brief Implementation of conditions 'pure virtual' method from TrgAbstract
00245     """
00246     return self.__conditions
00247
00248 # implementaions of user-level trigger classes
00249 class MiniGLTTrgEngines(rcTrgEngines):
00250   def __init__(self):
00251     rcTrgEngines.__init__(self)
00252     # There are two engines in the MiniGLT.
00253     # 0) User defined engine
00254     # 15) Marker engine
00255
00256     eng = MiniGLTSolicitedEngine()
00257     self.replaceEngine(0,eng)
00258
00259 class MiniGLTSolicitedEngine(TrgEngine):
00260   """This class defines an engine which reads out the detector
00261      whenever there is a solicited trigger.
00262      This engine is not prescaled.
00263   """
00264   def __init__(self):
00265     TrgEngine.__init__(self)
00266     self.__request = MarkerTrgReadout()
00267   def participate(self,conditionsValue):
00268     # This function relies on the programmer's knowledge that the
00269     # conditionsValue is a bitfield.
00270     cond = MiniGLTSolicitedCondition()
00271     condValue = cond.value()
00272     if conditionsValue & condValue:
00273       return True
00274     return False
00275   def prescale(self):
00276     return 0
00277   def request(self):
00278     return self.__request
00279
00280 class MiniGLTSolicitedCondition(MiniGLTTrgConditionsValue):
00281   """ Define a condition where only the CNO trigger is asserted
00282   """
00283   def __init__(self):
00284     MiniGLTTrgConditionsValue.__init__(self)
00285   def solicited(self):
00286     return True
00287
00288 class MarkerTrgReadout(TrgReadout):
00289   """\brief MarkerTrgReadout class definition
00290
00291   Directs a module to send to its Front-End Electronics a command sequence
00292   which is composed only of the TACK command. This command will trigger
00293   a readout of the module's Front-End Electronics.
00294   Zero suppression is turned on.
00295   Marker is set to 1
00296   """
00297   def __init__(self):
00298     """\brief TrgReadout constructor
00299     """
00300     TrgReadout.__init__(self)
00301
00302   def zeroSuppress(self):    return True
00303   def marker(self):          return 1
00304
00305
00306 class LDBI_LATcontributionIterator(LDF.LDBI_LATcontributionIterator):
00307   """\brief LDBI_LATcontributionIterator implementation
00308
00309   Reimplements virtual UDF contribution handler from LATcontributionIterator
00310   This implementation checks if the contribution ID corresponds to a
00311   ACD Software Counter contribution, and parses it out into summary,
00312   cno and tile pieces.  If the contribution ID does not match the
00313   expected ID, an error message is given, and the parser returns -1, an
00314   error.
00315   """
00316   def __init__(self, lci):
00317     LDF.LDBI_LATcontributionIterator.__init__(self, lci)
00318   def UDF(self, contrib, nextContrib):
00319     if contrib.identity().value() == ASC_CONTRIBUTION:
00320       print "Hey!  I saw an ASC_CONTRIBUTION"
00321       import Numeric
00322       buffer = Numeric.fromstring(contrib.rawData(), 'i')
00323
00324       CNOstart = 16
00325       GECstart = CNOstart + 24
00326
00327       JJsummary      = buffer[0:CNOstart]
00328       JJcnoCounts    = buffer[CNOstart:GECstart]
00329       JJascHists     = buffer[GECstart:]
00330       print "JJsummary: ", JJsummary
00331       # Now something needs to be done with these.
00332
00333     else:
00334       msg = "Unexpected LATcontribution id 0x%08x seen in event" % contrib.identity().value()
00335       log.error(msg)
00336       return -1
00337
00338     return 0
00339
00340
00341 class SimpleGasuExample(TrgUsingTiles):
00342   """\brief SimpleGASU example interface to GEM
00343   """
00344   def __init__(self):
00345     """\brief SimpleGasuExample constructor
00346     """
00347     TrgUsingTiles.__init__(self)
00348     self.__inputEnables             = SGETrgInputEnables()
00349     self.__engines                  = SGETrgEngines()
00350     self.__conditions               = FullCondition()
00351
00352   # Pure Virtual function implementation
00353   def conditions(self):
00354     return self.__conditions
00355
00356   def coincidences(self):
00357     """\brief Implementation of coincdences 'pure virtual' method from TrgUsingTiles
00358     """
00359     # it just so happens that the roi is exactly the same as the coincidences object
00360     return self.roi()
00361
00362   def inputEnables(self):
00363     """\brief Implementation of inputEnables 'pure virtual' method from TrgAbstract
00364     """
00365     return self.__inputEnables
00366
00367   def engines(self):
00368     """\brief Implementation of engines 'pure virtual' method from TrgAbstract
00369     """
00370     return self.__engines
00371
00372   def useAcdAsTrigger(self):
00373     """Use ACD as a trigger source.
00374     """
00375     return True
00376
00377 # implementaions of user-level trigger classes
00378
00379 class SGETrgInputEnables(NoInputsEnabled):
00380   """Class SGETrgInputEnables:
00381      Empty Input enables.
00382   """
00383   def __init__(self):
00384     NoInputsEnabled.__init__(self)
00385
00386
00387 class SGETrgEngines(rcTrgEngines):
00388   """Class MyTrgEngines:
00389      Initialize the trigger engines list class.
00390   """
00391   def __init__(self):
00392     rcTrgEngines.__init__(self)
00393     eng1 = SolicitedEngine()
00394     eng2 = FullEngine()
00395     self.replaceEngine(0,eng1)
00396     self.replaceEngine(1,eng2)
00397
00398 class SolicitedEngine(TrgEngine):
00399   """This class defines an engine which reads out the detector
00400      whenever there is a solicited trigger.
00401      This engine is not prescaled.
00402   """
00403   def __init__(self):
00404     TrgEngine.__init__(self)
00405     self.__request = MarkerTrgReadout()
00406   def participate(self,conditionsValue):
00407     # This function relies on the programmer's knowledge that the
00408     # conditionsValue is a bitfield.
00409     cond = SolicitedCondition()
00410     if conditionsValue & cond.value():
00411       return True
00412     return False
00413   def prescale(self):
00414     return 0
00415   def request(self):
00416     return self.__request
00417
00418 class SolicitedCondition(TrgConditionsValue):
00419   """ Define a condition where only the solicited trigger is asserted
00420   """
00421   def __init__(self):
00422     TrgConditionsValue.__init__(self)
00423   def solicited(self):
00424     return True
00425
00426 class FullCondition(TrgConditionsValue):
00427   """ Define a condition where only the solicited trigger is asserted
00428   """
00429   def __init__(self):
00430     TrgConditionsValue.__init__(self)
00431   def solicited(self):   return True
00432   def roi(self):         return True
00433   def calLow(self):      return True
00434   def calHigh(self):     return True
00435   def tkr(self):         return True
00436   def periodic(self):    return True
00437   def cno(self):         return True
00438   def external(self):    return True
00439
00440 class FullEngine(TrgEngine):
00441   def __init__(self):
00442     TrgEngine.__init__(self)
00443     self.__request = TrgReadout()
00444   def participate(self,conditionsValue):
00445     # This function relies on the programmer's knowledge that the
00446     # conditionsValue is a bitfield.
00447     cond = FullCondition()
00448     if conditionsValue & cond.value():
00449       return True
00450     return False
00451   def prescale(self):    return 0
00452   def request(self):     return self.__request
00453
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppAlarm.py Source File

tests / apps

testAppAlarm.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application that tests rule alarms, use with simpleAlarmSchema.xml"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import threading
00021 import logging        as     log
00022 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00023 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00024 #from   rcHouseKeeping import rcHouseKeeping
00025 import time
00026
00027 from support.SimpleGasuExample   import *
00028 from support.MiniGLTExample      import *
00029
00030 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00031 #  the userApplication example to get the number of self triggers to take.
00032 class userArgument(ArgumentImpl):
00033   "GUI for getting the user to input some sort of value."
00034   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00035     ArgumentImpl.__init__(self, parent, name, modal, fl)
00036     self.__value = 0
00037     self.setCaption("Hello world!")
00038
00039   def OKButtonClicked(self):
00040     self.__value = int(self.ArgumentList.text().latin1())
00041     self.close()
00042
00043   def CancelButtonClicked(self):
00044     self.__value = None
00045     self.close()
00046
00047   def getValue(self, caption):
00048     self.setCaption(caption)
00049     self.show()
00050     self.exec_loop()
00051     return self.__value
00052
00053 class userArgText(object):
00054   "Text user interface for getting the user to input some sort of value"
00055   def __init__(self):
00056     pass
00057
00058   def getValue(self, caption):
00059     return int(raw_input("%s: " % (caption)))
00060
00061
00062 #  Example application implementation.
00063 #  Note that the name of the class must be userApplication.
00064 #  Look at rcTransitions for names of other transition methods that can be used.
00065 class userApplication(rcTransitions):
00066   "Implmentation class for a user application"
00067   def __init__(self, rc, userId, debug):
00068     rcTransitions.__init__(self, rc, userId, debug)
00069     log.debug("userApplication.__init__()")
00070     self.__eventSem    = threading.Semaphore(0)
00071     self.__cmdSynchSem = threading.Semaphore(0)
00072
00073   def getName(self):
00074     return __name__
00075
00076   def setup(self):
00077     log.debug("userApplication.setup()")
00078
00079     if self.rc is None:
00080       self.__arg = userArgText()
00081     else:
00082       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00083
00084     tem = self.lat.downTEM(0)
00085
00086     tic = tem.TIC
00087
00088     # Retrieve the global rule list for this schema
00089     rules = self.lat.getRules()
00090
00091     # Access any of the rule objects and call clearAllActions() to clear actions.
00092     rules.values()[0].clearAllActions()
00093     # For the adc_tem_digital_3_3v register, associate the voltageMonitor rule's
00094     # yellowAction with the yellowAlarm1 method.
00095     rules['voltageMonitor'].registerAction('yellowAction', self.yellowAlarm1,
00096                                             sender=tic.regs['adc_tem_digital_3_3v'])
00097     # For all other registers using the voltageMonitor rule, associate this rule's
00098     # yellowAction with the yellowAlarm2 method.
00099     rules['tempMonitor'].registerAction('yellowAction', self.yellowAlarm2)
00100     # For all registers using the voltageMonitor rule, associate this rule's
00101     # redAction with the redAlarm method.
00102     rules['voltageMonitor'].registerAction('redAction', self.redAlarm)
00103     # The application can unregister any of the actions that it previously
00104     # registered using the following method call.
00105     #rules['voltageMonitor'].unregisterAction('redAction', self.redAlarm)
00106
00107
00108
00109     # reset the TEM since we are going to modify DATA_MASKS
00110     #tem.CMD_RESET = 1
00111
00112     # clear TEM stats reg
00113     tem.COMMAND_RESPONSE = 0
00114
00115     # clear TEM status reg
00116     tem.STATUS = 0
00117
00118     # enable CAL, disable TKR, no diag #  0x10FF for diag
00119     tem.DATA_MASKS = 0x00FF
00120
00121     # TEM config reg # set TEM timeout
00122     tem.CONFIGURATION = 0
00123
00124     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00125     #printf("tem config reg = 0x%08x\n", payload);
00126
00127     # enable output in our GCCCs
00128     # broadcast load of GCCC_REG_CONFIGURATION
00129
00130     bcast_ccc = tem.allCCC()
00131     bcast_ccc.CONFIGURATION = 0x80000000L
00132
00133     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00134     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00135     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00136     ccc0 = tem.downCCC(0) # O$GCCC_00
00137     ccc0.LAYER_MASK_0 = 0xFFFF0000L
00138     ccc0.LAYER_MASK_1 = 0xFFFF000FL
00139     ccc2 = tem.downCCC(2) # O$GCCC_02
00140     ccc2.LAYER_MASK_0 = 0xFFFF0000L
00141     ccc2.LAYER_MASK_1 = 0xFFFF0000L
00142
00143     # config GCFE for calibration -- range 0 first
00144     bcast_cfe = tem.allCCC().allCRC().allCFE()
00145     bcast_cfe.CONFIG_0    = 0x00
00146     bcast_cfe.CONFIG_1    = 0x36
00147     bcast_cfe.FLE_DAC     = 0x55
00148     bcast_cfe.FHE_DAC     = 0x55
00149     bcast_cfe.LOG_ACPT    = 0x10
00150     bcast_cfe.RNG_ULD_DAC = 0x7F
00151     bcast_cfe.REF_DAC     = 0x7f
00152
00153     # config GCRC for calibration
00154     bcast_crc = tem.allCCC().allCRC()
00155     bcast_crc.DELAY_1 = 0xFF
00156     bcast_crc.DELAY_2 = 0xFF
00157     bcast_crc.DELAY_3 = 0xFF
00158     bcast_crc.DAC = 0x42FE
00159     bcast_crc.DAC = 0x42FE
00160
00161     # large timeouts for all GCCCs
00162     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00163     bcast_ccc.EVENT_TIMEOUTS = 0x0
00164     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00165     #printf("gccc register event timeouts = 0x%08x\n", payload);
00166
00167     # Register environment variables for housekeeping
00168     #hsk = self.getHSK()
00169     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00170     #hsk.addEnvRegs(regs)
00171     #hsk.setUpdateInterval(1)
00172
00173     # Two choices for the trigger, GEM and MiniGLT
00174     if self.lat.existsGEM():
00175       self.trigger( SimpleGasuExample() )
00176     else:
00177       self.trigger( MiniGLTExample() )
00178
00179     # A state transition can be rejected by not returning None
00180     return None
00181
00182   def startRun(self):
00183     log.debug("userApplication.startRun()")
00184
00185     caption = "Enter number of triggers to take"
00186     if self.rc is None:
00187       cnt = self.__arg.getValue(caption)
00188     else:
00189       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00190
00191     # The user pressed 'Cancel'
00192     if cnt is None:  return -1
00193     self.__cnt = cnt
00194
00195     # Spawn a thread to synchronize commands with events
00196     self.__cmdSynchQuit = False
00197
00198     # A state transition can be rejected by not returning None
00199     return None
00200
00201   def stopRun(self):
00202     log.debug("userApplication.stopRun()")
00203
00204     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00205     self.__cmdSynchQuit = True
00206     self.__eventSem.release()
00207
00208     # The STOP_RUN transition can not be rejected
00209
00210   def resume(self):
00211     log.debug("userApplication.resume()")
00212
00213     # Issue self trigger to make up for the one that was lost during PAUSE
00214     self.trigger().solicit()
00215
00216     return None
00217
00218   def stop(self):
00219     log.debug("userApplication.stop()")
00220     return self.stopRun()
00221
00222   def process(self, (status, buffer)):
00223     "Method called back for each data event taken"
00224     #log.debug("userApplication.process()")
00225
00226     evtCli = self.evtCli
00227
00228     if status != 0:
00229       if evtCli.isGGLTStatus():
00230         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00231       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00232         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00233       self.__eventSem.release()
00234       return
00235     try:
00236       # In the future this event may contain additional data
00237       if evtCli.isSweepEvent(): return
00238     except:
00239       # Event summary word inaccessible, handle the bad event here
00240       import gutil
00241       gutil.logException()
00242       return
00243
00244     #evtCli.evDumpCAL_LogAccepts();
00245     ###print ""
00246     #evtCli.evDumpCAL_Logs();
00247     #~ #print ""
00248     #~ #evtCli.evDumpTKR()
00249     ###evtCli.evDumpTEM_Error()
00250     ###evtCli.evDumpDiagnostic()
00251     ###for acc in evtCli.evt.CAL_LogAccepts:
00252     ###  print "CAL Log Accept: 0x%08x" % acc.ui
00253
00254     ###for data in evtCli.evt.CAL_LogData:
00255     ###  print "CAL Log Data: 0x%08x" % data.ui
00256     #~ sum = evtCli.evt.summary
00257     ###evtCli.evDumpSummary()
00258
00259     # Get next event triggered
00260     self.__eventSem.release()
00261
00262
00263   #def __commandSynch(self, count):
00264   def commandSynch(self):
00265     "Method called by the command synchronization task"
00266     import time
00267     trigger  = self.trigger()
00268     eventSem = self.__eventSem
00269
00270     # Drain the semaphore release count
00271     # Handles the case when the stop run release collided with a trigger release
00272     while eventSem.acquire(0):  pass
00273
00274     t0  = time.time()
00275
00276     # Compensate for the extra CMD_SELF_TRIGGER below
00277     cnt   = 1
00278     count = self.__cnt
00279
00280     # Wait for START_RUN to enable triggers
00281     trigger.waitForMaskEnable()
00282
00283     trigger.solicit()                   # Issue an internal trigger
00284     eventSem.acquire()                  # Wait for the event to be processed
00285
00286     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00287
00288     while cnt < count and not self.__cmdSynchQuit:
00289       cnt += 1
00290       trigger.solicit()                 # Issue an internal trigger
00291       time.sleep(.0001)
00292       eventSem.acquire()                # Wait for the event to be processed
00293       #trigger.disable()                # Disable triggers
00294       # Do stuff
00295       #trigger.enable()                 # Enable triggers
00296
00297     t2 = trigger.getTimeStamp()                 # Get the last trigger timestamp
00298
00299     if t1 is None:
00300       t1 = t0
00301     if t2 is None:
00302       t2 = time.time()
00303     dT = t2 - t1
00304     if dT == 0.0:  dT = 0.000001
00305     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00306              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00307
00308     # Get out of waiting when in suite or standalone mode
00309     self.sync()
00310
00311     # execute the GUI functions for stopRun, just in case
00312     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00313       if self.rc is not None:
00314         self.rc.doStop()
00315
00316   def wait(self):
00317     self.__cmdSynchSem.acquire()
00318
00319   def sync(self):
00320     if __name__ == "__main__" or self.isRunFromSuite():
00321       self.__cmdSynchSem.release()
00322
00323   def yellowAlarm1(self, value, signal, sender, sendNode):
00324     print "Yellow Alarm #1!", value, signal, "from", sender.getName()
00325
00326   def yellowAlarm2(self, value, signal, sender, sendNode):
00327     print sender
00328     print sender.getName()
00329     print sendNode
00330     print "Yellow Alarm #2!", value, signal, "from", sender.getName()
00331
00332   def redAlarm(self, value, signal, sender):
00333     print "Red Alarm!", value, signal, "from", sender.getName()
00334
00335
00336 # Standalone mode:
00337 if __name__ == "__main__":
00338   import os
00339   log.basicConfig()
00340   log.getLogger("").setLevel(log.DEBUG)
00341   ua = userApplication(None, 321, 0)
00342   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00343   ua.rcStartRun()
00344   ua.wait()
00345   ua.rcStopRun()
00346   ua.rcTeardown()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppArchiver.py Source File

tests / apps

testAppArchiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example script to test custom archiver testArchiver"
00012 __author__   = "S. Tuvi <STuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.2.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import threading
00021 import logging        as     log
00022 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00023 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00024 #from   rcHouseKeeping import rcHouseKeeping
00025 import time
00026 import support.testArchiver as testArchiver
00027
00028 from support.SimpleGasuExample   import *
00029 from support.MiniGLTExample      import *
00030
00031 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00032 #  the userApplication example to get the number of self triggers to take.
00033 class userArgument(ArgumentImpl):
00034   "GUI for getting the user to input some sort of value."
00035   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00036     ArgumentImpl.__init__(self, parent, name, modal, fl)
00037     self.__value = 0
00038     self.setCaption("Hello world!")
00039
00040   def OKButtonClicked(self):
00041     self.__value = int(self.ArgumentList.text().latin1())
00042     self.close()
00043
00044   def CancelButtonClicked(self):
00045     self.__value = None
00046     self.close()
00047
00048   def getValue(self, caption):
00049     self.setCaption(caption)
00050     self.show()
00051     self.exec_loop()
00052     return self.__value
00053
00054 class userArgText(object):
00055   "Text user interface for getting the user to input some sort of value"
00056   def __init__(self):
00057     pass
00058
00059   def getValue(self, caption):
00060     return int(raw_input("%s: " % (caption)))
00061
00062
00063 #  Example application implementation.
00064 #  Note that the name of the class must be userApplication.
00065 #  Look at rcTransitions for names of other transition methods that can be used.
00066 class userApplication(rcTransitions):
00067   "Implmentation class for a user application"
00068   def __init__(self, rc, userId, debug):
00069     rcTransitions.__init__(self, rc, userId, debug)
00070     log.debug("userApplication.__init__()")
00071     self.__eventSem    = threading.Semaphore(0)
00072     self.__cmdSynchSem = threading.Semaphore(0)
00073     self.setArchiverClass(testArchiver.testArchiver)
00074
00075   def getName(self):
00076     return __name__
00077
00078   def setup(self):
00079     log.debug("userApplication.setup()")
00080
00081     if self.rc is None:
00082       self.__arg = userArgText()
00083     else:
00084       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00085
00086     tem = self.lat.downTEM(0)
00087
00088     # reset the TEM since we are going to modify DATA_MASKS
00089     #tem.CMD_RESET = 1
00090
00091     # clear TEM stats reg
00092     tem.COMMAND_RESPONSE = 0
00093
00094     # clear TEM status reg
00095     tem.STATUS = 0
00096
00097     # enable CAL, disable TKR, no diag #  0x10FF for diag
00098     tem.DATA_MASKS = 0x00FF
00099
00100     # TEM config reg # set TEM timeout
00101     tem.CONFIGURATION = 0
00102
00103     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00104     #printf("tem config reg = 0x%08x\n", payload);
00105
00106     # enable output in our GCCCs
00107     # broadcast load of GCCC_REG_CONFIGURATION
00108
00109     bcast_ccc = tem.allCCC()
00110     bcast_ccc.CONFIGURATION = 0x80000000L
00111
00112     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00113     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00114     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00115     ccc0 = tem.downCCC(0) # O$GCCC_00
00116     ccc0.LAYER_MASK_0 = 0xFFFF0000L
00117     ccc0.LAYER_MASK_1 = 0xFFFF000FL
00118     ccc2 = tem.downCCC(2) # O$GCCC_02
00119     ccc2.LAYER_MASK_0 = 0xFFFF0000L
00120     ccc2.LAYER_MASK_1 = 0xFFFF0000L
00121
00122     # config GCFE for calibration -- range 0 first
00123     bcast_cfe = tem.allCCC().allCRC().allCFE()
00124     bcast_cfe.CONFIG_0    = 0x00
00125     bcast_cfe.CONFIG_1    = 0x36
00126     bcast_cfe.FLE_DAC     = 0x55
00127     bcast_cfe.FHE_DAC     = 0x55
00128     bcast_cfe.LOG_ACPT    = 0x10
00129     bcast_cfe.RNG_ULD_DAC = 0x7F
00130     bcast_cfe.REF_DAC     = 0x7f
00131
00132     # config GCRC for calibration
00133     bcast_crc = tem.allCCC().allCRC()
00134     bcast_crc.DELAY_1 = 0xFF
00135     bcast_crc.DELAY_2 = 0xFF
00136     bcast_crc.DELAY_3 = 0xFF
00137     bcast_crc.DAC = 0x42FE
00138     bcast_crc.DAC = 0x42FE
00139
00140     # large timeouts for all GCCCs
00141     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00142     bcast_ccc.EVENT_TIMEOUTS = 0x0
00143     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00144     #printf("gccc register event timeouts = 0x%08x\n", payload);
00145
00146     # Register environment variables for housekeeping
00147     #hsk = self.getHSK()
00148     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00149     #hsk.addEnvRegs(regs)
00150     #hsk.setUpdateInterval(1)
00151
00152     # Two choices for the trigger, GEM and MiniGLT
00153     if self.lat.existsGEM():
00154       self.trigger( SimpleGasuExample() )
00155     else:
00156       self.trigger( MiniGLTExample() )
00157
00158     # A state transition can be rejected by not returning None
00159     return None
00160
00161   def startRun(self):
00162     log.debug("userApplication.startRun()")
00163
00164     caption = "Enter number of triggers to take"
00165     if self.rc is None:
00166       cnt = self.__arg.getValue(caption)
00167     else:
00168       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00169
00170     # The user pressed 'Cancel'
00171     if cnt is None:  return -1
00172     self.__cnt = cnt
00173
00174     # Spawn a thread to synchronize commands with events
00175     self.__cmdSynchQuit = False
00176
00177     # Example of how to use the archiver userMethod()
00178     self.getArchiverInstance().userMethod("test1", "test2")
00179
00180     # A state transition can be rejected by not returning None
00181     return None
00182
00183   def stopRun(self):
00184     log.debug("userApplication.stopRun()")
00185
00186     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00187     self.__cmdSynchQuit = True
00188     self.__eventSem.release()
00189     #self.__cmdSynch.join(2.0)
00190     #if self.__cmdSynch.isAlive():
00191     #  log.error("%s.%s: cmdSynch thread did not exit when expected" % \
00192     #            (self.getName(), "stopRun"))
00193
00194     # The STOP_RUN transition can not be rejected
00195
00196   def resume(self):
00197     log.debug("userApplication.resume()")
00198
00199     # Issue self trigger to make up for the one that was lost during PAUSE
00200     self.trigger().solicit()
00201
00202     return None
00203
00204   def stop(self):
00205     log.debug("userApplication.stop()")
00206
00207     return self.stopRun()
00208
00209   def process(self, (status, buffer)):
00210     "Method called back for each data event taken"
00211     #log.debug("userApplication.process()")
00212
00213     evtCli = self.evtCli
00214
00215     if status != 0:
00216       if evtCli.isGGLTStatus():
00217         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00218       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00219         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00220       self.__eventSem.release()
00221       return
00222     try:
00223       # In the future this event may contain additional data
00224       if evtCli.isSweepEvent(): return
00225     except:
00226       # Event summary word inaccessible, handle the bad event here
00227       import gutil
00228       gutil.logException()
00229       return
00230
00231     #evtCli.evDumpCAL_LogAccepts();
00232     ###print ""
00233     #evtCli.evDumpCAL_Logs();
00234     #~ #print ""
00235     #~ #evtCli.evDumpTKR()
00236     ###evtCli.evDumpTEM_Error()
00237     ###evtCli.evDumpDiagnostic()
00238     ###for acc in evtCli.evt.CAL_LogAccepts:
00239     ###  print "CAL Log Accept: 0x%08x" % acc.ui
00240
00241     ###for data in evtCli.evt.CAL_LogData:
00242     ###  print "CAL Log Data: 0x%08x" % data.ui
00243     #~ sum = evtCli.evt.summary
00244     ###evtCli.evDumpSummary()
00245
00246     # Get next event triggered
00247     self.__eventSem.release()
00248
00249
00250   #def __commandSynch(self, count):
00251   def commandSynch(self):
00252     "Method called by the command synchronization task"
00253     import time
00254     trigger  = self.trigger()
00255     eventSem = self.__eventSem
00256
00257     # Drain the semaphore release count
00258     # Handles the case when the stop run release collided with a trigger release
00259     while eventSem.acquire(0):  pass
00260
00261     t0  = time.time()
00262
00263     # Compensate for the extra CMD_SELF_TRIGGER below
00264     cnt   = 1
00265     count = self.__cnt
00266
00267     # Wait for START_RUN to enable triggers
00268     trigger.waitForMaskEnable()
00269
00270     trigger.solicit()                   # Issue an internal trigger
00271     eventSem.acquire()                  # Wait for the event to be processed
00272
00273     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00274
00275     while cnt < count and not self.__cmdSynchQuit:
00276       cnt += 1
00277       trigger.solicit()                 # Issue an internal trigger
00278       time.sleep(.0001)
00279       eventSem.acquire()                # Wait for the event to be processed
00280       #trigger.disable()                # Disable triggers
00281       # Do stuff
00282       #trigger.enable()                 # Enable triggers
00283
00284     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00285
00286     if t1 is None:
00287       t1 = t0
00288     if t2 is None:
00289       t2 = time.time()
00290     dT = t2 - t1
00291     if dT == 0.0:  dT = 0.000001
00292     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00293              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00294
00295     # Get out of waiting when in suite or standalone mode
00296     self.sync()
00297
00298     # execute the GUI functions for stopRun, just in case
00299     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00300       if self.rc is not None:
00301         self.rc.doStop()
00302
00303   def wait(self):
00304     self.__cmdSynchSem.acquire()
00305
00306   def sync(self):
00307     if __name__ == "__main__" or self.isRunFromSuite():
00308       self.__cmdSynchSem.release()
00309
00310
00311 # Standalone mode:
00312 if __name__ == "__main__":
00313   import os
00314   log.basicConfig()
00315   log.getLogger("").setLevel(log.DEBUG)
00316   ua = userApplication(None, 321, 0)
00317   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00318   ua.rcStartRun()
00319   ua.wait()
00320   ua.rcStopRun()
00321   ua.rcTeardown()
00322
00323 # History:
00324 #     $Log: testAppArchiver.py,v $
00325 #     Revision 1.2.2.1  2005/01/22 01:10:59  stuvi
00326 #     Commented out the TEM reset.
00327 #
00328 #     Revision 1.2  2004/08/26 22:35:36  stuvi
00329 #     Converted from LATTE 3
00330 #
00331 #     Revision 1.1  2004/08/26 02:01:23  stuvi
00332 #     Fixed for LATTE 4
00333 #
00334 #     Revision 1.4  2004/05/03 21:19:47  stuvi
00335 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00336 #
00337 #     Revision 1.3  2004/03/10 22:24:50  panetta
00338 #     Upgraded trigger interface.
00339 #     Removed dependencies on self.glt.
00340 #
00341 #     Revision 1.2  2004/03/06 01:18:26  stuvi
00342 #     Added userMethod example
00343 #
00344 #     Revision 1.1  2004/02/20 00:33:44  stuvi
00345 #     Sample testArchiver app and class
00346 #
00347 #
00348
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppCal.py Source File

tests / apps

testAppCal.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.7.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import            threading
00021 import logging as log
00022 import            time
00023
00024 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00025 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00026 #from   rcHouseKeeping import rcHouseKeeping
00027
00028 from support.SimpleGasuExample   import *
00029 from support.MiniGLTExample      import *
00030
00031
00032 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00033 #  the userApplication example to get the number of self triggers to take.
00034 class userArgument(ArgumentImpl):
00035   "GUI for getting the user to input some sort of value."
00036   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00037     ArgumentImpl.__init__(self, parent, name, modal, fl)
00038     self.__value = 0
00039     self.setCaption("Hello world!")
00040
00041   def OKButtonClicked(self):
00042     self.__value = int(self.ArgumentList.text().latin1())
00043     self.close()
00044
00045   def CancelButtonClicked(self):
00046     self.__value = None
00047     self.close()
00048
00049   def getValue(self, caption):
00050     self.setCaption(caption)
00051     self.show()
00052     self.exec_loop()
00053     return self.__value
00054
00055 class userArgText(object):
00056   "Text user interface for getting the user to input some sort of value"
00057   def __init__(self):
00058     pass
00059
00060   def getValue(self, caption):
00061     return int(raw_input("%s: " % (caption)))
00062
00063
00064 #  Example application implementation.
00065 #  Note that the name of the class must be userApplication.
00066 #  Look at rcTransitions for names of other transition methods that can be used.
00067 class userApplication(rcTransitions):
00068   "Implmentation class for a user application"
00069   def __init__(self, rc, userId, debug):
00070     rcTransitions.__init__(self, rc, userId, debug)
00071     log.debug("userApplication.__init__()")
00072     self.__eventSem    = threading.Semaphore(0)
00073     self.__cmdSynchSem = threading.Semaphore(0)
00074
00075   def getName(self):
00076     return __name__
00077
00078   def setup(self):
00079     log.debug("userApplication.setup()")
00080
00081     if self.rc is None:
00082       self.__arg = userArgText()
00083     else:
00084       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00085
00086     tem = self.lat.downTEM(0)
00087
00088     # reset the TEM since we are going to modify DATA_MASKS
00089     #tem.CMD_RESET = 1
00090
00091     # clear TEM stats reg
00092     tem.COMMAND_RESPONSE = 0
00093
00094     # clear TEM status reg
00095     tem.STATUS = 0
00096
00097     # enable CAL, disable TKR, no diag #  0x10FF for diag
00098     tem.DATA_MASKS = 0x10FF
00099
00100     # TEM config reg # set TEM timeout
00101     tem.CONFIGURATION = 0x00000000 # Set primary
00102     #tem.CONFIGURATION = 0x03000000 # Set redundant
00103
00104     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00105     #printf("tem config reg = 0x%08x\n", payload);
00106
00107     # enable output in our GCCCs
00108     # broadcast load of GCCC_REG_CONFIGURATION
00109
00110     bcast_ccc = tem.allCCC()
00111     bcast_ccc.CONFIGURATION = 0x80000000L
00112
00113     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00114     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00115     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00116     ccc0 = tem.downCCC(0) # O$GCCC_00
00117     ccc0.LAYER_MASK_0 = 0xFFFF0000L
00118     ccc0.LAYER_MASK_1 = 0xFFFF000FL
00119     ccc2 = tem.downCCC(2) # O$GCCC_02
00120     ccc2.LAYER_MASK_0 = 0xFFFF0000L
00121     ccc2.LAYER_MASK_1 = 0xFFFF0000L
00122
00123     # config GCFE for calibration -- range 0 first
00124     #bcast_cfe = tem.allCCC().allCRC().allCFE()
00125     #bcast_cfe.CONFIG_0    = 0x00
00126     #bcast_cfe.CONFIG_1    = 0x36
00127     #bcast_cfe.FLE_DAC     = 0x55
00128     #bcast_cfe.FHE_DAC     = 0x55
00129     #bcast_cfe.LOG_ACPT    = 0x10
00130     #bcast_cfe.RNG_ULD_DAC = 0x7F
00131     #bcast_cfe.REF_DAC     = 0x7f
00132
00133     # config GCRC for calibration
00134     #bcast_crc = tem.allCCC().allCRC()
00135     #bcast_crc.DELAY_1 = 0xFF
00136     #bcast_crc.DELAY_2 = 0xFF
00137     #bcast_crc.DELAY_3 = 0xFF
00138     #bcast_crc.DAC = 0x42FE
00139     #bcast_crc.DAC = 0x42FE
00140
00141     # large timeouts for all GCCCs
00142     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00143     bcast_ccc.EVENT_TIMEOUTS = 0x0
00144     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00145     #printf("gccc register event timeouts = 0x%08x\n", payload);
00146
00147     # Register environment variables for housekeeping
00148     #hsk = self.getHSK()
00149     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00150     #hsk.addEnvRegs(regs)
00151     #hsk.setUpdateInterval(1)
00152
00153     # Two choices for the trigger, GEM and MiniGLT
00154     if self.lat.existsGEM():
00155       self.trigger( SimpleGasuExample() )
00156     else:
00157       self.trigger( MiniGLTExample() )
00158
00159     # A state transition can be rejected by not returning None
00160     return None
00161
00162   def startRun(self):
00163     log.debug("userApplication.startRun()")
00164
00165     caption = "Enter number of triggers to take"
00166     if self.rc is None:
00167       cnt = self.__arg.getValue(caption)
00168     else:
00169       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00170
00171     # The user pressed 'Cancel'
00172     if cnt is None:  return -1
00173     self.__cnt = cnt
00174
00175     if self.rc is not None:
00176       self.getParameterVerifier().add(caption, cnt)
00177
00178     # Spawn a thread to synchronize commands with events
00179     self.__cmdSynchQuit = False
00180
00181     # A state transition can be rejected by not returning None
00182     return None
00183
00184   def stopRun(self):
00185     log.debug("userApplication.stopRun()")
00186
00187     if self.getBadEvents() == 0 and self.getErrorEvents() == 0:
00188       self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00189     else:
00190       self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00191
00192     self.__cmdSynchQuit = True
00193     self.__eventSem.release()
00194
00195     # The STOP_RUN transition can not be rejected
00196
00197   def resume(self):
00198     log.debug("userApplication.resume()")
00199
00200     # Issue self trigger to make up for the one that was lost during PAUSE
00201     self.trigger().solicit()
00202
00203     return None
00204
00205   def stop(self):
00206     log.debug("userApplication.stop()")
00207
00208     return self.stopRun()
00209
00210   def teardown(self):
00211     log.debug("userApplication.teardown()")
00212     # Allow the C++ object to be deleted
00213     if self.rc is not None and self.__arg is not None:
00214       self.__arg.deleteLater()
00215
00216   def process(self, (status, buffer)):
00217     "Method called back for each data event taken"
00218     #log.debug("userApplication.process()")
00219
00220     evtCli = self.evtCli
00221
00222     if status != 0:
00223       if evtCli.isGGLTStatus():
00224         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00225       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00226         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00227       self.__eventSem.release()
00228       return
00229     try:
00230       # In the future this event may contain additional data
00231       if evtCli.isSweepEvent(): return
00232     except:
00233       # Event summary word inaccessible, handle the bad event here
00234       log.exception("")
00235       return
00236
00237     evtCli.setCurrentContribution(evtCli.TEM0)
00238     evtCli.evDumpCAL_LogAccepts()
00239     ###print ""
00240     evtCli.evDumpCAL_Logs();
00241     #~ #print ""
00242     evtCli.evDumpTKR()
00243     evtCli.evDumpTEM_Error()
00244     evtCli.evDumpDiagnostic()
00245     #for acc in evtCli.evt.CAL_LogAccepts:
00246     #  print "CAL Log Accept: 0x%08x" % acc.ui
00247
00248     #for layerLogData in evtCli.evt.CAL_LogData:
00249     #  print "CAL Log Data: %s 0x%08x" % layerLogData.layer, layerLogData.data
00250     #  sum = evtCli.evt.summary
00251     ###evtCli.evDumpSummary()
00252
00253     #for errorGCCC in evtCli.evt.errGCCCmsg:
00254     #  errGCCC = errorGCCC.errGCCC
00255     #  print "GCCC", errorGCCC.gccc, "Error:", hex(errGCCC.errParm), hex(errGCCC.sweepNum), hex(errGCCC.errType)
00256
00257     #for calDiag in evtCli.evt.diag.cal:
00258     #  print calDiag.layer, calDiag.gccc, calDiag.negLayerEnd, calDiag.posLayerEnd
00259     #print
00260     #for tkrDiag in evtCli.evt.diag.tkr:
00261     #  print tkrDiag.gtcc, tkrDiag.trgRequests
00262
00263     # Get next event triggered
00264     self.__eventSem.release()
00265
00266
00267   #def __commandSynch(self, count):
00268   def commandSynch(self):
00269     "Method called by the command synchronization task"
00270     import time
00271     trigger  = self.trigger()
00272     eventSem = self.__eventSem
00273
00274     # Drain the semaphore release count
00275     # Handles the case when the stop run release collided with a trigger release
00276     while eventSem.acquire(0):  pass
00277
00278     t0  = time.time()
00279
00280     # Compensate for the extra CMD_SELF_TRIGGER below
00281     cnt   = 1
00282     count = self.__cnt
00283
00284     # Wait for START_RUN to enable triggers
00285     trigger.waitForMaskEnable()
00286
00287     trigger.solicit()                   # Issue an internal trigger
00288     eventSem.acquire()                  # Wait for the event to be processed
00289
00290     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00291     while cnt < count and not self.__cmdSynchQuit:
00292       cnt += 1
00293       trigger.solicit()                 # Issue an internal trigger
00294       time.sleep(.0001)
00295       eventSem.acquire()                # Wait for the event to be processed
00296       #trigger.disable()                # Disable triggers
00297       # Do stuff
00298       #trigger.enable()                 # Enable triggers
00299
00300     t2 = trigger.getTimeStamp()                 # Get the last trigger timestamp
00301
00302     if t1 is None:
00303       t1 = t0
00304     if t2 is None:
00305       t2 = time.time()
00306     dT = t2 - t1
00307     if dT == 0.0:  dT = 0.000001
00308     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00309              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00310
00311     # Get out of waiting when in suite or standalone mode
00312     self.sync()
00313
00314     # execute the GUI functions for stopRun, just in case
00315     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00316       if self.rc is not None:
00317         self.rc.doStop()
00318
00319   def wait(self):
00320     self.__cmdSynchSem.acquire()
00321
00322   def sync(self):
00323     if __name__ == "__main__" or self.isRunFromSuite():
00324       self.__cmdSynchSem.release()
00325
00326
00327 # Standalone mode:
00328 if __name__ == "__main__":
00329   from LATTE.runcontrol.RunControlCommon import RunControlCommon
00330
00331   rcCommon = RunControlCommon()
00332   rcCommon.initialize()
00333   rcCommon.setLoggingLevel("INFO")
00334   rcCommon.connect()
00335   ua = userApplication(None, 321, rcCommon)
00336   ua.rcSetup()
00337   ua.rcStartRun()
00338   ua.wait()
00339   ua.rcStopRun()
00340   ua.rcTeardown()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppCal_dg.py Source File

tests / apps

testAppCal_dg.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.6.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import            threading
00021 import logging as log
00022 import            time
00023
00024 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00025 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00026 #from   rcHouseKeeping import rcHouseKeeping
00027
00028 from support.SimpleGasuExample   import *
00029 from support.MiniGLTExample      import *
00030
00031 import LDF
00032 import Numeric
00033
00034
00035 OneDgContrib = True
00036
00037 class CAL_LATcontribution(object):
00038   def __init__(self, buf):
00039     # For application level contributions, offset the typeID value from the
00040     # subsystem base values defined in LDF/include/LATidentity.h.
00041     #   The primary value identifies the structure of the contribution.
00042     #   The secondary value identifies the version of that structure.
00043     primary   = LDF.LATprimaryId().Base_CAL   + 0
00044     secondary = LDF.LATsecondaryId().Base_CAL + 0
00045
00046     # Pad the contributions with zeros to force it to be an integer number of
00047     # longwords in length
00048     remainder = len(buf) & 0x3
00049     if remainder:  buf += "\x00\x00\x00"[0:4-remainder]
00050
00051     typeId = LDF.LATtypeId(primary, secondary)
00052     length = len(buf)                   # 16 bit contribution length in bytes
00053     opaque = 0                          # User defined 16 bit quantity
00054
00055     assert (length < 0x10000), "LATcontribution length is > 64K: %d" % (length)
00056
00057     # Need to prepend some space for the LATcontribution header items
00058     # I would prefer to hide this in the LDF package, but don't know how, now
00059     buf = (len(LDF.LATcontribution()) * " ") + buf
00060
00061     # The following may byteswap
00062     self.__contrib = LDF.LATcontribution.create(typeId, length, opaque, buf)
00063
00064   def __str__(self):
00065     """Helper python method so that we can take the str() of this object"""
00066     return self.__contrib.string()
00067
00068   def __len__(self):
00069     """Helper python method so that we can take the len() of this object"""
00070     return self.__contrib.length()
00071
00072
00073 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00074 #  the userApplication example to get the number of self triggers to take.
00075 class userArgument(ArgumentImpl):
00076   "GUI for getting the user to input some sort of value."
00077   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00078     ArgumentImpl.__init__(self, parent, name, modal, fl)
00079     self.__value = 0
00080     self.setCaption("Hello world!")
00081
00082   def OKButtonClicked(self):
00083     self.__value = int(self.ArgumentList.text().latin1())
00084     self.close()
00085
00086   def CancelButtonClicked(self):
00087     self.__value = None
00088     self.close()
00089
00090   def getValue(self, caption):
00091     self.setCaption(caption)
00092     self.show()
00093     self.exec_loop()
00094     return self.__value
00095
00096 class userArgText(object):
00097   "Text user interface for getting the user to input some sort of value"
00098   def __init__(self):
00099     pass
00100
00101   def getValue(self, caption):
00102     return int(raw_input("%s: " % (caption)))
00103
00104
00105 #  Example application implementation.
00106 #  Note that the name of the class must be userApplication.
00107 #  Look at rcTransitions for names of other transition methods that can be used.
00108 class userApplication(rcTransitions):
00109   "Implmentation class for a user application"
00110   def __init__(self, rc, userId, debug):
00111     rcTransitions.__init__(self, rc, userId, debug)
00112     log.debug("userApplication.__init__()")
00113     self.__eventSem    = threading.Semaphore(0)
00114     self.__cmdSynchSem = threading.Semaphore(0)
00115
00116   def getName(self):
00117     return __name__
00118
00119   def setup(self):
00120     log.debug("userApplication.setup()")
00121
00122     if self.rc is None:
00123       self.__arg = userArgText()
00124     else:
00125       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00126
00127     tem = self.lat.downTEM(0)
00128
00129     # reset the TEM since we are going to modify DATA_MASKS
00130     #tem.CMD_RESET = 1
00131
00132     # clear TEM stats reg
00133     tem.COMMAND_RESPONSE = 0
00134
00135     # clear TEM status reg
00136     tem.STATUS = 0
00137
00138     # enable CAL, disable TKR, no diag #  0x10FF for diag
00139     tem.DATA_MASKS = 0x10FF
00140
00141     # TEM config reg # set TEM timeout
00142     tem.CONFIGURATION = 0
00143
00144     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00145     #printf("tem config reg = 0x%08x\n", payload);
00146
00147     # enable output in our GCCCs
00148     # broadcast load of GCCC_REG_CONFIGURATION
00149
00150     bcast_ccc = tem.allCCC()
00151     bcast_ccc.CONFIGURATION = 0x80000000L
00152
00153     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00154     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00155     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00156     ccc0 = tem.downCCC(0) # O$GCCC_00
00157     ccc0.LAYER_MASK_0 = 0xFFFF0000L
00158     ccc0.LAYER_MASK_1 = 0xFFFF000FL
00159     ccc2 = tem.downCCC(2) # O$GCCC_02
00160     ccc2.LAYER_MASK_0 = 0xFFFF0000L
00161     ccc2.LAYER_MASK_1 = 0xFFFF0000L
00162
00163     # config GCFE for calibration -- range 0 first
00164     bcast_cfe = tem.allCCC().allCRC().allCFE()
00165     bcast_cfe.CONFIG_0    = 0x00
00166     bcast_cfe.CONFIG_1    = 0x36
00167     bcast_cfe.FLE_DAC     = 0x55
00168     bcast_cfe.FHE_DAC     = 0x55
00169     bcast_cfe.LOG_ACPT    = 0x10
00170     bcast_cfe.RNG_ULD_DAC = 0x7F
00171     bcast_cfe.REF_DAC     = 0x7f
00172
00173     # config GCRC for calibration
00174     bcast_crc = tem.allCCC().allCRC()
00175     bcast_crc.DELAY_1 = 0xFF
00176     bcast_crc.DELAY_2 = 0xFF
00177     bcast_crc.DELAY_3 = 0xFF
00178     bcast_crc.DAC = 0x42FE
00179     bcast_crc.DAC = 0x42FE
00180
00181     # large timeouts for all GCCCs
00182     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00183     bcast_ccc.EVENT_TIMEOUTS = 0x0
00184     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00185     #printf("gccc register event timeouts = 0x%08x\n", payload);
00186
00187     # Register environment variables for housekeeping
00188     #hsk = self.getHSK()
00189     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00190     #hsk.addEnvRegs(regs)
00191     #hsk.setUpdateInterval(1)
00192
00193     # Two choices for the trigger, GEM and MiniGLT
00194     if self.lat.existsGEM():
00195       self.trigger( SimpleGasuExample() )
00196     else:
00197       self.trigger( MiniGLTExample() )
00198
00199     # Override the default event handler
00200     self.selectEventHandler(rcTransitions.EVENT_HANDLER_LEAN_AND_MEAN)
00201
00202     # A state transition can be rejected by not returning None
00203     return None
00204
00205   def startRun(self):
00206     log.debug("userApplication.startRun()")
00207
00208     caption = "Enter number of triggers to take"
00209     if self.rc is None:
00210       cnt = self.__arg.getValue(caption)
00211     else:
00212       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00213
00214     # The user pressed 'Cancel'
00215     if cnt is None:  return -1
00216     self.__cnt = cnt
00217
00218     self.getParameterVerifier().add(caption, cnt)
00219
00220     calHdr  = "HDR:"
00221     calHdr += "LEN=%d:" % (9999)
00222     calHdr += "VERSION=%2d:" % (6)
00223     calHdr += "USERSEGMENT:"
00224     calHdr += "{'comment':"
00225     calHdr += " 'Comprehensive Functional Test (CPT) on CAL FM101 at 20.0 MHz and 3.3 volts', "
00226     calHdr += "'tackdelay': %d, " % (70)
00227     calHdr += "'leGain': %d, " % (5)
00228     calHdr += "'heGain': %d, " % (0)
00229     calHdr += "'app': '%s', " % (self.getName())  #'calf_mu_optical')
00230     calHdr += "'feconfig_0': %d, " % (517)
00231
00232     array  = Numeric.array_str(2*Numeric.ones((4,4,12)))
00233     calHdr += "'feconfig_1list': array(%s), " % (array)
00234
00235     calHdr += "'fourRngFlag': %s, " % ('True')
00236     calHdr += "'suppression': %s" % ('False')
00237     calHdr += "}"
00238
00239     if OneDgContrib:
00240       # Two methods to add a LATcontribution to the data stream:
00241       # 1)  Build a datagram containing the CAL_LATcontribution
00242       archiver = self.getArchiverInstance()
00243       if archiver is not None and not archiver.isClosed():
00244         import struct
00245         lc = CAL_LATcontribution(calHdr)
00246         dg = LDF.LATdatagram()
00247         dg = struct.pack('>2L', dg.ID, len(dg) + len(lc))
00248         archiver.writeTuple((dg, str(lc)))
00249     else:
00250       # 2) Prebuild the CAL_LATcontribution and prepend it to the first event
00251       #    in process(), below.
00252       self.__latCon = str(CAL_LATcontribution(calHdr))
00253
00254     # Spawn a thread to synchronize commands with events
00255     self.__cmdSynchQuit = False
00256
00257     # A state transition can be rejected by not returning None
00258     return None
00259
00260   def stopRun(self):
00261     log.debug("userApplication.stopRun()")
00262
00263     if self.getBadEvents() == 0 and self.getErrorEvents() == 0:
00264       self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00265     else:
00266       self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00267
00268     self.__cmdSynchQuit = True
00269     self.__eventSem.release()
00270
00271     # The STOP_RUN transition can not be rejected
00272
00273   def resume(self):
00274     log.debug("userApplication.resume()")
00275
00276     # Issue self trigger to make up for the one that was lost during PAUSE
00277     self.trigger().solicit()
00278
00279     return None
00280
00281   def stop(self):
00282     log.debug("userApplication.stop()")
00283
00284     return self.stopRun()
00285
00286   def teardown(self):
00287     log.debug("userApplication.teardown()")
00288     # Allow the C++ object to be deleted
00289     if self.rc is not None and self.__arg is not None:
00290       self.__arg.deleteLater()
00291
00292   def process(self, (status, latDatagram)):
00293     "Method called back for each data event taken"
00294     #log.debug("userApplication.process()")
00295
00296     #evtCli = self.evtCli
00297
00298     if status != 0:
00299       #if evtCli.isGGLTStatus():
00300       log.error("%s.process(): GGLT_STATUS = 0x%08x = %d", self.getName(), status, status)
00301       #log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00302       #elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00303       #  log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00304     #try:
00305     #  # In the future this event may contain additional data
00306     #  if evtCli.isSweepEvent(): return
00307     #except:
00308     #  # Event summary word inaccessible, handle the bad event here
00309     #  log.exception()
00310     #  return
00311
00312     # Get next event triggered
00313     #self.__eventSem.release()
00314
00315     if not OneDgContrib:
00316       if self.__latCon is None:  return
00317
00318       latCon = self.__latCon
00319       self.__latCon = None
00320       return latCon, latDatagram[8:]
00321
00322   def commandSynch(self):
00323     "Method called by the command synchronization task"
00324     import time
00325     trigger  = self.trigger()
00326     eventSem = self.__eventSem
00327
00328     # Drain the semaphore release count
00329     # Handles the case when the stop run release collided with a trigger release
00330     while eventSem.acquire(0):  pass
00331
00332     t0  = time.time()
00333
00334     # Compensate for the extra CMD_SELF_TRIGGER below
00335     cnt   = 1
00336     count = self.__cnt
00337
00338     # Wait for START_RUN to enable triggers
00339     trigger.waitForMaskEnable()
00340
00341     trigger.solicit()                   # Issue an internal trigger
00342     #eventSem.acquire()                  # Wait for the event to be processed
00343
00344     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00345     while cnt < count and not self.__cmdSynchQuit:
00346       cnt += 1
00347       trigger.solicit()                 # Issue an internal trigger
00348       time.sleep(.0001)
00349       #eventSem.acquire()                # Wait for the event to be processed
00350       #trigger.disable()                # Disable triggers
00351       # Do stuff
00352       #trigger.enable()                 # Enable triggers
00353
00354     t2 = trigger.getTimeStamp()                 # Get the last trigger timestamp
00355
00356     if t1 is None:
00357       t1 = t0
00358     if t2 is None:
00359       t2 = time.time()
00360     dT = t2 - t1
00361     if dT == 0.0:  dT = 0.000001
00362     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00363              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00364
00365     # Get out of waiting when in suite or standalone mode
00366     self.sync()
00367
00368     # execute the GUI functions for stopRun, just in case
00369     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00370       if self.rc is not None:
00371         self.rc.doStop()
00372
00373   def wait(self):
00374     self.__cmdSynchSem.acquire()
00375
00376   def sync(self):
00377     if __name__ == "__main__" or self.isRunFromSuite():
00378       self.__cmdSynchSem.release()
00379
00380
00381 # Standalone mode:
00382 if __name__ == "__main__":
00383   import os
00384   log.basicConfig()
00385   log.getLogger("").setLevel(log.DEBUG)
00386   ua = userApplication(None, 321, 0)
00387   prefs = {'datasave': 1, 'datadir':os.path.join(os.environ['ONLINE_ROOT'],'temp')}
00388   ua.setPrefs(prefs)
00389   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00390   ua.rcStartRun()
00391   ua.wait()
00392   ua.rcStopRun()
00393   ua.rcTeardown()
00394
00395 # History:
00396 #     $Log: testAppCal_dg.py,v $
00397 #     Revision 1.6.2.1  2005/01/22 01:10:59  stuvi
00398 #     Commented out the TEM reset.
00399 #
00400 #     Revision 1.6  2004/11/01 23:09:39  claus
00401 #     Added a comment.
00402 #
00403 #     Revision 1.5  2004/10/30 01:52:20  stuvi
00404 #     Check if the archiver is None before accessing it.
00405 #
00406 #     Revision 1.4  2004/10/25 02:44:43  panetta
00407 #     Fixes regarding byteswapping and error contribution
00408 #
00409 #     Revision 1.3  2004/10/23 23:50:33  claus
00410 #     Added completionStatus logic.
00411 #
00412 #     Revision 1.2  2004/10/18 01:00:19  claus
00413 #     Provided switch between 2 examples of adding custom LATcontributions.
00414 #
00415 #     Revision 1.4  2004/08/31 03:13:38  stuvi
00416 #     Integrated the parameter verifier with Run Control
00417 #
00418 #     Revision 1.3  2004/08/18 18:00:15  stuvi
00419 #     Updated for LATTE 4.
00420 #     All hippo functions go through the Qt GUI bridge now.
00421 #
00422 #     Revision 1.2  2004/08/13 04:46:22  claus
00423 #     Got rid of obsolete TRUE and FALSE declarations.
00424 #
00425 #     Revision 1.1  2004/07/28 21:24:00  stuvi
00426 #     Added testAppCal and its supporting classes.
00427 #
00428 #     Revision 1.28  2004/07/09 23:14:17  stuvi
00429 #     Added "operatorobj" preference that contains the rcUser object and left the "operator" preference to contain the user name.
00430 #
00431 #     Revision 1.27  2004/05/03 22:49:36  stuvi
00432 #     Added commented out code example that demonstrates how to access the CAL and TKR diagnostics contributions.
00433 #
00434 #     Revision 1.26  2004/05/03 21:19:47  stuvi
00435 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00436 #
00437 #     Revision 1.25  2004/04/21 21:05:29  stuvi
00438 #     Added an example of how to pass the preferences using the setPrefs method when running in standalone mode.
00439 #
00440 #     Revision 1.24  2004/04/17 02:23:48  stuvi
00441 #     Added teardown() to delete the C++ object for the userArgument
00442 #     Fixed LogData parsing based on the evtCli changes
00443 #
00444 #     Revision 1.23  2004/03/31 01:01:19  stuvi
00445 #     Added commented code on how to parse the error contribution.
00446 #
00447 #     Revision 1.22  2004/03/10 22:24:51  panetta
00448 #     Upgraded trigger interface.
00449 #     Removed dependencies on self.glt.
00450 #
00451 #     Revision 1.21  2004/03/04 23:08:47  stuvi
00452 #     Removed glt.destination assignment
00453 #
00454 #     Revision 1.20  2004/02/20 03:20:23  stuvi
00455 #     Added handling of the sweep events and error checking to the process() method,
00456 #
00457 #     Revision 1.19  2004/02/13 03:13:25  stuvi
00458 #     Sweep events are also sent to user script's process event now, so added code to handle the case.
00459 #
00460 #     Revision 1.18  2004/02/02 23:14:00  stuvi
00461 #     Changes required to make the scripts work with the new FSM engine.
00462 #
00463 #     Revision 1.17  2004/01/30 04:33:44  claus
00464 #     Updated for transitions not running in the GUI thread.
00465 #     New commandSynch handling.
00466 #
00467 #     Revision 1.16  2003/12/19 02:05:26  stuvi
00468 #     Added support for creating and updating GUIs from a suite
00469 #
00470 #     Revision 1.15  2003/12/11 02:22:35  stuvi
00471 #     Suite and standalone mode modifications
00472 #
00473 #     Revision 1.14  2003/12/11 01:53:16  stuvi
00474 #     Modified code to support suites.
00475 #
00476 #     Revision 1.13  2003/11/25 02:16:12  stuvi
00477 #     Modified according to the current test setup to generate some results
00478 #
00479 #     Revision 1.12  2003/11/04 04:25:11  stuvi
00480 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00481 #
00482 #     Revision 1.11  2003/10/31 01:09:37  panetta
00483 #     1)  Moved register writes from startRun to setup
00484 #     2)  Added GLT enabling logic to __commandSynch
00485 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00486 #
00487 #     Revision 1.10  2003/10/28 03:17:34  stuvi
00488 #     Added support for calculating the event rate correctly using the new GLT behaviour.
00489 #
00490 #     Revision 1.9  2003/08/21 21:13:38  stuvi
00491 #     no message
00492 #
00493 #     Revision 1.8  2003/07/17 00:01:35  stuvi
00494 #     no message
00495 #
00496 #     Revision 1.7  2003/06/13 23:26:24  stuvi
00497 #     Added TEM reset
00498 #
00499 #     Revision 1.6  2003/04/12 02:38:34  stuvi
00500 #     Added Cancel button handler to argument class
00501 #
00502 #     Revision 1.5  2003/04/09 00:45:15  stuvi
00503 #     Commented out references to DATA_MASKS register which should not be touched during script execution.
00504 #
00505 #     Revision 1.4  2003/04/01 21:04:59  stuvi
00506 #     Fixed event count discrepancy when the run is stopped in the middle.
00507 #
00508 #     Revision 1.3  2003/03/31 19:23:44  stuvi
00509 #     Fixed name
00510 #
00511 #     Revision 1.2  2003/03/26 21:59:36  stuvi
00512 #     Fixed standalone mode
00513 #
00514 #     Revision 1.1  2003/03/11 21:20:55  stuvi
00515 #     Moved from RunControl directory
00516 #
00517 #     Revision 1.8  2003/02/06 05:19:38  claus
00518 #     Added resume; StopRun bug fix
00519 #
00520 #     Revision 1.7  2003/02/06 04:14:35  claus
00521 #     Fixed StopRun bug
00522 #
00523 #     Revision 1.6  2002/12/11 21:18:07  stuvi
00524 #     Changed glt register assignments to bit field assignments
00525 #
00526 #     Revision 1.5  2002/12/10 01:09:58  claus
00527 #     Added path and changed schema/config file for stand-alone mode
00528 #
00529 #     Revision 1.4  2002/12/04 01:59:23  claus
00530 #     Added message logging
00531 #
00532 #     Revision 1.3  2002/12/02 17:17:09  claus
00533 #     Added provision to allow application to run stand-alone
00534 #
00535 #     Revision 1.2  2002/11/28 02:02:04  claus
00536 #     Shuffled constructor arguments
00537 #
00538 #     Revision 1.1  2002/11/27 05:02:48  claus
00539 #     Initial version of Run Control
00540 #
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvt.py Source File

tests / apps

testAppEvt.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example EBF event handling test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "2/25/2003"
00014 __version__  = "$Revision: 1.3.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 # History:
00020 #     $Log: testAppEvt.py,v $
00021 #     Revision 1.3.2.1  2005/01/22 01:10:59  stuvi
00022 #     Commented out the TEM reset.
00023 #
00024 #     Revision 1.3  2004/10/22 20:32:48  stuvi
00025 #     Fixed log.exception()
00026 #
00027 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00028 #     Updated for LATTE 4.
00029 #     All hippo functions go through the Qt GUI bridge now.
00030 #
00031 #     Revision 1.1  2004/08/07 02:10:53  stuvi
00032 #     no message
00033 #
00034 #     Revision 1.24  2004/05/03 21:19:47  stuvi
00035 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00036 #
00037 #     Revision 1.23  2004/04/06 21:57:03  claus
00038 #     Better handling of unsigneds > 0x7fffffff.
00039 #
00040 #     Revision 1.22  2004/04/03 02:17:45  claus
00041 #     Updated to use LDF and new interface.
00042 #
00043 #     Revision 1.21  2004/03/10 22:24:51  panetta
00044 #     Upgraded trigger interface.
00045 #     Removed dependencies on self.glt.
00046 #
00047 #     Revision 1.20  2004/02/20 03:20:23  stuvi
00048 #     Added handling of the sweep events and error checking to the process() method,
00049 #
00050 #     Revision 1.19  2004/02/02 23:14:00  stuvi
00051 #     Changes required to make the scripts work with the new FSM engine.
00052 #
00053 #     Revision 1.18  2003/12/11 02:22:35  stuvi
00054 #     Suite and standalone mode modifications
00055 #
00056 #     Revision 1.17  2003/12/11 01:53:16  stuvi
00057 #     Modified code to support suites.
00058 #
00059 #     Revision 1.16  2003/11/04 18:30:53  panetta
00060 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00061 #
00062 #     Revision 1.15  2003/10/31 01:09:37  panetta
00063 #     1)  Moved register writes from startRun to setup
00064 #     2)  Added GLT enabling logic to __commandSynch
00065 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00066 #
00067 #     Revision 1.14  2003/06/13 23:26:24  stuvi
00068 #     Added TEM reset
00069 #
00070 #     Revision 1.13  2003/04/09 00:45:15  stuvi
00071 #     Commented out references to DATA_MASKS register which should not be touched during script execution.
00072 #
00073 #     Revision 1.12  2003/04/01 21:05:00  stuvi
00074 #     Fixed event count discrepancy when the run is stopped in the middle.
00075 #
00076 #     Revision 1.11  2003/03/26 21:59:36  stuvi
00077 #     Fixed standalone mode
00078 #
00079 #     Revision 1.10  2003/03/25 04:57:32  stuvi
00080 #     Made sure the semaphores are drained
00081 #
00082 #     Revision 1.9  2003/03/13 00:07:23  claus
00083 #     Interface changes plus additional dumps
00084 #
00085 #     Revision 1.8  2003/03/12 17:50:19  claus
00086 #     Merged changes
00087 #
00088 #     Revision 1.7  2003/03/12 04:14:24  stuvi
00089 #     Added contribution iteration and stamp display
00090 #
00091 #     Revision 1.6  2003/03/12 02:59:35  stuvi
00092 #     God rid of extra readEvent()
00093 #
00094 #     Revision 1.5  2003/03/11 22:46:38  stuvi
00095 #     Commented out EBF stuff, put back the old code
00096 #
00097 #     Revision 1.4  2003/03/11 04:08:35  stuvi
00098 #     Using EBF with backward compatibility example
00099 #
00100 #     Revision 1.3  2003/03/11 00:43:26  claus
00101 #     Debugging evtCli.dat...
00102 #
00103 #     Revision 1.2  2003/03/10 22:09:43  claus
00104 #     Added commented out lines in process for working in the old way
00105 #
00106 #     Revision 1.1  2003/03/10 21:50:56  claus
00107 #     Example of a RunControl application accessing event data through EBF
00108 #
00109 #
00110
00111 import                      threading
00112 import logging       as     log
00113 from   LATTE.runcontrol.rcTransitions import rcTransitions
00114 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00115 import                      time
00116
00117 from support.SimpleGasuExample   import *
00118 from support.MiniGLTExample      import *
00119
00120 TRUE  = (0 < 1)
00121 FALSE = not TRUE
00122
00123 import LDF
00124
00125 import Numeric as Numeric
00126
00127
00128 def _unsigned(arg):
00129   """\brief Convert an unsigned int argument to an unsigned long
00130
00131   This funtion exists to help format unsigned ints greater than 0x7fffffff,
00132   which in Python 2.4 and up will be displayed as signed strings.
00133   """
00134   return arg & (2L * sys.maxint + 1)
00135
00136
00137 class myLATcomponentIterator(LDF.LATcomponentIterator):
00138   def __init__(self):
00139     LDF.LATcomponentIterator.__init__(self)
00140
00141   def UDFcomponent(self, event, ebfContribution):
00142     print ""
00143     print "Undefined EBF component"
00144     return 0
00145
00146   def GLTcomponent(self, event, gemContribution):
00147     data = Numeric.fromstring(gemContribution.data(), 'i')
00148     print "GEM data: %08x %08x" % (data[0], data[1])
00149     print "Time = %f" % (gemContribution.timeFloat())
00150     return 0
00151
00152   def ACDcomponent(self, event, aemContribution):
00153     print "ACD summary word        = 0x%08x" % (aemContribution.summary())
00154     print "ACD contribution length = %d"     % (aemContribution.length())
00155     data = Numeric.fromstring(aemContribution.data(), 'i')
00156     for i in range(aemContribution.payloadSize() >> 2):
00157       print "ACD data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00158     return 0
00159
00160   def CALcomponent(self, event, calContribution):
00161     print "CAL summary word        = 0x%08x" % (calContribution.summary())
00162     print "CAL contribution length = %d"     % (calContribution.length())
00163     print "CAL accepts             = 0x%08x" % (calContribution.logAccepts())
00164     data = Numeric.fromstring(calContribution.data(), 'i')
00165     for i in range(calContribution.numLogAccepts()):
00166       print "CAL Log Data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00167
00168     #evt  = data[0:384]
00169     #evt.shape = (4,4,2,12)
00170     #evt = Numeric.swapaxes(evt,0,1)
00171     #evt = Numeric.resize(evt, (4,8,12))
00172     return 0
00173
00174   def TKRcomponent(self, event, tkrContribution):
00175     print "TKR summary word        = 0x%08x" % (tkrContribution.summary())
00176     print "TKR contribution length = %d"     % (tkrContribution.length())
00177     array = 8*4*' '          # 8 longwords of space to receive accepts
00178     accepts = Numeric.fromstring(tkrContribution.acceptsMask(event, array), 'i')
00179     print "TKR accepts             = 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x" % \
00180           (accepts[0], accepts[1], accepts[2], accepts[3],
00181            accepts[4], accepts[5], accepts[6], accepts[7])
00182     data = Numeric.fromstring(tkrContribution.data(event), 'i')
00183     for i in range(tkrContribution.numAccepts(event)):
00184       print "TKR data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00185     return 0
00186
00187
00188 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00189 #  the userApplication example to get the number of self triggers to take.
00190 class userArgument(ArgumentImpl):
00191   "GUI for getting the user to input some sort of value."
00192   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00193     ArgumentImpl.__init__(self, parent, name, modal, fl)
00194     self.__value = 0
00195     self.setCaption("Hello world!")
00196
00197   def OKButtonClicked(self):
00198     self.__value = int(self.ArgumentList.text().latin1())
00199     self.close()
00200
00201   def CancelButtonClicked(self):
00202     self.__value = None
00203     self.close()
00204
00205   def getValue(self, caption):
00206     self.setCaption(caption)
00207     self.show()
00208     self.exec_loop()
00209     return self.__value
00210
00211 class userArgText(object):
00212   "Text user interface for getting the user to input some sort of value"
00213   def __init__(self):
00214     pass
00215
00216   def getValue(self, caption):
00217     return int(raw_input("%s: " % (caption)))
00218
00219
00220 #  Example application implementation.
00221 #  Note that the name of the class must be userApplication.
00222 #  Look at rcTransitions for names of other transition methods that can be used.
00223 class userApplication(rcTransitions):
00224   "Implmentation class for a user application"
00225   def __init__(self, rc, userId, debug):
00226     rcTransitions.__init__(self, rc, userId, debug)
00227     log.debug("userApplication.__init__()")
00228     self.__eventSem    = threading.Semaphore(0)
00229     self.__cmdSynchSem = threading.Semaphore(0)
00230     self.__lci         = myLATcomponentIterator()
00231     self.__ldbi        = LDF.LATdataBufferIterator(self.__lci)
00232
00233   def getName(self):
00234     return __name__
00235
00236   def setup(self):
00237     log.debug("userApplication.setup()")
00238
00239     if self.rc is None:
00240       self.__arg = userArgText()
00241     else:
00242       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00243
00244     tem = self.lat.downTEM(0)
00245
00246     if tem is not None:
00247
00248       # reset the TEM since we are going to modify DATA_MASKS
00249       #tem.CMD_RESET = 1
00250
00251       # clear TEM stats reg
00252       tem.COMMAND_RESPONSE = 0
00253
00254       # clear TEM status reg
00255       tem.STATUS = 0
00256
00257       # enable CAL, disable TKR, no diag #  0x10FF for diag
00258       tem.DATA_MASKS = 0x00FF
00259
00260       # TEM config reg # set TEM timeout
00261       tem.CONFIGURATION = 0
00262
00263       #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00264       #printf("tem config reg = 0x%08x\n", payload);
00265
00266       # enable output in our GCCCs
00267       # broadcast load of GCCC_REG_CONFIGURATION
00268
00269       bcast_ccc = tem.allCCC()
00270       bcast_ccc.CONFIGURATION = 0x80000000L
00271
00272       #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00273       bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00274       bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00275       ccc2 = tem.downCCC(2) # O$GCCC_02
00276       ccc2.LAYER_MASK_1 = 0x3BFD3FFFL
00277
00278       # large timeouts for all GCCCs
00279       # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00280       bcast_ccc.EVENT_TIMEOUTS = 0x0
00281       #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00282       #printf("gccc register event timeouts = 0x%08x\n", payload);
00283     else:
00284       log.fatal("No TEM found in the schema: aborting...")
00285       return -1
00286
00287     # Two choices for the trigger, GEM and MiniGLT
00288     if self.lat.existsGEM():
00289       self.trigger( SimpleGasuExample() )
00290     else:
00291       self.trigger( MiniGLTExample() )
00292
00293     # A state transition can be rejected by not returning None
00294     return None
00295
00296   def startRun(self):
00297     log.debug("userApplication.startRun()")
00298
00299     caption = "Enter number of triggers to take"
00300     if self.rc is None:
00301       cnt = self.__arg.getValue(caption)
00302     else:
00303       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00304
00305     if cnt is None:  return -1
00306     self.__cnt = cnt
00307
00308     # Spawn a thread to synchronize commands with events
00309     self.__cmdSynchQuit = FALSE
00310
00311     # A state transition can be rejected by not returning None
00312     return None
00313
00314   def stopRun(self):
00315     log.debug("userApplication.stopRun()")
00316
00317     self.setCompletionStatus(self.COMPL_STATUS_SUCCESS)
00318     self.__cmdSynchQuit = TRUE
00319     self.__eventSem.release()
00320
00321     # The STOP_RUN transition can not be rejected
00322
00323   def resume(self):
00324     log.debug("userApplication.resume()")
00325
00326     # Issue self trigger to make up for the one that was lost during PAUSE
00327     self.trigger().solicit()
00328
00329     return None
00330
00331   def stop(self):
00332     log.debug("userApplication.stop()")
00333
00334     return self.stopRun()
00335
00336   def process(self, (status, buffer)):
00337     "Method called back for each data event taken"
00338     ###log.debug("userApplication.process()")
00339
00340     evtCli = self.evtCli
00341
00342     if status == 0:
00343      if 0:                              # One _OR_ the other method, not both
00344       self.__ldbi.iterate(buffer, len(buffer))
00345      else:                              # Old way of doing things
00346        pass
00347     else:
00348       if evtCli.isGGLTStatus():
00349         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00350       elif not evtCli.checkOnlineStatus(status, evtCli.PLAYBACK_ERROR):
00351         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00352       self.__eventSem.release()
00353       return
00354
00355     try:
00356       # In the future this event may contain additional data
00357       if evtCli.isSweepEvent(): return
00358     except:
00359       # Event summary word inaccessible, handle the bad event here
00360       log.exception("")
00361       return
00362
00363       print "Event Size           =", evtCli.getEvtSize()
00364       print "Event Status         =", evtCli.getEvtStatus()
00365       ts = evtCli.evGetTimestamp()
00366       print "Event Timestamp (GMT)=", asctime(gmtime(ts)), \
00367                                       "and", int(modf(ts)[0]*1000), "ms"
00368       contList = evtCli.getContributionList()
00369       for cId in contList:
00370         evtCli.setCurrentContribution(cId)
00371         if cId.startswith('TEM'):
00372           evtCli.evDumpSummary()
00373           evtCli.evDumpCAL_LogAccepts()
00374           evtCli.evDumpCAL_Logs()
00375           evtCli.evDumpTKR()
00376           evtCli.evDumpTEM_Error()
00377           evtCli.evDumpDiagnostic()
00378           for acc in evtCli.evt.CAL_LogAccepts:
00379             print "CAL Log Accept: 0x%08x" % acc.ui
00380
00381           for data in evtCli.evt.CAL_LogData:
00382             print "CAL Log Data: 0x%08x" % data.ui
00383         elif cId == 'ACD':
00384           evtCli.evDumpSummary()
00385           evtCli.evDumpEventAEM()
00386           print "AEM Veto Hit Vectors:"
00387           j = 0
00388           for hitVect in evtCli.evt.aem.vetoHitVectors:
00389             print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00390             j+=1
00391           print "\nAEM Accept Hit Vectors:"
00392           j = 0
00393           for hitVect in evtCli.evt.aem.acceptHitVectors:
00394             print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00395             j+=1
00396           print "\nAEM PHA Values:"
00397           j = 0
00398           for pha in evtCli.evt.aem.PHA:
00399             print "\tPHA Value: 0x%04x" % pha
00400
00401     # Get next event triggered
00402     self.__eventSem.release()
00403
00404   #def __commandSynch(self, count):
00405   def commandSynch(self):
00406     "Method called by the command synchronization task"
00407     import time
00408     trigger  = self.trigger()
00409     eventSem = self.__eventSem
00410     # Drain the semaphore release count
00411     # Handles the case when the stop run release collided with a trigger release
00412     while eventSem.acquire(0):  pass
00413
00414     t0  = time.time()
00415
00416     # Compensate for the extra CMD_SELF_TRIGGER below
00417     cnt = 1
00418     count = self.__cnt
00419
00420     # Wait for START_RUN to enable triggers
00421     trigger.waitForMaskEnable()
00422
00423     trigger.solicit()                   # Issue an internal trigger
00424     eventSem.acquire()                  # Wait for the event to be processed
00425
00426     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00427
00428     while cnt < count and not self.__cmdSynchQuit:
00429       cnt += 1
00430       trigger.solicit()                 # Issue an internal trigger
00431       time.sleep(.0001)
00432       eventSem.acquire()                # Wait for the event to be processed
00433       #trigger.disable()                # Disable triggers
00434       # Do stuff
00435       #trigger.enable()                 # Enable triggers
00436
00437     t2 = trigger.getTimeStamp()                 # Get the last trigger timestamp
00438     # When we get here the triggers should still be enabled.
00439     # If the glt.MASK needs to be set through any other means
00440     # then it needs to be restored to its SETUP value here.
00441
00442     if t1 is None:
00443       t1 = t0
00444     if t2 is None:
00445       t2 = time.time()
00446     dT = t2 - t1
00447     if dT == 0.0:  dT = 0.000001
00448     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00449              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00450
00451     # Get out of waiting when in suite or standalone mode
00452     self.sync()
00453
00454     # execute the GUI functions for stopRun, just in case
00455     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00456       if self.rc is not None:
00457         self.rc.doStop()
00458
00459   def wait(self):
00460     self.__cmdSynchSem.acquire()
00461
00462   def sync(self):
00463     if __name__ == "__main__" or self.isRunFromSuite():
00464       self.__cmdSynchSem.release()
00465
00466
00467 # Standalone mode:
00468 if __name__ == "__main__":
00469   import os
00470   log.basicConfig()
00471   log.getLogger("").setLevel(log.DEBUG)
00472   ua = userApplication(None, 321, 1)
00473   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00474   ua.rcStartRun()
00475   ua.wait()
00476   ua.rcStopRun()
00477   ua.rcTeardown()
00478
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvtCli.py Source File

tests / apps

testAppEvtCli.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example test script which uses the custom event client testEvtCli"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/01/22 01:10:59 $").split(' ')[1]
00014 __version__  = "$Revision: 1.4.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import                                  threading
00021 import logging                   as     log
00022 #from   rcHouseKeeping           import rcHouseKeeping
00023 import                                  time
00024 from   support.testEvtCli        import *
00025
00026 from   support.SimpleGasuExample import *
00027 from   support.MiniGLTExample    import *
00028
00029 from   LATTE.runcontrol.rcTransitions import rcTransitions
00030 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00031
00032 TRUE  = (0 < 1)
00033 FALSE = not TRUE
00034
00035 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00036 #  the userApplication example to get the number of self triggers to take.
00037 class userArgument(ArgumentImpl):
00038   "GUI for getting the user to input some sort of value."
00039   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00040     ArgumentImpl.__init__(self, parent, name, modal, fl)
00041     self.__value = 0
00042     self.setCaption("Hello world!")
00043
00044   def OKButtonClicked(self):
00045     self.__value = int(self.ArgumentList.text().latin1())
00046     self.close()
00047
00048   def CancelButtonClicked(self):
00049     self.__value = None
00050     self.close()
00051
00052   def getValue(self, caption):
00053     self.setCaption(caption)
00054     self.show()
00055     self.exec_loop()
00056     return self.__value
00057
00058 class userArgText(object):
00059   "Text user interface for getting the user to input some sort of value"
00060   def __init__(self):
00061     pass
00062
00063   def getValue(self, caption):
00064     return int(raw_input("%s: " % (caption)))
00065
00066
00067 #  Example application implementation.
00068 #  Note that the name of the class must be userApplication.
00069 #  Look at rcTransitions for names of other transition methods that can be used.
00070 class userApplication(rcTransitions):
00071   "Implmentation class for a user application"
00072   def __init__(self, rc, userId, debug):
00073     rcTransitions.__init__(self, rc, userId, debug)
00074     log.debug("userApplication.__init__()")
00075     self.__eventSem    = threading.Semaphore(0)
00076     self.__cmdSynchSem = threading.Semaphore(0)
00077     self.__ec = testEvtCli(debug=debug)
00078     self.setEvtCli(self.__ec)
00079
00080   def getName(self):
00081     return __name__
00082
00083   def setup(self):
00084     log.debug("userApplication.setup()")
00085
00086     #self.__ec.open("c:/temp/ebf040218020523.arch")
00087
00088     if self.rc is None:
00089       self.__arg = userArgText()
00090     else:
00091       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00092
00093     tem = self.lat.downTEM(0)
00094
00095     # reset the TEM since we are going to modify DATA_MASKS
00096     #tem.CMD_RESET = 1
00097
00098     # clear TEM stats reg
00099     tem.COMMAND_RESPONSE = 0
00100
00101     # clear TEM status reg
00102     tem.STATUS = 0
00103
00104     # enable CAL, disable TKR, no diag #  0x10FF for diag
00105     tem.DATA_MASKS = 0x00FF
00106
00107     # TEM config reg # set TEM timeout
00108     tem.CONFIGURATION = 0
00109
00110     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00111     #printf("tem config reg = 0x%08x\n", payload);
00112
00113     # enable output in our GCCCs
00114     # broadcast load of GCCC_REG_CONFIGURATION
00115
00116     bcast_ccc = tem.allCCC()
00117     bcast_ccc.CONFIGURATION = 0x80000000L
00118
00119     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00120     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00121     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00122     ccc0 = tem.downCCC(0) # O$GCCC_00
00123     ccc0.LAYER_MASK_0 = 0xFFFF0000L
00124     ccc0.LAYER_MASK_1 = 0xFFFF000FL
00125     ccc2 = tem.downCCC(2) # O$GCCC_02
00126     ccc2.LAYER_MASK_0 = 0xFFFF0000L
00127     ccc2.LAYER_MASK_1 = 0xFFFF0000L
00128
00129     # config GCFE for calibration -- range 0 first
00130     bcast_cfe = tem.allCCC().allCRC().allCFE()
00131     bcast_cfe.CONFIG_0    = 0x00
00132     bcast_cfe.CONFIG_1    = 0x36
00133     bcast_cfe.FLE_DAC     = 0x55
00134     bcast_cfe.FHE_DAC     = 0x55
00135     bcast_cfe.LOG_ACPT    = 0x10
00136     bcast_cfe.RNG_ULD_DAC = 0x7F
00137     bcast_cfe.REF_DAC     = 0x7f
00138
00139     # config GCRC for calibration
00140     bcast_crc = tem.allCCC().allCRC()
00141     bcast_crc.DELAY_1 = 0xFF
00142     bcast_crc.DELAY_2 = 0xFF
00143     bcast_crc.DELAY_3 = 0xFF
00144     bcast_crc.DAC = 0x42FE
00145     bcast_crc.DAC = 0x42FE
00146
00147     # large timeouts for all GCCCs
00148     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00149     bcast_ccc.EVENT_TIMEOUTS = 0x0
00150     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00151     #printf("gccc register event timeouts = 0x%08x\n", payload);
00152
00153     # Register environment variables for housekeeping
00154     #hsk = self.getHSK()
00155     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00156     #hsk.addEnvRegs(regs)
00157     #hsk.setUpdateInterval(1)
00158
00159     # Two choices for the trigger, GEM and MiniGLT
00160     if self.lat.existsGEM():
00161       self.trigger( SimpleGasuExample() )
00162     else:
00163       self.trigger( MiniGLTExample() )
00164
00165     # A state transition can be rejected by not returning None
00166     return None
00167
00168   def startRun(self):
00169     log.debug("userApplication.startRun()")
00170
00171     caption = "Enter number of triggers to take"
00172     if self.rc is None:
00173       cnt = self.__arg.getValue(caption)
00174     else:
00175       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00176
00177     # The user pressed 'Cancel'
00178     if cnt is None:  return -1
00179     self.__cnt = cnt
00180
00181     # Spawn a thread to synchronize commands with events
00182     self.__cmdSynchQuit = FALSE
00183     #cmdSynch = threading.Thread(None, self.__commandSynch, 'CmdSynch',
00184     #                            (cnt, self.__eventSem))
00185     #cmdSynch.start()
00186     #self.__cmdSynch = cmdSynch
00187
00188     # A state transition can be rejected by not returning None
00189     return None
00190
00191   def stopRun(self):
00192     log.debug("userApplication.stopRun()")
00193
00194     self.__cmdSynchQuit = TRUE
00195     self.__eventSem.release()
00196     #self.__cmdSynch.join(2.0)
00197     #if self.__cmdSynch.isAlive():
00198     #  log.error("%s.%s: cmdSynch thread did not exit when expected" % \
00199     #            (self.getName(), "stopRun"))
00200
00201     # The STOP_RUN transition can not be rejected
00202
00203   def resume(self):
00204     log.debug("userApplication.resume()")
00205
00206     # Issue self trigger to make up for the one that was lost during PAUSE
00207     self.trigger().solicit()
00208
00209     return None
00210
00211   def stop(self):
00212     log.debug("userApplication.stop()")
00213
00214     return self.stopRun()
00215
00216   def process(self, (status, buffer)):
00217     "Method called back for each data event taken"
00218     #log.debug("userApplication.process()")
00219
00220     evtCli = self.evtCli
00221
00222     if status != 0:
00223       if evtCli.isGGLTStatus():
00224         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00225       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00226         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00227       self.__eventSem.release()
00228       return
00229     try:
00230       # In the future this event may contain additional data
00231       if evtCli.isSweepEvent():
00232         log.debug("SWEEP EVENT")
00233         return
00234     except:
00235       # Event summary word inaccessible, handle the bad event here
00236       log.exception("")
00237       return
00238
00239     #evtCli.evDumpCAL_LogAccepts();
00240     ###print ""
00241     #evtCli.evDumpCAL_Logs();
00242     #~ #print ""
00243     #~ #evtCli.evDumpTKR()
00244     ###evtCli.evDumpTEM_Error()
00245     ###evtCli.evDumpDiagnostic()
00246     ###for acc in evtCli.evt.CAL_LogAccepts:
00247     ###  print "CAL Log Accept: 0x%08x" % acc.ui
00248
00249     ###for data in evtCli.evt.CAL_LogData:
00250     ###  print "CAL Log Data: 0x%08x" % data.ui
00251     #~ sum = evtCli.evt.summary
00252     ###evtCli.evDumpSummary()
00253
00254     # Get next event triggered
00255     self.__eventSem.release()
00256
00257
00258   #def __commandSynch(self, count):
00259   def commandSynch(self):
00260     "Method called by the command synchronization task"
00261     import time
00262     trigger  = self.trigger()
00263     eventSem = self.__eventSem
00264
00265     # Drain the semaphore release count
00266     # Handles the case when the stop run release collided with a trigger release
00267     while eventSem.acquire(0):  pass
00268
00269     t0  = time.time()
00270
00271     # Compensate for the extra CMD_SELF_TRIGGER below
00272     cnt   = 1
00273     count = self.__cnt
00274
00275     # Wait for START_RUN to enable triggers
00276     trigger.waitForMaskEnable()
00277
00278     trigger.solicit()                   # Issue an internal trigger
00279     eventSem.acquire()                  # Wait for the event to be processed
00280
00281     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00282
00283     while cnt < count and not self.__cmdSynchQuit:
00284       cnt += 1
00285       trigger.solicit()                 # Issue an internal trigger
00286       time.sleep(.0001)
00287       eventSem.acquire()                # Wait for the event to be processed
00288       #trigger.disable()                # Disable triggers
00289       # Do stuff
00290       #trigger.enable()                 # Enable triggers
00291
00292     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00293     # When we get here the triggers should still be enabled.
00294     # If the glt.MASK needs to be set through any other means
00295     # then it needs to be restored to its SETUP value here.
00296
00297     if t1 is None:
00298       t1 = t0
00299     if t2 is None:
00300       t2 = time.time()
00301     dT = t2 - t1
00302     if dT == 0.0:  dT = 0.000001
00303     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00304              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00305
00306     # Get out of waiting when in suite or standalone mode
00307     self.sync()
00308
00309     # execute the GUI functions for stopRun, just in case
00310     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00311       if self.rc is not None:
00312         self.rc.doStop()
00313
00314   def wait(self):
00315     self.__cmdSynchSem.acquire()
00316
00317   def sync(self):
00318     if __name__ == "__main__" or self.isRunFromSuite():
00319       self.__cmdSynchSem.release()
00320
00321
00322 # Standalone mode:
00323 if __name__ == "__main__":
00324   import os
00325   log.basicConfig()
00326   log.getLogger("").setLevel(log.DEBUG)
00327   ua = userApplication(None, 321, 0)
00328   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00329   ua.rcStartRun()
00330   ua.wait()
00331   ua.rcStopRun()
00332   ua.rcTeardown()
00333
00334 # History:
00335 #     $Log: testAppEvtCli.py,v $
00336 #     Revision 1.4.2.1  2005/01/22 01:10:59  stuvi
00337 #     Commented out the TEM reset.
00338 #
00339 #     Revision 1.4  2004/10/22 20:32:48  stuvi
00340 #     Fixed log.exception()
00341 #
00342 #     Revision 1.3  2004/08/18 18:00:15  stuvi
00343 #     Updated for LATTE 4.
00344 #     All hippo functions go through the Qt GUI bridge now.
00345 #
00346 #     Revision 1.2  2004/08/07 02:10:27  stuvi
00347 #     no message
00348 #
00349 #     Revision 1.1  2004/08/06 18:59:26  stuvi
00350 #     Application for testing custom event client functionality
00351 #
00352 #     Revision 1.3  2004/05/03 21:19:47  stuvi
00353 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00354 #
00355 #     Revision 1.2  2004/03/10 22:24:51  panetta
00356 #     Upgraded trigger interface.
00357 #     Removed dependencies on self.glt.
00358 #
00359 #     Revision 1.1  2004/02/20 00:34:37  stuvi
00360 #     Sample custom event client implementation and test app
00361 #
00362 #
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppEvtTO.py Source File

tests / apps

testAppEvtTO.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application that tests event timeouts"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.1.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 import logging        as     log
00021 from   LATTE.runcontrol.rcTransitions  import rcTransitions
00022 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00023 #from   rcHouseKeeping import rcHouseKeeping
00024
00025 from support.SimpleGasuExample   import *
00026 from support.MiniGLTExample      import *
00027
00028 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00029 #  the userApplication example to get the number of self triggers to take.
00030 class userArgument(ArgumentImpl):
00031   "GUI for getting the user to input some sort of value."
00032   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00033     ArgumentImpl.__init__(self, parent, name, modal, fl)
00034     self.__value = 0
00035     self.setCaption("Hello world!")
00036
00037   def OKButtonClicked(self):
00038     self.__value = int(self.ArgumentList.text().latin1())
00039     self.close()
00040
00041   def CancelButtonClicked(self):
00042     self.__value = None
00043     self.close()
00044
00045   def getValue(self, caption):
00046     self.setCaption(caption)
00047     self.show()
00048     self.exec_loop()
00049     return self.__value
00050
00051 class userArgText(object):
00052   "Text user interface for getting the user to input some sort of value"
00053   def __init__(self):
00054     pass
00055
00056   def getValue(self, caption):
00057     return int(raw_input("%s: " % (caption)))
00058
00059
00060 #  Example application implementation.
00061 #  Note that the name of the class must be userApplication.
00062 #  Look at rcTransitions for names of other transition methods that can be used.
00063 class userApplication(rcTransitions):
00064   "Implmentation class for a user application"
00065   def __init__(self, rc, userId, debug):
00066     rcTransitions.__init__(self, rc, userId, debug)
00067     log.debug("userApplication.__init__()")
00068     self.__eventSem    = threading.Semaphore(0)
00069     self.__cmdSynchSem = threading.Semaphore(0)
00070
00071
00072   def getName(self):
00073     return __name__
00074
00075   def setup(self):
00076     log.debug("userApplication.setup()")
00077
00078     if self.rc is None:
00079       self.__arg = userArgText()
00080     else:
00081       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00082
00083     tem = self.lat.downTEM(0)
00084
00085     # reset the TEM since we are going to modify DATA_MASKS
00086     #tem.CMD_RESET = 1
00087
00088     # clear TEM stats reg
00089     tem.COMMAND_RESPONSE = 0
00090
00091     # clear TEM status reg
00092     tem.STATUS = 0
00093
00094     # enable CAL, disable TKR, no diag #  0x10FF for diag
00095     tem.DATA_MASKS = 0x00FF
00096
00097     # TEM config reg # set TEM timeout
00098     tem.CONFIGURATION = 0
00099
00100     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00101     #printf("tem config reg = 0x%08x\n", payload);
00102
00103     # enable output in our GCCCs
00104     # broadcast load of GCCC_REG_CONFIGURATION
00105
00106     bcast_ccc = tem.allCCC()
00107     bcast_ccc.CONFIGURATION = 0x80000000L
00108
00109     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00110     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00111     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00112     ccc2 = tem.downCCC(2) # O$GCCC_02
00113     ccc2.LAYER_MASK_1 = 0x3BFD3FFFL
00114
00115     # large timeouts for all GCCCs
00116     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00117     bcast_ccc.EVENT_TIMEOUTS = 0xFFFFFFFF
00118     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00119     #printf("gccc register event timeouts = 0x%08x\n", payload);
00120
00121     # Register environment variables for housekeeping
00122     #hsk = self.getHSK()
00123     #regs = [tem.regs['data_masks'], ccc2.regs['layer_mask_1']]
00124     #hsk.addEnvRegs(regs)
00125     #hsk.setUpdateInterval(1)
00126
00127     # Two choices for the trigger, GEM and MiniGLT
00128     if self.lat.existsGEM():
00129       self.trigger( SimpleGasuExample() )
00130     else:
00131       self.trigger( MiniGLTExample() )
00132
00133     self.evtCli.setTimeoutEnabled(1)
00134
00135     # A state transition can be rejected by not returning None
00136     return None
00137
00138   def startRun(self):
00139     log.debug("userApplication.startRun()")
00140
00141     caption = "Enter number of triggers to take"
00142     if self.rc is None:
00143       cnt = self.__arg.getValue(caption)
00144     else:
00145       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00146
00147     # The user pressed 'Cancel'
00148     if cnt is None:  return -1
00149     self.__cnt = cnt
00150
00151     # Spawn a thread to synchronize commands with events
00152     self.__cmdSynchQuit = False
00153
00154     # A state transition can be rejected by not returning None
00155     return None
00156
00157   def stopRun(self):
00158     log.debug("userApplication.stopRun()")
00159
00160     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00161     self.__cmdSynchQuit = True
00162     self.__eventSem.release()
00163
00164
00165     # The STOP_RUN transition can not be rejected
00166
00167   def resume(self):
00168     log.debug("userApplication.resume()")
00169
00170     # Issue self trigger to make up for the one that was lost during PAUSE
00171     self.trigger().solicit()
00172
00173     return None
00174
00175   def stop(self):
00176     log.debug("userApplication.stop()")
00177
00178     return self.stopRun()
00179
00180   def process(self, (status, buffer)):
00181     "Method called back for each data event taken"
00182     ###log.debug("userApplication.process()")
00183
00184     evtCli = self.evtCli
00185
00186     if status != 0:
00187       if evtCli.isGGLTStatus():
00188         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00189       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00190         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00191       self.__eventSem.release()
00192       return
00193     try:
00194       # In the future this event may contain additional data
00195       if evtCli.isSweepEvent(): return
00196     except:
00197       # Event summary word inaccessible, handle the bad event here
00198       import gutil
00199       gutil.logException()
00200       return
00201
00202     ###evtCli.evDumpCAL_LogAccepts();
00203     ###print ""
00204     ###evtCli.evDumpCAL_Logs();
00205     #~ #print ""
00206     #~ #evtCli.evDumpTKR()
00207     ###evtCli.evDumpTEM_Error()
00208     ###evtCli.evDumpDiagnostic()
00209     ###for acc in evtCli.evt.CAL_LogAccepts:
00210     ###  print "CAL Log Accept: 0x%08x" % acc.ui
00211
00212     ###for data in evtCli.evt.CAL_LogData:
00213     ###  print "CAL Log Data: 0x%08x" % data.ui
00214     #~ sum = evtCli.evt.summary
00215     ###evtCli.evDumpSummary()
00216
00217     # Get next event triggered
00218     self.__eventSem.release()
00219
00220
00221   #def __commandSynch(self, count):
00222   def commandSynch(self):
00223     "Method called by the command synchronization task"
00224     import time
00225     trigger  = self.trigger()
00226     eventSem = self.__eventSem
00227
00228     # Drain the semaphore release count
00229     # Handles the case when the stop run release collided with a trigger release
00230     while eventSem.acquire(0):  pass
00231
00232     t0  = time.time()
00233
00234     # Compensate for the extra CMD_SELF_TRIGGER below
00235     cnt   = 1
00236     count = self.__cnt
00237
00238     # Wait for START_RUN to enable triggers
00239     trigger.waitForMaskEnable()
00240
00241     trigger.solicit()                   # Issue an internal trigger
00242     eventSem.acquire()                  # Wait for the event to be processed
00243
00244     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00245
00246     while cnt < count and not self.__cmdSynchQuit:
00247       cnt += 1
00248       trigger.solicit()                 # Issue an internal trigger
00249       time.sleep(.0001)
00250       eventSem.acquire()                # Wait for the event to be processed
00251       #trigger.disable()                # Disable triggers
00252       # Do stuff
00253       #trigger.enable()                 # Enable triggers
00254
00255     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00256
00257     if t1 is None:
00258       t1 = t0
00259     if t2 is None:
00260       t2 = time.time()
00261     dT = t2 - t1
00262     if dT == 0.0:  dT = 0.000001
00263     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00264              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00265
00266     # Get out of waiting when in suite or standalone mode
00267     self.sync()
00268
00269     # execute the GUI functions for stopRun, just in case
00270     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00271       if self.rc is not None:
00272         self.rc.doStop()
00273
00274   def wait(self):
00275     self.__cmdSynchSem.acquire()
00276
00277   def sync(self):
00278     if __name__ == "__main__" or self.isRunFromSuite():
00279       self.__cmdSynchSem.release()
00280
00281
00282 # Standalone mode:
00283 if __name__ == "__main__":
00284   log.basicConfig()
00285   log.getLogger("").setLevel(log.DEBUG)
00286   ua = userApplication(None, 321, 0)
00287   ua.rcSetup('../repos/simpleTemSchema.xml') # Use env var later: kludge for now
00288   ua.rcStartRun()
00289   ua.wait()
00290   ua.rcStopRun()
00291   ua.rcTeardown()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppLDFdump.py Source File

tests / apps

testAppLDFdump.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example EBF event handling test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "2/25/2003"
00014 __version__  = "$Revision: 1.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 import logging       as     log
00021
00022 from   LATTE.runcontrol.rcTransitions import rcTransitions
00023 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00024
00025 from support.SimpleGasuExample   import *
00026 from support.MiniGLTExample      import *
00027
00028 import LDF
00029 import LDF.LDFdumper as LD
00030
00031 class LATcomponentIterator(LD.LATcomponentIterator):
00032   def __init__(self):
00033     LDF.LATcomponentIterator.__init__(self)
00034     self.__calSrc                  = None
00035     self.__tkrContributionIterator = None
00036     print "LATcomponentIterator.__init__"
00037
00038   def UDFcomponent(self, event, ebfContribution):
00039     print ""
00040     print "Undefined EBF component"
00041     LD.EBFcontribution(event, ebfContribution).dumpCommon("  ")
00042     LD.EBFcontribution(event, ebfContribution).dump("  ")
00043     return 0
00044
00045   def OSWcomponent(self, event, oswContribution):
00046     # Assuming this is always the first component seen, dump the event
00047     print ""
00048     LD.EBFevent(event).dump()
00049     print ""
00050     print "OSW:"
00051     LD.EBFcontribution(event, oswContribution).dumpCommon("  ")
00052     oswContribIter = LD.OSWcontributionIterator(event, oswContribution)
00053     print "  OSW:"
00054     oswContribIter.dump("  ")
00055     return 0
00056
00057   def GLTcomponent(self, event, gltContribution):
00058     print ""
00059     print "GLT:"
00060     LD.EBFcontribution(event, gltContribution).dumpCommon("  ")
00061     LD.GLTcontribution(event, gltContribution).dump("  ")
00062     return 0
00063
00064   def GEMcomponent(self, event, gemContribution):
00065     print ""
00066     print "GEM:"
00067     LD.EBFcontribution(event, gemContribution).dumpCommon("  ")
00068     LD.GEMcontribution(event, gemContribution).dump("  ")
00069     return 0
00070
00071   def ACDcomponent(self, event, aemContribution):
00072     print ""
00073     print "AEM:"
00074     LD.EBFcontribution(event, aemContribution).dumpCommon("  ")
00075     aemContribIter = LD.AEMcontributionIterator(event, aemContribution)
00076     print "  ACD:"
00077     aemContribIter.dump("  ")
00078     return 0
00079
00080   def CALcomponent(self, event, calContribution):
00081     self.__calSrc = LD.LATPcellHeader.source(calContribution.header())
00082     print ""
00083     print "TEM %2d:" % (self.__calSrc)
00084     LD.EBFcontribution(event, calContribution).dumpCommon("  ")
00085     calContribIter = LD.CALcontributionIterator(event,calContribution)
00086     calContribIter.dump("  ")
00087     self.CALend(calContribIter.CALend())
00088     return 0
00089
00090   def TKRcomponent(self, event, tkrContribution):
00091     if self.__calSrc != LD.LATPcellHeader.source(tkrContribution.header()):
00092       print ""
00093       print "TEM %2d:" % (LD.LATPcellHeader.source(tkrContribution.header()))
00094       LD.EBFcontribution(event, tkrContribution).dumpCommon("  ")
00095     tkrContribIter = LD.TKRcontributionIterator(event, tkrContribution)
00096     tkrContribIter.dump("  ")
00097     self.__tkrContributionIterator = tkrContribIter
00098     if tkrContribIter.diagnostic() is not None:
00099       self.TKRend(tkrContribIter.diagnostic())
00100     return 0
00101
00102 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00103 #  the userApplication example to get the number of self triggers to take.
00104 class userArgument(ArgumentImpl):
00105   "GUI for getting the user to input some sort of value."
00106   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00107     ArgumentImpl.__init__(self, parent, name, modal, fl)
00108     self.__value = 0
00109     self.setCaption("Hello world!")
00110
00111   def OKButtonClicked(self):
00112     self.__value = int(self.ArgumentList.text().latin1())
00113     self.close()
00114
00115   def getValue(self, caption):
00116     self.setCaption(caption)
00117     self.show()
00118     self.exec_loop()
00119     return self.__value
00120
00121 class userArgText(object):
00122   "Text user interface for getting the user to input some sort of value"
00123   def __init__(self):
00124     pass
00125
00126   def getValue(self, caption):
00127     return int(raw_input("%s: " % (caption)))
00128
00129
00130 #  Example application implementation.
00131 #  Note that the name of the class must be userApplication.
00132 #  Look at rcTransitions for names of other transition methods that can be used.
00133 class userApplication(rcTransitions):
00134   "Implmentation class for a user application"
00135   def __init__(self, gui, userId, debug):
00136     rcTransitions.__init__(self, gui, userId, debug)
00137     log.debug("userApplication.__init__()")
00138     self.__eventSem    = threading.Semaphore(0)
00139     self.__cmdSynchSem = threading.Semaphore(0)
00140     self.__lci         = LATcomponentIterator()
00141     self.__ldbi        = LDF.LATdataBufferIterator(self.__lci)
00142
00143   def getName(self):
00144     return __name__
00145
00146   def setup(self):
00147     log.debug("userApplication.setup()")
00148
00149     if self.rc is None:
00150       self.__arg = userArgText()
00151     else:
00152       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00153
00154     tem = self.lat.downTEM(0)
00155
00156     if tem is not None:
00157       # reset the TEM since we are going to modify DATA_MASKS
00158       tem.CMD_RESET = 1
00159
00160       # clear TEM stats reg
00161       tem.COMMAND_RESPONSE = 0
00162
00163       # clear TEM status reg
00164       tem.STATUS = 0
00165
00166       # enable CAL, disable TKR, no diag #  0x10FF for diag
00167       tem.DATA_MASKS = 0x00FF
00168
00169       # TEM config reg # set TEM timeout
00170       tem.CONFIGURATION = 0
00171
00172       #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00173       #printf("tem config reg = 0x%08x\n", payload);
00174
00175       # enable output in our GCCCs
00176       # broadcast load of GCCC_REG_CONFIGURATION
00177
00178       bcast_ccc = tem.allCCC()
00179       bcast_ccc.CONFIGURATION = 0x80000000L
00180
00181       #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00182       bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00183       bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00184       ccc2 = tem.downCCC(2) # O$GCCC_02
00185       ccc2.LAYER_MASK_1 = 0x3BFD3FFF
00186
00187       # large timeouts for all GCCCs
00188       # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00189       bcast_ccc.EVENT_TIMEOUTS = 0x0
00190       #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00191       #printf("gccc register event timeouts = 0x%08x\n", payload);
00192     else:
00193       log.fatal("No TEM found in the schema: aborting...")
00194       return -1
00195
00196     # Two choices for the trigger, GEM and MiniGLT
00197     if self.lat.existsGEM():
00198       self.trigger( SimpleGasuExample() )
00199     else:
00200       self.trigger( MiniGLTExample() )
00201
00202     # A state transition can be rejected by not returning None
00203     return None
00204
00205   def startRun(self):
00206     log.debug("userApplication.startRun()")
00207
00208     caption = "Enter number of triggers to take"
00209     if self.rc is None:
00210       cnt = self.__arg.getValue(caption)
00211     else:
00212       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00213
00214     # The user pressed 'Cancel'
00215     if cnt is None:  return -1
00216     self.__cnt = cnt
00217
00218     # Spawn a thread to synchronize commands with events
00219     # This must happen after triggers are enabled
00220     self.__cmdSynchQuit = False
00221
00222     # A state transition can be rejected by not returning None
00223     return None
00224
00225   def stopRun(self):
00226     self.setCompletionStatus(self.COMPL_STATUS_SUCCESS)
00227     self.__cmdSynchQuit = True
00228     self.__eventSem.release()
00229
00230     # The STOP_RUN transition can not be rejected
00231
00232   def resume(self):
00233     # Issue self trigger to make up for the one that was lost during PAUSE
00234     self.trigger().solicit()
00235
00236     return None
00237
00238   def stop(self):
00239     return self.stopRun()
00240
00241   def process(self, (status, buffer)):
00242     "Method called back for each data event taken"
00243     ###log.debug("userApplication.process()")
00244
00245     evtCli = self.evtCli
00246
00247     if status != 0:
00248       if evtCli.isGGLTStatus():
00249         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00250       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00251         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00252       self.__eventSem.release()
00253       return
00254
00255     try:
00256       # In the future this event may contain additional data
00257       if evtCli.isSweepEvent(): return
00258     except:
00259       # Event summary word inaccessible, handle the bad event here
00260       import gutil
00261       gutil.logException()
00262       return
00263
00264     self.__ldbi.iterate(buffer, len(buffer))
00265
00266     # Get next event triggered
00267     self.__eventSem.release()
00268
00269   def commandSynch(self):
00270     "Method called by the command synchronization task"
00271     import time
00272     trigger  = self.trigger()
00273     eventSem = self.__eventSem
00274
00275     # Drain the semaphore release count
00276     # Handles the case when the stop run release collided with a trigger release
00277     while eventSem.acquire(0):  pass
00278
00279     t0  = time.time()
00280
00281     # Compensate for the extra CMD_SELF_TRIGGER below
00282     cnt   = 1
00283     count = self.__cnt
00284
00285     # Wait for START_RUN to enable triggers
00286     trigger.waitForMaskEnable()
00287
00288     trigger.solicit()                   # Issue an internal trigger
00289     eventSem.acquire()                  # Wait for the event to be processed
00290
00291     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00292
00293     while cnt < count and not self.__cmdSynchQuit:
00294       cnt += 1
00295       trigger.solicit()                 # Issue an internal trigger
00296       time.sleep(.0001)
00297       eventSem.acquire()                # Wait for the event to be processed
00298       #trigger.disable()                # Disable triggers
00299       # Do stuff
00300       #trigger.enable()                 # Enable triggers
00301
00302     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00303
00304     if t1 is None:
00305       t1 = t0
00306     if t2 is None:
00307       t2 = time.time()
00308     dT = t2 - t1
00309     if dT == 0.0:  dT = 0.000001
00310     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00311              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00312
00313     # Get out of waiting when in standalone mode
00314     self.sync()
00315
00316     # execute the GUI functions for stopRun, just in case
00317     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00318       if self.gui is not None:
00319         self.gui.doStopRun()
00320
00321   def wait(self):
00322     self.__cmdSynchSem.acquire()
00323
00324   def sync(self):
00325     if __name__ == "__main__" or self.isRunFromSuite():
00326       self.__cmdSynchSem.release()
00327
00328
00329 # Standalone mode:
00330 if __name__ == "__main__":
00331   import os
00332   log.basicConfig()
00333   log.getLogger("").setLevel(log.DEBUG)
00334   ua = userApplication(None, 321, 1)
00335   ua.rcSetup(os.path.join(os.environ['ONLINE_ROOT'], 'repos/simpleTemSchema.xml'))
00336   ua.rcStartRun()
00337   ua.wait()
00338   ua.rcStopRun()
00339   ua.rcTeardown()
00340
00341 # History:
00342 #     $Log: testAppLDFdump.py,v $
00343 #     Revision 1.1  2004/08/18 18:00:15  stuvi
00344 #     Updated for LATTE 4.
00345 #     All hippo functions go through the Qt GUI bridge now.
00346 #
00347 #     Revision 1.3  2004/05/03 21:19:47  stuvi
00348 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00349 #
00350 #     Revision 1.2  2004/04/02 23:57:53  claus
00351 #     xxxComponent methods must return a status value.
00352 #
00353 #     Revision 1.1  2004/04/02 22:31:46  claus
00354 #     Event dumper using the LDF library and the new LATdataBufferIterator class.
00355 #
00356 #     Revision 1.8  2004/03/10 22:24:51  panetta
00357 #     Upgraded trigger interface.
00358 #     Removed dependencies on self.glt.
00359 #
00360 #     Revision 1.7  2003/11/04 18:30:53  panetta
00361 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00362 #
00363 #     Revision 1.6  2003/10/31 01:09:37  panetta
00364 #     1)  Moved register writes from startRun to setup
00365 #     2)  Added GLT enabling logic to __commandSynch
00366 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00367 #
00368 #     Revision 1.5  2003/06/13 23:26:24  stuvi
00369 #     Added TEM reset
00370 #
00371 #     Revision 1.4  2003/04/01 21:04:59  stuvi
00372 #     Fixed event count discrepancy when the run is stopped in the middle.
00373 #
00374 #     Revision 1.3  2003/03/26 21:59:36  stuvi
00375 #     Fixed standalone mode
00376 #
00377 #     Revision 1.2  2003/03/13 00:06:34  claus
00378 #     Interface changes plus diagnostic and error dumps
00379 #
00380 #     Revision 1.1  2003/03/10 21:49:56  claus
00381 #     RunControl example of an event dumper
00382 #
00383 #
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testAppTkr.py Source File

tests / apps

testAppTkr.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example TKR test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.4 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import                      threading
00020 import logging       as     log
00021
00022 from   LATTE.runcontrol.rcTransitions import rcTransitions
00023 from   LATTE.runcontrol.ArgumentImpl   import ArgumentImpl
00024 import                      time
00025
00026 from support.SimpleGasuExample   import *
00027 from support.MiniGLTExample      import *
00028
00029 TRUE  = (0 < 1)
00030 FALSE = not TRUE
00031
00032 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00033 #  the userApplication example to get the number of self triggers to take.
00034 class userArgument(ArgumentImpl):
00035   "GUI for getting the user to input some sort of value."
00036   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00037     ArgumentImpl.__init__(self, parent, name, modal, fl)
00038     self.__value = 0
00039     self.setCaption("Hello world!")
00040
00041   def OKButtonClicked(self):
00042     self.__value = int(self.ArgumentList.text().latin1())
00043     self.close()
00044
00045   def CancelButtonClicked(self):
00046     self.__value = None
00047     self.close()
00048
00049   def getValue(self, caption):
00050     self.setCaption(caption)
00051     self.show()
00052     self.exec_loop()
00053     return self.__value
00054
00055 class userArgText(object):
00056   "Text user interface for getting the user to input some sort of value"
00057   def __init__(self):
00058     pass
00059
00060   def getValue(self, caption):
00061     return int(raw_input("%s: " % (caption)))
00062
00063
00064 #  Example application implementation.
00065 #  Note that the name of the class must be userApplication.
00066 #  Look at rcTransitions for names of other transition methods that can be used.
00067 class userApplication(rcTransitions):
00068   "Implmentation class for a user application"
00069   def __init__(self, rc, userId, debug):
00070     rcTransitions.__init__(self, rc, userId, debug)
00071     log.debug("userApplication.__init__()")
00072     self.__eventSem    = threading.Semaphore(0)
00073     self.__cmdSynchSem = threading.Semaphore(0)
00074
00075   def getName(self):
00076     return __name__
00077
00078   def setup(self):
00079     log.debug("userApplication.setup()")
00080
00081     if self.rc is None:
00082       self.__arg = userArgText()
00083     else:
00084       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00085
00086     tem = self.lat.downTEM(0)
00087
00088 #  Move to schema configuration
00089 #    # reset the TEM since we are going to modify DATA_MASKS
00090 #    tem.CMD_RESET = 1
00091
00092 #    #
00093 #    # Configure TEM
00094
00095 #    # config TEM TKR calstrobe delay for ~ 5usec
00096 #    tem.TKR_TRGSEQ = 0x3C
00097
00098 #    # enable TKR, no diag #  0x1F00 for diag
00099 #    # make sure we also enable CAL CC 1 since it is required for
00100 #    # proper event data taking
00101 #    # enable GTCC 2 and 3
00102 #    tem.DATA_MASKS = 0x0DF3
00103 #    tem.configuration = 0x00010000L # primary
00104 #    #tem.CONFIGURATION = 0x03010000L # redundant
00105
00106 #    ccc = tem.allCCC()
00107 #    # enable output in our GCCCs
00108 #    # broadcast load of GCCC_REG_CONFIGURATION
00109 #    ccc.CONFIGURATION = 0x80000000L
00110
00111 #    #  disable all GCRCs in all GCCCs via broadcast
00112 #    ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00113 #    ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00114
00115     tcc = tem.allTCC()
00116
00117     # broadcast load of GTCC_REG_CONFIGURATION
00118     # enable controller output and set cable length to 1
00119     # 0xC0000000 is for one layer
00120     # 0x80000000 is for two layers
00121     tcc.CONFIGURATION = 0xC0000000L
00122     x_tcc = tem.downTCC(0)
00123     # enable all masks
00124     tcc.INPUT_MASK = 0x0
00125
00126     # set maximum event timeout
00127     tcc.EVENT_TIMEOUTS = 0x0
00128
00129     #
00130     # Configure GTRCs
00131     #
00132
00133     # our board is connected CC = 2, RC = 0 and CC = 3, RC = 0
00134     # reset GTRC # required before all triggers
00135
00136     trc = tcc.allTRC()
00137
00138     trc.CMD_RESET = 1
00139
00140     # number of GTFE to readout left
00141     nGTFEsLeft  = 7
00142     nGTFEsRight = 0
00143
00144     # max hits per GTRC # 31 max
00145     maxHits = 31
00146
00147     enMask  = 0x6
00148
00149     dLO = (enMask << 28) | ((nGTFEsRight << 7)& 0xF80) | (maxHits & 0x7F);
00150     print "dLO=", dLO, hex(dLO)
00151
00152     # cable controller 2, readout controller 0
00153     tcc = tem.downTCC(2)
00154     trc = tcc.downTRC(1)
00155
00156     trc.CSR = dLO
00157
00158     dLO = (enMask << 28) | ((nGTFEsLeft << 7)& 0xF80) | (maxHits & 0x7F);
00159     print "dLO=", dLO, hex(dLO)
00160
00161     # cable controller 3, readout controller 0
00162     tcc = tem.downTCC(3)
00163     trc = tcc.downTRC(1)
00164
00165     trc.CSR = dLO
00166
00167     #
00168     # Configure GTFEs
00169     #
00170
00171     tfe = trc.allTFE()
00172     tfe.TRIG_MASK = 0x0
00173     tfe.DATA_MASK = 0x0
00174     tfe.CALIB_MASK = 0x0
00175     tfe.DAC = 0x00001902
00176     # configure front ends # all listen to left
00177     tfe.MODE = 0
00178     #tfe = trc.downTFE(0)
00179
00180     # configure default DACs for threshold and calibration
00181     # Calibration DAC Range and Resolution
00182     # Low Range (B6=0):  DAC output voltage in mV = 1.57 + 1.53*DAC_Value
00183     # High Range (B6=1): DAC output voltage in mV = 15.0 + 14.6*DAC_Value
00184     # Discriminator Threshold DAC Range and Resolution
00185     # Low Range (B6=0):  DAC output voltage in mV = 4.5 + 4.5*DAC_Value
00186     # High Range (B6=1): DAC output voltage in mV = 12.9 + 12.9*DAC_Value
00187
00188
00189     # calRng = 1
00190     # thrRng = 0
00191     # calDAC = 60
00192     # thrDAC = 10
00193
00194     tfe.DAC = 0x00001952  # based on the above Rng and DAC values
00195
00196     # enable GTFE for data taking # all channels
00197     tfe.TRIG_MASK = 0xffffffffffffffff
00198     tfe.DATA_MASK = 0xffffffffffffffff
00199
00200     # Cal strobe channels 4 and 48 only
00201     tfe.CALIB_MASK = 0x0001000000000010
00202
00203     #~ #Mask of the following Registers
00204     #~ tfe = trc.downTFE(13)
00205     #~ tfe.DATA_MASK = 0x0L
00206     #~ tfe.CALIB_MASK = 0x0L
00207     #~ tfe.TRIG_MASK = 0x0L
00208
00209     #~ tfe = trc.downTFE(14)
00210     #~ tfe.DATA_MASK = 0x0L
00211     #~ tfe.CALIB_MASK = 0x0L
00212     #~ tfe.TRIG_MASK = 0x0L
00213
00214     #~ tfe = trc.downTFE(19)
00215     #~ #tfe.DATA_MASK = 0x0L
00216     #~ tfe.CALIB_MASK = 0x0L
00217     #~ tfe.TRIG_MASK = 0x0L
00218
00219     #~ tfe = trc.downTFE(20)
00220     #~ #tfe.DATA_MASK = 0x0L
00221     #~ tfe.CALIB_MASK = 0x0L
00222     #~ tfe.TRIG_MASK = 0x0L
00223
00224
00225
00226     # Two choices for the trigger, GEM and MiniGLT
00227     if self.lat.existsGEM():
00228       self.trigger( SimpleGasuExample() )
00229     else:
00230       self.trigger( MiniGLTExample() )
00231
00232
00233     # A state transition can be rejected by not returning None
00234     return None
00235
00236   def startRun(self):
00237     log.debug("userApplication.startRun()")
00238
00239     caption = "Enter number of triggers to take"
00240     if self.rc is None:
00241       cnt = self.__arg.getValue(caption)
00242     else:
00243       cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00244
00245     # The user pressed 'Cancel'
00246     if cnt is None:  return -1
00247     self.__cnt = cnt
00248
00249     # Spawn a thread to synchronize commands with events
00250     # This must happen after triggers are enabled
00251     self.__cmdSynchQuit = FALSE
00252     #cmdSynch = threading.Thread(None, self.__commandSynch, 'CmdSynch', (cnt,))
00253     #self.__cmdSynch = cmdSynch
00254     #cmdSynch.start()
00255     # A state transition can be rejected by not returning None
00256     return None
00257
00258   def stopRun(self):
00259     log.debug("userApplication.stopRun()")
00260     self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00261     self.__cmdSynchQuit = TRUE
00262     self.__eventSem.release()
00263     #self.__cmdSynch.join()
00264
00265     # The STOP_RUN transition can not be rejected
00266
00267   def resume(self):
00268     log.debug("userApplication.resume()")
00269     # Issue self trigger to make up for the one that was lost during PAUSE
00270     self.trigger().solicit()
00271
00272     return None
00273
00274   def stop(self):
00275     log.debug("userApplication.stop()")
00276
00277     return self.stopRun()
00278
00279   def teardown(self):
00280     log.debug("userApplication.teardown()")
00281     # Allow the C++ object to be deleted
00282     if self.rc is not None and self.__arg is not None:
00283       self.__arg.deleteLater()
00284
00285   def process(self, (status, buffer)):
00286     "Method called back for each data event taken"
00287     ###log.debug("userApplication.process()")
00288
00289     evtCli = self.evtCli
00290
00291     if status != 0:
00292       if evtCli.isGGLTStatus():
00293         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00294       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00295         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00296       self.__eventSem.release()
00297       return
00298     try:
00299       # In the future this event may contain additional data
00300       if evtCli.isSweepEvent(): return
00301     except:
00302       # Event summary word inaccessible, handle the bad event here
00303       log.exception("")
00304       return
00305
00306     if evtCli.setCurrentContribution(evtCli.TEM0) != -1:
00307       evtCli.evDumpSummary()
00308       evtCli.evDumpTKR()
00309       evtCli.evDumpTEM_Error()
00310       evtCli.evDumpDiagnostic()
00311     else:
00312       print "*******************************************"
00313       print "*   NO TEM 0 CONTRIBUTION PRESENT           *"
00314       print "*******************************************"
00315
00316     #print "TKRSTRIPS: ", len(evtCli.evt.TKRstrips)
00317     #for strip in evtCli.evt.TKRstrips:
00318     #  print strip.ui
00319
00320     # Get next event triggered
00321     self.__eventSem.release()
00322
00323   #def __commandSynch(self, count):
00324   def commandSynch(self):
00325     "Method called by the command synchronization task"
00326     import time
00327     trigger  = self.trigger()
00328     eventSem = self.__eventSem
00329     # Drain the semaphore release count
00330     # Handles the case when the stop run release collided with a trigger release
00331     while eventSem.acquire(0):  pass
00332
00333     t0  = time.time()
00334
00335     # Compensate for the extra CMD_SELF_TRIGGER below
00336     cnt = 1
00337     count = self.__cnt
00338
00339     # Wait for START_RUN to enable triggers
00340     trigger.waitForMaskEnable()
00341
00342     trigger.solicit()                   # Issue an internal trigger
00343     eventSem.acquire()                  # Wait for the event to be processed
00344
00345     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00346
00347     while cnt < count and not self.__cmdSynchQuit:
00348       cnt += 1
00349       trigger.solicit()                 # Issue an internal trigger
00350       time.sleep(.0001)
00351       eventSem.acquire()                # Wait for the event to be processed
00352       #trigger.disable()                # Disable triggers
00353       # Do stuff
00354       #trigger.enable()                 # Enable triggers
00355
00356     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00357     # When we get here the triggers should still be enabled.
00358     # If the glt.MASK needs to be set through any other means
00359     # then it needs to be restored to its SETUP value here.
00360
00361     if t1 is None:
00362       t1 = t0
00363     if t2 is None:
00364       t2 = time.time()
00365     dT = t2 - t1
00366     if dT == 0.0:  dT = 0.000001
00367     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00368              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00369
00370     # Get out of waiting when in suite or standalone mode
00371     self.sync()
00372
00373     # execute the GUI functions for stopRun, just in case
00374     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00375       if self.rc is not None:
00376         self.rc.doStop()
00377
00378   def wait(self):
00379     self.__cmdSynchSem.acquire()
00380
00381   def sync(self):
00382     if __name__ == "__main__" or self.isRunFromSuite():
00383       self.__cmdSynchSem.release()
00384
00385
00386
00387 # Standalone mode:
00388 if __name__ == "__main__":
00389   from LATTE.runcontrol.RunControlCommon import RunControlCommon
00390
00391   rcCommon = RunControlCommon()
00392   rcCommon.initialize()
00393   rcCommon.setLoggingLevel("INFO")
00394   rcCommon.connect()
00395   ua = userApplication(None, 321, rcCommon)
00396   ua.rcSetup()
00397   ua.rcStartRun()
00398   ua.wait()
00399   ua.rcStopRun()
00400   ua.rcTeardown()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testArchiver.py Source File

tests / apps / support

testArchiver.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example custom event archiver class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/26 02:01:16 $").split(' ')[1]
00014 __version__  = "$Revision: 1.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # History:
00021 #     $Log: testArchiver.py,v $
00022 #     Revision 1.2  2004/08/26 02:01:16  stuvi
00023 #     Fixed for LATTE 4
00024 #
00025 #     Revision 1.1  2004/07/28 21:24:00  stuvi
00026 #     Added testAppCal and its supporting classes.
00027 #
00028 #     Revision 1.3  2004/03/08 21:40:23  stuvi
00029 #     Added comments  for userMethod.
00030 #
00031 #     Revision 1.2  2004/03/06 01:18:26  stuvi
00032 #     Added userMethod example
00033 #
00034 #     Revision 1.1  2004/02/20 00:33:44  stuvi
00035 #     Sample testArchiver app and class
00036 #
00037 #
00038
00039 from LATTE.runcontrol import rcArchiver
00040 import logging            as     log
00041
00042 class testArchiver(rcArchiver.rcArchiver):
00043
00044   def __init__(self, filePath=None, fileName=None):
00045     rcArchiver.rcArchiver.__init__(self, filePath, fileName)
00046
00047   def write(self, data):
00048     log.info("Writing data using the custom event archiver %s" % self.__class__.__name__)
00049     rcArchiver.rcArchiver.write(self, data)
00050
00051   def getFileNameFromTS(ts):
00052     return "custom" + ts + ".data"
00053   getFileNameFromTS = staticmethod(getFileNameFromTS)
00054
00055   def userMethod(self, data, moreData):
00056     """User defined method for adding custom data to the archive
00057     It should not be called before startRun() method since the
00058     archiver doesn't get instantiated before then.
00059     """
00060     log.info("In userMethod of %s" % self.__class__.__name__)
00061     rcArchiver.rcArchiver.write(self, data)
00062     rcArchiver.rcArchiver.write(self, moreData)
00063
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testEvtCli.py Source File

tests / apps / support

testEvtCli.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example custom event client class"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/09/14 02:14:44 $").split(' ')[1]
00014 __version__  = "$Revision: 1.3 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 # History:
00021 #     $Log: testEvtCli.py,v $
00022 #     Revision 1.3  2004/09/14 02:14:44  stuvi
00023 #     evtCli.read() now returns a 6 word header tuple and the event data as a two item tuple.
00024 #
00025 #     Revision 1.2  2004/08/06 03:33:57  stuvi
00026 #     Added custom event client support.
00027 #
00028 #     Revision 1.1  2004/07/28 21:24:00  stuvi
00029 #     Added testAppCal and its supporting classes.
00030 #
00031 #     Revision 1.1  2004/02/20 00:34:37  stuvi
00032 #     Sample custom event client implementation and test app
00033 #
00034 #
00035
00036 from LATTE.client.gEvtCli import *
00037
00038 class testEvtCli(EvtCli):
00039   def __init__(self, debug=0):
00040     EvtCli.__init__(self, debug)
00041
00042   def readEvent(self, dat=None):
00043     self.evt.clearEvent()
00044     (header, self.dat) = self.read()
00045     self._EvtCli__gglt_status = header[0]
00046     self.__version_info = header[3]
00047     self.__evt_status   = header[4] >> 16
00048     self.__evt_size     = header[4] & 0xFFFF
00049     if self._EvtCli__gglt_status != 0:
00050       self._EvtCli__online_status |= EvtCli.GGLT_STATUS_ERROR
00051       print "GGLT status=", self._EvtCli__gglt_status
00052       return self._EvtCli__online_status
00053     self.evt.cont_offset = EvtCli.FIRST_CONTRIBUTION_OFFSET
00054     # Get the summary word stored in the OSW contribution
00055     # to determine if the event has error.
00056     self.evt.summary = evSummary(self.getDWord(self.evGetSummary()))
00057     self._EvtCli__evt_error = self.evt.summary.error
00058     self.evt.cont_offset += ((header[5] & 0xFFFF) << 2)
00059     #self.evt.cont_cellHeader = evCellHeader(self.getDWord(self.evt.cont_offset) >> 16)
00060     #self.evt.contributor = self.evt.cont_cellHeader.source
00061     self.evt.cont_size   = (self.getDWord(self.evt.cont_offset) & 0xFFFF) << 4
00062     self.evt.cont_end    = (self.evt.cont_offset << 2) + self.evt.cont_size
00063     return self._EvtCli__online_status
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSAppCal.py Source File

tests / apps

testSAppCal.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example CAL test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "11/21/2002"
00014 __version__  = "$Revision: 1.4.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 import logging       as     log
00021 from   LATTE.runcontrol.rcTransitions import rcTransitions
00022 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00023 import time
00024
00025 from support.SimpleGasuExample   import *
00026 from support.MiniGLTExample      import *
00027
00028 TRUE  = (0 < 1)
00029 FALSE = not TRUE
00030
00031 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00032 #  the userApplication example to get the number of self triggers to take.
00033 class userArgument(ArgumentImpl):
00034   "GUI for getting the user to input some sort of value."
00035   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00036     ArgumentImpl.__init__(self, parent, name, modal, fl)
00037     self.__value = 0
00038     self.setCaption("Hello world!")
00039
00040   def OKButtonClicked(self):
00041     self.__value = int(self.ArgumentList.text().latin1())
00042     self.close()
00043
00044   def CancelButtonClicked(self):
00045     self.__value = None
00046     self.close()
00047
00048   def getValue(self, caption):
00049     self.setCaption(caption)
00050     self.show()
00051     self.exec_loop()
00052     return self.__value
00053
00054 class userArgText(object):
00055   "Text user interface for getting the user to input some sort of value"
00056   def __init__(self):
00057     pass
00058
00059   def getValue(self, caption):
00060     return int(raw_input("%s: " % (caption)))
00061
00062
00063 #  Example application implementation.
00064 #  Note that the name of the class must be userApplication.
00065 #  Look at rcTransitions for names of other transition methods that can be used.
00066 class userApplication(rcTransitions):
00067   "Implmentation class for a user application"
00068   def __init__(self, rc, userId, debug):
00069     rcTransitions.__init__(self, rc, userId, debug)
00070     log.debug("userApplication.__init__()")
00071     self.__eventSem    = threading.Semaphore(0)
00072     self.__cmdSynchSem = threading.Semaphore(0)
00073
00074   def getName(self):
00075     return __name__
00076
00077   def setup(self):
00078     log.debug("userApplication.setup()")
00079
00080     if self.isRunFromSuite():
00081       self.__arg = None
00082     elif self.rc is None:
00083       self.__arg = userArgText()
00084     else:
00085       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00086
00087     tem = self.lat.downTEM(0)
00088
00089     # reset the TEM since we are going to modify DATA_MASKS
00090     #tem.CMD_RESET = 1
00091
00092     # clear TEM stats reg
00093     tem.COMMAND_RESPONSE = 0
00094
00095     # clear TEM status reg
00096     tem.STATUS = 0
00097
00098     # enable CAL, disable TKR, no diag #  0x10FF for diag
00099     tem.DATA_MASKS = 0x00FF
00100
00101     # TEM config reg # set TEM timeout
00102     tem.CONFIGURATION = 0
00103
00104     #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00105     #printf("tem config reg = 0x%08x\n", payload);
00106
00107     # enable output in our GCCCs
00108     # broadcast load of GCCC_REG_CONFIGURATION
00109
00110     bcast_ccc = tem.allCCC()
00111     bcast_ccc.CONFIGURATION = 0x80000000L
00112
00113     #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00114     bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00115     bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00116     ccc2 = tem.downCCC(2) # O$GCCC_02
00117     ccc2.LAYER_MASK_1 = 0x3BFD3FFFL
00118
00119     # large timeouts for all GCCCs
00120     # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00121     bcast_ccc.EVENT_TIMEOUTS = 0x0
00122     #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00123     #printf("gccc register event timeouts = 0x%08x\n", payload);
00124
00125     # Two choices for the trigger, GEM and MiniGLT
00126     if self.lat.existsGEM():
00127       self.trigger( SimpleGasuExample() )
00128     else:
00129       self.trigger( MiniGLTExample() )
00130
00131     # A state transition can be rejected by not returning None
00132     return None
00133
00134   def startRun(self):
00135     log.debug("userApplication.startRun()")
00136
00137 #    if self.isRunFromSuite():
00138     cnt = 3
00139 #    else:
00140 #      caption = "Enter number of triggers to take"
00141 #      if self.rc is None:
00142 #        cnt = self.__arg.getValue(caption)
00143 #      else:
00144 #        cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00145
00146     # The user pressed 'Cancel'
00147     if cnt is None:  return -1
00148     self.__cnt = cnt
00149
00150     # Spawn a thread to synchronize commands with events
00151     self.__cmdSynchQuit = FALSE
00152     #cmdSynch = threading.Thread(None, self.__commandSynch, 'CmdSynch', (cnt,))
00153     #self.__cmdSynch = cmdSynch
00154     #cmdSynch.start()
00155
00156     # A state transition can be rejected by not returning None
00157     return None
00158
00159   def stopRun(self):
00160     log.debug("userApplication.stopRun()")
00161
00162     if self.getSessionVar("test") is not None:
00163       self.setSessionVar("test", self.getSessionVar("test") + "d")
00164     self.__cmdSynchQuit = TRUE
00165     self.__eventSem.release()
00166     #self.__cmdSynch.join()
00167
00168     # The STOP_RUN transition can not be rejected
00169
00170   def resume(self):
00171     log.debug("userApplication.resume()")
00172
00173     # Issue self trigger to make up for the one that was lost during PAUSE
00174     self.trigger().solicit()
00175
00176     return None
00177
00178   def stop(self):
00179     log.debug("userApplication.stop()")
00180
00181     return self.stopRun()
00182
00183   def process(self, (status, buffer)):
00184     "Method called back for each data event taken"
00185     ###log.debug("userApplication.process()")
00186
00187     evtCli = self.evtCli
00188
00189     if status != 0:
00190       if evtCli.isGGLTStatus():
00191         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00192       elif not evtCli.checkOnlineStatus(status, self.evtCli.PLAYBACK_ERROR):
00193         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00194       self.__eventSem.release()
00195       return
00196     try:
00197       # In the future this event may contain additional data
00198       if evtCli.isSweepEvent():
00199         return
00200     except:
00201       # Event summary word inaccessible, handle the bad event here
00202       log.exception("")
00203       return
00204
00205     ###evtCli.evDumpCAL_LogAccepts();
00206     ###print ""
00207     ###evtCli.evDumpCAL_Logs();
00208     #~ #print ""
00209     #~ #evtCli.evDumpTKR()
00210     ###evtCli.evDumpTEM_Error()
00211     ###evtCli.evDumpDiagnostic()
00212     ###for acc in evtCli.evt.CAL_LogAccepts:
00213     ###  print "CAL Log Accept: 0x%08x" % acc.ui
00214
00215     ###for data in evtCli.evt.CAL_LogData:
00216     ###  print "CAL Log Data: 0x%08x" % data.ui
00217     #~ sum = evtCli.evt.summary
00218     ###evtCli.evDumpSummary()
00219
00220     # Get next event triggered
00221     self.__eventSem.release()
00222
00223   #def __commandSynch(self, count):
00224   def commandSynch(self):
00225     "Method called by the command synchronization task"
00226     import time
00227     trigger  = self.trigger()
00228     eventSem = self.__eventSem
00229     # Drain the semaphore release count
00230     # Handles the case when the stop run release collided with a trigger release
00231     while eventSem.acquire(0):  pass
00232
00233     t0  = time.time()
00234
00235     # Compensate for the extra CMD_SELF_TRIGGER below
00236     cnt = 1
00237     count = self.__cnt
00238
00239     # Wait for START_RUN to enable triggers
00240     trigger.waitForMaskEnable()
00241
00242     trigger.solicit()                   # Issue an internal trigger
00243     eventSem.acquire()                  # Wait for the event to be processed
00244
00245     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00246
00247     while cnt < count and not self.__cmdSynchQuit:
00248       cnt += 1
00249       trigger.solicit()                 # Issue an internal trigger
00250       time.sleep(.0001)
00251       eventSem.acquire()                # Wait for the event to be processed
00252       #trigger.disable()                # Disable triggers
00253       # Do stuff
00254       #trigger.enable()                 # Enable triggers
00255
00256     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00257     # When we get here the triggers should still be enabled.
00258     # If the glt.MASK needs to be set through any other means
00259     # then it needs to be restored to its SETUP value here.
00260
00261     if t1 is None:
00262       t1 = t0
00263     if t2 is None:
00264       t2 = time.time()
00265     dT = t2 - t1
00266     if dT == 0.0:  dT = 0.000001
00267     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00268              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00269
00270     # Get out of waiting when in batch or standalone mode
00271     self.sync()
00272
00273     # execute the GUI functions for stopRun, just in case
00274     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00275       if self.rc is not None:
00276         self.rc.doStop()
00277
00278   def wait(self):
00279     self.__cmdSynchSem.acquire()
00280
00281   def sync(self):
00282     if __name__ == "__main__" or self.isRunFromSuite():
00283       self.__cmdSynchSem.release()
00284
00285
00286 # Standalone mode:
00287 if __name__ == "__main__":
00288   log.basicConfig()
00289   log.getLogger("").setLevel(log.DEBUG)
00290   ua = userApplication(None, 321, 0)
00291   ua.rcSetup('../repos/simpleTemSchema.xml') # Use env var later: kludge for now
00292   ua.rcStartRun()
00293   ua.wait()
00294   ua.rcStopRun()
00295   ua.rcTeardown()
00296
00297 # History:
00298 #     $Log: testSAppCal.py,v $
00299 #     Revision 1.4.2.1  2005/01/22 01:11:00  stuvi
00300 #     Commented out the TEM reset.
00301 #
00302 #     Revision 1.4  2004/10/22 20:32:48  stuvi
00303 #     Fixed log.exception()
00304 #
00305 #     Revision 1.3  2004/08/18 18:00:15  stuvi
00306 #     Updated for LATTE 4.
00307 #     All hippo functions go through the Qt GUI bridge now.
00308 #
00309 #     Revision 1.2  2004/08/16 22:30:29  stuvi
00310 #     no message
00311 #
00312 #     Revision 1.1  2004/08/07 02:10:42  stuvi
00313 #     Test suite examples.
00314 #
00315 #     Revision 1.14  2004/05/03 21:19:47  stuvi
00316 #     Moved non-Runcontrol scripts to the support directory and modified imports accordingly.
00317 #
00318 #     Revision 1.13  2004/03/10 22:24:51  panetta
00319 #     Upgraded trigger interface.
00320 #     Removed dependencies on self.glt.
00321 #
00322 #     Revision 1.12  2004/02/20 03:20:23  stuvi
00323 #     Added handling of the sweep events and error checking to the process() method,
00324 #
00325 #     Revision 1.11  2004/02/02 23:14:00  stuvi
00326 #     Changes required to make the scripts work with the new FSM engine.
00327 #
00328 #     Revision 1.10  2003/12/11 01:21:34  stuvi
00329 #     Changed code to support the new suite implementation
00330 #
00331 #     Revision 1.9  2003/11/26 21:11:00  stuvi
00332 #     Do not induce stopRun if running as part of a suite
00333 #
00334 #     Revision 1.8  2003/11/04 18:30:53  panetta
00335 #     Changed the commandSynch logic so that the enableMask() call would not pose a threat to snapshot taking.
00336 #
00337 #     Revision 1.7  2003/10/31 01:09:37  panetta
00338 #     1)  Moved register writes from startRun to setup
00339 #     2)  Added GLT enabling logic to __commandSynch
00340 #     3)  Gave example of getting the start/stop time from the hardware/event stream
00341 #
00342 #     Revision 1.6  2003/07/17 00:01:35  stuvi
00343 #     no message
00344 #
00345 #     Revision 1.5  2003/06/13 23:26:24  stuvi
00346 #     Added TEM reset
00347 #
00348 #     Revision 1.4  2003/04/09 00:45:15  stuvi
00349 #     Commented out references to DATA_MASKS register which should not be touched during script execution.
00350 #
00351 #     Revision 1.3  2003/04/01 21:05:00  stuvi
00352 #     Fixed event count discrepancy when the run is stopped in the middle.
00353 #
00354 #     Revision 1.2  2003/03/31 19:23:44  stuvi
00355 #     Fixed name
00356 #
00357 #     Revision 1.1  2003/03/28 03:21:40  stuvi
00358 #     Fixed FITS file status display
00359 #     Added test suite capability
00360 #
00361 #     Revision 1.2  2003/03/26 21:59:36  stuvi
00362 #     Fixed standalone mode
00363 #
00364 #     Revision 1.1  2003/03/11 21:20:55  stuvi
00365 #     Moved from RunControl directory
00366 #
00367 #     Revision 1.8  2003/02/06 05:19:38  claus
00368 #     Added resume; StopRun bug fix
00369 #
00370 #     Revision 1.7  2003/02/06 04:14:35  claus
00371 #     Fixed StopRun bug
00372 #
00373 #     Revision 1.6  2002/12/11 21:18:07  stuvi
00374 #     Changed glt register assignments to bit field assignments
00375 #
00376 #     Revision 1.5  2002/12/10 01:09:58  claus
00377 #     Added path and changed schema/config file for stand-alone mode
00378 #
00379 #     Revision 1.4  2002/12/04 01:59:23  claus
00380 #     Added message logging
00381 #
00382 #     Revision 1.3  2002/12/02 17:17:09  claus
00383 #     Added provision to allow application to run stand-alone
00384 #
00385 #     Revision 1.2  2002/11/28 02:02:04  claus
00386 #     Shuffled constructor arguments
00387 #
00388 #     Revision 1.1  2002/11/27 05:02:48  claus
00389 #     Initial version of Run Control
00390 #
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSAppEvt.py Source File

tests / apps

testSAppEvt.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2003
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example EBF event handling test application"
00012 __author__   = "R. Claus <Claus@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "2/25/2003"
00014 __version__  = "$Revision: 1.4.2.1 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 import threading
00020 import logging       as     log
00021 from   LATTE.runcontrol.rcTransitions import rcTransitions
00022 from   LATTE.runcontrol.ArgumentImpl  import ArgumentImpl
00023 from   time          import *
00024
00025 from support.SimpleGasuExample   import *
00026 from support.MiniGLTExample      import *
00027
00028 TRUE  = (0 < 1)
00029 FALSE = not TRUE
00030
00031 import LDF
00032
00033 import Numeric as Numeric
00034
00035
00036 def _unsigned(arg):
00037   """\brief Convert an unsigned int argument to an unsigned long
00038
00039   This funtion exists to help format unsigned ints greater than 0x7fffffff,
00040   which in Python 2.4 and up will be displayed as signed strings.
00041   """
00042   return arg & (2L * sys.maxint + 1)
00043
00044
00045 class myLATcomponentIterator(LDF.LATcomponentIterator):
00046   def __init__(self):
00047     LDF.LATcomponentIterator.__init__(self)
00048
00049   def UDFcomponent(self, ebfContribution):
00050     print ""
00051     print "Undefined EBF component"
00052
00053   def GLTcomponent(self, gemContribution):
00054     data = Numeric.fromstring(gemContribution.data(), 'i')
00055     print "GEM data: %08x %08x" % (_unsigned(data[0]), _unsigned(data[1]))
00056     print "Time = %f" % (gemContribution.timeFloat())
00057
00058   def ACDcomponent(self, aemContribution):
00059     print "ACD summary word        = 0x%08x" % (aemContribution.summary())
00060     print "ACD contribution length = %d"     % (aemContribution.length())
00061     data = Numeric.fromstring(aemContribution.data(), 'i')
00062     for i in range(aemContribution.payloadSize() >> 2):
00063       print "ACD data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00064
00065   def CALcomponent(self, calContribution):
00066     print "CAL summary word        = 0x%08x" % (calContribution.summary())
00067     print "CAL contribution length = %d"     % (calContribution.length())
00068     print "CAL accepts             = 0x%08x" % (calContribution.logAccepts())
00069     data = Numeric.fromstring(calContribution.data(), 'i')
00070     for i in range(calContribution.numLogAccepts()):
00071       print "CAL Log Data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00072
00073     #evt  = data[0:384]
00074     #evt.shape = (4,4,2,12)
00075     #evt = Numeric.swapaxes(evt,0,1)
00076     #evt = Numeric.resize(evt, (4,8,12))
00077
00078   def TKRcomponent(self, tkrContribution):
00079     print "TKR summary word        = 0x%08x" % (tkrContribution.summary())
00080     print "TKR contribution length = %d"     % (tkrContribution.length())
00081     array = 8*4*' '          # 8 longwords of space to receive accepts
00082     accepts = Numeric.fromstring(tkrContribution.acceptsMask(event, array), 'i')
00083     print "TKR accepts             = 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x 0x%03x" % \
00084           (accepts[0], accepts[1], accepts[2], accepts[3],
00085            accepts[4], accepts[5], accepts[6], accepts[7])
00086     data = Numeric.fromstring(tkrContribution.data(event), 'i')
00087     for i in range(tkrContribution.numAcceptsevent()):
00088       print "TKR data[%3d]: 0x%08x" % (i, _unsigned(data[i]))
00089
00090
00091 #  This class puts up a GUI for inputting a value of some sort.  It is used by
00092 #  the userApplication example to get the number of self triggers to take.
00093 class userArgument(ArgumentImpl):
00094   "GUI for getting the user to input some sort of value."
00095   def __init__(self, parent = None, name = None, modal = 0, fl = 0):
00096     ArgumentImpl.__init__(self, parent, name, modal, fl)
00097     self.__value = 0
00098     self.setCaption("Hello world!")
00099
00100   def OKButtonClicked(self):
00101     self.__value = int(self.ArgumentList.text().latin1())
00102     self.close()
00103
00104   def CancelButtonClicked(self):
00105     self.__value = None
00106     self.close()
00107
00108   def getValue(self, caption):
00109     self.setCaption(caption)
00110     self.show()
00111     self.exec_loop()
00112     return self.__value
00113
00114 class userArgText(object):
00115   "Text user interface for getting the user to input some sort of value"
00116   def __init__(self):
00117     pass
00118
00119   def getValue(self, caption):
00120     return int(raw_input("%s: " % (caption)))
00121
00122
00123 #  Example application implementation.
00124 #  Note that the name of the class must be userApplication.
00125 #  Look at rcTransitions for names of other transition methods that can be used.
00126 class userApplication(rcTransitions):
00127   "Implmentation class for a user application"
00128   def __init__(self, rc, userId, debug):
00129     rcTransitions.__init__(self, rc, userId, debug)
00130     log.debug("userApplication.__init__()")
00131     self.__eventSem    = threading.Semaphore(0)
00132     self.__cmdSynchSem = threading.Semaphore(0)
00133     self.__lci         = myLATcomponentIterator()
00134     self.__ldbi        = LDF.LATdataBufferIterator(self.__lci)
00135
00136   def getName(self):
00137     return __name__
00138
00139   def setup(self):
00140     log.debug("userApplication.setup()")
00141
00142     if self.isRunFromSuite():
00143       self.__arg = None
00144     elif self.rc is None:
00145       self.__arg = userArgText()
00146     else:
00147       self.__arg = self.rc.createGUI(userArgument, self.rc, 'test1', 1)
00148
00149     tem = self.lat.downTEM(0)
00150
00151     if tem is not None:
00152       # reset the TEM since we are going to modify DATA_MASKS
00153       #tem.CMD_RESET = 1
00154
00155       # clear TEM stats reg
00156       tem.COMMAND_RESPONSE = 0
00157
00158       # clear TEM status reg
00159       tem.STATUS = 0
00160
00161       # enable CAL, disable TKR, no diag #  0x10FF for diag
00162       tem.DATA_MASKS = 0x00FF
00163
00164       # TEM config reg # set TEM timeout
00165       tem.CONFIGURATION = 0
00166
00167       #status = gTEMread( __GT, temId, TEM_REG_CONFIGURATION, &payload);
00168       #printf("tem config reg = 0x%08x\n", payload);
00169
00170       # enable output in our GCCCs
00171       # broadcast load of GCCC_REG_CONFIGURATION
00172
00173       bcast_ccc = tem.allCCC()
00174       bcast_ccc.CONFIGURATION = 0x80000000L
00175
00176       #  disable all GCRCs in all GCCCs via broadcast # GCCC_REG_LAYER_MASK_0, GCCC_REG_LAYER_MASK_1
00177       bcast_ccc.LAYER_MASK_0 = 0xFFFFFFFFL
00178       bcast_ccc.LAYER_MASK_1 = 0xFFFFFFFFL
00179       ccc2 = tem.downCCC(2) # O$GCCC_02
00180       ccc2.LAYER_MASK_1 = 0x3BFD3FFFL
00181
00182       # large timeouts for all GCCCs
00183       # broadcast load of GCCC_REG_EVENT_TIMEOUTS
00184       bcast_ccc.EVENT_TIMEOUTS = 0x0
00185       #status = gGCCCread( __GT, temId, 1, GCCC_REG_EVENT_TIMEOUTS, &payload);
00186       #printf("gccc register event timeouts = 0x%08x\n", payload);
00187     else:
00188       log.fatal("No TEM found in the schema: aborting...")
00189       return -1
00190
00191     # Two choices for the trigger, GEM and MiniGLT
00192     if self.lat.existsGEM():
00193       self.trigger( SimpleGasuExample() )
00194     else:
00195       self.trigger( MiniGLTExample() )
00196
00197     # A state transition can be rejected by not returning None
00198     return None
00199
00200   def startRun(self):
00201     log.debug("userApplication.startRun()")
00202
00203     if self.isRunFromSuite():
00204       cnt = 3
00205     else:
00206       caption = "Enter number of triggers to take"
00207       if self.rc is None:
00208         cnt = self.__arg.getValue(caption)
00209       else:
00210         cnt = self.rc.execGUImethod(self.__arg.getValue, caption)
00211
00212       if cnt is None:  return -1
00213     self.__cnt = cnt
00214
00215     # Spawn a thread to synchronize commands with events
00216     self.__cmdSynchQuit = FALSE
00217
00218     # A state transition can be rejected by not returning None
00219     return None
00220
00221   def stopRun(self):
00222     log.debug("userApplication.stopRun()")
00223
00224     self.setCompletionStatus(self.COMPL_STATUS_SUCCESS)
00225     log.info("In %s: SESSION VAR=%s" % (self.getName(), self.getSessionVar("test")))
00226     test = "e"
00227     self.setSessionVar("test", test)
00228     self.__cmdSynchQuit = TRUE
00229     self.__eventSem.release()
00230
00231     # The STOP_RUN transition can not be rejected
00232
00233   def resume(self):
00234     log.debug("userApplication.resume()")
00235
00236     # Issue self trigger to make up for the one that was lost during PAUSE
00237     self.trigger().solicit()
00238
00239     return None
00240
00241   def stop(self):
00242     log.debug("userApplication.stop()")
00243
00244     return self.stopRun()
00245
00246   def teardown(self):
00247     log.debug("userApplication.teardown()")
00248     # Allow the C++ object to be deleted
00249     if self.rc is not None and self.__arg is not None:
00250       self.__arg.deleteLater()
00251
00252   def process(self, (status, buffer)):
00253     "Method called back for each data event taken"
00254     ###log.debug("userApplication.process()")
00255
00256     evtCli = self.evtCli
00257
00258     if status == 0:
00259      if 0:                              # One _OR_ the other method, not both
00260       self.__ldbi.iterate(buffer, len(buffer))
00261      else:                              # Old way of doing things
00262        pass
00263     else:
00264       if evtCli.isGGLTStatus():
00265         log.error("GGLT_STATUS=%d %s" % (evtCli.getGGLTStatus(), evtCli.getGGLTStatusStr()))
00266       elif not evtCli.checkOnlineStatus(status, evtCli.PLAYBACK_ERROR):
00267         log.error("EVENT ERROR= 0x%x %s" % (status, evtCli.getOnlineStatusStr()))
00268       self.__eventSem.release()
00269       return
00270
00271     try:
00272       # In the future this event may contain additional data
00273       if evtCli.isSweepEvent(): return
00274     except:
00275       # Event summary word inaccessible, handle the bad event here
00276       log.exception("")
00277       return
00278
00279       print "Event Size           =", evtCli.getEvtSize()
00280       print "Event Status         =", evtCli.getEvtStatus()
00281       ts = evtCli.evGetTimestamp()
00282       print "Event Timestamp (GMT)=", asctime(gmtime(ts)), \
00283                                       "and", int(modf(ts)[0]*1000), "ms"
00284       contList = evtCli.getContributionList()
00285       for cId in contList:
00286         evtCli.setCurrentContribution(cId)
00287         if cId.startswith('TEM'):
00288           evtCli.evDumpSummary()
00289           evtCli.evDumpCAL_LogAccepts()
00290           evtCli.evDumpCAL_Logs()
00291           evtCli.evDumpTKR()
00292           evtCli.evDumpTEM_Error()
00293           evtCli.evDumpDiagnostic()
00294           for acc in evtCli.evt.CAL_LogAccepts:
00295             print "CAL Log Accept: 0x%08x" % acc.ui
00296
00297           for data in evtCli.evt.CAL_LogData:
00298             print "CAL Log Data: 0x%08x" % data.ui
00299         elif cId == 'ACD':
00300           evtCli.evDumpSummary()
00301           evtCli.evDumpEventAEM()
00302           print "AEM Veto Hit Vectors:"
00303           j = 0
00304           for hitVect in evtCli.evt.aem.vetoHitVectors:
00305             print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00306             j+=1
00307           print "\nAEM Accept Hit Vectors:"
00308           j = 0
00309           for hitVect in evtCli.evt.aem.acceptHitVectors:
00310             print "\tCable %2d Raw Data 0x%05x" % (j, hitVect)
00311             j+=1
00312           print "\nAEM PHA Values:"
00313           j = 0
00314           for pha in evtCli.evt.aem.PHA:
00315             print "\tPHA Value: 0x%04x" % pha
00316
00317     # Get next event triggered
00318     self.__eventSem.release()
00319
00320   #def __commandSynch(self, count):
00321   def commandSynch(self):
00322     "Method called by the command synchronization task"
00323     import time
00324     trigger  = self.trigger()
00325     eventSem = self.__eventSem
00326     # Drain the semaphore release count
00327     # Handles the case when the stop run release collided with a trigger release
00328     while eventSem.acquire(0):  pass
00329
00330     t0  = time.time()
00331
00332     # Compensate for the extra CMD_SELF_TRIGGER below
00333     cnt = 1
00334     count = self.__cnt
00335
00336     # Wait for START_RUN to enable triggers
00337     trigger.waitForMaskEnable()
00338
00339     trigger.solicit()                   # Issue an internal trigger
00340     eventSem.acquire()                  # Wait for the event to be processed
00341
00342     t1 = trigger.getEnableTime()        # get the last trigger enable time from GLT
00343
00344     while cnt < count and not self.__cmdSynchQuit:
00345       cnt += 1
00346       trigger.solicit()                 # Issue an internal trigger
00347       time.sleep(.0001)
00348       eventSem.acquire()                # Wait for the event to be processed
00349       #trigger.disable()                # Disable triggers
00350       # Do stuff
00351       #trigger.enable()                 # Enable triggers
00352
00353     t2 = trigger.getTimeStamp()         # Get the last trigger timestamp
00354     # When we get here the triggers should still be enabled.
00355     # If the glt.MASK needs to be set through any other means
00356     # then it needs to be restored to its SETUP value here.
00357
00358     if t1 is None:
00359       t1 = t0
00360     if t2 is None:
00361       t2 = time.time()
00362     dT = t2 - t1
00363     if dT == 0.0:  dT = 0.000001
00364     log.info("%s processed %d events in %.3f seconds = %.1f events/second" % \
00365              (self.getName(), self.evtCnt, dT, self.evtCnt/dT))
00366
00367     # Get out of waiting when in standalone mode
00368     self.sync()
00369
00370     # execute the GUI functions for stopRun, just in case
00371     if not self.__cmdSynchQuit and not self.isRunFromSuite():
00372       if self.rc is not None:
00373         self.rc.doStop()
00374
00375   def wait(self):
00376     self.__cmdSynchSem.acquire()
00377
00378   def sync(self):
00379     if __name__ == "__main__" or self.isRunFromSuite():
00380       self.__cmdSynchSem.release()
00381
00382
00383 # Standalone mode:
00384 if __name__ == "__main__":
00385   from LATTE.runcontrol.RunControlCommon import RunControlCommon
00386
00387   rcCommon = RunControlCommon()
00388   rcCommon.initialize()
00389   rcCommon.setLoggingLevel("INFO")
00390   rcCommon.connect()
00391   ua = userApplication(None, 321, rcCommon)
00392   ua.rcSetup()
00393   ua.rcStartRun()
00394   ua.wait()
00395   ua.rcStopRun()
00396   ua.rcTeardown()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuite2.py Source File

tests / apps

testSuite2.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example test suite"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/18 18:00:15 $").split(' ')[1]
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 # History:
00020 #     $Log: testSuite2.py,v $
00021 #     Revision 1.2  2004/08/18 18:00:15  stuvi
00022 #     Updated for LATTE 4.
00023 #     All hippo functions go through the Qt GUI bridge now.
00024 #
00025 #     Revision 1.1  2004/08/07 02:10:42  stuvi
00026 #     Test suite examples.
00027 #
00028 #     Revision 1.2  2004/01/24 00:27:17  stuvi
00029 #     Modified to use the appdir from preferences
00030 #
00031 #     Revision 1.1  2003/12/11 01:22:34  stuvi
00032 #     A sample test suite that is called as a sub suite from the testSuite sample.
00033 #
00034 #     Revision 1.2  2003/07/26 04:15:30  stuvi
00035 #     Fixed schema path
00036 #
00037 #     Revision 1.1  2003/03/28 03:21:41  stuvi
00038 #     Fixed FITS file status display
00039 #     Added test suite capability
00040 #
00041
00042 from   LATTE.runcontrol.rcSuite import rcSuite
00043 import logging as     log
00044 import                os
00045
00046
00047 class userSuite(rcSuite):
00048   "Implmentation class for a user application"
00049   def __init__(self, gui, userId, debug):
00050     rcSuite.__init__(self, gui, userId, debug)
00051     log.debug("userSuite.__init__()")
00052
00053   def getName(self):
00054     return __name__
00055
00056   def setupSuite(self):
00057     pass
00058
00059   def startSuite(self):
00060     sessionContext = {"test":"abc"}
00061     # The following script will change the value of session var "test"
00062     appDir = self.gui.preferences()['appdir']
00063     sessionStateAfterTest1 = self.scriptRun(module=os.path.join(appDir,'testSAppCal'),
00064                                             context=sessionContext)
00065     log.info("In %s: SESSION VAR=%s" % (self.getName(), self.getSessionVar("test")))
00066     # The following script will print the value of session var "test" and modify it
00067     sessionStateAfterTest2 = self.scriptRun(module=os.path.join(appDir,'testSAppEvt'))
00068     # Finally let's print the value of the session var "test" here
00069     print sessionStateAfterTest1
00070     print sessionStateAfterTest2
00071     log.info("In %s: SESSION VAR=%s" % (self.getName(), self.getSessionVar("test")))
00072
00073   def stopSuite(self):
00074     log.info("End of suite 2")
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuite.py Source File

tests / apps

testSuite.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example test suite"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/10/20 03:44:55 $").split(' ')[1]
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 # History:
00020 #     $Log: testSuite.py,v $
00021 #     Revision 1.2  2004/10/20 03:44:55  stuvi
00022 #     Commented out the selection of another schema since we want to use the one selected by RunControl.
00023 #
00024 #     Revision 1.1  2004/08/07 02:10:42  stuvi
00025 #     Test suite examples.
00026 #
00027 #     Revision 1.5  2004/01/24 00:27:17  stuvi
00028 #     Modified to use the appdir from preferences
00029 #
00030 #     Revision 1.4  2003/12/11 01:53:00  stuvi
00031 #     Now calling the regular test applications to show that there is no need to change the tests to run them in suites.
00032 #
00033 #     Revision 1.3  2003/12/11 01:23:27  stuvi
00034 #     Modified and documented the code according to the new rcSuite implementation.
00035 #
00036 #     Revision 1.2  2003/07/26 04:15:30  stuvi
00037 #     Fixed schema path
00038 #
00039 #     Revision 1.1  2003/03/28 03:21:41  stuvi
00040 #     Fixed FITS file status display
00041 #     Added test suite capability
00042 #
00043
00044 from   LATTE.runcontrol.rcSuite import rcSuite
00045 import logging as     log
00046 import                os
00047
00048
00049 class userSuite(rcSuite):
00050   "Implmentation class for a user application"
00051   def __init__(self, gui, userId, debug):
00052     rcSuite.__init__(self, gui, userId, debug)
00053     log.debug("userSuite.__init__()")
00054
00055   def getName(self):
00056     return __name__
00057
00058   def setupSuite(self):
00059     # This method is executed after rcStartSuite successfully loads a schema (either
00060     # through the RunControl GUI or by reusing a previously loaded schema)
00061     #self.__schema = os.path.join(os.environ['ONLINE_ROOT'], 'LATTE/repos/simpleTemSchema.xml')
00062     pass
00063
00064   def pauseSuite(self):
00065     # This method is executed before the currently running application is paused.
00066     # Note that there is currently no way to pause a suite, meaning if there is some
00067     # lengthy code that executes between scriptRun calls, that can not be paused.
00068     # Pause can be rejected by not returning None
00069     log.debug("userSuite.pauseSuite")
00070     return None
00071
00072   def startSuite(self):
00073     stopped = 0
00074     try:
00075
00076       # We pass the sesssion variables using a dictionary.
00077       # The set/getSessionVar methods can also be used.
00078       # Please do not use session variables which start with the "_" (underscore)
00079       # character as these are reserved for RunControl use
00080       sessionContext = {"test":"abc"}
00081
00082       # The module name can either be a python file name or a module name
00083       # If a full path is specified then the module at that location is used
00084       # otherwise the PYTHONPATH is searched
00085
00086       # The following script will change the value of session var "test"
00087       appDir = self.gui.preferences()['appdir']
00088       sessionStateAfterTest1 = self.scriptRun(module=os.path.join(appDir,'testAppCal'),
00089                                               context=sessionContext)
00090
00091       # The following script will print the value of session var "test" and modify it
00092       sessionStateAfterTest2 = self.scriptRun(module=os.path.join(appDir,'testAppEvt'))
00093
00094       print sessionStateAfterTest1
00095       print sessionStateAfterTest2
00096
00097       # The schema for subsequent tests or suites can be changed using the following methods.
00098       # The schema chosen when the top level suite was selected in RunControl is still saved
00099       # in case the operator checked the "Reuse schema" checkbox on the load application dialog
00100       #self.readSchema(self.__schema)
00101       #self.applyConfig()
00102
00103       # When the stop button is clicked a StopRequestedException is thrown after which
00104       # the current executing application is interrupted and rcStoprun and rcTeardown
00105       # is called. The suite calling the application should trap the exception using
00106       # a try block as demonstrated below and take the appropriate action.
00107       #
00108       # StopRequestedException class has three members. "msg" contains a generic message,
00109       # "suite" contains the name of the suite that was executing when the stop button was
00110       # clicked. Note that currently only the immediate parent suite name is recorded in
00111       # the exception. The third member is the "module" which contains the name of the
00112       # application that was executing at the time.
00113       self.scriptRun(module=os.path.join(appDir,'testSuite2'))
00114     except rcSuite.StopRequestedException, e:
00115       log.info("%s, suite: %s, module: %s" % (e.msg, e.suite, e.module))
00116       stopped = 1
00117
00118     # Normally the suite appears to be running even after all the tests have been completed.
00119     # In order to stop the suite the operator must click on the stop button. Alternatively
00120     # the suite can issue the stop by calling self.gui.doStopRun similar to the way it is
00121     # done with applications. Note that a flag is being used to make sure that rcStopSuite
00122     # hasn't already been called (ie. the suite was interrupted before it completed).
00123     if not stopped and self.gui is not None:
00124       self.gui.doStopRun()
00125
00126   # stopSuite is called after rcStopSuite has been executed. If a sub-suite within the suite
00127   # is currently executing then the sub-suite's rcStopSuite is called and then this method
00128   # is called.
00129   def stopSuite(self):
00130     log.info("End of suite 1")
00131
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testSuiteLong.py Source File

tests / apps

testSuiteLong.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2002
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Example test suite"
00012 __author__   = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2004/08/16 23:00:20 $").split(' ')[1]
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017 import LATTE.copyright_SLAC
00018
00019 # History:
00020 #     $Log: testSuiteLong.py,v $
00021 #     Revision 1.2  2004/08/16 23:00:20  stuvi
00022 #     no message
00023 #
00024 #     Revision 1.1  2004/08/16 22:30:44  stuvi
00025 #     no message
00026 #
00027 #     Revision 1.1  2004/08/07 02:10:42  stuvi
00028 #     Test suite examples.
00029 #
00030 #     Revision 1.2  2004/01/24 00:27:17  stuvi
00031 #     Modified to use the appdir from preferences
00032 #
00033 #     Revision 1.1  2003/12/11 01:22:34  stuvi
00034 #     A sample test suite that is called as a sub suite from the testSuite sample.
00035 #
00036 #     Revision 1.2  2003/07/26 04:15:30  stuvi
00037 #     Fixed schema path
00038 #
00039 #     Revision 1.1  2003/03/28 03:21:41  stuvi
00040 #     Fixed FITS file status display
00041 #     Added test suite capability
00042 #
00043
00044 from   LATTE.runcontrol.rcSuite import rcSuite
00045 import logging as     log
00046 import                os
00047 import time
00048
00049
00050 class userSuite(rcSuite):
00051   "Implmentation class for a user application"
00052   def __init__(self, gui, userId, debug):
00053     rcSuite.__init__(self, gui, userId, debug)
00054     log.debug("userSuite.__init__()")
00055
00056   def getName(self):
00057     return __name__
00058
00059   def setupSuite(self):
00060     pass
00061     #self.addApplication('./applications/testSAppCal.py', schema)
00062     #self.addApplication('./applications/testSAppEvt.py', schema)
00063
00064   def startSuite(self):
00065     sessionContext = {"test":"abc"}
00066     stopped = 0
00067     # The following script will change the value of session var "test"
00068     appDir = self.gui.preferences()['appdir']
00069     for i in xrange(1000000):
00070       if i % 1000 == 0:
00071         print("Test Run #%d" %i)
00072       # The following script will print the value of session var "test" and modify it
00073       try:
00074         sessionStateAfterTest2 = self.scriptRun(module=os.path.join(appDir,'testSAppCal'), context=sessionContext)
00075       except rcSuite.StopRequestedException, e:
00076         log.info("%s, suite: %s, module: %s" % (e.msg, e.suite, e.module))
00077         stopped = 1
00078         break
00079     if not stopped and self.gui is not None:
00080       self.gui.doStopRun()
00081
00082   def stopSuite(self):
00083     log.info("End of long suite")
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: testTrending.py Source File

monitoring

testTrending.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Housekeeping trending tester module"
00012 __author__   = "J. Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "7/20/2004"
00014 __version__  = "$Revision: 1.2 $"
00015 __credits__  = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 from LATTE.monitoring.Receiver import *
00021 import logging
00022 import qt
00023
00024
00025 class QtReceiver(qt.QObject,UDPReceiver):
00026     class TrendUpdateEvent(qt.QCustomEvent):
00027         def __init__(self,trendables):
00028             qt.QCustomEvent.__init__(self,qt.QEvent.MaxUser-20)
00029             self.trendables=trendables
00030     def __init__(self,*args):
00031         qt.QObject.__init__(self,*args)
00032         Receiver.__init__(self)
00033     def process(self,trendables):
00034         qt.QApplication.postEvent(self,QtReceiver.TrendUpdateEvent(trendables))
00035     def customEvent(self,event):
00036         self.emit(qt.PYSIGNAL('TrendUpdate(trendables)'),(event.trendables,))
00037
00038 class TrendTestGUI(qt.QTextEdit):
00039     def __init__(self,*args):
00040         qt.QTextEdit.__init__(self,*args)
00041         self.setTextFormat(qt.Qt.LogText)
00042         self.setMaxLogLines(1000)
00043     def update(self,trendables):
00044         for t in trendables:
00045             self.append(str(t))
00046
00047 class TrendTree(qt.QListView):
00048     def __init__(self,*args):
00049         qt.QListView.__init__(self,*args)
00050         self.columns=['Name','Time']
00051         self.addColumn('Name')
00052         self.addColumn('Time')
00053         self.setRootIsDecorated(1)
00054         self.setResizeMode(qt.QListView.AllColumns)
00055         self.setAllColumnsShowFocus(1)
00056         self.setShowSortIndicator(1)
00057         self.setSelectionMode(qt.QListView.Extended)
00058         self.__dynamic=1
00059
00060     def isDynamic(self):
00061         return self.__dynamic
00062
00063     def setDynamic(self,bool):
00064         self.__dynamic=bool
00065
00066     def addLeaf(self,name):
00067         if not self.findItem(name,0):
00068             bname=self.getBranchName(name)
00069             branch=self.findItem(bname,0)
00070             if not branch:
00071                 branch=qt.QListViewItem(self,bname)
00072             leaf=qt.QListViewItem(branch,name)
00073             return leaf
00074
00075     def update(self,trendables):
00076         for t in trendables:
00077             leaf=self.findItem(t.name,0)
00078             if not leaf and self.__dynamic:
00079                 leaf=self.addLeaf(t.name)
00080             if leaf:
00081                 from time import ctime
00082                 leaf.setText(1,ctime(t.time))
00083                 for k in t.content.keys():
00084                     try:
00085                         c=self.columns.index(k)
00086                     except ValueError, e:
00087                         self.addColumn(k)
00088                         self.columns.append(k)
00089                         c=self.columns.index(k)
00090                     leaf.setText(c,str(t.content[k]))
00091
00092     def getBranchName(self,name):
00093         return name.split('_')[0]
00094
00095
00096 class TrendPlotter(qt.QWidget):
00097     def __init__(self,*args):
00098         qt.QWidget.__init__(self,*args)
00099
00100         self.__ntuples={}
00101         self.__plots={}
00102         self.__views={}
00103         self.__defaultDepth=150
00104         self.__defaultLabels=['Time','Counts']
00105
00106         self.__dynamic=1
00107
00108         self.grid=qt.QGridLayout(self,1,4)
00109         self.grid.setAutoAdd(1)
00110
00111     def isDynamic(self):
00112         return self.__dynamic
00113     def setDynamic(self,bool):
00114         self.__dynamic==bool
00115
00116     def addPlot(self,trendable):
00117         name=trendable.name
00118         labels=self.__defaultLabels
00119         depth=self.__defaultDepth
00120         import sihippo
00121         # Create the Circular buffer to store the data
00122         ntc=sihippo.NTupleController.instance()
00123         nt=ntc.createCircularBuffer(labels)
00124         nt.reserve(depth)
00125         nt.setTitle(name)
00126         nt.setName(name)
00127         # Create the Plot
00128         dc=sihippo.DisplayController.instance()
00129         # plot=dc.createDisplay('XY Plot',nt,labels)
00130         plot=dc.createDisplay('Strip Chart',nt,labels)
00131         view=sihippo.QtViewWidget(self)
00132         view.setPlotter(plot)
00133         view.setDoubleBuffering(1)
00134         view.resize(200,100)
00135         view.setMinimumSize(qt.QSize(100,50))
00136         #self.grid.addWidget(view)
00137         view.show()
00138
00139         self.__ntuples[name]=nt
00140         self.__plots[name]=plot
00141         self.__views[name]=view
00142
00143     def update(self,trendables):
00144         for t in trendables:
00145             if t.name not in self.__views.keys() and self.__dynamic:
00146                 self.addPlot(t)
00147             if t.name not in self.__views.keys():
00148                 return
00149             x=t.time
00150             y=t.content['Raw Value']
00151             self.__ntuples[t.name].addRow([x,y])
00152
00153
00154 # This is just a dumb way to control the TrendTree
00155 class FancyTrendTree(qt.QVBox):
00156     def __init__(self,*args):
00157         qt.QVBox.__init__(self,*args)
00158
00159         self.tree=TrendTree(self)
00160
00161         self.menu=qt.QPopupMenu(self)
00162         self.menu.insertItem('Remove Selected',self.removeSelected)
00163         self.menu.insertItem('New Leaf',self.newTrend)
00164         self.menu.insertItem('Toggle Dynamic',self.toggleDynamic)
00165
00166         self.connect(self.tree,
00167                      qt.SIGNAL('contextMenuRequested'\
00168                                +'(QListViewItem*,const QPoint&,int)')
00169                      ,self.contextMenu)
00170
00171     def toggleDynamic(self):
00172         self.tree.setDynamic(not self.tree.isDynamic())
00173
00174     def update(self,trendables):
00175         self.tree.update(trendables)
00176
00177     def newTrend(self):
00178         name,ok=qt.QInputDialog.getText('New Leaf',
00179                                         'Name of new leaf',
00180                                         qt.QLineEdit.Normal,
00181                                         '',self)
00182         if ok:
00183             self.tree.addLeaf(str(name))
00184
00185
00186     def removeSelected(self):
00187         it=qt.QListViewItemIterator(self.tree,
00188                                     qt.QListViewItemIterator.Selected)
00189         while it.current():
00190             item=it.current()
00191             if item.parent():
00192                 item.parent().takeItem(item)
00193             else:
00194                 self.tree.takeItem(item)
00195             it+=1
00196
00197     def contextMenu(self,item,point,pos):
00198         self.menu.popup(point)
00199
00200 ###############################################################
00201 def testQtReceiver(args):
00202     app=qt.QApplication(args)
00203
00204     logging.basicConfig()
00205     logging.root.setLevel(logging.DEBUG)
00206
00207     r=QtReceiver()
00208     udpServerName='testTrendingServer'
00209     udpServerAddr='54320@239.255.1.14'
00210     r.setUDPClient(udpServerName,udpServerAddr)
00211
00212     # gui=TrendTestGUI()
00213     # gui=TrendTree()
00214     # gui=FancyTrendTree()
00215     gui=TrendPlotter()
00216     gui.connect(r,qt.PYSIGNAL('TrendUpdate(trendables)'),gui.update)
00217
00218     app.connect(app,qt.SIGNAL("lastWindowClosed()"),
00219                 app,qt.SLOT("quit()"))
00220
00221     app.setMainWidget(gui)
00222     gui.show()
00223
00224     r.setReceiving(1)
00225     app.exec_loop()
00226     r.shutdown()
00227
00228 def testReceiver():
00229     logging.basicConfig()
00230     logging.root.setLevel(logging.DEBUG)
00231
00232     udpServerName='testTrendingServer'
00233     udpServerAddr='54320@239.255.1.14'
00234
00235     r=UDPReceiver()
00236     r.setUDPClient(udpServerName,udpServerAddr)
00237     r.setReceiving(1)
00238     from time import sleep
00239     try:
00240         while 1:
00241             sleep(.1)
00242     except Exception, e:
00243         r.shutdown()
00244
00245 if __name__ == '__main__':
00246     import sys
00247     testQtReceiver(sys.argv)
00248     #testReceiver()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: Trendable.py Source File

monitoring

Trendable.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 class Trendable(object):
00021   def __init__(self,name,time,content={}):
00022     self.name    = name
00023     self.time    = time
00024     self.content = content
00025
00026   def __str__(self):
00027     fstring = '%s | %s' + len(self.content.keys()) * ' | %s'
00028     data    = (self.name, self.time) + tuple(self.content.values())
00029     return fstring % data
00030
00031
00032 class TrendLimit(object):
00033   def __init__(self,name,compare,limit):
00034     self.name  =name
00035     self.limit =limit
00036     if compare is 'lt':
00037       self.add = 1
00038     elif compare is 'gt':
00039       self.add = -1
00040     else:
00041       raise TypeError("Comparison should be \'lt\' or \'gt\'")
00042
00043   def check(self, value):
00044     if cmp(value, self.limit) + self.add:
00045       return 'ok'
00046     else:
00047       return self.name
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrendMaps.py Source File

monitoring

TrendMaps.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Housekeeping server infrastructure"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "07/28/04"
00014 __version__  = "$Revision: 1.7 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 #from LATTE.monitoring.Trendable import Trendable
00020 from LATTE.database.gHSK import GHSK
00021 from LATTE.database.gLAT import GLAT
00022 from copy import deepcopy
00023
00024 class TrendMapBase(object):
00025   def __init__(self):
00026     # set up basic definition of a the LATTE housekeeping map.  Pretty much just define keys
00027     self.__map = {}
00028
00029     self.__map['LHKSPARE08']         = None      #8 bit spare tag
00030     self.__map['LHKSPARE01']         = None      #8 bit spare tag
00031     # Add direct TEM quantities
00032     for i in range(16):
00033       self.__map['LHKT%XCAL33IA'%i ] = None      # CAL 3.3 analog I
00034       self.__map['LHKT%XCAL33ID'%i ] = None      # CAL 3.3 digital I
00035       self.__map['LHKT%XCAL33VA'%i ] = None      # CAL 3.3 analog V
00036       self.__map['LHKT%XCAL33VD'%i ] = None      # CAL 3.3 digital V
00037       self.__map['LHKT%XCALBIASI'%i] = None      # CAL bias I
00038       self.__map['LHKT%XCALBIASV'%i] = None      # CAL bias V
00039       self.__map['LHKT%XTEM33I'%i  ] = None      # TEM digital 3.3 I
00040       self.__map['LHKT%XTEM33V'%i  ] = None      # TEM digital 3.3 V
00041       self.__map['LHKT%XTKR25ID'%i ] = None      # TKR digital 2.5 I
00042       self.__map['LHKT%XTKR25VD'%i ] = None      # TKR digital 2.5 V
00043       self.__map['LHKT%XTKR15IAA'%i] = None      # TKR analog A 1.5 I
00044       self.__map['LHKT%XTKR15VAA'%i] = None      # TKR analog A 1.5 V
00045       self.__map['LHKT%XTKR25IAB'%i] = None      # TKR analog B 2.5 I
00046       self.__map['LHKT%XTKR25VAB'%i] = None      # TKR analog B 2.5 V
00047       self.__map['LHKT%XTKRBIASI'%i] = None      # TKR Bias I
00048       self.__map['LHKT%XTKRBIASV'%i] = None      # TKR Bias V
00049       for j in range(4):
00050         self.__map['LHKT%XCALAF%XT0'%(i,j)] = None     # CAL AFEE T0
00051         self.__map['LHKT%XCALAF%XT1'%(i,j)] = None     # CAL AFEE T1
00052       for j in range(8):
00053         self.__map['LHKT%XTKRC%XT0'%(i,j) ] = None     # TKR CC T0
00054         self.__map['LHKT%XTKRC%XT1'%(i,j) ] = None     # TKR CC T1
00055
00056     # Add ACD FREE values to map.  12*4 + 4 = 52 values
00057     self.__map['LHKAFR33ISUM'  ] = None         # AEM DAQ board FreeI
00058     self.__map['LHKADABTEMP'   ] = None         # AEM DAQ board Temperature
00059     self.__map['LHKAFR28ISUM'  ] = None         # AEM DAQ board HVI
00060     self.__map['LHKADAB33V'    ] = None         # AEM DAQ board DAQV
00061     # self.__map['?????????????' ] = None         # AEM Common status
00062     # self.__map['?????????????' ] = None         # AEM Cable status
00063     for i in range(12):
00064       self.__map['LHKAEMFR%dT'%i ] = None       # Temperature Free board i
00065       self.__map['LHKAEMFR%dV1'%i] = None       # HV1 Free board i
00066       self.__map['LHKAEMFR%dV2'%i] = None       # HV2 Free board i
00067       self.__map['LHKAEMFR%dVD'%i] = None       # VDD Free board i
00068
00069     # Add PDU values to map.  2 pdus
00070     for p in range(2):
00071       self.__map['LHKP%dACDBGT0'%(p)] = None           # PDU ACD BEA GRID temp 0
00072       self.__map['LHKP%dACDBGT1'%(p)] = None           # PDU ACD BEA GRID temp 0
00073       self.__map['LHKP%dACDCNVT'%(p)  ] = None         # PDU ACD Power converter source
00074       self.__map['LHKP%dACDPM'%(p)    ] = None         # PDU ACD power state
00075       self.__map['LHKP%dACDPRT0'%(p)  ] = None         # PDU ACD PMT rail temp 0
00076       self.__map['LHKP%dACDPRT1'%(p)  ] = None         # PDU ACD PMT rail temp 1
00077       self.__map['LHKP%dACDPRT2'%(p)  ] = None         # PDU ACD PMT rail temp 2
00078       self.__map['LHKP%dACDPRT3'%(p)  ] = None         # PDU ACD PMT rail temp 3
00079       self.__map['LHKP%dACDPSP'%(p)   ] = None         # PDU ACD power supply source
00080       self.__map['LHKP%dACDSHT0'%(p)  ] = None         # PDU ACD Shell Temp 0
00081       self.__map['LHKP%dACDSHT1'%(p)  ] = None         # PDU ACD Shell Temp 1
00082
00083       # Add PDU Tem quants to map
00084       for i in range(16):
00085         self.__map['LHKP%dCAL%XBPT'%(p,i)] = None      # PDU CAL Baseplate temp
00086         self.__map['LHKP%dTEM%X33V'%(p,i)] = None      # PDU TEM digital 3.3v
00087         self.__map['LHKP%dTEM%XPCT'%(p,i)] = None      # PDU TEM PCB temp
00088         self.__map['LHKP%dTEM%XPM'%(p,i) ] = None      # PDU TEM power state
00089         self.__map['LHKP%dTEM%XPST'%(p,i) ] = None     # PDU TEM power supply temp
00090
00091       # PDU EPU quants
00092       for i in range(3):
00093         self.__map['LHKP%dEPU%d33V'%(p,i) ] = None     # PDU EPU digital 3.3v
00094         self.__map['LHKP%dEPU%dCNVT'%(p,i)] = None     # PDU EPU Crate power state
00095         self.__map['LHKP%dEPU%dPM'%(p,i)  ] = None     # PDU EPU Converter state
00096         self.__map['LHKP%dEPU%dT'%(p,i)   ] = None     # PDU EPU Temp
00097
00098       for i in range(12):
00099         self.__map['LHKP%dGRID%dT'%(p,i) ] = None      # PDU grid temp
00100         self.__map['LHKP%dRAD%dT'%(p,i)  ] = None      # PDU radiators temp
00101
00102       self.__map['LHKP%dRADAFHT0'%(p)] = None          # PDU Radiator afrz temp0
00103       self.__map['LHKP%dRADAFHT1'%(p)] = None          # PDU Radiator afrz temp1
00104       for i in range(4):
00105         self.__map['LHKP%dGRAD%dIFT'%(p,i)] = None     # PDU Grid-Rad Iface Temp
00106
00107       for i in range(6):
00108         self.__map['LHKP%dMHP%dDSIT'%(p,i)] = None     # PDU VCHP-DSHP interface temps
00109         self.__map['LHKP%dMHP%dRVHT'%(p,i)] = None     # PDU VCHP Reservoir temps
00110         self.__map['LHKP%dMHP%dXLIT'%(p,i)] = None     # PDU VCHP-XLHP interface temps
00111         self.__map['LHKP%dPHP%dDSIT'%(p,i)] = None     # PDU VCHP-DSHP interface temps
00112         self.__map['LHKP%dPHP%dRVHT'%(p,i)] = None     # PDU VCHP Reservoir temps
00113         self.__map['LHKP%dPHP%dXLIT'%(p,i)] = None     # PDU VCHP-XLHP interface temps
00114
00115 #     # Add EBM values to map
00116 #     self.__map['LHKEEVT']         = None               # EBM Events
00117 #     self.__map['LHKEGEMRS']       = None               # EBM GEM Receive stat
00118 #     self.__map['LHKEAEMRS']       = None               # EBM AEM Receive stat
00119 #     self.__map['LHKESIU0RS']      = None               # EBM SIU Receive stat
00120 #     self.__map['LHKESIU1RS']      = None               # EBM SIU Receive stat
00121 #     for i in range(16):
00122 #       self.__map['LHKETEM%XRS'%i] = None               # EBM TEM Receive stat
00123 #     for i in range(3):
00124 #       self.__map['LHKEEPU%XRS'%i] = None               # EBM EPU Receive stat
00125 #       self.__map['LHKEEPU%XTS'%i] = None               # EBM EPU Transmit stat
00126 #     self.__map['LHKESIU0TS']      = None               # EBM SIU Transmit stat
00127 #     self.__map['LHKESIU1TS']      = None               # EBM SIU Transmit stat
00128 #     self.__map['LHKESSRTS']       = None               # EBM SSR Transmit stat
00129
00130     # Still need HCOM, HCPU, LRS quantities
00131
00132     # Create all the "ST" status tags.
00133     kList = self.mapKeys()
00134     for key in kList:
00135       self.__map[key + 'ST'] = None
00136
00137   def mapSet(self, key, value):
00138     if self.__map.has_key(key):
00139       self.__map[key] = value
00140     else:
00141       raise KeyError("TrendMap does not contain key %s.", key)
00142
00143   def mapGet(self, key):
00144     if self.__map.has_key(key):
00145       return self.__map[key]
00146     else:
00147       raise KeyError("TrendMap does not contain key %s.", key)
00148
00149   def mapKeys(self):
00150     return self.__map.keys()
00151
00152 class GHSKTrendMap(TrendMapBase):
00153   def __init__(self, ghsk):
00154     TrendMapBase.__init__(self)
00155
00156     # Hack for null quantities
00157     hnul = ghsk.downHNUL()
00158     self.mapSet('LHKSPARE08',         (hnul, 'EMPTY')         )# Spare bits in hsk packet
00159     self.mapSet('LHKSPARE01',         (hnul, 'EMPTY')         )# Spare bits in hsk packet
00160
00161 # Add direct TEM quantities
00162     for i in range(16):
00163       htem = ghsk.downHTEM(i)
00164       if htem is None: continue
00165       self.mapSet('LHKT%XCAL33IA'%i , (htem, 'CAL_ANALOG_I')  )# CAL 3.3 analog I
00166       self.mapSet('LHKT%XCAL33ID'%i , (htem, 'CAL_DIGITAL_I') )# CAL 3.3 digital I
00167       self.mapSet('LHKT%XCAL33VA'%i , (htem, 'CAL_ANALOG_V')  )# CAL 3.3 analog V
00168       self.mapSet('LHKT%XCAL33VD'%i , (htem, 'CAL_DIGITAL_V') )# CAL 3.3 digital V
00169       self.mapSet('LHKT%XCALBIASI'%i, (htem, 'CAL_BIAS_I')    )# CAL bias I
00170       self.mapSet('LHKT%XCALBIASV'%i, (htem, 'CAL_BIAS_V')    )# CAL bias V
00171       self.mapSet('LHKT%XTEM33I'%i  , (htem, 'TEM_DIGITAL_I') )# TEM digital 3.3 I
00172       self.mapSet('LHKT%XTEM33V'%i  , (htem, 'TEM_DIGITAL_V') )# TEM digital 3.3 V
00173       self.mapSet('LHKT%XTKR25ID'%i , (htem, 'TKR_DIGITAL_I') )# TKR digital 2.5 I
00174       self.mapSet('LHKT%XTKR25VD'%i , (htem, 'TKR_DIGITAL_V') )# TKR digital 2.5 V
00175       self.mapSet('LHKT%XTKR15IAA'%i, (htem, 'TKR_ANALOGA_I') )# TKR analog A 1.5 I
00176       self.mapSet('LHKT%XTKR15VAA'%i, (htem, 'TKR_ANALOGA_V') )# TKR analog A 1.5 V
00177       self.mapSet('LHKT%XTKR25IAB'%i, (htem, 'TKR_ANALOGB_I') )# TKR analog B 2.5 I
00178       self.mapSet('LHKT%XTKR25VAB'%i, (htem, 'TKR_ANALOGB_V') )# TKR analog B 2.5 V
00179       self.mapSet('LHKT%XTKRBIASI'%i, (htem, 'TKR_BIAS_I')    )# TKR Bias I
00180       self.mapSet('LHKT%XTKRBIASV'%i, (htem, 'TKR_BIAS_V')    )# TKR Bias V
00181       for j in range(4):
00182         self.mapSet('LHKT%XCALAF%XT0'%(i,j), (htem, 'AFEE_%d_T0'%j) )     # CAL AFEE T0
00183         self.mapSet('LHKT%XCALAF%XT1'%(i,j), (htem, 'AFEE_%d_T1'%j) )     # CAL AFEE T1
00184       for j in range(8):
00185         self.mapSet('LHKT%XTKRC%XT0'%(i,j) , (htem, 'TKR_C%d_T0'%j) )     # TKR CC T0
00186         self.mapSet('LHKT%XTKRC%XT1'%(i,j) , (htem, 'TKR_C%d_T1'%j) )     # TKR CC T1
00187
00188     # Add ACD FREE values to map.  12*4 + 4 = 52 values
00189     haem = ghsk.downHAEM()
00190     if haem is not None:
00191       self.mapSet('LHKAFR33ISUM'  , (haem, 'FreeI'       ) )         # AEM DAQ board FreeI
00192       self.mapSet('LHKADABTEMP'   , (haem, 'Temperature' ) )         # AEM DAQ board Temperature
00193       self.mapSet('LHKAFR28ISUM'  , (haem, 'HVI'         ) )         # AEM DAQ board HVI
00194       self.mapSet('LHKADAB33V'    , (haem, 'DAQV'        ) )         # AEM DAQ board DAQV
00195       # self.mapSet('?????????????' , (haem, 'CommonStatus') )       # AEM Common status
00196       # self.mapSet('?????????????' , (haem, 'CableStatus' ) )       # AEM Cable status
00197       for i in range(12):
00198         harc = haem.downHARC(i)
00199         if harc is None: continue
00200         self.mapSet('LHKAEMFR%dT'%i , (harc, 'Temperature') )       # Temperature Free board i
00201         self.mapSet('LHKAEMFR%dVD'%i, (harc, 'Vdd'        ) )       # VDD Free board i
00202         self.mapSet('LHKAEMFR%dV1'%i, (harc, 'HV1'        ) )       # HV1 Free board i
00203         self.mapSet('LHKAEMFR%dV2'%i, (harc, 'HV2'        ) )       # HV2 Free board i
00204
00205     # Add PDU values to map.  2 pdus
00206     for p in range(2):
00207       hpdu = ghsk.downHPDU(i)
00208       if hpdu is None: continue
00209       self.mapSet('LHKP%dACDBGT0'%(p), (hpdu, 'ACDBEAgridTemp0') )           # PDU ACD BEA GRID temp 0
00210       self.mapSet('LHKP%dACDBGT1'%(p), (hpdu, 'ACDBEAgridTemp1') )           # PDU ACD BEA GRID temp 0
00211       self.mapSet('LHKP%dACDCNVT'%(p)  , (hpdu, 'ACDconvTemp') )             # PDU ACD Power converter source
00212       self.mapSet('LHKP%dACDPM'%(p)    , (hpdu, 'ACDpowerState') )           # PDU ACD power state
00213       self.mapSet('LHKP%dACDPRT0'%(p)  , (hpdu, 'ACDpmtRailTemp0') )         # PDU ACD PMT rail temp 0
00214       self.mapSet('LHKP%dACDPRT1'%(p)  , (hpdu, 'ACDpmtRailTemp1') )         # PDU ACD PMT rail temp 1
00215       self.mapSet('LHKP%dACDPRT2'%(p)  , (hpdu, 'ACDpmtRailTemp2') )         # PDU ACD PMT rail temp 2
00216       self.mapSet('LHKP%dACDPRT3'%(p)  , (hpdu, 'ACDpmtRailTemp3') )         # PDU ACD PMT rail temp 3
00217       self.mapSet('LHKP%dACDPSP'%(p)   , (hpdu, 'ACDpowerSupply') )          # PDU ACD power supply source
00218       self.mapSet('LHKP%dACDSHT0'%(p)  , (hpdu, 'ACDShellTemp0') )           # PDU ACD Shell Temp 0
00219       self.mapSet('LHKP%dACDSHT1'%(p)  , (hpdu, 'ACDShellTemp1') )           # PDU ACD Shell Temp 1
00220
00221       # Add PDU Tem quants to map
00222       for i in range(16):
00223         self.mapSet('LHKP%dCAL%XBPT'%(p,i), (hpdu, 'CalBaseplateTemp%d'%i) )      # PDU CAL Baseplate temp
00224         self.mapSet('LHKP%dTEM%X33V'%(p,i), (hpdu, 'TEM%d_digital33V'%i)   )      # PDU TEM digital 3.3v
00225         self.mapSet('LHKP%dTEM%XPCT'%(p,i), (hpdu, 'TEM%d_PCBTemp'%i)      )      # PDU TEM PCB temp
00226         self.mapSet('LHKP%dTEM%XPST'%(p,i), (hpdu, 'TEM%d_PSTemp'%i)    )         # PDU TEM power supply
00227         self.mapSet('LHKP%dTEM%XPM'%(p,i) , (hpdu, 'TEM%d_powerState'%i)    )     # PDU TEM power supply
00228
00229       # PDU EPU quants
00230       for i in range(3):
00231         self.mapSet('LHKP%dEPU%d33V'%(p,i) , (hpdu, 'EPUdigitalVoltage%d'%i) )     # PDU EPU digital 3.3v
00232         self.mapSet('LHKP%dEPU%dCNVT'%(p,i), (hpdu, 'EPUCratePowerStat%d'%i) )     # PDU EPU Crate power state
00233         self.mapSet('LHKP%dEPU%dPM'%(p,i)  , (hpdu, 'EPUConverterStat%d')    )     # PDU EPU Converter state
00234         self.mapSet('LHKP%dEPU%dT'%(p,i)   , (hpdu, 'EPUTemp%d'%i)           )     # PDU EPU Temp
00235
00236       for i in range(12):
00237         self.mapSet('LHKP%dGRID%dT'%(p,i) , (hpdu, 'GridTemp%d'%i) )              # PDU grid temp
00238         self.mapSet('LHKP%dRAD%dT'%(p,i)  , (hpdu, 'RadiatorTemp%d'%i) )          # PDU radiators temp
00239
00240       self.mapSet('LHKP%dRADAFHT0'%(p), (hpdu, 'RadiatorAfrzTemp0') )             # PDU Radiator afrz temp0
00241       self.mapSet('LHKP%dRADAFHT1'%(p), (hpdu, 'RadiatorAfrzTemp1') )             # PDU Radiator afrz temp1
00242       for i in range(4):
00243         self.mapSet('LHKP%dGRAD%dIFT'%(p,i), (hpdu, 'GridRadiatorTemp%d'%i) )     # PDU Grid-Rad Iface Temp
00244
00245       for i in range(6):
00246         self.mapSet('LHKP%dMHP%dDSIT'%(p,i), (hpdu, 'VHCP_DSHP_M_Temp%d'%i) )     # PDU VCHP-DSHP interface temps
00247         self.mapSet('LHKP%dMHP%dRVHT'%(p,i), (hpdu, 'VHCPRes_M_Temp%d'%i)   )     # PDU VCHP Reservoir temps
00248         self.mapSet('LHKP%dMHP%dXLIT'%(p,i), (hpdu, 'VHCP_XLHP_M_Temp%d'%i) )     # PDU VCHP-XLHP interface temps
00249         self.mapSet('LHKP%dPHP%dDSIT'%(p,i), (hpdu, 'VHCP_DSHP_P_Temp%d'%i) )     # PDU VCHP-DSHP interface temps
00250         self.mapSet('LHKP%dPHP%dRVHT'%(p,i), (hpdu, 'VHCPRes_P_Temp%d'%i)   )     # PDU VCHP Reservoir temps
00251         self.mapSet('LHKP%dPHP%dXLIT'%(p,i), (hpdu, 'VHCP_XLHP_P_Temp%d'%i) )     # PDU VCHP-XLHP interface temps
00252
00253 #     # Add EBM values to map
00254 #     hebm = ghsk.downHEBM()
00255 #     if hebm is not None:
00256 #       self.mapSet('LHKEEVT'         , (hebm, 'Events') )               # EBM Events
00257 #       self.mapSet('LHKEGEMRS'       , (hebm, 'GEMreceive') )           # EBM GEM Receive stat
00258 #       self.mapSet('LHKEAEMRS'       , (hebm, 'AEMreceive') )           # EBM AEM Receive stat
00259 #       self.mapSet('LHKESIU0RS'      , (hebm, 'SIU0receive') )          # EBM SIU Receive stat
00260 #       self.mapSet('LHKESIU1RS'      , (hebm, 'SIU1receive') )          # EBM SIU Receive stat
00261 #       for i in range(16):
00262 #         self.mapSet('LHKETEM%XRS'%i , (hebm, 'TEM%dreceive'%i) )       # EBM TEM Receive stat
00263 #       for i in range(3):
00264 #         self.mapSet('LHKEEPU%XRS'%i , (hebm, 'EPU%dreceive'%i) )       # EBM EPU Receive stat
00265 #         self.mapSet('LHKEEPU%XTS'%i , (hebm, 'EPU%dtransmit'%i) )      # EBM EPU Transmit stat
00266 #       self.mapSet('LHKESIU0TS'      , (hebm, 'SIU0transmit') )         # EBM SIU Transmit stat
00267 #       self.mapSet('LHKESIU1TS'      , (hebm, 'SIU1transmit') )         # EBM SIU Transmit stat
00268 #       self.mapSet('LHKESSRTS'       , (hebm, 'SSRtransmit') )          # EBM SSR Transmit stat
00269
00270     # Still need HCOM, HCPU, LRS quantities
00271
00272     # Create all the "ST" status tags.
00273     kList = self.mapKeys()
00274     for key in kList:
00275       # Check the last two chars:
00276       if key[len(key)-2:] == 'ST':
00277         self.mapSet(key,            (hnul, 'EMPTY')         )# Don't put status into GHSK
00278
00279
00280 class GLATTrendMap(TrendMapBase):
00281   def __init__(self, glat):
00282     TrendMapBase.__init__(self)
00283
00284     # Add direct TEM quantities
00285     for i in range(16):
00286       gtem = glat.downTEM(i)
00287       if gtem is None: continue
00288       gtic = gtem.downTIC()
00289       self.mapSet('LHKT%XCAL33IA'%i , (gtic, 'adc_cal_analog_3_3i')  )# CAL 3.3 analog I
00290       self.mapSet('LHKT%XCAL33ID'%i , (gtic, 'adc_cal_digital_3_3i') )# CAL 3.3 digital I
00291       self.mapSet('LHKT%XCAL33VA'%i , (gtic, 'adc_cal_analog_3_3v')  )# CAL 3.3 analog V
00292       self.mapSet('LHKT%XCAL33VD'%i , (gtic, 'adc_cal_digital_3_3v') )# CAL 3.3 digital V
00293       self.mapSet('LHKT%XCALBIASI'%i, (gtic, 'adc_cal_bias_i')    )# CAL bias I
00294       self.mapSet('LHKT%XCALBIASV'%i, (gtic, 'adc_cal_bias_v')    )# CAL bias V
00295       self.mapSet('LHKT%XTEM33I'%i  , (gtic, 'adc_tem_digital_3_3i') )# TEM digital 3.3 I
00296       self.mapSet('LHKT%XTEM33V'%i  , (gtic, 'adc_tem_digital_3_3v') )# TEM digital 3.3 V
00297       self.mapSet('LHKT%XTKR25ID'%i , (gtic, 'adc_tkr_digital_2_5i') )# TKR digital 2.5 I
00298       self.mapSet('LHKT%XTKR25VD'%i , (gtic, 'adc_tkr_digital_2_5v') )# TKR digital 2.5 V
00299       self.mapSet('LHKT%XTKR15IAA'%i, (gtic, 'adc_tkr_analog_a_1_5i') )# TKR analog A 1.5 I
00300       self.mapSet('LHKT%XTKR15VAA'%i, (gtic, 'adc_tkr_analog_a_1_5v') )# TKR analog A 1.5 V
00301       self.mapSet('LHKT%XTKR25IAB'%i, (gtic, 'adc_tkr_analog_b_2_5i') )# TKR analog B 2.5 I
00302       self.mapSet('LHKT%XTKR25VAB'%i, (gtic, 'adc_tkr_analog_b_2_5v') )# TKR analog B 2.5 V
00303       self.mapSet('LHKT%XTKRBIASI'%i, (gtic, 'adc_tkr_bias_i')    )# TKR Bias I
00304       self.mapSet('LHKT%XTKRBIASV'%i, (gtic, 'adc_tkr_bias_v')    )# TKR Bias V
00305       for j in range(4):
00306         self.mapSet('LHKT%XCALAF%XT0'%(i,j), (gtic, 'adc_afee%d_t0'%j) )     # CAL AFEE T0
00307         self.mapSet('LHKT%XCALAF%XT1'%(i,j), (gtic, 'adc_afee%d_t1'%j) )     # CAL AFEE T1
00308       for j in range(8):
00309         self.mapSet('LHKT%XTKRC%XT0'%(i,j) , (gtic, 'adc_tkr_c%d_t0'%j) )     # TKR CC T0
00310         self.mapSet('LHKT%XTKRC%XT1'%(i,j) , (gtic, 'adc_tkr_c%d_t1'%j) )     # TKR CC T1
00311
00312     # Add ACD FREE values to map.  12*4 + 4 = 52 values
00313     gaem = glat.downAEM()
00314     if gaem is not None:
00315       gaeq = glat.downAEM().downAEQ()
00316       self.mapSet('LHKAFR33ISUM'  , (gaeq, 'env_dac_digital_3_3i') )         # AEM DAQ board FreeI
00317       self.mapSet('LHKADABTEMP'   , (gaeq, 'env_dac_temp'        ) )         # AEM DAQ board Temperature
00318       self.mapSet('LHKAFR28ISUM'  , (gaeq, 'env_dac_hv_i'        ) )         # AEM DAQ board HVI
00319       self.mapSet('LHKADAB33V'    , (gaeq, 'env_dac_v'           ) )         # AEM DAQ board DAQV
00320       # self.mapSet('?????????????' , (gaem, 'common_status') )       # AEM Common status
00321       # self.mapSet('?????????????' , (gaem, 'power_status' ) )       # AEM Cable status
00322       garcs = ['1la', '1rb', '2la', '2lb', '2ra', '2rb',
00323                '3la', '3rb', '4la', '4lb', '4ra', '4rb']
00324       for i in range(12):
00325         garc = gaem.downARC(i)
00326         if garc is None: continue
00327         g = garcs[i]
00328         self.mapSet('LHKAEMFR%dT'%i , (gaeq, 'env_temp_%s'%g) )       # Temperature Free board i
00329         self.mapSet('LHKAEMFR%dVD'%i, (gaeq, 'env_vdd_%s'%g ) )       # VDD Free board i
00330         self.mapSet('LHKAEMFR%dV1'%i, (gaeq, 'env_hv1_%s'%g ) )       # HV1 Free board i
00331         self.mapSet('LHKAEMFR%dV2'%i, (gaeq, 'env_hv2_%s'%g ) )       # HV2 Free board i
00332
00333     # Add GEM values to map.
00334     ggem = glat.downGEM()
00335     if ggem is not None:
00336       pass
00337
00338     # Add PDU values to map.  2 pdus
00339     for p in range(2):
00340       gpdu = glat.downPDU(i)
00341       if gpdu is None: continue
00342       self.mapSet('LHKP%dACDBGT0'%(p), (gpdu, 'acd_bea_grid_intf_t_0') )      # PDU ACD BEA GRID temp 0
00343       self.mapSet('LHKP%dACDBGT1'%(p), (gpdu, 'acd_bea_grid_intf_t_1') )      # PDU ACD BEA GRID temp 0
00344 #       self.mapSet('LHKP%dACDCNVT'%(p)  , (gpdu, 'ACDconvTemp') )            # PDU ACD Power converter source
00345 #       self.mapSet('LHKP%dACDPM'%(p)    , (gpdu, 'ACDpowerState') )          # PDU ACD power state
00346       self.mapSet('LHKP%dACDPRT0'%(p)  , (gpdu, 'acd_pmt_rail_t_0') )         # PDU ACD PMT rail temp 0
00347       self.mapSet('LHKP%dACDPRT1'%(p)  , (gpdu, 'acd_pmt_rail_t_1') )         # PDU ACD PMT rail temp 1
00348       self.mapSet('LHKP%dACDPRT2'%(p)  , (gpdu, 'acd_pmt_rail_t_2') )         # PDU ACD PMT rail temp 2
00349       self.mapSet('LHKP%dACDPRT3'%(p)  , (gpdu, 'acd_pmt_rail_t_3') )         # PDU ACD PMT rail temp 3
00350 #       self.mapSet('LHKP%dACDPSP'%(p)   , (gpdu, 'ACDpowerSupply') )         # PDU ACD power supply source
00351       self.mapSet('LHKP%dACDSHT0'%(p)  , (gpdu, 'acd_shell_t_0') )            # PDU ACD Shell Temp 0
00352       self.mapSet('LHKP%dACDSHT1'%(p)  , (gpdu, 'acd_shell_t_1') )            # PDU ACD Shell Temp 1
00353 #
00354       # Add PDU Tem quants to map
00355       for i in range(16):
00356         self.mapSet('LHKP%dCAL%XBPT'%(p,i), (gpdu, 'cal_baseplate_t_%02d'%i) ) # PDU CAL Baseplate temp
00357         self.mapSet('LHKP%dTEM%X33V'%(p,i), (gpdu, 'tem_v_%02d'%i)   )         # PDU TEM digital 3.3v
00358         self.mapSet('LHKP%dTEM%XPCT'%(p,i), (gpdu, 'tem_t_%02d'%i)      )      # PDU TEM PCB temp
00359         self.mapSet('LHKP%dTEM%XPM'%(p,i) , (gpdu, 'tem_ps_t_%02d'%i)    )     # PDU TEM power supply
00360 #
00361       # PDU EPU quants
00362       for i in range(3):
00363         self.mapSet('LHKP%dEPU%d33V'%(p,i) , (gpdu, 'epu_v_%d'%i) )             # PDU EPU digital 3.3v
00364 #         self.mapSet('LHKP%dEPU%dCNVT'%(p,i), (gpdu, 'EPUCratePowerStat%d'%i) )     # PDU EPU Crate power state
00365 #         self.mapSet('LHKP%dEPU%dPM'%(p,i)  , (gpdu, 'EPUConverterStat%d')    )     # PDU EPU Converter state
00366         self.mapSet('LHKP%dEPU%dT'%(p,i)   , (gpdu, 'epu_t_%d'%i)           )   # PDU EPU Temp
00367 #
00368       for i in range(12):
00369         self.mapSet('LHKP%dGRID%dT'%(p,i) , (gpdu, 'grid_t_%02d'%i) )          # PDU grid temp
00370 #         self.mapSet('LHKP%dRAD%dT'%(p,i)  , (gpdu, 'RadiatorTemp%d'%i) )      # PDU radiators temp
00371 #
00372 #       self.mapSet('LHKP%dRADAFHT0'%(p), (gpdu, 'RadiatorAfrzTemp0') )         # PDU Radiator afrz temp0
00373 #       self.mapSet('LHKP%dRADAFHT1'%(p), (gpdu, 'RadiatorAfrzTemp1') )         # PDU Radiator afrz temp1
00374 #      for i in range(4):
00375 #         self.mapSet('LHKP%dGRAD%dIFT'%(p,i), (gpdu, 'GridRadiatorTemp%d'%i) )     # PDU Grid-Rad Iface Temp
00376 #
00377       for i in range(6):
00378         self.mapSet('LHKP%dMHP%dDSIT'%(p,i), (gpdu, 'my_vchp_dshp_intf_t_%d'%i))     # PDU VCHP-DSHP interface temps
00379         self.mapSet('LHKP%dMHP%dRVHT'%(p,i), (gpdu, 'py_vchp_rsvr_htr_t_%d'%i) )     # PDU VCHP Reservoir temps
00380         self.mapSet('LHKP%dMHP%dXLIT'%(p,i), (gpdu, 'py_vchp_xlhp_intf_t_%d'%i))     # PDU VCHP-XLHP interface temps
00381         self.mapSet('LHKP%dPHP%dDSIT'%(p,i), (gpdu, 'py_vchp_dshp_intf_t_%d'%i))     # PDU VCHP-DSHP interface temps
00382         self.mapSet('LHKP%dPHP%dRVHT'%(p,i), (gpdu, 'py_vchp_rsvr_htr_t_%d'%i) )     # PDU VCHP Reservoir temps
00383         self.mapSet('LHKP%dPHP%dXLIT'%(p,i), (gpdu, 'py_vchp_xlhp_intf_t_%d'%i))     # PDU VCHP-XLHP interface temps
00384
00385 #     # Add EBM values to map
00386 #     gebm = glat.downEBM()
00387 #     if gebm is not None:
00388 #       gebmst = gebm.downEBMST()
00389 #       gebmc  = gebm.downEBMC()
00390 #       # self.mapSet('LHKEEVT'         , (gebmst, 'Events') )               # EBM Events
00391 #       self.mapSet('LHKEGEMRS'       , (gebmst, 'receive_gem') )               # EBM GEM Receive stat
00392 #       self.mapSet('LHKEAEMRS'       , (gebmst, 'receive_aem') )               # EBM AEM Receive stat
00393 #       self.mapSet('LHKESIU0RS'      , (gebmst, 'receive_siu0') )               # EBM SIU Receive stat
00394 #       self.mapSet('LHKESIU1RS'      , (gebmst, 'receive_siu1') )               # EBM SIU Receive stat
00395 #       for i in range(16):
00396 #         # deal with muxes in other code...
00397 #         self.mapSet('LHKETEM%XRS'%i , (gebm, 'receive_tem_mux0') )               # EBM TEM Receive stat
00398 #       for i in range(3):
00399 #         self.mapSet('LHKEEPU%XRS'%i , (gebmst, 'receive_epu%d'%i) )               # EBM EPU Receive stat
00400 #         self.mapSet('LHKEEPU%XTS'%i , (gebmst, 'transmit_epu%d'%i) )               # EBM EPU Transmit stat
00401 #       self.mapSet('LHKESIU0TS'      , (gebmst, 'transmit_siu0') )               # EBM SIU Transmit stat
00402 #       self.mapSet('LHKESIU1TS'      , (gebmst, 'transmit_siu1') )               # EBM SIU Transmit stat
00403 #       self.mapSet('LHKESSRTS'       , (gebmst, 'transmit_ssr') )               # EBM SSR Transmit stat
00404
00405
00406     # Still need HCOM, HCPU, LRS quantities
00407
00408
00409
00410 class ReverseTrendMap(TrendMapBase):
00411   """Class to create a reverse map from a TrendMap using
00412      gnodes as function ptrs such as GHSKTrendMap and GLATTrendMap
00413   """
00414   def __init__(self, startMap):
00415     TrendMapBase.__init__(self)
00416     self.__map = {}
00417     for key in startMap.mapKeys():
00418       try:
00419         node,attr = startMap.mapGet(key)
00420         nodeStr   = self.__nodeString(node)
00421         newKey    = nodeStr.upper()+attr.upper()
00422         self.__map[newKey] = key
00423       except TypeError:
00424         pass
00425
00426   def mapSet(self, key, value):
00427     if self.__map.has_key(key):
00428       self.__map[key] = value
00429     else:
00430       raise KeyError("TrendMap does not contain key %s.", key)
00431
00432   def mapGet(self, key):
00433     if self.__map.has_key(key):
00434       return self.__map[key]
00435     else:
00436       raise KeyError("TrendMap does not contain key %s.", key)
00437
00438   def mapKeys(self):
00439     return self.__map.keys()
00440
00441   def __nodeString(self, node):
00442     """Useful little recursive function to generate a string representation
00443     of a gDb-like object.
00444
00445     \param node  Any gDb-like object.  (i.e. GLAT, GHSK)
00446     Object must support getName(), up() and id() methods.
00447     """
00448     string = ''
00449     if node is not None:
00450       string += self.__nodeString(node.up())
00451       string += node.getName()
00452       if node.id() is not None:
00453         string += '[' + str(node.id()) + ']'
00454       string += '.'
00455     return string
00456
00457 def makeSimpleMap( trendables, trendMap):
00458   returnMap = {}
00459   # Add the timestamp
00460   returnMap['TimeStamp'] = trendables[0].time
00461
00462   for t in trendables:
00463     key     = t.name
00464     atuple  = trendMap.mapGet(key)
00465     if atuple is not None:
00466       node, attr = atuple
00467       if node is not None:
00468         if  attr != '' and attr is not None:
00469           returnMap[t.name] = node.regs[attr.lower()].get(bypass=False)
00470           # raw = node.regs[attr.lower()].get(bypass=True)
00471         elif isinstance(node, str):
00472           returnMap[t.name] = t.content['Raw Value']
00473   return returnMap
00474
00475 if __name__ == '__main__':
00476   print "Regression test of TrendMaps"
00477   try:
00478     ghsk = GHSK(None)
00479     print "  GHSK instantiation passed"
00480   except:
00481     print "  Could not instantiate ghsk.  aborting"
00482     exit
00483
00484   try:
00485     glat = GLAT(None)
00486     print "  GLAT instantiation passed"
00487   except:
00488     print "  Could not instantiate glat.  aborting"
00489     exit
00490
00491   try:
00492     ghsk.readSchema("c:/panetta/LATTE/repos/hskTestSchema.xml")
00493     print "  GHSK readSchema passed"
00494   except Exception, e:
00495     print "  could not apply schema. Reason: %s" % e
00496
00497   try:
00498     glat.readSchema("c:/panetta/LATTE/repos/hskTestSchema.xml")
00499     print "  GLAT readSchema passed"
00500   except Exception, e:
00501     print "  could not apply schema. Reason: %s" % e
00502
00503   try:
00504     a = TrendMapBase()
00505     print "  TrendMapBase instantiation passed"
00506   except Exception, e:
00507     print "  Could not instantiate TrendMapBase.  Reason: %s" % e
00508
00509   try:
00510     b = GHSKTrendMap(ghsk)
00511     print "  GHSKTrendMap instantiation passed"
00512   except Exception, e:
00513     print "  Could not instantiate GHSKTrendMap.  Reason: %s" % e
00514
00515   try:
00516     c = GLATTrendMap(glat)
00517     print "  GLATTrendMap instantiation passed"
00518   except Exception, e:
00519     print "  Could not instantiate GLATTrendMap.  Reason: %s" % e
00520
00521   try:
00522     d = ReverseTrendMap(b)
00523     print "  ReverseTrendMap(GHSKTrendMap) instantiation passed"
00524   except Exception, e:
00525     print "  Could not instantiate   ReverseTrendMap(GHSKTrendMap).  Reason: %s" % e
00526
00527   try:
00528     e = ReverseTrendMap(c)
00529     print "  ReverseTrendMap(GLATTrendMap) instantiation passed"
00530   except Exception, e:
00531     print "  Could not instantiate ReverseTrendMap(GLATTrendMap).  Reason: %s" % e
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgAbstract.py Source File

trigger

TrgAbstract.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Abstract classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgAbstract: Interface for Coincidence based Trigger System"""
00025
00026
00027 class TrgAbstract(TrgObject):
00028   """\brief Abstract trigger interface class definition
00029   """
00030   def __init__(self):
00031     """\brief TrgAbstract constructor
00032     """
00033     pass
00034
00035   def conditions(self):
00036     """\brief conditions 'pure virtual' method
00037
00038     \return A TrgConditionsValue object
00039     This object specifies the set of conditions to be enabled when
00040     the enable() member function is called
00041     """
00042     raise NotImplementedError
00043     pass
00044
00045   def engines(self):
00046     """\brief Engines 'pure virtual' method
00047
00048     \return A TrgEngines object
00049     This object specifies the set of engines used by the trigger
00050     """
00051     raise NotImplementedError
00052     pass
00053
00054   def sequence(self):
00055     """\brief Sequence 'pure virtual' method
00056
00057     \return A TrgSequence object
00058     This object specifies the initial sequence number definitions for the trigger
00059     """
00060     raise NotImplementedError
00061     pass
00062
00063   def inputEnables(self):
00064     """\brief Enables 'pure virtual' method
00065
00066     \return A TrgInputEnables object
00067     This object specifies the input masking definitions for the trigger
00068     """
00069     raise NotImplementedError
00070     pass
00071
00072   def version(self):
00073     """\brief Version 'pure virtual' method
00074
00075     \return An integer
00076     This value specifies (in a hardware dependent representation) the
00077     generation and revision numbers of the Trigger System.
00078     """
00079     raise NotImplementedError
00080     pass
00081
00082   def maxEngines(self):
00083     """\brief maxEngines 'pure virtual' method
00084
00085     \return An integer
00086     This value determines the maximum number of Trigger Engines
00087     supported by the Trigger System.
00088     """
00089     raise NotImplementedError
00090     pass
00091
00092   def maxConditions(self):
00093     """\brief maxConditions 'pure virtual' method
00094
00095     \return An integer
00096     This value specifies the type and number of conditions
00097     supported by the Trigger System.
00098     """
00099     raise NotImplementedError
00100     pass
00101
00102   def solicit(self):
00103     """\brief Solicit 'pure virtual' method
00104
00105     Allows the application to assert the solicited condition.
00106     Depending on the engine (or engines) associated with this
00107     condition, asserting this condition will most likely cause
00108     a readout of the detector. This function returns no value.
00109     """
00110     raise NotImplementedError
00111     pass
00112
00113   def enable(self):
00114     """\brief Enable 'pure virtual' method
00115
00116     This function returns no value.
00117
00118     Enables the trigger conditions returned by the conditions() member function.
00119     Once a condition is enabled and the
00120     condition occurs in the LAT, the Trigger Engines corresponding to
00121     the condition will fire and most likely cause a Trigger Message to
00122     be emitted by the Trigger System.
00123     """
00124     raise NotImplementedError
00125     pass
00126
00127   def disable(self):
00128     """\brief disable 'pure virtual' method
00129
00130     This function returns no value.
00131
00132     Disables the conditions returned by the conditions() member function.
00133     Once a condition is disabled, the
00134     condition will not activate the Trigger System, independent of its
00135     presence in the LAT.
00136     """
00137     raise NotImplementedError
00138     pass
00139
00140   def shut(self, marker):
00141     """\brief shut 'pure virtual' method
00142
00143     \param marker an integer representing a marker value
00144
00145     This function returns no value.
00146
00147     This function returns performs two functions:
00148     a) it disables any enabled conditions
00149     b) it solicits a trigger with a marker of the value of the input value
00150     """
00151     raise NotImplementedError
00152     pass
00153
00154
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCmdCounters.py Source File

trigger

TrgCmdCounters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Trigger Counter classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from TrgObject import TrgObject
00021
00022 """TrgCmdCounters: Interface for Command Response system"""
00023
00024 class TrgCmdCounters(TrgObject):
00025   """\brief TrgCmdCounters class
00026
00027      This class controls the counters associated with the commands
00028      received and the responses sent by the GEM.
00029   """
00030   def __init__(self):
00031     """\brief TrgCmdCounters constructor
00032     """
00033     TrgObject.__init__(self)
00034     pass
00035
00036   def stats(self):
00037     """\brief stats() method
00038
00039        Get the command statistics object.
00040        \return a TrgCmdStats object
00041     """
00042     raise NotImplementedError
00043     pass
00044
00045   def reset(self):
00046     """\brief reset() method
00047
00048        Reset the command counters
00049     """
00050     raise NotImplementedError
00051     pass # returns void...
00052
00053 class TrgCmdStats(TrgObject):
00054   """\brief TrgCmdStats class
00055
00056      This class specifies the statistics returned by the command counters.
00057      cf: LAT-TD-01545 section 2.3
00058   """
00059   def __init__(self):
00060     """\brief TrgCmdStats constructor
00061     """
00062     TrgObject.__init__(self)
00063     pass
00064
00065   def command(self):
00066     """\brief command() method
00067        \return an integer
00068     """
00069     raise NotImplementedError
00070     pass
00071
00072   def response(self):
00073     """\brief response() method
00074        \return an integer
00075     """
00076     raise NotImplementedError
00077     pass
00078
00079
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgCoincidences.py Source File

trigger

TrgCoincidences.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Coincidence Interface: Coincidence definition classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgCoincidences: Interface for Trigger Coincidence classes"""
00025
00026 class TrgRois(TrgObject):
00027   """\brief Trigger ROI (Region of Interest) list class definition
00028   """
00029   def __init__(self):
00030     """\brief TrgRois constructor
00031     """
00032     pass
00033
00034   def roi(self, regionNumber):
00035     """\brief roi 'pure virtual' method
00036     Reference into the list of ROIs
00037     \param regionNumber  A region number
00038     \return A TrgRoi objece
00039     """
00040     raise NotImplementedError
00041     pass
00042
00043
00044 class TrgRoi(TrgObject):
00045   """\brief Trigger ROI (Region of Interest) class definition
00046   """
00047   def __init__(self):
00048     """\brief TrgRoi constructor
00049     """
00050     pass
00051
00052   def tile(self, tileNumber):
00053     """\brief tile 'pure virtual' method
00054
00055     \param tileNumber  A tile number
00056     \return A boolean
00057     """
00058     raise NotImplementedError
00059     pass
00060
00061
00062 class TrgCoincidences(TrgRois):
00063   """\brief Trigger Coincidences class definition
00064   """
00065   def __init__(self):
00066     """\brief TrgCoincidences constructor
00067     """
00068     TrgRois.__init__(self)
00069
00070   def coincidence(self, coincidenceNumber):
00071     """\brief coincidence 'pure virtual' method
00072     Reference into the list of coincidences.
00073     \param coincidenceNumber  A coincidence number
00074     \return A TrgCoincidence object
00075     """
00076     raise NotImplementedError
00077     pass
00078
00079
00080 class TrgCoincidence(TrgObject):
00081   """\brief Trigger Coincidence class definition
00082   This class defines the set of tiles which will constitute any one coincidence.
00083   """
00084   def __init__(self):
00085     """\brief TrgCoincidence constructor
00086     """
00087     pass
00088
00089   def inCoincidence(self, tileNumber):
00090     """\brief InCoincidence 'pure virtual' method
00091     To be satisfied by the user.
00092     \param tileNumber  A tile number [0..107]
00093     \return An integer
00094     """
00095     raise NotImplementedError
00096     pass
00097
00098
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditions.py Source File

trigger

TrgConditions.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Conditions Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023 """TrgConditions: Interface for Trigger Conditions"""
00024
00025 class TrgConditions(TrgObject):
00026   """\brief Trigger Conditions Value class definition
00027   This class is used to define one combinatoric of the 128 possible conditions.
00028   """
00029   def __init__(self):
00030     """\brief TrgConditions constructor
00031     """
00032     pass
00033
00034   def roi(self):
00035     """\brief roi() 'pure virtual' method
00036
00037     Condition corresponding to a ROI trigger
00038     \return A boolean
00039     """
00040     raise NotImplementedError
00041     pass
00042
00043   def calLow(self):
00044     """\brief calLow() 'pure virtual' method
00045
00046     Condition corresponding to a calorimeter low-energy trigger
00047     \return A boolean
00048     """
00049     raise NotImplementedError
00050     pass
00051
00052   def calHigh(self):
00053     """\brief calHigh() 'pure virtual' method
00054
00055     Condition corresponding to a calorimeter high-energy trigger
00056     \return A boolean
00057     """
00058     raise NotImplementedError
00059     pass
00060
00061   def tkr(self):
00062     """\brief tkr() 'pure virtual' method
00063
00064     Condition corresponding to a tracker 'three in a row' trigger
00065     \return A boolean
00066     """
00067     raise NotImplementedError
00068     pass
00069
00070   def periodic(self):
00071     """\brief periodic() 'pure virtual' method
00072
00073     Condition corresponding to a periodic trigger
00074     \return A boolean
00075     """
00076     raise NotImplementedError
00077     pass
00078
00079   def solicited(self):
00080     """\brief solicited() 'pure virtual' method
00081
00082     Condition corresponding to a solicited trigger
00083     \return A boolean
00084     """
00085     raise NotImplementedError
00086     pass
00087
00088   def cno(self):
00089     """\brief cno() 'pure virtual' method
00090
00091     Condition corresponding to a CNO trigger
00092     \return A boolean
00093     """
00094     raise NotImplementedError
00095     pass
00096
00097   def external(self):
00098     """\brief external() 'pure virtual' method
00099
00100     Condition corresponding to an external trigger source
00101     \return A boolean
00102     """
00103     raise NotImplementedError
00104     pass
00105
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgConditionsValue.py Source File

trigger

TrgConditionsValue.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Conditions Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgConditions import TrgConditions
00022
00023
00024
00025 class TrgConditionsValue(TrgConditions):
00026   """\brief Trigger Conditions Value  class definition
00027   """
00028   def __init__(self):
00029     """\brief TrgConditionsValue constructor
00030     """
00031     pass
00032
00033   def value(self):
00034     """\brief Value method
00035
00036     \return integer
00037
00038     Returns an integer corresponding to the conditionValue integer
00039             corresponding to the WINDOW_OPEN mask register of the GEM
00040             Ref: LAT-TD-01545, S 2.9.2
00041     """
00042     val = 0
00043     val |= ( self.roi()       & 0x1  )  << 0
00044     val |= ( self.tkr()       & 0x1  )  << 1
00045     val |= ( self.calLow()    & 0x1  )  << 2
00046     val |= ( self.calHigh()   & 0x1  )  << 3
00047     val |= ( self.cno()       & 0x1  )  << 4
00048     val |= ( self.periodic()  & 0x1  )  << 5
00049     val |= ( self.solicited() & 0x1  )  << 6
00050     val |= ( self.external()  & 0x1  )  << 7
00051     return val
00052
00053   ########### implementation of pure virtual methods from TrgConditions
00054   # All triggers are off by default.
00055   def roi(self):
00056     return False
00057
00058   def calLow(self):
00059     return False
00060
00061   def calHigh(self):
00062     return False
00063
00064   def tkr(self):
00065     return False
00066
00067   def periodic(self):
00068     return False
00069
00070   def solicited(self):
00071     return False
00072
00073   def cno(self):
00074     return False
00075
00076   def external(self):
00077     return False
00078
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEngines.py Source File

trigger

TrgEngines.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Engine interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgEngines: Interface for the Trigger Engine classes"""
00025
00026
00027 class TrgEngines(TrgObject):
00028   """\brief Trigger Engines class definition
00029   A Trigger Engine defines what the Trigger System does when it
00030   detects a triggerable condition within the LAT
00031   """
00032   def __init__(self):
00033     """\brief TrgEngines constructor
00034     """
00035     pass
00036
00037   def engine(self, engineNumber):
00038     """\brief Engine 'pure virtual' method
00039     Reference into a list of engines.
00040     \param engineNumber  An integer
00041     \return A TrgEngine object
00042     """
00043     raise NotImplementedError
00044     pass
00045
00046
00047 class TrgEngine(TrgObject):
00048   """\brief Trigger Engine class definition
00049   The user inherits from this class to customize their own Trigger Engines.
00050   The user must satisfy the member function 'request', which returns an
00051   object of type TrgEngineRequest.
00052   The user must satisfy the member function 'prescale', which returns an
00053   integer.
00054   """
00055   def __init__(self):
00056     """\brief TrgEngine constructor
00057     """
00058     pass
00059
00060   def prescale(self):
00061     """\brief prescale 'pure virtual' method
00062
00063     \return An integer
00064     """
00065     raise NotImplementedError
00066     pass
00067
00068   def request(self):
00069     """\brief request 'pure virtual' method
00070     Return the TrgEngineRequest object corresponding to this engine.
00071     \return A TrgEngineRequest object
00072     """
00073     raise NotImplementedError
00074     pass
00075
00076   def participate(self,conditionsValue):
00077     """\brief participate 'pure virtual' method
00078     Determines whether or not this engine participates when a particular
00079     conditionsValue is satisfied in the GEM.
00080     \param conditionsValue  An integer
00081     \return A boolean
00082     """
00083     raise NotImplementedError
00084     pass
00085
00086
00087 class TrgEngineRequest(TrgObject):
00088   """\brief Trigger Engine Request class definition
00089   The TrgEngineRequest class is used to specify the parameterization
00090   of the Trigger Message associated with a given engine.
00091
00092   See below for concrete examples.
00093   """
00094   def __init__(self):
00095     """\brief TrgEngineRequest constructor
00096     """
00097     pass
00098
00099
00100   def fourRange(self):
00101     """\brief fourRange 'virtual' method
00102     Return TRUE if the four-range-readout is enabled, else FALSE.
00103     \return A boolean
00104     """
00105     return False
00106
00107   def zeroSuppress(self):
00108     """\brief zeroSuppress 'virtual' method
00109     Return TRUE if the zero-suppression is enabled, else FALSE.
00110     \return A boolean
00111     """
00112     return False
00113
00114   def destination(self):
00115     """\brief destination method
00116
00117     \return An integer
00118     """
00119     raise NotImplementedError
00120     pass
00121
00122   def marker(self, markerValue = 0):
00123     """\brief marker  method
00124
00125     \param markerValue  A marker value
00126     \return An integer
00127     """
00128     return 0
00129
00130   def sequence(self):
00131     """\brief sequence 'pure virtual' method
00132
00133     \return An integer
00134     """
00135     raise NotImplementedError
00136     pass
00137
00138 class TrgInjectCharge(TrgEngineRequest):
00139   """\brief TrgInjectCharge class definition
00140
00141   Directs a module to send to its Front-End Electronics a command sequence
00142   which is composed only of the CALSTROBE command. This command will not
00143   trigger a readout of the module's Front-End Electronics.
00144   """
00145   def __init__(self):
00146     """\brief TrgInjectCharge constructor
00147     """
00148     TrgEngineRequest.__init__(self)
00149
00150   def sequence(self):
00151     """\brief sequence() method
00152     See TrgEngineRequest base class
00153     """
00154     return 2
00155
00156 class TrgReadout(TrgEngineRequest):
00157   """\brief TrgReadout class definition
00158
00159   Directs a module to send to its Front-End Electronics a command sequence
00160   which is composed only of the TACK command. This command will trigger
00161   a readout of the module's Front-End Electronics.
00162   """
00163   def __init__(self):
00164     """\brief TrgReadout constructor
00165     """
00166     TrgEngineRequest.__init__(self)
00167
00168   def sequence(self):
00169     """\brief sequence() method
00170     See TrgEngineRequest base class
00171     """
00172     return 1
00173
00174 class TrgInjectChargeReadout(TrgEngineRequest):
00175   """\brief Trigger Inject Charge Readout class definition
00176
00177   Directs a module to send to its Front-End Electronics a command sequence
00178   which is composed of a CALSTROBE followed by a TACK command.
00179   This sequence will trigger a readout of the module's Front-End Electronics.
00180   """
00181   def __init__(self):
00182     """\brief TrgInjectChargeReadout constructor
00183     """
00184     TrgEngineRequest.__init__(self)
00185
00186   def sequence(self):
00187     """\brief sequence() method
00188     See TrgEngineRequest base class
00189     """
00190     return 3
00191
00192 class TrgInjectMarker(TrgEngineRequest):
00193   """\brief Trigger Inject Marker class definition
00194   Directs a module to send to its Front-End Electronics a command sequence
00195   which is composed of only a TACK command. This sequence will trigger
00196   a readout of the module's Front-End Electronics.
00197   """
00198   def __init__(self, marker):
00199     """\brief TrgInjectMarker constructor
00200     """
00201     TrgEngineRequest.__init__(self)
00202     self.__marker = marker
00203
00204   def sequence(self):
00205     """\brief sequence() method
00206     See TrgEngineRequest base class
00207     """
00208     return 1
00209
00210   def marker(self):
00211     """\brief marker() method
00212     See TrgEngineRequest base class
00213     """
00214     return self.__marker
00215
00216
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgEventCounter.py Source File

trigger

TrgEventCounter.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Abstract classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from TrgObject import TrgObject
00021
00022 """TrgEventCounter: Interface for event counters. """
00023
00024 class TrgEventCounter(TrgObject):
00025   """\brief TrgEventCounter class
00026
00027      This class controls the counters associated with the event stream
00028      received and the responses sent by the GEM.
00029
00030      These functions to be implemented at the hardware abstraction level.
00031   """
00032   def __init__(self):
00033     """\brief TrgEventCounter contructor
00034     """
00035     TrgObject.__init__(self)
00036     pass
00037
00038   def stats(self):
00039     """\brief stats() method
00040
00041        Return the number of events seen by the counter
00042        \return an integer
00043     """
00044     raise NotImplementedError
00045     pass
00046
00047   def reset(self):
00048     """\brief reset() method
00049
00050        Reset the event counters
00051     """
00052     raise NotImplementedError
00053     pass
00054
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGem.py Source File

trigger

TrgGem.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgGem: This file implements the hardware register access to the GEM"""
00021
00022 from TrgGemRegisters      import TrgGemRegisters
00023 from TrgGemCounters       import *
00024 from LATTE.database.gGEM  import GGEM
00025
00026 class TrgGem(TrgGemRegisters):
00027   """\brief Trigger Global Trigger Electronics Module Interface class definition
00028   This class implements the hardware register access to the GEM
00029   """
00030   __SOLICIT_MASK = 0x40
00031
00032   def __init__(self):
00033     """\brief TrgGem constructor
00034     """
00035     TrgGemRegisters.__init__(self)
00036
00037     self.__condValue = None
00038     self.__glt       = None
00039
00040   def GEM(self, glt = None):
00041     """\brief GEM function
00042     \param glt:  a GGEM object
00043     \return a GGEM object
00044
00045     This function sets and/or the GGEM hardware implementation used by
00046     TrgGem.
00047     """
00048     if ( glt is not None ):
00049       if ( not isinstance(glt,GGEM) ):
00050         raise AssertionError, "the glt object passed is not a GGEM"
00051       self.__glt = glt
00052       self.__epuaddr = glt.getEPUaddr()
00053     return self.__glt
00054
00055   def __commit(self):
00056     """\brief Private commit function
00057
00058     This function commits the configuration defined by this
00059     TrgGem object to the hardware.  It does *all* the registers.
00060     """
00061     gem = self.GEM()
00062
00063     # set up the counter accesses and reset them
00064     self.__triggerCounters = TrgGemTriggerCounters(gem)
00065     self.__tileCounters    = TrgGemTileCounters(gem)
00066     self.__cmdCounters     = TrgGemCmdCounters(gem)
00067     self.__eventCounter    = TrgGemEventCounter(gem)
00068     self.__triggerCounters.reset()
00069     self.__tileCounters.reset()
00070     self.__cmdCounters.reset()
00071     self.__eventCounter.reset()
00072
00073     # Pass the GEM to TrgGemSequence and TrgGemPeriodicCondition objects
00074     self.sequence()._TrgGemSequence__setGEM(gem)
00075     self.periodicCondition()._TrgGemPeriodicCondition__setGEM(gem)
00076
00077     # set all engine destination addresses.
00078     # Because engines can't have a real HW dependence, this is done by cheating:
00079     #   replace each instance of the TrgEngineRequest.destination function
00080     #   with a local private function.
00081     for engineNo in range(TrgObject.ENGINE_NUMBER_MAX + 1):
00082       self.engines().engine(engineNo).request().destination = self.__getDestinationFromEPU
00083
00084     gemw = gem.downGEMW()
00085     gemw.WINDOW_OPEN_MASK = 0               # all disabled at startup by default
00086
00087     # print "setting command registers"
00088     # Command registers (GEMC)
00089     gemc = gem.downGEMC()
00090     gemc.CONFIGURATION         = self.configurationRegister()
00091     # NEVER EVER touch the ADDRESS register.  Ever.  Really.
00092     gemc.PERIODIC_MODE         = self.periodicModeRegister()
00093     gemc.PERIODIC_LIMITS       = self.periodicLimitRegister()
00094     gemc.PERIODIC_RATE         = self.periodicRateRegister()
00095     gemc.SEQUENCE              = self.sequenceRegister()
00096     gemc.CR_STATISTICS         = 0    # Always reset statistics
00097     gemc.EVENT_STATISTICS      = 0    # Always reset statistics
00098
00099     # print "setting TAM"
00100     # TAM generator (GEMMG)
00101     gemmg = gem.downGEMMG()
00102     if gemmg is None:
00103       raise RuntimeError, "GEM has no GEMMG"
00104     regList = gemmg.regs.values()           # get the list of registers
00105     for reg in regList:
00106       if reg.size() > 0:
00107         reg.set(self.templateRegister(reg.id()))
00108
00109     # print "setting statistics"
00110     # Statistics registers (GEMST)
00111     gemst = gem.downGEMST()
00112     if gemst is None:
00113       raise RuntimeError, "GEM has no GEMST"
00114     regList = gemst.regs.values()           # get the list of registers
00115     for reg in regList:
00116       if reg.size() > 0:
00117         reg.set(0)                            # Reset all to zero
00118
00119     # print "setting scheduler"
00120     # Scheduler Registers (GEMSC)
00121     gemsc = gem.downGEMSC()
00122     if gemsc is None:
00123       raise RuntimeError, "GEM has no GEMSC"
00124     regList = gemsc.regs.values()           # get the list of registers
00125     for reg in regList:
00126       if reg.size() > 0:
00127         reg.set(self.lookupTableRegister(reg.id()))
00128
00129     # print "setting roi"
00130     # ROI Registers (GEMVG)
00131     gemvg = gem.downGEMVG()
00132     if gemvg is None:
00133       raise RuntimeError, "GEM has no GEMVG"
00134     regList = gemvg.regs.values()           # get the list of registers
00135     for reg in regList:
00136       if reg.size() > 0:
00137         reg.set(self.roiRegister(reg.id()))
00138
00139     # print "setting input enables"
00140     # Input Enable Registers (GEMIE)
00141     gemie = gem.downGEMIE()
00142     if gemie is None:
00143       raise RuntimeError, "GEM has no GEMIE"
00144     regList = gemie.regs.values()           # get the list of registers
00145     for reg in regList:
00146       if reg.size() > 0:
00147         reg.set(self.__ieRegister(reg.id()))  # private function below
00148
00149     # print "setting windowing"
00150     # Window Registers (GEMW)
00151     gemw = gem.downGEMW()
00152     if gemw is None:
00153       raise RuntimeError, "GEM has no GEMW"
00154     gemw.WINDOW_WIDTH = self.width()
00155     gemw.WINDOW_OPEN_MASK = 0               # all disabled at startup by default
00156
00157   def __getDestinationFromEPU(self):
00158     return self.__epuaddr
00159
00160   def __ieRegister(self, registerNumber):
00161     # routine that maps the input-enable registers to the register functions
00162     # 18 input enable registers.
00163     # 0-3 Tower Inputs
00164     # 4 acdCNO
00165     # 5-16 ACD veto enables
00166     # 17 Tower_busy enable
00167     if 0 <= registerNumber <= 3:
00168       return self.towerEnableRegister(registerNumber)
00169     if 4 == registerNumber:
00170       return self.cnoEnableRegister()
00171     if 5 <= registerNumber <= 16:
00172       return self.tileEnableRegister(registerNumber - 5)
00173     if 17 == registerNumber:
00174       return self.towerBusyEnableRegister()
00175     # shouldn't get here
00176     raise IndexError, "registerNumber out of range 0..17"
00177
00178   ############### Pure virtual function implementation
00179   def version(self):
00180     cfg = self.GEM().GEMC.CONFIGURATION
00181     return ( ( cfg >> 16 ) & 0xffff )
00182
00183   def solicit(self):
00184     # transmit the GEM's TRIGGER dataless command
00185     self.GEM().downGEMC().CMD_TRIGGER = 1
00186
00187   def enable(self, mask=None):
00188     if mask is not None:
00189       outMask = mask
00190     elif self.conditions() is not None:
00191       outMask = self.conditions().value()
00192     else:
00193       raise AssertionError, "Attempting to enable a TrgConditionsValue of None"
00194     self.GEM().downGEMW().WINDOW_OPEN_MASK = outMask
00195
00196   def disable(self):
00197     self.GEM().downGEMW().WINDOW_OPEN_MASK = 0
00198
00199   def triggerCounters(self):
00200     return self.__triggerCounters
00201
00202   def tileCounters(self):
00203     return self.__tileCounters
00204
00205   def cmdCounters(self):
00206     return self.__cmdCounters
00207
00208   def eventCounter(self):
00209     return self.__eventCounter
00210
00211   def shut(self, marker):
00212     """Implementation of the shut function.
00213     """
00214     gemw  = self.GEM().GEMW
00215     gemmg = self.GEM().GEMMG
00216     gemsc = self.GEM().GEMSC
00217
00218     #0) disable triggers
00219     self.disable()
00220
00221     #1) Replace engine 0 with a marker engine
00222     from TrgEngine import TrgInjectMarker
00223     newEngine = TrgInjectMarker(marker)
00224     newTAM = self._TrgGemRegisters__parseEngine(newEngine)
00225     oldTAM = gemmg.ENGINE_0
00226     gemmg.ENGINE_0 = newTAM
00227
00228     #2) eplace contents of all schedulers with solicited with (Engine) 0
00229     oldSched = [ gemsc.CONDITIONS_40_47,
00230                  gemsc.CONDITIONS_48_4F,
00231                  gemsc.CONDITIONS_50_57,
00232                  gemsc.CONDITIONS_58_5F,
00233                  gemsc.CONDITIONS_60_67,
00234                  gemsc.CONDITIONS_68_6F,
00235                  gemsc.CONDITIONS_70_77,
00236                  gemsc.CONDITIONS_78_7F ]
00237     scheduler = ( 0x00000000L )               # Everything's 0!
00238     gemsc.CONDITIONS_40_47 = scheduler
00239     gemsc.CONDITIONS_48_4F = scheduler
00240     gemsc.CONDITIONS_50_57 = scheduler
00241     gemsc.CONDITIONS_58_5F = scheduler
00242     gemsc.CONDITIONS_60_67 = scheduler
00243     gemsc.CONDITIONS_68_6F = scheduler
00244     gemsc.CONDITIONS_70_77 = scheduler
00245     gemsc.CONDITIONS_78_7F = scheduler
00246
00247     #3) Change conditions to be solicit only, solicit a trigger and disable
00248     gemw.WINDOW_OPEN_MASK = TrgGem.__SOLICIT_MASK
00249     self.solicit()
00250     self.disable()
00251
00252     #4) Put the original contents of scheduler 0x40 back, and put the TAM back
00253     gemsc.CONDITIONS_40_47 = oldSched[0]
00254     gemsc.CONDITIONS_48_4F = oldSched[1]
00255     gemsc.CONDITIONS_50_57 = oldSched[2]
00256     gemsc.CONDITIONS_58_5F = oldSched[3]
00257     gemsc.CONDITIONS_60_67 = oldSched[4]
00258     gemsc.CONDITIONS_68_6F = oldSched[5]
00259     gemsc.CONDITIONS_70_77 = oldSched[6]
00260     gemsc.CONDITIONS_78_7F = oldSched[7]
00261
00262     gemmg.ENGINE_0 = oldTAM
00263
00264     #5) Put the trigger conditions back
00265     self.enable()
00266
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemAbstract.py Source File

trigger

TrgGemAbstract.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgGemAbstract: Abstract interface for GEM based systems. """
00021
00022 from TrgObject   import TrgObject
00023 from TrgAbstract import TrgAbstract
00024 from TrgPeriodic import TrgPeriodicCondition
00025
00026 class TrgGemAbstract(TrgAbstract):
00027   """\brief Trigger Global trigger Electronics Module Interface class definition
00028   """
00029   def __init__(self):
00030     """\brief TrgGemAbstract constructor
00031     """
00032     TrgAbstract.__init__(self)
00033
00034
00035   #############  Pure Virtual functions
00036   def width(self):
00037     """\brief width 'pure virtual' method
00038
00039     \return An int.
00040
00041     This value specifies the window of the GEM's trigger window
00042     (see [4]). The width is specified in units of system clock, where one
00043     system clock is 50 nanoseconds.
00044     """
00045     raise NotImplementedError
00046     pass
00047
00048   def useAcdAsTrigger(self):
00049     """\brief UseAcdAsTrigger 'pure virtual' method
00050
00051     \return A boolean
00052
00053     This value specifies whether or not the the ROI generator and its ACD
00054     tile signals are be used as a trigger or as a veto.
00055     If the value returned is TRUE, the ROI generator is used as a trigger.
00056     If the value returned is FALSE, the ROI generator is used as a veto.
00057     """
00058     raise NotImplementedError
00059     pass
00060
00061   def redundantPPS(self):
00062     """\brief RedundantPPS 'pure virtual' method
00063
00064     \return A boolean
00065
00066     This value specifies whether or not the GEM should use the redundant
00067     1-PPS signal. If the value returned is TRUE, the redundant 1-PPS signal
00068     will be used. If the value returned is FALSE, the primary
00069     1-PPS signal will not be used.
00070     """
00071     raise NotImplementedError
00072     pass
00073
00074   def responseHeaderParityEven(self):
00075     """\brief responseHeaderParityEven 'pure virtual' method
00076
00077     \return A boolean
00078
00079     This value specifies whether or not the parity associated with a command
00080     responsepacket header should be sent with odd or even parity. If the value returned is
00081     TRUE, response headers will have even parity. If the value returned is FALSE,
00082     responses will have odd parity.
00083     """
00084     raise NotImplementedError
00085     pass
00086
00087   def responseDataParityEven(self):
00088     """\brief responseDataParityEven 'pure virtual' method
00089
00090     \return A boolean
00091
00092     This value specifies whether or not the parity associated with a command
00093     response packet body should be sent with odd or even parity. If the value returned is
00094     TRUE, response bodies will have even parity. If the value returned is FALSE,
00095     responses will have odd parity.
00096     """
00097     raise NotImplementedError
00098     pass
00099
00100   def eventHeaderParityEven(self):
00101     """\brief eventHeaderParityEven 'pure virtual' method
00102
00103     \return A boolean
00104
00105     This value specifies whether or not the parity associated with a trigger
00106     message header initiated by the GEM should be sent with odd or even parity.
00107     If the value returned is TRUE, trigger message headers will have even parity.
00108     If the value returned is FALSE, trigger message headers will have odd parity.
00109     """
00110     raise NotImplementedError
00111     pass
00112
00113   def eventDataParityEven(self):
00114     """\brief eventDataParityEven 'pure virtual' method
00115
00116     \return A boolean
00117
00118     This value specifies whether or not the parity associated with a trigger
00119     message body initiated by the GEM should be sent with odd or even parity.
00120     If the value returned is TRUE, trigger message bodies will have even parity.
00121     If the value returned is FALSE, trigger message bodies will have odd parity.
00122     """
00123     raise NotImplementedError
00124     pass
00125
00126   def triggerParityEven(self):
00127     """\brief TriggerParityEven 'pure virtual' method
00128
00129     \return A boolean
00130
00131     This value specifies whether or not the parity associated with a trigger
00132     message initiated by the GEM should be sent with odd or even parity.
00133     If the value returned is TRUE, trigger messages will have even parity.
00134     If the value returned is FALSE, trigger messages will have odd parity.
00135     """
00136     raise NotImplementedError
00137     pass
00138
00139   def inhibitContribution(self):
00140     """\brief inhibitContribution 'pure virtual' method
00141
00142     \return A boolean
00143
00144     This value specifies whether or not the GEM transmits a contribution
00145     to the event.
00146     If the value returned is TRUE, GEM contributions are inhibited.
00147     If the value returned is FALSE, GEM contributions are sent with the event.
00148     """
00149     raise NotImplementedError
00150     pass
00151
00152   def periodicCondition(self):
00153     """\brief PeriodicCondition 'pure virtual' method
00154
00155     \return A TrgPeriodicCondition object
00156
00157     This object specifies the initial and current definition of
00158     the periodic condition
00159     """
00160     raise NotImplementedError
00161     pass
00162
00163   def roi(self):
00164     """\brief Roi 'pure virtual' method
00165
00166     \return A TrgRoi object
00167
00168     This object specifies the definition of the GEM's ROI generator
00169     """
00170     raise NotImplementedError
00171     pass
00172
00173   def triggerCounters(self):
00174     """\brief triggerCounters 'pure virtual' method
00175
00176     \return A TrgTriggerCounters object
00177
00178     This object specifies an implementation of the GEM's trigger counters
00179     """
00180     raise NotImplementedError
00181     pass
00182
00183   def tileCounters(self):
00184     """\brief tileCounters 'pure virtual' method
00185
00186     \return A TrgTileCounters object
00187
00188     This object specifies an implementation of the GEM's tile counters
00189     """
00190     raise NotImplementedError
00191     pass
00192
00193   def cmdCounters(self):
00194     """\brief cmdCounters 'pure virtual' method
00195
00196     \return A TrgCmdCounters object
00197
00198     This object specifies an implementation of the GEM's Command/Response counters
00199     """
00200     raise NotImplementedError
00201     pass
00202
00203   def eventCounter(self):
00204     """\brief eventCounter 'pure virtual' method
00205
00206     \return A TrgEventCounter object
00207
00208     This object specifies an implementation of the GEM's events sent counter
00209     """
00210     raise NotImplementedError
00211     pass
00212
00213   ############### Pure virtual function implementation
00214   def maxEngines(self):
00215     return (TrgObject.ENGINE_NUMBER_MAX + 1)
00216
00217   def maxConditions(self):
00218     return (TrgObject.CONDITIONS_NUMBER_MAX + 1)
00219
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemCounters.py Source File

trigger

TrgGemCounters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from TrgObject          import TrgObject
00021 from TrgTriggerCounters import TrgTriggerCounters
00022 from TrgTriggerCounters import TrgTriggerStats
00023
00024 from TrgTileCounters    import TrgTileCounters
00025 from TrgTileCounters    import TrgTileStats
00026
00027 from TrgCmdCounters     import TrgCmdCounters
00028 from TrgCmdCounters     import TrgCmdStats
00029
00030 from TrgEventCounter    import TrgEventCounter
00031
00032 """TrgGemCounters: Trigger GEM counter hardware implementation class"""
00033
00034
00035 class TrgGemTriggerCounters(TrgTriggerCounters):
00036   """\brief TrgGemTriggerCounters class
00037
00038   This class implements the HW abstraction corresponding to
00039   figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2
00040
00041   """
00042   def __init__(self,glt):
00043     """\brief TrgGemTriggerCounters constructor
00044     """
00045     TrgTriggerCounters.__init__(self)
00046     self.__stats = TrgGemTriggerStats(glt)
00047     if glt is not None:
00048       self.__cmd = glt.downGEMST()
00049     else:
00050       self.__cmd = None
00051
00052   def stats(self):
00053     """\brief stats() member function
00054     Returns an object that accesses the trigger statistics
00055     \return a TrgGemTriggerStats object
00056     """
00057     return self.__stats
00058
00059   def reset(self):
00060     """\brief reset() member function
00061     Reset the statistics registers
00062     """
00063     # writing to the register resets it.
00064     self.__cmd.LIVETIME      = 0
00065     self.__cmd.PRESCALED = 0
00066     self.__cmd.DISCARDED = 0
00067     self.__cmd.SENT      = 0
00068
00069 class TrgGemTriggerStats(TrgTriggerStats):
00070   """\brief TrgGemTriggerStats
00071   This class implements the HW abstraction corresponding to
00072   figure 66-69 of the GEM document: LAT-01545 Section 2.6.1 and 2.6.2
00073
00074   Note:  Reading the livetime register latches all 4 registers.
00075          Rereading the livetime register unlatches the registers.
00076   """
00077   def __init__(self,glt):
00078     """\brief TrgGemTriggerStats constructor
00079     """
00080     TrgTriggerStats.__init__(self)
00081     if glt is not None:
00082       self.__cmd = glt.downGEMST()
00083     else:
00084       self.__cmd = None
00085
00086   def livetime(self):
00087     return self.__cmd.LIVETIME & 0x0fff
00088
00089   def prescaled(self):
00090     return self.__cmd.PRESCALED & 0x0fff
00091
00092   def discarded(self):
00093     return self.__cmd.DISCARDED & 0x0fff
00094
00095   def sent(self):
00096     return self.__cmd.SENT & 0x0fff
00097
00098 # ###########
00099
00100 class TrgGemTileCounters(TrgTileCounters):
00101   """ \brief TrgGemTileCounters
00102
00103   This class implements the HW abstraction corresponding to
00104   the tile counter detailed in the GEM document:
00105   LAT-01545 Section 2.6
00106   """
00107   def __init__(self,glt):
00108     """\brief TrgGemTileCounters constructor
00109     """
00110     TrgTileCounters.__init__(self)
00111     self.__stats = TrgGemTileStats(glt)
00112     if glt is not None:
00113       self.__cmd = glt.downGEMST()
00114     else:
00115       self.__cmd = None
00116
00117   def stats(self):
00118     return self.__stats
00119
00120   def reset(self):
00121     """\brief reset() member function
00122
00123     Reset the tile counter register
00124     """
00125     self.__cmd.TILE_COUNTERS = 0
00126
00127   def assignA(self,tileNumber):
00128     """\brief assignA() member function
00129
00130     Assign the 'A' tile counter to watch a particular tile
00131     Immediately after counter assignment, both counters are reset.
00132     """
00133     if tileNumber < TrgObject.TILE_NUMBER_MIN or \
00134        tileNumber > TrgObject.TILE_NUMBER_MAX:
00135       raise IndexError, "tileNumber is out of range"
00136
00137     self.__cmd.TILE_0 = ( tileNumber )
00138     self.reset()
00139
00140   def assignB(self, tileNumber):
00141     """\brief assignB() member function
00142
00143     Assign the 'B' tile counter to watch a particular tile
00144     Immediately after counter assignment, both counters are reset.
00145     """
00146     if tileNumber < TrgObject.TILE_NUMBER_MIN or \
00147        tileNumber > TrgObject.TILE_NUMBER_MAX:
00148       raise IndexError, "tileNumber is out of range"
00149
00150     self.__cmd.TILE_1 = ( tileNumber )
00151     self.reset()
00152
00153   def assignAB(self, a, b):
00154     """\brief assignAB() member function
00155
00156     Assign both the 'A' and the'B' tile counters to watch two tiles
00157     Immediately after counter assignment, both counters are reset.
00158     """
00159     if a < TrgObject.TILE_NUMBER_MIN or \
00160        a > TrgObject.TILE_NUMBER_MAX:
00161       raise IndexError, "tileNumber is out of range"
00162     if b < TrgObject.TILE_NUMBER_MIN or \
00163        b > TrgObject.TILE_NUMBER_MAX:
00164       raise IndexError, "tileNumber is out of range"
00165
00166     self.__cmd.TILE_0 = ( a & 0x7f )
00167     self.__cmd.TILE_1 = ( b & 0x7f )
00168     self.reset()
00169
00170 class TrgGemTileStats(TrgTileStats):
00171   """\brief TrgGemTileStats
00172
00173   This class implements the HW abstraction corresponding to
00174   figure 64 of the GEM document: LAT-01545 Section 2.5
00175   """
00176   def __init__(self,glt):
00177     """\brief TrgGemTileStats constructor
00178     """
00179     TrgTileStats.__init__(self)
00180     if glt is not None:
00181       self.__cmd = glt.downGEMST()
00182     else:
00183       self.__cmd = None
00184
00185   def A(self):
00186     return self.__cmd.TILE_COUNTERS & 0xffff
00187
00188   def B(self):
00189     return ( self.__cmd.TILE_COUNTERS >> 16 ) & 0xffff
00190
00191 # ###########
00192
00193 class TrgGemCmdCounters(TrgCmdCounters):
00194   """\brief TrgGemCmdCounters
00195
00196   This class implements the HW abstraction corresponding to
00197   figure 62 of the GEM document: LAT-01545 Section 2.3.4
00198   """
00199   def __init__(self,glt):
00200     """\brief TrgGemCmdCounters constructor
00201     """
00202     TrgCmdCounters.__init__(self)
00203     self.__stats = TrgGemCmdStats(glt)
00204     if glt is not None:
00205       self.__cmd = glt.downGEMC()
00206     else:
00207       self.__cmd = None
00208
00209   def stats(self):
00210     return self.__stats
00211
00212   def reset(self):
00213     """\brief reset() member function
00214
00215     Reset the command/response statistics register
00216     """
00217     self.__cmd.CR_STATISTICS = 0
00218
00219 class TrgGemCmdStats(TrgCmdStats):
00220   """\brief TrgGemCmdStats
00221
00222   This class implements the HW abstraction corresponding to
00223   figure 62 of the GEM document: LAT-01545 Section 2.3.4
00224   """
00225   def __init__(self,glt):
00226     """\brief TrgGemCmdStats constructor
00227     """
00228     TrgCmdStats.__init__(self)
00229     if glt is not None:
00230       self.__cmd = glt.downGEMC()
00231     else:
00232       self.__cmd = None
00233
00234   def command(self):
00235     return ( self.__cmd.CR_STATISTICS >> 16 ) & 0xffff
00236
00237   def response(self):
00238     return ( self.__cmd.CR_STATISTICS       ) & 0xffff
00239
00240 # ###########
00241
00242 class TrgGemEventCounter(TrgEventCounter):
00243   """\brief TrgGemEventCounter
00244
00245   This class implements the HW abstraction corresponding to
00246   figure 63 of the GEM document: LAT-01545 Section 2.3.6
00247   """
00248   def __init__(self,glt):
00249     """\brief TrgGemEventCounter constructor
00250     """
00251     TrgEventCounter.__init__(self)
00252     if glt is not None:
00253       self.__cmd = glt.downGEMC()
00254     else:
00255       self.__cmd = None
00256
00257   def stats(self):
00258     return ( self.__cmd.EVENT_STATISTICS ) & 0xffff
00259
00260   def reset(self):
00261     """\brief reset() member function
00262
00263     Reset the event statistics register
00264     """
00265     self.__cmd.EVENT_STATISTICS = 0
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemPeriodicCondition.py Source File

trigger

TrgGemPeriodicCondition.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgGemPeriodicCondition: Hardware implementation of TrgPeriodicCondition"""
00021
00022 from TrgPeriodic import TrgPeriodicCondition
00023
00024 class TrgGemPeriodicCondition(TrgPeriodicCondition):
00025   """\brief Trigger Periodic Condition class definition
00026   """
00027
00028   def __init__(self): # constructor...
00029     TrgPeriodicCondition.__init__(self)
00030     self.__gem = None
00031
00032   def __setGEM(self, gem):
00033     self.__gem = gem
00034
00035   def remaining(self):
00036     """\brief remaining() method
00037     See base class
00038     """
00039     return self.__gem.GEMC.PERIODIC_LIMITS
00040
00041   def reset(self):
00042     """\brief reset() method
00043     See base class
00044     """
00045     self.__gem.GEMC.PERIODIC_LIMITS = 0
00046     self.__gem.GEMC.PERIODIC_LIMITS = self.limit()
00047
00048   def abort(self):
00049     """\brief abort() method
00050     See base class
00051     """
00052     self.__gem.GEMC.PERIODIC_LIMITS = 0
00053
00054
00055   def source(self):
00056     """\brief source() method
00057     See base class
00058     """
00059     return self.definition().source()
00060
00061   def prescale(self):
00062     """\brief prescale() method
00063     See base class
00064     """
00065     return self.definition().prescale()
00066
00067   def limit(self):
00068     """\brief limit() method
00069     See base class
00070     """
00071     return self.definition().limit()
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemRegisterGeometry.py Source File

trigger

TrgGemRegisterGeometry.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 import LDF
00021
00022 """TrgGemRegisterGeometry: Define the mapping between tile number and tile name"""
00023
00024
00025 class ACDmap(LDF.ACDmap):
00026   """An implementation of LDF.ACDmap that forces a particular LATtypeId()
00027   """
00028   def __init__(self, gemVersion = None):
00029     LDF.ACDmap.__init__(self)
00030     self.__setLatId(gemVersion)
00031
00032   def __setLatId(self, gemVersion):
00033     if gemVersion is None:   # Take the most recent one
00034       self.__latId = LDF.LATtypeId(LDF.EBFevent.ID)
00035     else:                    # have a gemVersion, parse it.
00036       (type, board) = self.__parseGemVersion(gemVersion)
00037       if board == 0:         # Original, screwy board.
00038         self.__latId = LDF.LATtypeId(LDF.EBFevent.ID_3)
00039       else:
00040         self.__latId = LDF.LATtypeId(LDF.EBFevent.ID)
00041     return
00042
00043   def __parseGemVersion(self, gemVersion):
00044     board = ( gemVersion >> (16 + 12) ) & 0x3
00045     type  = ( gemVersion >> (16 + 14) ) & 0x3
00046     return (type, board)
00047
00048   def lookup(self, cable, channel):
00049     return LDF.ACDmap.lookup(self, self.__latId, cable, channel)
00050
00051   def freeName(self, cable):
00052     return LDF.ACDmap.freeName(self, self.__latId, cable)
00053
00054
00055
00056
00057
00058 AcdTileNumbering = {# "TileName" : TileNumber(hex)
00059   "000" : 0x00, "001" : 0x01, "002" : 0x02, "003" : 0x03,
00060   "004" : 0x04, "010" : 0x05, "011" : 0x06, "012" : 0x07,
00061   "013" : 0x08, "014" : 0x09, "020" : 0x0A, "021" : 0x0B,
00062   "022" : 0x0C, "023" : 0x0D, "024" : 0x0E, "030" : 0x0F,
00063   "031" : 0x10, "032" : 0x11, "033" : 0x12, "034" : 0x13,
00064   "040" : 0x14, "041" : 0x15, "042" : 0x16, "043" : 0x17,
00065   "044" : 0x18, "NA2" : 0x19, "NA3" : 0x1A, "100" : 0x1B,
00066   "101" : 0x1C, "102" : 0x1D, "103" : 0x1E, "104" : 0x1F,
00067   "110" : 0x20, "111" : 0x21, "112" : 0x22, "113" : 0x23,
00068   "114" : 0x24, "120" : 0x25, "121" : 0x26, "122" : 0x27,
00069   "123" : 0x28, "124" : 0x29, "130" : 0x2A, "NA4" : 0x2B,
00070   "NA5" : 0x2C, "200" : 0x2D, "201" : 0x2E, "202" : 0x2F,
00071   "203" : 0x30, "204" : 0x31, "210" : 0x32, "211" : 0x33,
00072   "212" : 0x34, "213" : 0x35, "214" : 0x36, "220" : 0x37,
00073   "221" : 0x38, "222" : 0x39, "223" : 0x3A, "224" : 0x3B,
00074   "230" : 0x3C, "NA6" : 0x3D, "NA7" : 0x3E, "300" : 0x3F,
00075   "301" : 0x40, "302" : 0x41, "303" : 0x42, "304" : 0x43,
00076   "310" : 0x44, "311" : 0x45, "312" : 0x46, "313" : 0x47,
00077   "314" : 0x48, "320" : 0x49, "321" : 0x4A, "322" : 0x4B,
00078   "323" : 0x4C, "324" : 0x4D, "330" : 0x4E, "NA8" : 0x4F,
00079   "NA9" : 0x50, "400" : 0x51, "401" : 0x52, "402" : 0x53,
00080   "403" : 0x54, "404" : 0x55, "410" : 0x56, "411" : 0x57,
00081   "412" : 0x58, "413" : 0x59, "414" : 0x5A, "420" : 0x5B,
00082   "421" : 0x5C, "422" : 0x5D, "423" : 0x5E, "424" : 0x5F,
00083   "430" : 0x60, "NA0" : 0x61, "NA1" : 0x62, "500" : 0x63,
00084   "501" : 0x64, "502" : 0x65, "503" : 0x66, "600" : 0x67,
00085   "601" : 0x68, "602" : 0x69, "603" : 0x6A, "NA10" : 0x6B
00086   }
00087
00088 RoiRegisterMap = { # address : [ "tileName0", "tileName1" ]
00089    0 : [ "000", "001" ],  1 : [ "002", "003" ],
00090    2 : [ "004", "010" ],  3 : [ "011", "012" ],
00091    4 : [ "013", "014" ],  5 : [ "020", "021" ],
00092    6 : [ "022", "023" ],  7 : [ "024", "030" ],
00093    8 : [ "031", "032" ],  9 : [ "033", "034" ],
00094   10 : [ "040", "041" ], 11 : [ "042", "043" ],
00095   12 : [ "044", "NA2" ], 13 : [ "NA3", "100" ],
00096   14 : [ "101", "102" ], 15 : [ "103", "104" ],
00097   16 : [ "110", "111" ], 17 : [ "112", "113" ],
00098   18 : [ "114", "120" ], 19 : [ "121", "122" ],
00099   20 : [ "123", "124" ], 21 : [ "130", "NA4" ],
00100   22 : [ "NA5", "200" ], 23 : [ "201", "202" ],
00101   24 : [ "203", "204" ], 25 : [ "210", "211" ],
00102   26 : [ "212", "213" ], 27 : [ "214", "220" ],
00103   28 : [ "221", "222" ], 29 : [ "223", "224" ],
00104   30 : [ "230", "NA6" ], 31 : [ "NA7", "300" ],
00105   32 : [ "301", "302" ], 33 : [ "303", "304" ],
00106   34 : [ "310", "311" ], 35 : [ "312", "313" ],
00107   36 : [ "314", "320" ], 37 : [ "321", "322" ],
00108   38 : [ "323", "324" ], 39 : [ "330", "NA8" ],
00109   40 : [ "NA9", "400" ], 41 : [ "401", "402" ],
00110   42 : [ "403", "404" ], 43 : [ "410", "411" ],
00111   44 : [ "412", "413" ], 45 : [ "414", "420" ],
00112   46 : [ "421", "422" ], 47 : [ "423", "424" ],
00113   48 : [ "430", "NA0" ], 49 : [ "NA1", "500" ],
00114   50 : [ "501", "502" ], 51 : [ "503", "600" ],
00115   52 : [ "601", "602" ], 53 : [ "603", "NA10"]
00116   }
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemRegisters.py Source File

trigger

TrgGemRegisters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.3.2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject              import TrgObject
00022 from TrgGemAbstract         import TrgGemAbstract
00023 from TrgGemRegisterGeometry import AcdTileNumbering
00024 from TrgGemRegisterGeometry import RoiRegisterMap
00025
00026 """TrgGemRegisters: Register shape defintions for a GASU trigger system"""
00027
00028
00029 class TrgGemRegisters(TrgGemAbstract):
00030   """\brief TrgGemRegisters class definition
00031
00032   Implements the register shape definitions for a GASU trigger system
00033   """
00034   ROI_REGISTER_MIN   =  0
00035   ROI_REGISTER_MAX   = 53
00036   TILE_REGISTER_MIN  =  0
00037   TILE_REGISTER_MAX  = 11
00038   TILE_REGISTER_SIZE =  9
00039
00040   def __init__(self):
00041     """\brief TrgGem constructor
00042     """
00043     TrgGemAbstract.__init__(self)
00044
00045   # protected:
00046   def configurationRegister(self):
00047     """\brief configurationRegister() method
00048
00049     Method to construct the value of the GEM configuration register
00050     \return An integer
00051     """
00052     # Configuration register format defined in LAT-01545: Sec 2.3.1
00053     conf = 0x0
00054     conf |= ( self.useAcdAsTrigger()          )  << 0
00055     conf |= ( self.redundantPPS()             )  << 1
00056     conf |= ( self.responseHeaderParityEven() )  << 2
00057     conf |= ( self.responseDataParityEven()   )  << 3
00058     conf |= ( self.eventHeaderParityEven()    )  << 4
00059     conf |= ( self.eventDataParityEven()      )  << 5
00060     conf |= ( self.triggerParityEven()        )  << 6
00061     conf |= ( self.inhibitContribution()      )  << 7
00062     conf |= ( self.version() & 0xffffL        )  << 16  # meaningless.  Field is RO
00063
00064     return conf
00065
00066   def widthRegister(self):
00067     """\brief widthRegister method
00068
00069     \return integer
00070
00071     Returns a 32 bit integer corresponding to the WINDOW_WIDTH register
00072     of the GEM. Ref: LAT-TD-01545, S 2.9.1
00073     """
00074     return (self.width() & 0x1f)
00075
00076   def periodicRateRegister(self):
00077     """\brief periodicRateRegister method
00078
00079     \return integer
00080
00081     Returns a 32 bit integer corresponding to the PERIODIC_RATE register
00082     of the GEM. Ref: LAT-TD-01545, S 2.3.3.1
00083     """
00084     # prescale is 24 bits.
00085     rate = 0
00086     rate |= ( self.periodicCondition().definition().prescale() & 0xffffff  )
00087     rate |= ( self.periodicCondition().definition().source()   & 0x1       ) << 31
00088     return rate
00089
00090   def periodicModeRegister(self):
00091     """\brief periodicModeRegister method
00092
00093     \return integer
00094
00095     Returns a 32 bit integer corresponding to the PERIODIC_MODE register
00096     of the GEM. Ref: LAT-TD-01545, S 2.3.3.2
00097     """
00098     mode = 1
00099     if self.periodicCondition().definition().limit() != 0:
00100       mode = 0
00101     return mode
00102
00103   def periodicLimitRegister(self):
00104     """\brief periodicLimitRegister method
00105
00106     \return integer
00107
00108     Returns a 32 bit integer corresponding to the PERIODIC_LIMITS register
00109     of the GEM. Ref: LAT-TD-01545, S 2.3.3.3
00110     """
00111     limit = 0
00112     limit |= ( self.periodicCondition().definition().limit() & 0xffffL )
00113     return limit
00114
00115   def sequenceRegister(self):
00116     """\brief sequenceRegister method
00117
00118     \return integer
00119
00120     Returns a 32 bit integer corresponding to the SEQUENCE register
00121     of the GEM. Ref: LAT-TD-01545, S 2.3.4
00122     """
00123     # yes, this is 17 bits...
00124     seq = 0
00125     seq |= ( self.sequence().definition().eventTag()    & 0x3    )
00126     seq |= ( self.sequence().definition().eventNumber() & 0x7fffL ) << 2
00127     return seq
00128
00129   def templateRegister(self, registerNumber):
00130     """\brief templateRegister method
00131
00132     \param registerNumber  An registerNumber value
00133     \return integer
00134
00135     Returns a 32 bit integer corresponding to the message engine
00136     template register of the TAM.  Ref: LAT-TD-01545, S 2.5
00137     Context portion is defined in 1.8.6.1
00138     """
00139     # note:  There is an exact correspondence between the engineNumber
00140     #        and the registerNumber
00141
00142     if registerNumber < TrgObject.ENGINE_NUMBER_MIN or \
00143        registerNumber > TrgObject.ENGINE_NUMBER_MAX:
00144       raise IndexError, "Register index out of bounds"
00145     eng = self.engines().engine(registerNumber)
00146     return self.__parseEngine(eng)
00147
00148   def __parseEngine(self, eng):
00149     presc = eng.prescale()
00150     if presc < 0:
00151       inhibit = 1
00152       presc = 0
00153     else:
00154       inhibit = 0
00155
00156     reg      = 0
00157     reg     |= ( presc                     & 0xff )
00158     reg     |= ( inhibit                   & 0x1  ) << 15
00159
00160     engReq   = eng.request()
00161     calstr   = ( engReq.sequence()     & 0x2  ) >> 1
00162     tack     = ( engReq.sequence()     & 0x1  )
00163     context  = 0
00164     context |= ( calstr                & 0x1  )
00165     # 2 bits for tag
00166     context |= ( tack                  & 0x1  ) << 3
00167     context |= ( engReq.fourRange()    & 0x1  ) << 4
00168     context |= ( engReq.zeroSuppress() & 0x1  ) << 5
00169     context |= ( engReq.marker()       & 0x7  ) << 6
00170     context |= ( engReq.destination()  & 0x3f ) << 9
00171
00172     reg |= ( context                & 0xffffL ) << 16
00173
00174     return reg
00175
00176   def lookupTableRegister(self, registerNumber):
00177     """\brief lookupTableRegister method
00178
00179     \param registerNumber  A reference into the Scheduler register set
00180     \return integer
00181
00182     Returns a 32 bit integer referencing the TAM generator used for a
00183     particular trigger summary
00184     Ref: LAT-TD-01545, S 2.7
00185     """
00186     nReg = ( TrgObject.CONDITIONS_NUMBER_MAX + 1 ) / 8
00187     if registerNumber < 0 or registerNumber > nReg:
00188       raise IndexError, "Register index out of bounds"
00189
00190     reg = 0
00191     for contrib in range(8):
00192       reg |= ( self.__lutEntry(contrib + (registerNumber << 3)) << (contrib << 2) )
00193     return reg
00194
00195   def __lutEntry(self, conditionValue):
00196     engineSet = self.engines()
00197     for engineNumber in range(TrgObject.ENGINE_NUMBER_MAX+1):
00198       if engineSet.engine(engineNumber).participate(conditionValue):
00199         return engineNumber
00200
00201     return 0  # error, shouldn't get here
00202
00203   def roiRegister(self, registerNumber):
00204     """\brief roiRegister method
00205
00206     \param registerNumber  A reference into the ROI generator registers
00207     \return integer
00208
00209     Returns a 32 bit integer referencing the 54 ROI registers defined in
00210     Ref: LAT-TD-01545, S 2.8
00211     """
00212     # two ways to define this register.  1)  ACD is trigger  (coincidence mode)
00213     #                                    2)  ACD is veto     (shadow mode)
00214     # The code is the same regardless of intent.  :-)
00215     if registerNumber < TrgGemRegisters.ROI_REGISTER_MIN or \
00216        registerNumber > TrgGemRegisters.ROI_REGISTER_MAX:
00217       raise IndexError, "Register index out of bounds"
00218
00219     reg = 0
00220     roiSet = self.roi()
00221     # RoiRegisterMap[n] returns ("name0","name1")
00222     # AcdTileNumbering["name"] returns tile number
00223     tile0 = AcdTileNumbering[ RoiRegisterMap[registerNumber][0] ]
00224     tile1 = AcdTileNumbering[ RoiRegisterMap[registerNumber][1] ]
00225     reg |= ( self.__roiValue(roiSet, tile0) & 0xffffL )
00226     reg |= ( self.__roiValue(roiSet, tile1) & 0xffffL ) << 16
00227     return reg
00228
00229   def __roiValue(self, roiSet, tileNumber):
00230     """ constructs either:
00231         a) the set of 8 region pairs that define the 16 bits of coincidence info
00232         b) the tower mask information
00233         The code is the same regardless of intent.  :-)
00234
00235         \param roiSet is passed to save function overhead.
00236         \param tileNumber As elsewhere
00237         c.f. figure 75, 76, 77, LAT-TD-01545
00238     """
00239     pairSet = 0
00240     for region in range(TrgObject.ROI_NUMBER_MAX + 1):
00241       bit = roiSet.roi(region).tile(tileNumber)  # tile returns 1 or 0
00242       pairSet |= (bit << region)
00243     return pairSet
00244
00245   def towerEnableRegister(self, registerNumber):
00246     """\brief towerEnableRegister method
00247
00248     \param registerNumber A reference into the tower enable registers
00249     \return integer
00250
00251     Returns a 32 bit object corresponding to figures 78/79 of the GEM
00252     documentation.  This is used to construct the registers
00253     TOWERS_0_3, etc.
00254     Ref: LAT-TD-01545, 2.9.1
00255     """
00256     # 4 towers/register
00257     nReg = ( TrgObject.TOWER_NUMBER_MAX + 1 ) / 4
00258     if registerNumber < 0 or registerNumber > nReg:
00259       raise IndexError, "Register index out of bounds"
00260
00261     reg = 0
00262     for twr in range(4):
00263       reg |= ( self.__tower3bit(twr + (registerNumber << 2)) << twr*3 )
00264     return reg
00265
00266   def __tower3bit(self, towerIndex):
00267     if towerIndex < TrgObject.TOWER_NUMBER_MIN or \
00268        towerIndex > TrgObject.TOWER_NUMBER_MAX:
00269       raise IndexError, "towerIndex out of bounds"
00270
00271     tower = self.inputEnables().towers().tower(towerIndex)
00272     twr = 0
00273     if tower is not None:
00274       twr |= ( tower.calorimeter().useLowEnergy()  & 0x1 )
00275       twr |= ( tower.calorimeter().useHighEnergy() & 0x1 ) << 1
00276       twr |= ( tower.tracker().use()               & 0x1 ) << 2
00277
00278     return twr
00279
00280   def towerBusyEnableRegister(self):
00281     """\brief towerBusyEnableRegister method
00282
00283     \return integer
00284
00285     Returns a 32 bit integer corresponding to the Tower Busy enable register
00286     """
00287     twrBusy = 0
00288     for tower in range(TrgObject.TOWER_NUMBER_MAX +1):
00289       # Tower is ON if one or more of the inputs is enabled
00290       if self.__tower3bit(tower) != 0:
00291         twrBusy |= ( 1 << tower )
00292
00293     return twrBusy
00294
00295   def cnoEnableRegister(self):
00296     """\brief cnoEnableRegister method
00297
00298     \return integer
00299
00300     Returns a 32 bit integer corresponding to the ACD CNO enable register
00301     Ref: LAT-TD-01545, 2.9.2
00302     """
00303
00304     enab = self.inputEnables().cno()
00305     cno = 0
00306     cno |= ( enab.LA1() & 0x1 )
00307     cno |= ( enab.RB1() & 0x1 ) << 1
00308     cno |= ( enab.LA2() & 0x1 ) << 2
00309     cno |= ( enab.LB2() & 0x1 ) << 3
00310     cno |= ( enab.RA2() & 0x1 ) << 4
00311     cno |= ( enab.RB2() & 0x1 ) << 5
00312     cno |= ( enab.LA3() & 0x1 ) << 6
00313     cno |= ( enab.RB3() & 0x1 ) << 7
00314     cno |= ( enab.LA4() & 0x1 ) << 8
00315     cno |= ( enab.LB4() & 0x1 ) << 9
00316     cno |= ( enab.RA4() & 0x1 ) << 10
00317     cno |= ( enab.RB4() & 0x1 ) << 11
00318
00319     return cno
00320
00321   def tileEnableRegister(self, registerNumber):
00322     """\brief tileEnableRegister method
00323
00324     \param registerNumber
00325     \return integer
00326
00327     Returns a 32 bit integer corresponding to the ACD tile enable register.
00328     Ref: LAT-TD-01545, 2.9.3
00329     """
00330     # 108 'real' tiles, 9 tiles/register --> 12 registers
00331     if registerNumber < TrgGemRegisters.TILE_REGISTER_MIN or \
00332        registerNumber > TrgGemRegisters.TILE_REGISTER_MAX:
00333       raise IndexError, "registerNumber out of bounds"
00334
00335     reg = 0
00336
00337     tto = self.inputEnables().tiles()
00338     for t in range(TrgGemRegisters.TILE_REGISTER_SIZE):
00339       tile = t + (TrgGemRegisters.TILE_REGISTER_SIZE) * registerNumber
00340       reg |= ( tto.tile(tile) & 0x1 ) << t
00341       reg |= ( tto.tile(tile) & 0x2 ) << (t+8)  # using 1 bit offset here
00342     return reg
00343
00344
00345   # Pure virtual function implementation
00346   # Defaults from ACD Roadmap document
00347   def width(self):
00348     return 0x5
00349
00350   def redundantPPS(self):
00351     return False
00352
00353   def responseHeaderParityEven(self):
00354     return False
00355
00356   def responseDataParityEven(self):
00357     return False
00358
00359   def eventHeaderParityEven(self):
00360     return False
00361
00362   def eventDataParityEven(self):
00363     return False
00364
00365   def triggerParityEven(self):
00366     return False
00367
00368   def inhibitContribution(self):
00369     return False
00370
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgGemSequence.py Source File

trigger

TrgGemSequence.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Sequence Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgGemSequence: Hardware implementation of TrgSequence"""
00021
00022 from TrgSequence import TrgSequence
00023 from TrgSequence import TrgDefaultSequence
00024
00025
00026 class TrgGemSequence(TrgSequence):
00027   """\brief TrgGemSequence
00028   Hardware abstraction for TrgSequence
00029   """
00030   def __init__(self): # constructor...
00031     """\brief TrgGemSequence constructor
00032     """
00033     TrgSequence.__init__(self)
00034     self.__gem = None
00035
00036   def __setGEM(self, gem):
00037     self.__gem = gem
00038
00039
00040   def eventNumber(self):
00041     """\brief eventNumber() method
00042     Returns 0
00043     """
00044     return ( self.__gem.GEMC.SEQUENCE & 0x1fffc ) >> 2
00045
00046   def eventTag(self):
00047     """brief eventTag() method
00048     Returns 0
00049     """
00050     return ( self.__gem.GEMC.SEQUENCE & 0x3 )
00051
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgInputEnables.py Source File

trigger

TrgInputEnables.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Input Enable Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgInputEnables: Interface for Trigger Input Enables"""
00025
00026
00027 class TrgInputEnables(TrgObject):
00028   """\brief Trigger Input Enables class definition
00029   """
00030   def __init__(self):
00031     """\brief TrgInputEnables constructor
00032     """
00033     pass
00034
00035   def towers(self):
00036     """\brief Towers 'pure virtual' method
00037
00038     \return A TrgTowerEnables object
00039     """
00040     raise NotImplementedError
00041     pass
00042
00043   def cno(self):
00044     """\brief Cno 'pure virtual' method
00045
00046     \return A TrgCnoEnables object
00047     """
00048     raise NotImplementedError
00049     pass
00050
00051   def tiles(self):
00052     """\brief Tiles 'pure virtual' method
00053
00054     \return A TrgTileEnables object
00055     """
00056     raise NotImplementedError
00057     pass
00058
00059
00060 class TrgTowerEnables(TrgObject):
00061   """\brief Trigger Tower Enables class definition
00062   """
00063   def __init__(self):
00064     """\brief TrgTowerEnables constructor
00065     """
00066     pass
00067
00068   def towers(self):
00069     """\brief towers() 'pure virtual' method
00070
00071     \return a TrgTowers object
00072     """
00073     pass
00074
00075 class TrgCnoEnables(TrgObject):
00076   """\brief Trigger CNO Enables class definition
00077   """
00078   def __init__(self):
00079     """\brief TrgCnoEnables constructor
00080     """
00081     pass
00082
00083   def LA1(self):
00084     """\brief LA1 'virtual' method
00085
00086     \return A boolean
00087     """
00088     return False
00089
00090   def RB1(self):
00091     """\brief RB1 'virtual' method
00092
00093     \return A boolean
00094     """
00095     return False
00096
00097   def LA2(self):
00098     """\brief LA2 'virtual' method
00099
00100     \return A boolean
00101     """
00102     return False
00103
00104   def LB2(self):
00105     """\brief LB2 'virtual' method
00106
00107     \return A boolean
00108     """
00109     return False
00110
00111   def RA2(self):
00112     """\brief RA2 'virtual' method
00113
00114     \return A boolean
00115     """
00116     return False
00117
00118   def RB2(self):
00119     """\brief RB2 'virtual' method
00120
00121     \return A boolean
00122     """
00123     return False
00124
00125   def LA3(self):
00126     """\brief LA3 'virtual' method
00127
00128     \return A boolean
00129     """
00130     return False
00131
00132   def RB3(self):
00133     """\brief RB3 'virtual' method
00134
00135     \return A boolean
00136     """
00137     return False
00138
00139   def LA4(self):
00140     """\brief LA4 'virtual' method
00141
00142     \return A boolean
00143     """
00144     return False
00145
00146   def LB4(self):
00147     """\brief LB4 'virtual' method
00148
00149     \return A boolean
00150     """
00151     return False
00152
00153   def RA4(self):
00154     """\brief RA4 'virtual' method
00155
00156     \return A boolean
00157     """
00158     return False
00159
00160   def RB4(self):
00161     """\brief RB4 'virtual' method
00162
00163     \return A boolean
00164     """
00165     return False
00166
00167
00168 class TrgTileEnables(TrgObject):
00169   """\brief Trigger Tile Enables class definition
00170   """
00171   def __init__(self):
00172     """\brief TrgTileEnables constructor
00173     """
00174     pass
00175
00176   def tile(self, tileNumber):
00177     """\brief Tile 'pure virtual' method
00178
00179     \param tileNumber A tile number
00180     \return An integer
00181     """
00182     raise NotImplementedError
00183     pass
00184
00185
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLT.py Source File

trigger

TrgMiniGLT.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.4 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 from TrgMiniGLTRegisters import TrgMiniGLTRegisters
00021 from TrgConditionsValue  import TrgConditionsValue
00022 from TrgObject           import TrgObject
00023
00024 """TrgMiniGLT: This file implements the hardware register access to the MiniGLT"""
00025
00026 class TrgMiniGLT(TrgMiniGLTRegisters):
00027   """\brief Mini GLT Hardware abstraction implementation
00028   """
00029
00030   __SWEEP_MARKER = 5
00031   __SOLICIT_MASK = ~0x01
00032
00033   def __init__(self):
00034     """\brief TrgMiniGLT constructor
00035     """
00036     TrgMiniGLTRegisters.__init__(self)
00037     self.__glt       = None
00038
00039   def __commit(self):
00040     """\brief commit function
00041     This function commits the configuration defined by this
00042     TrgMiniGLT object to the hardware.  It does *all* the registers.
00043     """
00044     glt = self.GLT()
00045
00046     # set all engine destination addresses.
00047     # Because engines can't have a real HW dependence, this is done by cheating:
00048     #   replace each instance of the TrgEngineRequest.destination function
00049     #   with a local private function.
00050     for engineNo in range(TrgObject.ENGINE_NUMBER_MAX + 1):
00051       self.engines().engine(engineNo).request().destination = self.__getDestinationFromEPU
00052
00053     glt.PARITY               = self.parity()
00054     glt.TAG                  = self.tag()
00055     glt.EVENT_NUMBER         = self.eventNumber()
00056     glt.DESTINATION          = self.destination()
00057     glt.MARKER               = self.marker()
00058     glt.TACK                 = self.tack()
00059     glt.ZERO_SUPPRESS        = self.zeroSuppress()
00060     glt.FOUR_RANGE_READOUT   = self.fourRangeReadout()
00061     glt.CAL_STROBE           = self.calStrobe()
00062
00063     glt.MASK                 = ~0              # everything disabled by default
00064
00065   def GLT(self, glt = None):
00066     """\brief GLT function
00067     \params glt:  a GGLT object
00068     This function sets the GLT hardware implementation used by
00069     TrgGem.
00070     """
00071     if glt is not None:
00072       self.__glt = glt
00073       self.__epuaddr = glt.getEPUaddr()
00074     return self.__glt
00075
00076   def __getDestinationFromEPU(self):
00077     return self.__epuaddr
00078
00079   ############### Pure virtual function implementation
00080   def solicit(self):
00081     # transmit the GEM's TRIGGER dataless command
00082     self.GLT().CMD_SELF_TRIGGER = 1
00083
00084   def enable(self, mask=None):
00085     if mask is not None:
00086       outMask = mask
00087     elif self.__condValue is not None:
00088       outMask = ~self.conditions().value()          # remember the MiniGLT has ~logic
00089     else:
00090       raise AssertionError, "Attempting to enable a TrgConditionsValue of None"
00091
00092     self.GLT().MASK = outMask
00093     self.GLT().enableMask()
00094
00095   def disable(self):
00096     self.GLT().disableMask()
00097
00098   def shut(self, marker):
00099     """Implementation of the shut function.
00100     """
00101
00102     #0) disable triggers
00103     self.disable()
00104
00105     #1) Set up marker logic
00106     glt = self.GLT()
00107
00108     mask           = glt.MASK           # Cache Mask, CalStrobe and Tack
00109     calStrobe      = glt.CAL_STROBE
00110     tack           = glt.TACK
00111
00112     glt.MASK       = TrgMiniGLT.__SOLICIT_MASK # Enable internal trigger only
00113     glt.MARKER     = marker             # Signal that we're sweeping
00114     glt.CAL_STROBE = 0                  # Don't inject charge
00115     glt.TACK       = 0                  # Don't force a readout
00116     glt.enableMask()
00117     self.solicit()                      # Solicit a trigger
00118     glt.disableMask()
00119
00120     #4) Put the original contents of scheduler 0x40 back, and put the TAM back
00121     glt.CAL_STROBE = calStrobe
00122     glt.TACK       = tack
00123     glt.MARKER     = 0
00124     glt.MASK       = mask
00125
00126     #5) Put the trigger conditions back
00127     glt.enableMask()
00128
00129
00130 class MiniGLTTrgConditionsValue(TrgConditionsValue):
00131   """This class overrides the value() method of TrgConditionsValue
00132      as the MiniGLT has a different bitmap for the MASK register.
00133      It also provides the external() function.
00134
00135      Use this class instead of TrgConditionsValue for MiniGLT operations.
00136   """
00137   def __init__(self):
00138     TrgConditionsValue.__init__(self)
00139
00140   def value(self):
00141     val = 0
00142     val |= ( self.solicited()   & 0x1 )  << 0
00143     val |= ( self.external()    & 0x1 )  << 1
00144     val |= ( self.calLow()      & 0x1 )  << 2
00145     val |= ( self.calHigh()     & 0x1 )  << 3
00146     val |= ( self.tkr()         & 0x1 )  << 4
00147     return val
00148
00149   def external(self):
00150     return False
00151
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTAbstract.py Source File

trigger

TrgMiniGLTAbstract.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgMiniGLTAbstract: Abstract interface for MiniGLT based systems. """
00021
00022 from TrgAbstract import TrgAbstract
00023
00024 class TrgMiniGLTAbstract(TrgAbstract):
00025   """\brief TrgMiniGLTAbstract Interface class definition
00026   This class inherits from TrgAbstract to define the structure of
00027   a MiniGLT trigger.
00028   """
00029   def __init__(self):
00030     """\brief TrgMiniGLTAbstract constructor
00031     """
00032     TrgAbstract.__init__(self)
00033
00034   #############  Pure Virtual functions
00035   def parity(self):
00036     """\brief parity() member function
00037     Returns a boolean indicating the state of the parity bitfield
00038     in the configuration register of the MiniGLT
00039     \return a boolean
00040     """
00041     raise NotImplementedError
00042     pass
00043
00044   def tag(self):
00045     """\brief tag() member function
00046     Returns an integer indicating the state of the tag bitfield in
00047     the configuration register of the MiniGLT
00048     \return an integer
00049     """
00050     raise NotImplementedError
00051     pass
00052
00053   def eventNumber(self):
00054     """\brief eventNumber() member function
00055     Returns an integer indicating the starting event number
00056     of the MiniGLT
00057     \return an integer
00058     """
00059     raise NotImplementedError
00060     pass
00061
00062   def destination(self):
00063     """\brief destination() member function
00064     Returns an integer indicating the state of the destination bitfield in
00065     the configuration register of the MiniGLT
00066     \return an integer
00067     """
00068     raise NotImplementedError
00069     pass
00070
00071   def marker(self):
00072     """\brief marker() member function
00073     Returns an integer indicating the state of the marker bitfield in
00074     the configuration register of the MiniGLT
00075     \return an integer
00076     """
00077     raise NotImplementedError
00078     pass
00079
00080   def tack(self):
00081     """\brief tack() member function
00082     Returns a boolean indicating the state of the tack bitfield
00083     in the configuration register of the MiniGLT
00084     \return a boolean
00085     """
00086     raise NotImplementedError
00087     pass
00088
00089   def zeroSuppress(self):
00090     """\brief zeroSuppress() member function
00091     Returns a boolean indicating the state of the zeroSuppress bitfield
00092     in the configuration register of the MiniGLT
00093     \return a boolean
00094     """
00095     raise NotImplementedError
00096     pass
00097
00098   def fourRangeReadout(self):
00099     """\brief fourRangeReadout() member function
00100     Returns a boolean indicating the state of the fourRangeReadout bitfield
00101     in the configuration register of the MiniGLT
00102     \return a boolean
00103     """
00104     raise NotImplementedError
00105     pass
00106
00107   def calStrobe(self):
00108     """\brief calStrobe() member function
00109     Returns a boolean indicating the state of the calStrobe bitfield
00110     in the configuration register of the MiniGLT
00111     \return a boolean
00112     """
00113     raise NotImplementedError
00114     pass
00115
00116
00117
00118
00119
00120
00121
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgMiniGLTRegisters.py Source File

trigger

TrgMiniGLTRegisters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgMiniGLTRegisters: Register shape definitions for a  MiniGLT based trigger system
00021 """
00022
00023 from TrgMiniGLTAbstract import TrgMiniGLTAbstract
00024
00025 class TrgMiniGLTRegisters(TrgMiniGLTAbstract):
00026   """\brief Register shape definition class for the MiniGLT
00027   This class defines the shapes of the registers and bitfields used
00028   in the MiniGLT
00029   """
00030   def __init__(self):
00031     TrgMiniGLTAbstract.__init__(self)
00032
00033   #############  Pure Virtual function implementation from parents
00034   def parity(self):
00035     return 0x0 & 0x1
00036
00037   def tag(self):
00038     return 0x0 & 0x3
00039
00040   def eventNumber(self):
00041     return 0x0 & 0x7fff
00042
00043   def destination(self):
00044     # There are exactly two engines in the MiniGLT.
00045     # 0) User defined engine
00046     # 15) Sweep Marker engine
00047     # Use the user-defined engine for everything.
00048     eng = self.engines().engine(0).request()
00049     return eng.destination()
00050
00051   def marker(self):
00052     eng = self.engines().engine(0).request()
00053     return eng.marker()
00054
00055   def tack(self):
00056     eng = self.engines().engine(0).request()
00057     return ( eng.sequence()     & 0x1  )
00058
00059   def zeroSuppress(self):
00060     eng = self.engines().engine(0).request()
00061     return eng.zeroSuppress()
00062
00063   def fourRangeReadout(self):
00064     eng = self.engines().engine(0).request()
00065     return eng.fourRange()
00066
00067   def calStrobe(self):
00068     eng = self.engines().engine(0).request()
00069     return (( eng.sequence()     & 0x2  ) >> 1)
00070
00071
00072
00073
00074
00075
00076
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgObject.py Source File

trigger

TrgObject.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.2 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 """TrgObject: Base class for the trigger.  Defines useful quantities"""
00022
00023
00024 class TrgObject(object):
00025   """\brief Trigger Object class definition
00026   """
00027   TILE_NUMBER_MIN        = 0
00028   TILE_NUMBER_MAX        = 107
00029   COINCIDENCE_NUMBER_MIN = 0
00030   COINCIDENCE_NUMBER_MAX = 7
00031   ENGINE_NUMBER_MIN      = 0
00032   ENGINE_NUMBER_MAX      = 15
00033   TOWER_NUMBER_MIN       = 0
00034   TOWER_NUMBER_MAX       = 15
00035   CONDITIONS_NUMBER_MIN  = 0
00036   CONDITIONS_NUMBER_MAX  = 0xff
00037   ROI_NUMBER_MIN         = 0
00038   ROI_NUMBER_MAX         = 15
00039
00040   # This unfortunately also impacts derived objects.
00041   # Can we FIX THIS?
00042   def __setattr__(self, name, value):
00043     """Reject attempts to modify TrgObject's constants.
00044     """
00045     assert name not in dir(TrgObject), \
00046            "Attempt made to modify the constant " + \
00047            self.__class__.__name__ + "." + name
00048     object.__setattr__(self, name, value)
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgPeriodic.py Source File

trigger

TrgPeriodic.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Periodic Interface classes"
00012 __author__   = "M. Huffer <mehsys@slac.stanford.edu> SLAC - GLAST LAT Electronics"
00013 __date__     = "1/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgPeriodic: Interface for the Periodic Trigger"""
00025
00026 class TrgPeriodicConditionAbstract(TrgObject):
00027   """\brief TrgPeriodicConditionAbstract class definition
00028   """
00029   def __init__(self):
00030     """\brief TrgPeriodicConditionAbstract constructor
00031     """
00032     pass
00033
00034   def source(self):
00035     """\brief source() 'virtual' method
00036     If the returned value is FALSE, the system clock is used as the
00037     source of the periodic condition. If the returned value is TRUE, the 1-PPS signal is
00038     used as the source of the condition.
00039     \return A boolean
00040     """
00041     raise NotImplementedError
00042     pass
00043
00044   def prescale(self):
00045     """\brief prescale() 'virtual' method
00046     Determines how the source signal is prescaled to form the periodic condition.
00047     That is, it sets the rate of the periodic condition. A value of zero does not prescale
00048     the periodic condition. This would, for example, assuming the system clock is
00049     used as source, create a periodic condition which operates at 20 MHZ.
00050     Range: [0 .. 0xffffff]
00051     \return An integer
00052     """
00053     raise NotImplementedError
00054     pass
00055
00056   def limit(self):
00057     """\brief limit() 'virtual' method
00058     Returns the number of iterations of the periodic condition before
00059     the condition stops. A value of zero (0) will cause the periodic condition to
00060     'free-run', or never stop.
00061     \return An integer
00062     """
00063     raise NotImplementedError
00064     pass
00065
00066 class TrgPeriodicCondition(TrgPeriodicConditionAbstract):
00067   """\brief Trigger Periodic Condition class definition
00068   """
00069
00070   def __init__(self): # constructor...
00071     TrgPeriodicConditionAbstract.__init__(self)
00072
00073   def definition(self):
00074     """\brief definition() method
00075     Returns an object of type TrgPeriodicConditionDefinition.
00076     This object will be used to both define the initial values for the
00077     periodic condition and is used by the reset() function to re-establish
00078     the initial limit value.
00079     """
00080     raise NotImplementedError
00081     pass # returns an object of type TrgPeriodicConditionDefinition
00082
00083   def remaining(self):
00084     """\brief remaining() method
00085     Returns the number of iterations remaining before the periodic condition stops.
00086     """
00087     raise NotImplementedError
00088     pass # returns an integer...
00089
00090   def reset(self):
00091     """\brief reset() method
00092     Will cause the periodic condition to stop, regardless of how many iterations are
00093     remaining. It will re-initialize the limit function with the value returned by the
00094     limit function of. If the periodic condition is free running, this function has no
00095     effect.
00096     """
00097     raise NotImplementedError
00098     pass # returns void...
00099
00100   def abort(self):
00101     """\brief abort() method
00102     Will cause the periodic condition to stop, regardless of how many iterations are
00103     remaining. If the periodic condition is free running, this function has no effect.
00104     """
00105     raise NotImplementedError
00106     pass # returns void...
00107
00108 class TrgPeriodicConditionDefinition(TrgPeriodicConditionAbstract):
00109   """\brief TrgPeriodicConditionDefinition class definition
00110   """
00111   def __init__(self):
00112     TrgPeriodicConditionAbstract.__init__(self)
00113
00114
00115 class TrgDefaultPeriodicCondition(TrgPeriodicConditionDefinition):
00116   """\brief TrgDefaultPeriodicCondition class definition
00117   """
00118   def __init__(self):
00119     TrgPeriodicConditionDefinition.__init__(self)
00120
00121   def source(self):
00122     """\brief source() method
00123     Default is FALSE, do not use 1-PPS clock
00124     """
00125     return False
00126
00127   def prescale(self):
00128     """\brief prescale() method
00129     Default is 0x1fffff, 10 hz periodic function
00130     """
00131     # Generate a 10 hz periodic function
00132     # 20 Megahertz clock, 1fffff = 2e6
00133     return 0x1fffff
00134
00135   def limit(self):
00136     """\brief limit() method
00137     Default is 0, free-run the condition.
00138     """
00139     return 0x0
00140
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoiAsTiles.py Source File

trigger

TrgRoiAsTiles.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "M. Huffer <mehsys@slac.stanford.edu> SLAC - GLAST LAT Electronics"
00013 __date__     = "1/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgRoiAsTiles: Map coincidences to Regions of Interest
00021 """
00022
00023 from TrgCoincidences import *
00024 from NullObjects     import NullCoincidence
00025
00026 class TrgRoiAsTiles(TrgCoincidences):
00027   """\brief Class TrgRoiAsTiles
00028   LATTE provided class to map coincidences to ROIs
00029   """
00030   def __init__(self):
00031     TrgCoincidences.__init__(self)
00032     self.__coincidenceList = []
00033     for i in range(TrgObject.COINCIDENCE_NUMBER_MAX + 1):
00034       self.__coincidenceList.append(NullCoincidence())
00035     self.__roiList = []
00036     for i in range(TrgObject.ROI_NUMBER_MAX+1):
00037       self.__roiList.append(AddableRoi())
00038
00039   def coincidence(self, coincidenceNumber):
00040     if coincidenceNumber < TrgObject.COINCIDENCE_NUMBER_MIN or \
00041        coincidenceNumber > TrgObject.COINCIDENCE_NUMBER_MAX:
00042       raise IndexError, "coincidenceNumber is out of range"
00043     return self.__coincidenceList[coincidenceNumber]
00044
00045   def roi(self, roiNumber):
00046     if roiNumber < TrgObject.ROI_NUMBER_MIN or \
00047        roiNumber > TrgObject.ROI_NUMBER_MAX:
00048       raise IndexError, "roiNumber is out of range"
00049     return self.__roiList[roiNumber]
00050
00051   def addCoincidence(self, cNumber, coinc):
00052     self.__coincidenceList[cNumber] = coinc
00053     self.__fillRoiList(cNumber)
00054
00055   def __fillRoiList(self, cNumber):
00056     """This function fills the list of ROIs by using the defined
00057        list of coincident tiles.  Each coincidence pair defines
00058        tiles in two ROIs.  Coincidence pair 0 maps to ROI 0 and 1,
00059        and so on.
00060     """
00061     rList = self.__roiList
00062     coin = self.coincidence(cNumber)
00063     for tileA in range(TrgObject.TILE_NUMBER_MAX+1):
00064       tileB = coin.inCoincidence(tileA)
00065       if tileB >= 0:
00066         c2 = cNumber * 2
00067         rList[c2].addTile(tileA)
00068         rList[c2+1].addTile(tileB)
00069
00070 class AddableRoi(TrgRoi):
00071   """The main purpose of this class is to add the member function
00072      addTile(tile).
00073      This function appends a tile to the list of tiles in the ROI
00074   """
00075   def __init__(self):
00076     TrgRoi.__init__(self)
00077     self.__tileList = []
00078
00079   def addTile(self,tile):
00080     if tile not in self.__tileList:
00081       if tile >= TrgObject.TILE_NUMBER_MIN and tile <= TrgObject.TILE_NUMBER_MAX:
00082         self.__tileList.append(tile)
00083
00084   def tile(self, tileNumber):
00085     if tileNumber < TrgObject.TILE_NUMBER_MIN or tileNumber > TrgObject.TILE_NUMBER_MAX:
00086       raise IndexError, "tileNumber is out of range"
00087     if tileNumber in self.__tileList:
00088       return True
00089     return False
00090
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgRoiAsVeto.py Source File

trigger

TrgRoiAsVeto.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Object class"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020 """TrgRoiAsVeto: Implement an ROI based veto system.
00021 """
00022
00023 from TrgCoincidences import *
00024
00025 #JHP: Finish me.
00026
00027
00028 class TrgRoiAsVeto(TrgRois):
00029   def __init__(self):
00030     TrgRois.__init__(self)
00031     self.__roiList = []
00032     for i in range(TrgObject.ROI_NUMBER_MAX+1):
00033       self.__roiList.append(MyRoi())
00034
00035   def roi(self, roiNumber):
00036     if roiNumber < TrgObject.ROI_NUMBER_MIN or roiNumber > TrgObject.ROI_NUMBER_MAX:
00037       raise IndexError, "roiNumber is out of range"
00038     return self.__roiList[roiNumber]
00039
00040 class MyRoi(TrgRoi):
00041   """
00042   """
00043   def __init__(self):
00044     TrgRoi.__init__(self)
00045     # tiles 0..5 shadow this tower
00046     self.__tileList = [ 0, 1, 2, 3, 4, 5]
00047
00048   def tile(self, tileNumber):
00049     if tileNumber < TrgObject.TILE_NUMBER_MIN or tileNumber > TrgObject.TILE_NUMBER_MAX:
00050       raise IndexError, "tileNumber is out of range"
00051     if tile in self.__tileList:
00052       return True
00053     return False
00054
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgSequence.py Source File

trigger

TrgSequence.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Sequence Interface classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgSequence: Interface for Trigger Sequences"""
00025
00026
00027 class TrgSequenceAbstract(TrgObject):
00028   """\brief Abstract Trigger Sequence class definition
00029   """
00030   def __init__(self):
00031     """\brief TrgSequenceAbstract constructor
00032     """
00033     pass
00034
00035   def eventNumber(self):
00036     """\brief EventNumber 'pure virtual' method
00037
00038     \return An integer containing the current event number
00039     """
00040     raise NotImplementedError
00041     pass
00042
00043   def eventTag(self):
00044     """\brief EventTag 'pure virtual' method
00045
00046     \return An integer containing the current event tag value
00047     """
00048     raise NotImplementedError
00049     pass
00050
00051 class TrgSequenceDefinition(TrgSequenceAbstract):
00052   """\brief Trigger Sequence Definition class definition
00053   """
00054   def __init__(self): # constructor...
00055     """\brief TrgSequenceDefinition constructor
00056     """
00057     TrgSequenceAbstract.__init__(self)
00058
00059
00060 class TrgSequence(TrgSequenceAbstract):
00061   """\brief Trigger Sequence class definition
00062   """
00063   def __init__(self): # constructor...
00064     """\brief TrgSequence constructor
00065     """
00066     TrgSequenceAbstract.__init__(self)
00067
00068   def definition(self) :
00069     """\brief definition() member
00070     \return an object of type TrgSequenceDefinition
00071     """
00072     pass # returns an object of type TrgSequenceDefinition
00073
00074
00075 class TrgDefaultSequence(TrgSequenceDefinition):
00076   """The class defines 'sensible' values for the initial Event and Tag numbers.
00077   """
00078   def __init__(self):
00079     """\brief TrgDefaultSequence constructor
00080     """
00081     TrgSequenceAbstract.__init__(self)
00082
00083   def eventNumber(self):
00084     """\brief eventNumber() method
00085     Returns 0
00086     """
00087     return 0x0
00088
00089   def eventTag(self):
00090     """brief eventTag() method
00091     Returns 0
00092     """
00093     return 0x0
00094
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTileCounters.py Source File

trigger

TrgTileCounters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Abstract classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgTileCounters: Trigger GEM tile counter abstract class"""
00025
00026 class TrgTileCounters(TrgObject):
00027   """\brief TrgTileCounters class definition
00028   This class controls the counters used to count ACD tile transitions.
00029   """
00030   def __init__(self): # constructor...
00031     pass
00032
00033   def stats(self):
00034     """\brief stats() member function
00035     Returns the statistics object for the tile counters
00036     \return A TrgTileStats object
00037     """
00038     raise NotImplementedError
00039     pass # returns a TrgTileStats object...
00040
00041   def reset(self):
00042     """\brief reset() member function
00043     Reset the tile statistics
00044     """
00045     raise NotImplementedError
00046     pass # returns void...
00047
00048   def assignA(self, a):
00049     """\brief assignA() member function
00050     Assign the 'A' tile counter to watch a particular tile
00051     Immediately after counter assignment, both counters are reset.
00052     """
00053     raise NotImplementedError
00054     pass # returns void...
00055
00056   def assignB(self, B):
00057     """\brief assignB() member function
00058     Assign the 'B' tile counter to watch a particular tile
00059     Immediately after counter assignment, both counters are reset.
00060     """
00061     raise NotImplementedError
00062     pass # returns void...
00063
00064   def assignAB(self, a, b):
00065     """\brief assignAB() member function
00066     Assign both the 'A' and the'B' tile counters to watch two tiles
00067     Immediately after counter assignment, both counters are reset.
00068     """
00069     raise NotImplementedError
00070     pass # returns void...
00071
00072
00073 class TrgTileStats(TrgObject):
00074   """\brief TrgTileStats class definition
00075   This class specifies the statistics returned by the counters
00076   described by TrgTileCounters.
00077   """
00078   def __init__(self): # constructor...
00079     pass
00080
00081   def A(self):
00082     """
00083     Return the statistics for the 'A' tile counter
00084     \return an integer
00085     """
00086     raise NotImplementedError
00087     pass # returns an integer...
00088
00089   def B(self):
00090     """
00091     Return the statistics for the 'B' tile counter
00092     \return an integer
00093     """
00094     raise NotImplementedError
00095     pass
00096
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTower.py Source File

trigger

TrgTower.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Trigger Tower Interface classes"
00012 __author__   = "M. Huffer <mehsys@slac.stanford.edu> SLAC - GLAST LAT Electronics"
00013 __date__     = "1/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019 from TrgObject import TrgObject
00020
00021 """TrgTower: Abstract interfaces for Trigger Tower classes"""
00022
00023
00024 class TrgTowers(TrgObject):
00025   """\brief Trigger Towers class definition
00026   """
00027   def __init__(self):
00028     """\brief TrgTowers constructor
00029     """
00030     pass
00031
00032   def tower(self, towerNumber):
00033     """\brief Tower 'pure virtual' method
00034
00035     \param towerNumber  A tower number
00036     \return A TrgTower object
00037     """
00038     raise NotImplementedError
00039     pass
00040
00041
00042 class TrgTower(TrgObject):
00043   """\brief Trigger Tower class definition
00044   """
00045   def __init__(self):
00046     """\brief TrgTower constructor
00047     """
00048     pass
00049
00050   def calorimeter(self):
00051     """\brief Calorimeter 'pure virtual' method
00052
00053     \return A TrgCalorimeter object
00054     """
00055     raise NotImplementedError
00056     pass
00057
00058   def tracker(self):
00059     """\brief Tracker 'pure virtual' method
00060
00061     \return A TrgTracker object
00062     """
00063     raise NotImplementedError
00064     pass
00065
00066
00067 class TrgCalorimeter(TrgObject):
00068   """\brief Trigger Calorimeter class definition
00069   """
00070   def __init__(self):
00071     """\brief TrgCalorimeter constructor
00072     """
00073     pass
00074
00075   def useHighEnergy(self):
00076     """\brief UseHighEnergy 'virtual' method
00077
00078     \return A boolean
00079     """
00080     return False
00081
00082   def useLowEnergy(self):
00083     """\brief UseLowEnergy 'virtual' method
00084
00085     \return A boolean
00086     """
00087     return False
00088
00089
00090 class TrgTracker(TrgObject):
00091   """\brief Trigger Tracker class definition
00092   """
00093   def __init__(self):
00094     """\brief TrgTracker constructor
00095     """
00096     pass
00097
00098   def use(self):
00099     """\brief Use 'virtual' method
00100
00101     \return A boolean
00102     """
00103     return False
00104
00105
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgTriggerCounters.py Source File

trigger

TrgTriggerCounters.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Abstract classes"
00012 __author__   = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST I&T"
00013 __date__     = "2/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from TrgObject import TrgObject
00022
00023
00024 """TrgTriggerCounters: Abstract interface to trigger counters"""
00025
00026
00027 class TrgTriggerCounters(TrgObject):
00028   """\brief TrgTriggerCounters class definition
00029   This class controls the counters associated with the performance of
00030   the LAT with respect to the Trigger System.
00031   """
00032   def __init__(self):
00033     """\brief TrgTriggerCounters constructor
00034     """
00035     pass
00036
00037   def stats(self):
00038     """ \brief stats() method
00039     Returns the Trigger Counter Statistics object.
00040     \return A TrgTriggerStats object
00041     """
00042     raise NotImplementedError
00043     pass
00044
00045   def reset(self):
00046     """\brief reset() method
00047     Reset the trigger counters.
00048     """
00049     raise NotImplementedError
00050     pass
00051
00052 class TrgTriggerStats(TrgObject):
00053   """\brief TrgTriggerStats
00054   This class specifies the statistics returned by the counters defined in TrgTriggerCounters.
00055   """
00056   def __init__(self): # constructor...
00057     """\brief TrgTriggerStats constructor
00058     """
00059     pass
00060   def livetime(self):
00061     """ \brief livetime() method
00062     Return the system livetime
00063     \return an integer
00064     """
00065     raise NotImplementedError
00066     pass # returns an integer...
00067
00068   def prescaled(self):
00069     """ \brief prescaled() method
00070     Return the number of events that have been prescaled
00071     \return an integer    """
00072     raise NotImplementedError
00073     pass # returns an integer...
00074
00075   def discarded(self):
00076     """\brief discarded() method
00077     Return the number of events discarded
00078     \return an integer
00079     """
00080     raise NotImplementedError
00081     pass # returns an integer...
00082
00083   def sent(self):
00084     """\brief sent() method
00085     Return the number of events sent on
00086     \return an integer
00087     """
00088     raise NotImplementedError
00089     pass # returns an integer...
00090
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1


LATTE: TrgUsingTiles.py Source File

trigger

TrgUsingTiles.py

00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST LAT Coincidence based Trigger System Interface classes"
00012 __author__   = "M. Huffer <mehsys@slac.stanford.edu> SLAC - GLAST LAT Electronics"
00013 __date__     = "1/14/04"
00014 __version__  = "$Revision: 2.1 $"
00015 __release__  = "$Name: P04-06-05 $"
00016 __credits__  = "SLAC"
00017
00018 import LATTE.copyright_SLAC
00019
00020
00021 from rcTrgGem                import rcTrgGem
00022 from TrgSequence             import TrgDefaultSequence
00023 from TrgGemSequence          import TrgGemSequence
00024 from TrgRoiAsTiles           import TrgRoiAsTiles
00025 from TrgGemPeriodicCondition import TrgGemPeriodicCondition
00026 from TrgPeriodic             import TrgDefaultPeriodicCondition
00027
00028 """TrgUsingTiles: Implementation of a tile-based trigger system"""
00029
00030 class TrgUsingTiles(rcTrgGem):
00031   """\brief Trigger Using Tiles class definition
00032   """
00033   def __init__(self):
00034     """\brief TrgUsingTiles constructor
00035     """
00036     self.__pCondition = DefaultPeriodicCondition()
00037     self.__sequence   = DefaultSequence()
00038     self.__roi        = TrgRoiAsTiles()
00039     rcTrgGem.__init__(self)
00040
00041   def coincidences(self):
00042     """\brief Coincdences 'pure virtual' method
00043
00044     \return A TrgCoincidences object
00045     """
00046     raise NotImplementedError
00047
00048   # Pure Virtual function implementation
00049   def useAcdAsTrigger(self):
00050     return True
00051
00052   def periodicCondition(self):
00053     return self.__pCondition
00054
00055   def sequence(self):
00056     return self.__sequence
00057
00058   def roi(self):
00059     return self.__roi
00060
00061 class DefaultPeriodicCondition(TrgGemPeriodicCondition):
00062   """\brief DefaultPeriodicCondition class
00063   """
00064   def __init__(self):
00065     """\brief DefaultPeriodicCondition constructor
00066     """
00067     TrgGemPeriodicCondition.__init__(self)
00068     self.__cond = TrgDefaultPeriodicCondition()
00069
00070   def definition(self):
00071     """\brief definition() method
00072     See TrgPeriodicCondition base class
00073     """
00074     return self.__cond
00075
00076 class DefaultSequence(TrgGemSequence):
00077   def __init__(self):
00078     """\brief DefaultSequence constructor
00079     """
00080     TrgGemSequence.__init__(self)
00081     self.__cond = TrgDefaultSequence()
00082
00083   def definition(self):
00084     """\brief definition() method
00085     See TrgSequence base class
00086     """
00087     return self.__cond
00088
00089
Generated on Fri Jan 21 18:00:53 2005 for LATTE P04-06-05 by doxygen 1.4.1