PlexRawChannelReadoutType Class Reference

#include <PlexRawChannelReadoutType.h>

Inheritance diagram for PlexRawChannelReadoutType:
DbiTableRow

List of all members.

Public Member Functions

 PlexRawChannelReadoutType ()
 PlexRawChannelReadoutType (Detector::Detector_t det, ElecType::Elec_t elec, Int_t crate, Int_t chadd, ReadoutType::Readout_t rtype, std::string add_descript="")
virtual ~PlexRawChannelReadoutType ()
RawChannelId GetRawChannelId () const
ReadoutType::Readout_t GetReadoutType () const
std::string GetDescript () const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const

Static Public Member Functions

static void SetDefensiveUnpkg (Bool_t defensive)
static Bool_t GetDefensiveUnpkg ()

Private Member Functions

 PlexRawChannelReadoutType (const PlexRawChannelReadoutType &from)

Private Attributes

RawChannelId fRawChannelId
ReadoutType::Readout_t fReadoutType
std::string fDescript

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 26 of file PlexRawChannelReadoutType.h.


Constructor & Destructor Documentation

PlexRawChannelReadoutType::PlexRawChannelReadoutType (  )  [inline]
PlexRawChannelReadoutType::PlexRawChannelReadoutType ( Detector::Detector_t  det,
ElecType::Elec_t  elec,
Int_t  crate,
Int_t  chadd,
ReadoutType::Readout_t  rtype,
std::string  add_descript = "" 
) [inline]

Definition at line 36 of file PlexRawChannelReadoutType.h.

References LEA_CTOR.

00040                                                          :
00041       fRawChannelId(det,elec,crate,chadd),
00042       fReadoutType(rtype), 
00043       fDescript(ReadoutType::AsString(rtype)+add_descript) { LEA_CTOR; };
   virtual ~PlexRawChannelReadoutType(){ LEA_DTOR; };

virtual PlexRawChannelReadoutType::~PlexRawChannelReadoutType (  )  [inline, virtual]

Definition at line 44 of file PlexRawChannelReadoutType.h.

References LEA_DTOR.

00044 { LEA_DTOR; };

PlexRawChannelReadoutType::PlexRawChannelReadoutType ( const PlexRawChannelReadoutType from  )  [inline, private]

Definition at line 69 of file PlexRawChannelReadoutType.h.

References LEA_CTOR.

00070      : DbiTableRow(from) { LEA_CTOR; *this = from; }


Member Function Documentation

virtual DbiTableRow* PlexRawChannelReadoutType::CreateTableRow (  )  const [inline, virtual]

Implements DbiTableRow.

Definition at line 52 of file PlexRawChannelReadoutType.h.

00052 { return new PlexRawChannelReadoutType; }

void PlexRawChannelReadoutType::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

Implements DbiTableRow.

Definition at line 45 of file PlexRawChannelReadoutType.cxx.

References bfld::AsString(), ClusterType::CharToEnum(), DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fDescript, fgDefensiveUnpkg, fRawChannelId, fReadoutType, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), Msg::kDebug, ElecType::kQIE, ElecType::kUnknown, ElecType::kVA, Msg::kWarning, MSG, DbiRowStream::NumCols(), and Detector::StringToEnum().

