ReadoutType Namespace Reference

Typedefs

typedef enum
ReadoutType::EReadoutType 
Readout_t

Enumerations

enum  EReadoutType {
  kUnknown = 0x0000, kScintStrip = 0x0001, kPinDiode = 0x0002, kFlashTrigPMT = 0x0004,
  kVACommonMode = 0x0008, kTriggerOR = 0x0010, kCerenkov = 0x0100, kTOF = 0x0200,
  kTimingFid = 0x0400, kUnconnectedPixel = 0x0800
}

Functions

Int_t FullMask ()
const Char_t * AsString (Readout_t readout)
const Char_t * MaskToString (Int_t mask)
ReadoutType::Readout_t StringToEnum (const Char_t *chars, Int_t maxChar=0)

Typedef Documentation


Enumeration Type Documentation

Enumerator:
kUnknown 
kScintStrip 
kPinDiode 
kFlashTrigPMT 
kVACommonMode 
kTriggerOR 
kCerenkov 
kTOF 
kTimingFid 
kUnconnectedPixel 

Definition at line 24 of file ReadoutType.h.

00024                              {
00025       kUnknown        = 0x0000,
00026       kScintStrip     = 0x0001,
00027       kPinDiode       = 0x0002,
00028       kFlashTrigPMT   = 0x0004,
00029       kVACommonMode   = 0x0008,
00030       kTriggerOR      = 0x0010,
00031       // special for CalDet
00032       kCerenkov       = 0x0100,
00033       kTOF            = 0x0200,
00034       kTimingFid      = 0x0400,
00035       // for Caldet, but may not be specific to it:
00036       kUnconnectedPixel = 0x0800
00037    } Readout_t;


Function Documentation

const Char_t * ReadoutType::AsString ( Readout_t  readout  ) 

Definition at line 18 of file ReadoutType.cxx.

References kCerenkov, kFlashTrigPMT, kPinDiode, kScintStrip, kTimingFid, kTOF, kTriggerOR, kUnconnectedPixel, kUnknown, and kVACommonMode.

Referenced by MaskToString(), Plexus::Print(), StringToEnum(), and LISummarySorter::Update().

00019 {
00020    switch (readout) {
00021    case kUnknown:          return "Unknown";      break;
00022    case kScintStrip:       return "ScintStrip";   break;
00023    case kPinDiode:         return "PinDiode";     break;
00024    case kFlashTrigPMT:     return "FlashTrigPMT"; break;
00025    case kVACommonMode:     return "VACommonMode"; break;
00026    case kTriggerOR:        return "TriggerOR";    break;
00027    case kCerenkov:         return "Cerenkov";     break;
00028    case kTOF:              return "TOF";          break;
00029    case kTimingFid:        return "TimingFid";    break;
00030    case kUnconnectedPixel: return "UnconnectedPixel"; break;
00031    default:                return "?Unknown?";    break;
00032    }
00033 }

Int_t ReadoutType::FullMask (  ) 

Definition at line 11 of file ReadoutType.cxx.

References kCerenkov, kFlashTrigPMT, kPinDiode, kScintStrip, kTOF, and kVACommonMode.

Referenced by MaskToString().

const Char_t * ReadoutType::MaskToString ( Int_t  mask  ) 

Definition at line 37 of file ReadoutType.cxx.

References AsString(), and FullMask().

00038 {
00039    // Return a mask of ReadoutTypes as a string
00040    //
00041    // Result is a pointer to a statically allocated string.
00042    // User should copy this into their own buffer before calling
00043    // this method again.
00044 
00045    static Char_t newstring[255] = "";
00046    
00047    Char_t* ptr = newstring;  // start at the beginning
00048 
00049    *ptr = 0; // start with nothing
00050    Int_t fullmask = ReadoutType::FullMask();
00051    
00052    for (Int_t i=0; i<32; i++) {
00053       ReadoutType::Readout_t areadout = (ReadoutType::Readout_t)(1<<i);
00054       if (mask & areadout & fullmask) {
00055          const Char_t* toadd = ReadoutType::AsString(areadout);
00056          if (ptr != newstring) *ptr++ = ',';
00057          strcpy(ptr,toadd);
00058          ptr += strlen(toadd);
00059       }
00060    }
00061    *ptr++ = 0; // ensure trailing 0
00062 
00063    return newstring;
00064 }

ReadoutType::Readout_t ReadoutType::StringToEnum ( const Char_t *  chars,
Int_t  maxChar = 0 
)

Definition at line 68 of file ReadoutType.cxx.

References AsString(), Nav::kBoth, and kUnknown.

00069 {
00070    // convert a set of chars to a valid enum
00071 
00072    TString thestring(chars);
00073    if (maxChar>0 && maxChar<thestring.Length()) thestring.Resize(maxChar);
00074    thestring.ToLower();
00075    // remove leading/trailing blanks
00076    thestring = thestring.Strip(TString::kBoth);
00077 
00078    Char_t asint[16];  // space enough to hold largest int + \0
00079 
00080    for (Int_t i=0; i<32; i++) {
00081       ReadoutType::Readout_t areadout = (ReadoutType::Readout_t)(1<<i);
00082       TString areadoutName = AsString(areadout);
00083       areadoutName.ToLower();
00084       if (thestring.Contains(areadoutName)) return areadout;
00085       sprintf(asint,"%d",(int)areadout);
00086       if (thestring == asint) return areadout;
00087    }
00088 
00089    return kUnknown;
00090 
00091 }


Generated on 2 Jul 2018 for loon by  doxygen 1.6.1