00001
00002
00003
00004
00005
00006
00007
00009
00010 #include "Plex/PlexLedId.h"
00011
00012 #include <iostream>
00013 #include <iomanip>
00014 #include <string>
00015
00016 #include <cassert>
00017
00018 #include "MessageService/MsgService.h"
00019
00020
00021 ClassImp(PlexLedId)
00022
00023
00024 ostream& operator<<(ostream& os, const PlexLedId& p)
00025 {
00026 os << p.AsString();
00027
00028 return os;
00029 }
00030
00031
00032 PlexLedId::PlexLedId()
00033 : fEncoded(defaultPlexLedId)
00034 {
00035
00036 }
00037
00038
00039 PlexLedId::PlexLedId(Detector::Detector_t detector,
00040 UInt_t pulserBox, UInt_t ledInBox)
00041 : fEncoded(defaultPlexLedId)
00042 {
00043
00044
00045 SetDetector(detector);
00046 SetPulserBox(pulserBox);
00047 SetLedInBox(ledInBox);
00048 }
00049
00050
00051 PlexLedId::PlexLedId(const UInt_t encoded)
00052 : fEncoded(encoded)
00053 {
00054
00055 }
00056
00057
00058 PlexLedId::~PlexLedId()
00059 {
00060
00061 }
00062
00063 #ifdef ENABLE_LEDID_ISNULL
00064
00065 Bool_t PlexLedId::IsNull() const
00066 {
00067 MSG("Plex",Msg::kWarning)
00068 << "PlexLedId::IsNull() is obsolete -- use !IsValid()" << endl;
00069 return !IsValid();
00070 }
00071 #endif
00072
00073
00074 const char * PlexLedId::AsString(Option_t *option) const
00075 {
00076
00077
00078
00079
00080
00081
00082 const int nbuffers = 8;
00083 static char newstring[nbuffers][64];
00084 static int ibuffer = nbuffers;
00085 ibuffer = (ibuffer+1)%nbuffers;
00086
00087 switch (option[0]) {
00088 default:
00089 sprintf(newstring[ibuffer],"LED-%1.1s%2.2d-%2.2d",
00090 Detector::AsString(GetDetector()),
00091 GetPulserBox(),GetLedInBox());
00092 break;
00093 }
00094
00095 return newstring[ibuffer];
00096 }
00097
00098
00099 void PlexLedId::Print(Option_t *option) const
00100 {
00101
00102
00103 printf("%s\n",AsString(option));
00104 }
00105
00106