Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PlexPixelToRawChannel Class Reference

#include <PlexPixelToRawChannel.h>

Inheritance diagram for PlexPixelToRawChannel:

DbiTableRow List of all members.

Public Member Functions

 PlexPixelToRawChannel ()
 PlexPixelToRawChannel (Detector::Detector_t det, ElecType::Elec_t elec, Char_t eastwest, Char_t racklevel, Int_t rackbay, Int_t inrack, Int_t tube, Int_t pixel, Int_t crate, Int_t chadd)
virtual ~PlexPixelToRawChannel ()
virtual Int_t GetAggregateNo () const
PlexPixelSpotId GetPlexPixelSpotId () const
RawChannelId GetRawChannelId () 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

void SetDefensiveUnpkg (Bool_t defensive)
Bool_t GetDefensiveUnpkg ()

Private Member Functions

 PlexPixelToRawChannel (const PlexPixelToRawChannel &from)

Private Attributes

Int_t fAggregate
PlexPixelSpotId fPlexPixelSpotId
RawChannelId fRawChannelId

Static Private Attributes

Bool_t fgDefensiveUnpkg = kFALSE

Constructor & Destructor Documentation

PlexPixelToRawChannel::PlexPixelToRawChannel  )  [inline]
 

Definition at line 32 of file PlexPixelToRawChannel.h.

00032 { LEA_CTOR; }

PlexPixelToRawChannel::PlexPixelToRawChannel Detector::Detector_t  det,
ElecType::Elec_t  elec,
Char_t  eastwest,
Char_t  racklevel,
Int_t  rackbay,
Int_t  inrack,
Int_t  tube,
Int_t  pixel,
Int_t  crate,
Int_t  chadd
[inline]
 

Definition at line 33 of file PlexPixelToRawChannel.h.

References det, fPlexPixelSpotId, and fRawChannelId.

00038                                                    :
00039       fPlexPixelSpotId(det,elec,eastwest,racklevel,rackbay,inrack,tube,pixel,0),
00040       fRawChannelId(det,elec,crate,chadd) { LEA_CTOR; }
   virtual ~PlexPixelToRawChannel(){ LEA_DTOR; };

virtual PlexPixelToRawChannel::~PlexPixelToRawChannel  )  [inline, virtual]
 

Definition at line 41 of file PlexPixelToRawChannel.h.

00041 { LEA_DTOR; };

PlexPixelToRawChannel::PlexPixelToRawChannel const PlexPixelToRawChannel from  )  [inline, private]
 

Definition at line 66 of file PlexPixelToRawChannel.h.

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


Member Function Documentation

virtual DbiTableRow* PlexPixelToRawChannel::CreateTableRow  )  const [inline, virtual]
 

Implements DbiTableRow.

Definition at line 49 of file PlexPixelToRawChannel.h.

00049 { return new PlexPixelToRawChannel; }

void PlexPixelToRawChannel::Fill DbiResultSet rs,
const DbiValidityRec vrec
[virtual]
 

Implements DbiTableRow.

Definition at line 45 of file PlexPixelToRawChannel.cxx.

