PlexLedId Class Reference

#include <PlexLedId.h>

List of all members.

Public Member Functions

 PlexLedId ()
 PlexLedId (const Detector::Detector_t detector, const UInt_t pulserBox, const UInt_t ledInBox)
virtual ~PlexLedId ()
 PlexLedId (const UInt_t encoded)
UInt_t GetEncoded () const
const char * AsString (Option_t *option="") const
Detector::Detector_t GetDetector () const
UShort_t GetPulserBox () const
UShort_t GetLedInBox () const
Bool_t IsValid () const
void Print (Option_t *option="") const
void SetDetector (Detector::Detector_t detector)
void SetPulserBox (UInt_t pulserBox)
void SetLedInBox (UInt_t ledInBox)

Protected Attributes

UInt_t fEncoded

Friends

Bool_t operator< (const PlexLedId &lhs, const PlexLedId &rhs)
Bool_t operator<= (const PlexLedId &lhs, const PlexLedId &rhs)
Bool_t operator== (const PlexLedId &lhs, const PlexLedId &rhs)
Bool_t operator!= (const PlexLedId &lhs, const PlexLedId &rhs)
Bool_t operator> (const PlexLedId &lhs, const PlexLedId &rhs)
Bool_t operator>= (const PlexLedId &lhs, const PlexLedId &rhs)

Detailed Description

Definition at line 26 of file PlexLedId.h.


Constructor & Destructor Documentation

PlexLedId::PlexLedId (  ) 

Definition at line 32 of file PlexLedId.cxx.

00033    : fEncoded(defaultPlexLedId)
00034 {
00035    // Default ctor constructs meaningless value
00036 }

PlexLedId::PlexLedId ( const Detector::Detector_t  detector,
const UInt_t  pulserBox,
const UInt_t  ledInBox 
)

Definition at line 39 of file PlexLedId.cxx.

References SetDetector(), SetLedInBox(), and SetPulserBox().

00041    : fEncoded(defaultPlexLedId)
00042 {
00043    // Normal ctor
00044 
00045    SetDetector(detector);
00046    SetPulserBox(pulserBox);
00047    SetLedInBox(ledInBox);
00048 }

PlexLedId::~PlexLedId (  )  [virtual]

Definition at line 58 of file PlexLedId.cxx.

00059 {
00060    // delete all the owned sub-objects
00061 }

PlexLedId::PlexLedId ( const UInt_t  encoded  ) 

Definition at line 51 of file PlexLedId.cxx.

00052    : fEncoded(encoded)
00053 {
00054    // constructor from pre-encoded value
00055 }


Member Function Documentation

const char * PlexLedId::AsString ( Option_t *  option = ""  )  const

Definition at line 74 of file PlexLedId.cxx.

References Detector::AsString(), GetDetector(), GetLedInBox(), and GetPulserBox().

Referenced by Plexus::BuildLedMaps(), FitNdNonlinQuad(), Print(), and LISummarySorter::ReconstructPin().

00075 {
00076    // Return unpacked PlexLedId as a string
00077    // User should copy result because it points to a 
00078    // statically allocated string.
00079    // Internally uses a circular list of buffers to avoid problems
00080    // using AsString multiple times in a cout-like situation.
00081 
00082    const int nbuffers = 8;  // use a circular list of strings
00083    static char newstring[nbuffers][64];  // "LED-DPP-II";
00084    static int ibuffer = nbuffers;
00085    ibuffer = (ibuffer+1)%nbuffers;  // each time move to next buffer
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 }

Detector::Detector_t PlexLedId::GetDetector (  )  const [inline]

Definition at line 121 of file PlexLedId.h.

References fEncoded, maskPlexLedIdDetector, and shftPlexLedIdDetector.

Referenced by AsString().

00122 { 
00123    Int_t bitField = 
00124      ( fEncoded & maskPlexLedIdDetector ) >> shftPlexLedIdDetector;
00125    return (Detector::Detector_t) bitField;   
00126 }

UInt_t PlexLedId::GetEncoded (  )  const [inline]
UShort_t PlexLedId::GetLedInBox (  )  const [inline]
UShort_t PlexLedId::GetPulserBox (  )  const [inline]
Bool_t PlexLedId::IsValid (  )  const [inline]

Definition at line 138 of file PlexLedId.h.

References defaultPlexLedId, and fEncoded.

Referenced by LIPlexMaps::PlotPlexStripMap(), LISummarySorter::ReconstructPin(), and LISummarySorter::ReconstructStripEnd().

00139 { 
00140    // test whether this is the nonsensical default value
00141    return fEncoded != defaultPlexLedId;
00142 }

void PlexLedId::Print ( Option_t *  option = ""  )  const

Definition at line 99 of file PlexLedId.cxx.

References AsString().

00100 {
00101    // Print the (decoded) value
00102 
00103    printf("%s\n",AsString(option));
00104 }

void PlexLedId::SetDetector ( Detector::Detector_t  detector  )  [inline]

Definition at line 144 of file PlexLedId.h.

References fEncoded, maskPlexLedIdDetector, and shftPlexLedIdDetector.

Referenced by PlexLedId().

00145 {
00146    fEncoded = ( fEncoded & ~maskPlexLedIdDetector ) | 
00147       ( ( detector << shftPlexLedIdDetector ) & maskPlexLedIdDetector );
00148 }

void PlexLedId::SetLedInBox ( UInt_t  ledInBox  )  [inline]

Definition at line 156 of file PlexLedId.h.

References fEncoded, maskPlexLedIdLedInBox, and shftPlexLedIdLedInBox.

Referenced by PlexLedId().

00157 {
00158    fEncoded = ( fEncoded & ~maskPlexLedIdLedInBox ) |
00159       ( ( ledInBox << shftPlexLedIdLedInBox ) & maskPlexLedIdLedInBox );
00160 }

void PlexLedId::SetPulserBox ( UInt_t  pulserBox  )  [inline]

Definition at line 150 of file PlexLedId.h.

References fEncoded, maskPlexLedIdPulserBox, and shftPlexLedIdPulserBox.

Referenced by PlexLedId().

00151 {
00152    fEncoded = ( fEncoded & ~maskPlexLedIdPulserBox ) |
00153       ( ( pulserBox << shftPlexLedIdPulserBox ) & maskPlexLedIdPulserBox );
00154 }


Friends And Related Function Documentation

Bool_t operator!= ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]
Bool_t operator< ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]
Bool_t operator<= ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]
Bool_t operator== ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]
Bool_t operator> ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]
Bool_t operator>= ( const PlexLedId lhs,
const PlexLedId rhs 
) [friend]

Member Data Documentation

UInt_t PlexLedId::fEncoded [protected]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1