00046                                                                   {
00047 //
00048 //
00049 //  Purpose:  Fill object from Result Set
00050 //
00051 //  Arguments: 
00052 //    rs           in    Result Set used to fill object
00053 //    vrec         in    Associated validity record (or 0 if filling
00054 //                                                    DbiValidityRec)
00055 //
00056 //  Return:    
00057 //
00058 //  Contact:   R. Hatcher
00059 //
00060 //  Specification:-
00061 //  =============
00062 //
00063 //  o Fill object from current row of Result Set.
00064 
00065 //  Program Notes:-
00066 //  =============
00067 
00068 //  None.
00069 
00070    Detector::Detector_t det =
00071       (Detector::Detector_t) 
00072       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00073 
00074    char   elecName = '?';
00075    char   elecType = ElecType::kUnknown;
00076    int    crate=0, chadd=0;
00077    int    varc, vmm, adcsel, vachip, vachan;
00078    int    geoaddr, master, minder;
00079 
00080    fDescript = "Unknown";
00081 
00082    if (fgDefensiveUnpkg) {
00083 
00084       // unpack allowing for various column names and ordering
00085 
00086       Int_t numCol = rs.NumCols();
00087       //  The first column (SeqNo) has already been processed.
00088       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00089          string colName = rs.CurColName();
00090          if      ( colName == "ELECNAME"    ) rs >> elecName;
00091          else if ( colName == "CRATE"       ) rs >> crate;
00092          else if ( colName == "CHADD"       ) rs >> chadd;
00093          else if ( colName == "VARC"        ) rs >> varc;
00094          else if ( colName == "VMM"         ) rs >> vmm;
00095          else if ( colName == "VAADCSEL"    ) rs >> adcsel;
00096          else if ( colName == "VACHIP"      ) rs >> vachip;
00097          else if ( colName == "VACHAN"      ) rs >> vachan;
00098          else if ( colName == "GEOADDR"     ) rs >> geoaddr;
00099          else if ( colName == "MASTER"      ) rs >> master;
00100          else if ( colName == "MINDER"      ) rs >> minder;
00101          else if ( colName == "READOUTNAME" ) rs >> fDescript;
00102          else {
00103             static int nmsg = 25;
00104             if (nmsg-- > 0) {
00105               MSG("Plex",Msg::kWarning) 
00106                 << "Ignoring column " << rs.CurColNum()
00107                 << " (of " << rs.NumCols() << ")"
00108                 << " \""<< colName << "\"; not part of "
00109                 << ClassName() << endl;
00110             }
00111             rs.IncrementCurCol();
00112          }
00113       }
00114    } // end defensive unpacking
00115    else {
00116 //       SeqNo         int,
00117 //       ElecName      tinytext,
00118 //       Crate         tinyint,
00119 //       VARC          tinyint,
00120 //       VMM           tinyint,
00121 //       VaAdcSel      tinyint,
00122 //       VaChip        tinyint,
00123 //       VaChan        tinyint,
00124 //       GeoAddr       tinyint,
00125 //       Master        tinyint,
00126 //       Minder        tinyint,
00127 //       ReadoutName   tinytext
00128 
00129       rs >> elecName
00130          >> crate
00131          >> varc
00132          >> vmm
00133          >> adcsel
00134          >> vachip
00135          >> vachan
00136          >> geoaddr
00137          >> master
00138          >> minder
00139          >> fDescript;
00140    }
00141 
00142    ElecType::Elec_t elec = ElecType::CharToEnum(elecName);
00143    if (ElecType::kUnknown == elec)  elec = (ElecType::Elec_t) elecType;
00144 
00145    fReadoutType = ReadoutType::StringToEnum(fDescript.c_str());
00146 
00147    if (chadd) {
00148      fRawChannelId = RawChannelId(det,elec,crate,chadd);
00149    } 
00150    else if (ElecType::kVA == elec) {
00151      fRawChannelId = RawChannelId(det,elec,crate,varc,vmm,adcsel,vachip,vachan);
00152    }
00153    else if (ElecType::kQIE == elec) {
00154      fRawChannelId = RawChannelId(det,elec,crate,geoaddr,master,minder);
00155    } else {
00156       MSG("Plex",Msg::kWarning) 
00157          << " bad electronics type \"" << elecName << "\"" << endl;
00158    }
00159 
00160    MSG("Plex",Msg::kDebug)
00161      << "PlexRawChannelReadoutType::Fill "
00162      << fRawChannelId << " is " << ReadoutType::AsString(fReadoutType)
00163      << " '" << fDescript << "'"
00164      << endl;
00165 
00166 }

static Bool_t PlexRawChannelReadoutType::GetDefensiveUnpkg (  )  [inline, static]