References ElecType::CharToEnum(), det, and MSG.

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    char   rackEastWest='?', rackLevel='?';
00077    int    rackBay=0, muxboxInRack=0;
00078    int    muxbox=0, tube, pixel;
00079    int    crate=0, chadd=0;
00080    int    varc, vmm, adcsel, vachip, vachan;
00081    int    geoaddr, master, minder;
00082 
00083    if (fgDefensiveUnpkg) {
00084 
00085       // unpack allowing for various column names and ordering
00086 
00087       Int_t numCol = rs.NumCols();
00088       //  The first column (SeqNo) has already been processed.
00089       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00090          string colName = rs.CurColName();
00091          if (      colName == "AGGREGATENO" ) rs >> fAggregate;
00092          else if ( colName == "ELECTYPE"    ) rs >> elecType;
00093          else if ( colName == "ELECNAME"    ) rs >> elecName;
00094          else if ( colName == "CRATE"       ) rs >> crate;
00095          else if ( colName == "CHADD"       ) rs >> chadd;
00096          else if ( colName == "VARC"        ) rs >> varc;
00097          else if ( colName == "VMM"         ) rs >> vmm;
00098          else if ( colName == "VFB"         ) rs >> adcsel;
00099          else if ( colName == "VAADCSEL"    ) rs >> adcsel;
00100          else if ( colName == "VACHIP"      ) rs >> vachip;
00101          else if ( colName == "VACHAN"      ) rs >> vachan;
00102          else if ( colName == "GEOADDR"     ) rs >> geoaddr;
00103          else if ( colName == "MASTER"      ) rs >> master;
00104          else if ( colName == "MINDER"      ) rs >> minder;
00105          else if ( colName == "MUXBOX"      ) rs >> muxbox;
00106          else if ( colName == "RACKEASTWEST") rs >> rackEastWest;
00107          else if ( colName == "RACKLEVEL"   ) rs >> rackLevel;
00108          else if ( colName == "RACKBAY"     ) rs >> rackBay;
00109          else if ( colName == "MUXBOXINRACK") rs >> muxboxInRack;
00110          else if ( colName == "TUBE"        ) rs >> tube;
00111          else if ( colName == "PIXEL"       ) rs >> pixel;
00112          else {
00113             static int nmsg = 25;
00114             if (nmsg-- > 0) MSG("Plex",Msg::kWarning) 
00115                << "Ignoring column " << rs.CurColNum()
00116                << " (of " << rs.NumCols() << ")"
00117                << " \""<< colName << "\"; not part of "
00118                << ClassName() << endl;
00119             rs.IncrementCurCol();
00120          }
00121       }
00122    } // end defensive unpacking
00123    else {
00124 //       SeqNo         int,
00125 //       AggregateNo   int,
00126 //       ElecName      tinytext,
00127 //       RackEastWest  char(1),
00128 //       RackLevel     char(1),
00129 //       RackBay       tinyint,
00130 //       MuxBoxInRack  tinyint,
00131 //       Tube          tinyint,
00132 //       Pixel         tinyint,
00133 //       Crate         tinyint,
00134 //       VARC          tinyint,
00135 //       VMM           tinyint,
00136 //       VaAdcSel      tinyint,
00137 //       VaChip        tinyint,
00138 //       VaChan        tinyint,
00139 //       GeoAddr       tinyint,
00140 //       Master        tinyint,
00141 //       Minder        tinyint
00142 
00143       rs >> fAggregate
00144          >> elecName
00145          >> rackEastWest
00146          >> rackLevel
00147          >> rackBay
00148          >> muxboxInRack
00149          >> tube
00150          >> pixel
00151          >> crate
00152          >> varc
00153          >> vmm
00154          >> adcsel
00155          >> vachip
00156          >> vachan
00157          >> geoaddr
00158          >> master
00159          >> minder;
00160    }
00161 
00162    const Int_t  spot       = 0;
00163 
00164    ElecType::Elec_t elec = ElecType::CharToEnum(elecName);
00165    if (ElecType::kUnknown == elec)  elec = (ElecType::Elec_t) elecType;
00166 
00167    if (chadd) {
00168      fRawChannelId = RawChannelId(det,elec,crate,chadd);
00169    } 
00170    else if (ElecType::kVA == elec) {
00171      fRawChannelId = RawChannelId(det,elec,crate,varc,vmm,adcsel,vachip,vachan);
00172                                    
00173    }
00174    else if (ElecType::kQIE == elec) {
00175      fRawChannelId = RawChannelId(det,elec,crate,geoaddr,master,minder);
00176    } else {
00177      MSG("Plex",Msg::kWarning) 
00178        << " bad electronics type \"" << elecName << "\"" << endl;
00179    }
00180 
00181    fPlexPixelSpotId = PlexPixelSpotId(det,elec,rackEastWest,rackLevel,
00182                                       rackBay,muxboxInRack,tube,pixel,spot);
00183 
00184 #ifdef AGGREGATE_TEST
00185    int  numeric = fPlexPixelSpotId.GetNumericMuxBox();
00186    MSG("Plex",Msg::kInfo)
00187      << "PlexPixelToRawChannel "
00188      << " aggrno " << fAggregate 
00189      << " 0x" << hex << setw(8) << fAggregate << dec
00190      << " numeric " << numeric 
00191      << " 0x" << hex << setw(8) << numeric << dec
00192      << endl;
00193 
00194    //  AggregateNo = MuxBoxInRack + 8*(RackBay-1)
00195    // + (if "top")128
00196    // + (if "west")256
00197 #endif
00198 
00199 //_____________________________________________________________________________
00200 
00201 }

