CoilStatus Namespace Reference

Typedefs

typedef enum
CoilStatus::ECoilStatus 
CoilStatus_t

Enumerations

enum  ECoilStatus {
  kOK = 0x00, kBad = 0x01, kReverse = 0x02, kDegauss = 0x04,
  kCalib = 0x08, kBadCurrent = 0x10, kDataGap = 0x20, kUnknown = 0x80
}

Functions

Int_t FullMask ()
Bool_t Good (CoilStatus_t coilstatus)
const Char_t * AsString (CoilStatus_t coilstatus)
Char_t * MaskToString (Int_t mask)

Typedef Documentation


Enumeration Type Documentation

Enumerator:
kOK 
kBad 
kReverse 
kDegauss 
kCalib 
kBadCurrent 
kDataGap 
kUnknown 

Definition at line 25 of file CoilStatus.h.

00025                            {
00026     kOK         = 0x00, // Completely OK, no errors or warnings
00027     kBad        = 0x01, // Judgement of OK (0) or Bad (1)
00028     kReverse    = 0x02, // Forward (0) or reverse (1) current
00029     kDegauss    = 0x04, // Properly degaussed (0) or not (1)
00030     kCalib      = 0x08, // Properly calibrated (0) or not (1)
00031     kBadCurrent = 0x10, // Current not within tolerance (80\pm 1A for FD)
00032     kDataGap    = 0x20, // More than 15m gap.  Manually set to warn user
00033                         // could still be !kBad from logbook perusal
00034                         // Note that <15m gaps happen a lot and get 
00035                         // handled automatically by the distiller
00036     kUnknown    = 0x80  // No Clue.  Useful if DB is empty
00037   } CoilStatus_t;


Function Documentation

const Char_t * CoilStatus::AsString ( CoilStatus_t  coilstatus  ) 

Definition at line 22 of file CoilStatus.cxx.

References kBad, kBadCurrent, kCalib, kDataGap, kDegauss, kOK, kReverse, and kUnknown.

Referenced by MaskToString().

00023 {
00024    switch (coilstatus) {
00025    case kOK:         return "OK";          break;
00026    case kBad:        return "Bad";         break;
00027    case kReverse:    return "Reverse";     break;
00028    case kDegauss:    return "Degauss";     break;
00029    case kCalib:      return "Calib";       break;
00030    case kBadCurrent: return "BadCurrent";  break;
00031    case kDataGap:    return "DataGap";     break;
00032    case kUnknown:    return "Unknown";     break;
00033    default:          return "?Unknown?";   break;
00034    }
00035 }

Int_t CoilStatus::FullMask (  ) 

Definition at line 8 of file CoilStatus.cxx.

References kBad, kBadCurrent, kCalib, kDataGap, kDegauss, and kReverse.

Referenced by MaskToString().

00009 {
00010    return kBad|kReverse|kDegauss|kCalib|kBadCurrent|kDataGap;
00011 }

Bool_t CoilStatus::Good ( CoilStatus_t  coilstatus  ) 

Definition at line 13 of file CoilStatus.cxx.

References kBad.

Referenced by DataUtil::IsGoodDataHV(), and Anp::FillHeader::Run().

00014 {
00015   if (coilstatus & kBad) {
00016     return false;
00017   } else {
00018     return true;
00019   }
00020 }

Char_t * CoilStatus::MaskToString ( Int_t  mask  ) 

Definition at line 39 of file CoilStatus.cxx.

References AsString(), and FullMask().

00040 {
00041    // Return a mask of CoilStatus as a string
00042    //
00043    // We might want to get the .NOT.s of these as well, ie "Forward"
00044    //
00045    // Result is a pointer to a statically allocated string.
00046    // User should copy this into their own buffer before calling
00047    // this method again.
00048 
00049    static Char_t newstring[255] = "";
00050    
00051    Char_t* ptr = newstring;  // start at the beginning
00052 
00053    *ptr = 0; // start with nothing
00054    Int_t fullmask = CoilStatus::FullMask();
00055    
00056    // Since zero is all OK, trap for this, else parse set bits
00057    if (!mask) {
00058      const Char_t* toadd = CoilStatus::AsString((CoilStatus_t) mask);
00059      if (ptr != newstring) *ptr++ = ','; 
00060      strcpy(ptr,toadd); 
00061      ptr += strlen(toadd); 
00062    } else {
00063      for (Int_t i=0; i<32; i++) {
00064        CoilStatus::CoilStatus_t acoil = (CoilStatus::CoilStatus_t)(1<<i);
00065        if (mask & acoil & fullmask) {
00066          const Char_t* toadd = CoilStatus::AsString(acoil);
00067          if (ptr != newstring) *ptr++ = ',';
00068          strcpy(ptr,toadd);
00069          ptr += strlen(toadd);
00070        }
00071      }
00072    }
00073    *ptr++ = 0; // ensure trailing 0
00074 
00075    return newstring;
00076 }


Generated on 25 Apr 2018 for loon by  doxygen 1.6.1