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

SimPmtM16Crosstalk.cxx

Go to the documentation of this file.
00001 #include "SimPmtM16Crosstalk.h"
00002 #include "MessageService/MsgService.h"
00003 #include "DatabaseInterface/DbiOutRowStream.h"
00004 #include "DatabaseInterface/DbiResultSet.h"
00005 #include "DatabaseInterface/DbiValidityRec.h"
00006 
00007 ClassImp(SimPmtM16Crosstalk)
00008 
00009 
00010 CVSID("$Id: SimPmtM16Crosstalk.cxx,v 1.6 2007/03/01 17:22:11 rhatcher Exp $");
00011 
00012 //  Instantiate associated Result Pointer class.
00013 //  *******************************************
00014 
00015 #include "DatabaseInterface/DbiResultPtr.tpl"
00016 template class  DbiResultPtr<SimPmtM16Crosstalk>;
00017 
00018 #include "DatabaseInterface/DbiWriter.tpl"
00019 template class  DbiWriter<SimPmtM16Crosstalk>;
00020 
00021 //   Definition of static data members
00022 //   *********************************
00023 
00024 UInt_t SimPmtM16Crosstalk::MakeIndex(UInt_t ip, UInt_t is, UInt_t xp)
00025 {
00026   return (ip-1)*8*16+(is-1)*16+(xp-1);
00027 }
00028 
00029 // Definition of member functions (alphabetical order)
00030 // ***************************************************
00031 
00032 
00033 //.....................................................................
00034 
00035 void SimPmtM16Crosstalk::Fill(DbiResultSet& rs,
00036                       const DbiValidityRec* /* vrec */) {
00037 
00038 //
00039 //
00040 //  Purpose:  Fill object from Result Set
00041 //
00042 //  Arguments:
00043 //    rs           in    Result Set used to fill object
00044 //    vrec         in    Associated validity record (or 0 if filling
00045 //                                                    DbiValidityRec)
00046 //  Return:
00047 //
00048 //  Contact:   N. West
00049 //
00050 //  Specification:-
00051 //  =============
00052 //
00053 //  o Fill object from current row of Result Set.
00054 
00055 //  Program Notes:-
00056 //  =============
00057 
00058 //  This method demonstrates both the "dumb" fill method (just
00059 //  load the data as it comes) and the smart method (check column
00060 //  name and load according to column order).
00061 
00062   if ( rs.TableName() == "SIMPMTM16CROSSTALK" ) {
00063       // Dumb method.
00064     rs >> fInjPixel >>fInjSpot>> fXPixel >> fElecFrac >> fElecFracErr
00065        >> fOptFrac >> fOptFracErr;
00066    }
00067    else {
00068       // Smart method
00069       Int_t numCol = rs.NumCols();
00070       //  The first column (SeqNo) has already been processed.
00071       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00072          string colName = rs.CurColName();
00073          if (      colName == "INJPIXEL" )    rs >> fInjPixel;
00074          else if ( colName == "INJSPOT" )      rs >> fInjSpot;
00075          else if ( colName == "XPIXEL" )      rs >> fXPixel;
00076          else if ( colName == "ELECFRAC" )    rs >> fElecFrac;
00077          else if ( colName == "ELECFRACERR" ) rs >> fElecFracErr;
00078          else if ( colName == "OPTFRAC" )     rs >> fOptFrac;
00079          else if ( colName == "OPTFRACERR" )  rs >> fOptFracErr;
00080          else {
00081            MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol
00082                                   << "(" << colName << ")"
00083                                   << "; not part of CalADCtoPE"
00084                                   << endl;
00085            rs.IncrementCurCol();
00086          }
00087       }
00088    }
00089 }
00090 
00091 
00092 //.....................................................................
00093 void SimPmtM16Crosstalk::Store(DbiOutRowStream& ors,
00094                        const DbiValidityRec* /* vrec */) const {
00095    //
00096 //
00097 //  Purpose:  Stream object to output row stream
00098 //
00099 //  Arguments:
00100 //    ors          in     Output row stream.
00101 //    vrec         in    Associated validity record (or 0 if filling
00102 //                                                    DbiValidityRec)
00103 //
00104 //  Return:
00105 //
00106 //  Contact:   N. West
00107 //
00108 //  Specification:-
00109 //  =============
00110 //
00111 //  o  Stream object to output row stream.
00112 
00113 //  Program Notes:-
00114 //  =============
00115 
00116 //  None.
00117 
00118   ors  << fInjPixel <<fInjSpot<< fXPixel << fElecFrac << fElecFracErr
00119        << fOptFrac << fOptFracErr;
00120 
00121 }
00122 
00123 
00124 
00125 

Generated on Mon Feb 15 11:07:37 2010 for loon by  doxygen 1.3.9.1