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

DbuVaChipPeds.cxx

Go to the documentation of this file.
00001 
00002 // $Id: DbuVaChipPeds.cxx,v 1.7 2007/02/15 14:15:48 rhatcher Exp $
00003 //
00004 // DbuVaChipPeds
00005 //
00006 // Package: DatabaseUpdater
00007 //
00008 // R. Hatcher  2002-04-19
00009 //
00010 // Concept:
00011 //   
00012 // Purpose:
00013 //
00015 
00016 #include "DatabaseUpdater/DbuVaChipPeds.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 #include <iostream>
00022 
00023 #include <cassert>
00024 
00025 ClassImp(DbuVaChipPeds)
00026 
00027 //   Definition of static data members
00028 //   *********************************
00029 
00030 CVSID("$Id: DbuVaChipPeds.cxx,v 1.7 2007/02/15 14:15:48 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00031 
00032 //  Instantiate associated Result Pointer class.
00033 //  *******************************************
00034 
00035 #include "DatabaseInterface/DbiResultPtr.tpl"
00036 template class  DbiResultPtr<DbuVaChipPeds>;
00037 
00038 #include "DatabaseInterface/DbiWriter.tpl"
00039 template class  DbiWriter<DbuVaChipPeds>;
00040 
00041 const Int_t  maskPedMode   = 0x00200000;
00042 const Int_t  maskSparsMode = 0x00400000;
00043 const Int_t  maskComMode   = 0x00800000;
00044 const Int_t  maskModes     = maskPedMode | maskSparsMode | maskComMode;
00045 const Int_t  shiftModes    = 21;
00046 
00047 //.....................................................................
00048 
00049 std::ostream& operator<<(std::ostream& os, const DbuVaChipPeds& drs)
00050 {
00051    os << drs.GetName() 
00052       << " " << drs.fRawChannelId.AsString("e");
00053    for (int i=0; i<22; ++i) {
00054       if (0==i || 11==i) os << endl << " | ";
00055       os << setw(5) << drs.fChanPed[i];
00056    }
00057    os << endl;
00058 
00059    return os;
00060 }
00061 
00062 //.....................................................................
00063 
00064 // Definition of member functions (alphabetical order)
00065 // ***************************************************
00066 
00067 //.....................................................................
00068 
00069 void DbuVaChipPeds::Fill(DbiResultSet& rs,
00070                                       const DbiValidityRec* vrec) {
00071 //
00072 //
00073 //  Purpose:  Fill object from Result Set
00074 //
00075 //  Arguments: 
00076 //    rs           in    Result Set used to fill object
00077 //    vrec         in    Associated validity record (or 0 if filling
00078 //                                                    DbiValidityRec)
00079 //
00080 //  Return:    
00081 //
00082 //  Contact:   R. Hatcher
00083 //
00084 //  Specification:-
00085 //  =============
00086 //
00087 //  o Fill object from current row of Result Set.
00088 
00089 //  Program Notes:-
00090 //  =============
00091 
00092 //  None.
00093 
00094    Detector::Detector_t det =
00095       (Detector::Detector_t) 
00096       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00097    
00098    ElecType::Elec_t elec = ElecType::kVA;
00099 
00100    UInt_t       crate, varc, vmm, adcsel, vachip;
00101    const UInt_t vachan = 0;
00102    Int_t        modeflags;
00103 
00104    rs >> crate
00105       >> modeflags
00106       >> varc
00107       >> vmm
00108       >> adcsel
00109       >> vachip;
00110    for (int i=0; i<22; ++i) rs >> fChanPed[i];
00111    
00112    modeflags  = modeflags << shiftModes;
00113    Bool_t pedMode    = modeflags & maskPedMode;
00114    Bool_t sparsMode  = modeflags & maskSparsMode;
00115    Bool_t commonMode = modeflags & maskComMode;
00116 
00117    fRawChannelId = RawChannelId(det,elec,crate,varc,vmm,adcsel,vachip,vachan);
00118    fRawChannelId.SetModeBits(commonMode,sparsMode,pedMode);
00119 }
00120 
00121 //.....................................................................
00122 
00123 void DbuVaChipPeds::Store(DbiOutRowStream& ors,
00124                           const DbiValidityRec* /* vrec */) const {
00125 //
00126 //
00127 //  Purpose:  Stream object to output row stream
00128 //
00129 //  Arguments: 
00130 //    ors          in     Output row stream.
00131 //    vrec         in     Associated validity record (or 0 if filling
00132 //                                                    DbiValidityRec)
00133 //
00134 //  Return:    
00135 //
00136 //  Contact:   R. Hatcher
00137 //
00138 //  Specification:-
00139 //  =============
00140 //
00141 //  o  Stream object to output row stream.
00142 
00143 //  Program Notes:-
00144 //  =============
00145 
00146 //  None.
00147 
00148    Int_t modeflags = 
00149       (fRawChannelId.GetEncoded() & maskModes) >> shiftModes;
00150 
00151    ors << fRawChannelId.GetCrate()
00152        << modeflags
00153        << fRawChannelId.GetVarcId()
00154        << fRawChannelId.GetVmm()
00155        << fRawChannelId.GetVaAdcSel()
00156        << fRawChannelId.GetVaChip();
00157    for (int i=0; i<22; ++i) ors << fChanPed[i];
00158 
00159 }
00160 
00161 //.....................................................................
00162 
00163 const char* DbuVaChipPeds::GetTableDescr()
00164 {
00165 //
00166 //
00167 //  Purpose:  Return a string describing rows in the table
00168 //            Used in creating temporary tables
00169 //
00170 //  Return:   const char* to parenthesized comma separated list
00171 //            of column name and type pairs
00172 //
00173 //  Contact:   R. Hatcher
00174 //
00175 //  Specification:-
00176 //  =============
00177 //
00178 
00179 //  Program Notes:-
00180 //  =============
00181 
00182 //  None.
00183 
00184    const char* const_tabledescr = "(\
00185        SEQNO             int,      \
00186        ROW_COUNTER       int,      \
00187        CRATE             smallint, \
00188        MODEFLAGS         tinyint,  \
00189        VARC              tinyint,  \
00190        VMM               tinyint,  \
00191        VAADCSEL          tinyint,  \
00192        VACHIP            tinyint,  \
00193        CHAN00            smallint, \
00194        CHAN01            smallint, \
00195        CHAN02            smallint, \
00196        CHAN03            smallint, \
00197        CHAN04            smallint, \
00198        CHAN05            smallint, \
00199        CHAN06            smallint, \
00200        CHAN07            smallint, \
00201        CHAN08            smallint, \
00202        CHAN09            smallint, \
00203        CHAN10            smallint, \
00204        CHAN11            smallint, \
00205        CHAN12            smallint, \
00206        CHAN13            smallint, \
00207        CHAN14            smallint, \
00208        CHAN15            smallint, \
00209        CHAN16            smallint, \
00210        CHAN17            smallint, \
00211        CHAN18            smallint, \
00212        CHAN19            smallint, \
00213        CHAN20            smallint, \
00214        CHAN21            smallint, \
00215        primary key (SEQNO,ROW_COUNTER) \
00216        )";
00217 
00218    return const_tabledescr;
00219 }
00220 
00221 
00222 /*    Template for New Member Function
00223 
00224 //.....................................................................
00225 
00226 DbuVaChipPeds:: {
00227 //
00228 //
00229 //  Purpose:  
00230 //
00231 //  Arguments: 
00232 //    xxxxxxxxx    in    yyyyyy
00233 //
00234 //  Return:    
00235 //
00236 //  Contact:   R. Hatcher
00237 //
00238 //  Specification:-
00239 //  =============
00240 //
00241 //  o 
00242 
00243 //  Program Notes:-
00244 //  =============
00245 
00246 //  None.
00247 
00248 
00249 }
00250 
00251 */
00252 

Generated on Mon Feb 15 11:06:36 2010 for loon by  doxygen 1.3.9.1