Definition at line 63 of file PlexRawChannelReadoutType.h.

References fgDefensiveUnpkg.

00063 { return fgDefensiveUnpkg; }

std::string PlexRawChannelReadoutType::GetDescript (  )  const [inline]

Definition at line 50 of file PlexRawChannelReadoutType.h.

References fDescript.

Referenced by Plexus::BuildReadoutMap().

00050 { return fDescript; }

RawChannelId PlexRawChannelReadoutType::GetRawChannelId ( void   )  const [inline]

Definition at line 48 of file PlexRawChannelReadoutType.h.

References fRawChannelId.

Referenced by Plexus::BuildReadoutMap().

00048 { return fRawChannelId; }

ReadoutType::Readout_t PlexRawChannelReadoutType::GetReadoutType (  )  const [inline]

Definition at line 49 of file PlexRawChannelReadoutType.h.

References fReadoutType.

Referenced by Plexus::BuildReadoutMap().

00049 { return fReadoutType; } 

static void PlexRawChannelReadoutType::SetDefensiveUnpkg ( Bool_t  defensive  )  [inline, static]

Definition at line 61 of file PlexRawChannelReadoutType.h.

References fgDefensiveUnpkg.

00062       { fgDefensiveUnpkg = defensive; }

void PlexRawChannelReadoutType::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

Reimplemented from DbiTableRow.

Definition at line 169 of file PlexRawChannelReadoutType.cxx.

References bfld::AsString(), RawChannelId::DecompChAdd(), fDescript, fRawChannelId, RawChannelId::GetChAdd(), RawChannelId::GetCrate(), RawChannelId::GetElecType(), ElecType::kQIE, and ElecType::kVA.

00170                                                                               {
00171 //
00172 //
00173 //  Purpose:  Stream object to output row stream
00174 //
00175 //  Arguments: 
00176 //    ors          in     Output row stream.
00177 //    vrec         in     Associated validity record (or 0 if filling
00178 //                                                    DbiValidityRec)
00179 //
00180 //  Return:    
00181 //
00182 //  Contact:   R. Hatcher
00183 //
00184 //  Specification:-
00185 //  =============
00186 //
00187 //  o  Stream object to output row stream.
00188 
00189 //  Program Notes:-
00190 //  =============
00191 
00192 //  None.
00193 
00194    ElecType::Elec_t etype = fRawChannelId.GetElecType();
00195    unsigned int chadd = fRawChannelId.GetChAdd();
00196    unsigned int varc=0, vmm=0, adcsel=0, vachip=0, vachan=0;
00197    unsigned int geoaddr=0, master=0, minder=0;
00198 
00199    if (ElecType::kVA == etype) {
00200      RawChannelId::DecompChAdd(chadd,varc,vmm,adcsel,vachip,vachan);
00201    }
00202    else if (ElecType::kQIE == etype) {
00203      RawChannelId::DecompChAdd(chadd,geoaddr,master,minder);
00204    }
00205 
00206    ors << ElecType::AsString(etype)
00207        << fRawChannelId.GetCrate()
00208        << varc << vmm << adcsel << vachip << vachan
00209        << geoaddr << master << minder
00210        << fDescript;   
00211 }


Member Data Documentation

std::string PlexRawChannelReadoutType::fDescript [private]

Definition at line 76 of file PlexRawChannelReadoutType.h.

Referenced by Fill(), GetDescript(), and Store().

Bool_t PlexRawChannelReadoutType::fgDefensiveUnpkg = kFALSE [static, private]

Definition at line 80 of file PlexRawChannelReadoutType.h.

Referenced by Fill(), GetDefensiveUnpkg(), and SetDefensiveUnpkg().

Definition at line 74 of file PlexRawChannelReadoutType.h.

Referenced by Fill(), GetRawChannelId(), and Store().

Definition at line 75 of file PlexRawChannelReadoutType.h.

Referenced by Fill(), and GetReadoutType().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1