virtual Int_t PlexPixelToRawChannel::GetAggregateNo  )  const [inline, virtual]
 

Reimplemented from DbiTableRow.

Definition at line 45 of file PlexPixelToRawChannel.h.

00045 { return fAggregate; }

Bool_t PlexPixelToRawChannel::GetDefensiveUnpkg  )  [inline, static]
 

Definition at line 60 of file PlexPixelToRawChannel.h.

00060 { return fgDefensiveUnpkg; }

PlexPixelSpotId PlexPixelToRawChannel::GetPlexPixelSpotId  )  const [inline]
 

Definition at line 46 of file PlexPixelToRawChannel.h.

Referenced by Plexus::BuildPixelMaps().

00046 { return fPlexPixelSpotId; }

RawChannelId PlexPixelToRawChannel::GetRawChannelId void   )  const [inline]
 

Definition at line 47 of file PlexPixelToRawChannel.h.

Referenced by Plexus::BuildPixelMaps().

00047 { return fRawChannelId; }

void PlexPixelToRawChannel::SetDefensiveUnpkg Bool_t  defensive  )  [inline, static]
 

Definition at line 58 of file PlexPixelToRawChannel.h.

References fgDefensiveUnpkg.

00059       { fgDefensiveUnpkg = defensive; }

void PlexPixelToRawChannel::Store DbiOutRowStream ors,
const DbiValidityRec vrec
const [virtual]
 

Reimplemented from DbiTableRow.

Definition at line 204 of file PlexPixelToRawChannel.cxx.

References fAggregate, fPlexPixelSpotId, fRawChannelId, RawChannelId::GetChAdd(), RawChannelId::GetCrate(), PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetElecType(), PlexMuxBoxId::GetInRack(), PlexPixelSpotId::GetPixel(), PlexMuxBoxId::GetRackBay(), PlexMuxBoxId::GetRackLevel(), and PlexPixelSpotId::GetTube().

00205                                                                           {
00206 //
00207 //
00208 //  Purpose:  Stream object to output row stream
00209 //
00210 //  Arguments: 
00211 //    ors          in     Output row stream.
00212 //    vrec         in     Associated validity record (or 0 if filling
00213 //                                                    DbiValidityRec)
00214 //
00215 //  Return:    
00216 //
00217 //  Contact:   R. Hatcher
00218 //
00219 //  Specification:-
00220 //  =============
00221 //
00222 //  o  Stream object to output row stream.
00223 
00224 //  Program Notes:-
00225 //  =============
00226 
00227 //  None.
00228 
00229   int  elect   = (int)fPlexPixelSpotId.GetElecType();
00230   char rackEastWest = fPlexPixelSpotId.GetEastWest();
00231   char rackLevel    = fPlexPixelSpotId.GetRackLevel();
00232   int  rackBay      = fPlexPixelSpotId.GetRackBay();
00233   int  muxInRack    = fPlexPixelSpotId.GetInRack();
00234 
00235    ors << fAggregate 
00236        << elect
00237        << rackEastWest
00238        << rackLevel
00239        << rackBay
00240        << muxInRack
00241        << fPlexPixelSpotId.GetTube()
00242        << fPlexPixelSpotId.GetPixel()
00243        << fRawChannelId.GetCrate()
00244        << fRawChannelId.GetChAdd();
00245    
00246 }


Member Data Documentation

Int_t PlexPixelToRawChannel::fAggregate [private]
 

Definition at line 71 of file PlexPixelToRawChannel.h.

Referenced by Store().

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

Definition at line 28 of file PlexPixelToRawChannel.cxx.

Referenced by SetDefensiveUnpkg().

PlexPixelSpotId PlexPixelToRawChannel::fPlexPixelSpotId [private]
 

Definition at line 72 of file PlexPixelToRawChannel.h.

Referenced by PlexPixelToRawChannel(), and Store().

RawChannelId PlexPixelToRawChannel::fRawChannelId [private]
 

Definition at line 73 of file PlexPixelToRawChannel.h.

Referenced by PlexPixelToRawChannel(), and Store().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:04 2010 for loon by  doxygen 1.3.9.1