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

CalStripToStrip.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalStripToStrip.cxx,v 1.5 2005/03/22 12:28:12 tagg Exp $
00003 //
00004 // CalStripToStrip
00005 //
00006 // DB Row class corresponding to a single strip-to-strip calibration.
00007 //
00008 // The fResponse constant is the relative light output for energy deposited in the center of the strip
00009 //  (as seen at the phototube) for the strip end
00010 //
00011 // Nathaniel Tagg n.tagg1@physics.ox.ac.uk
00013 
00014 #include "Calibrator/CalStripToStrip.h"
00015 #include "MessageService/MsgService.h"
00016 #include "DatabaseInterface/DbiOutRowStream.h"
00017 #include "DatabaseInterface/DbiResultSet.h"
00018 #include "DatabaseInterface/DbiValidityRec.h"
00019 
00020 ClassImp(CalStripToStrip)
00021 
00022 //   Definition of static data members
00023 //   *********************************
00024 
00025 CVSID("$Id: CalStripToStrip.cxx,v 1.5 2005/03/22 12:28:12 tagg Exp $\n  \
00026       CVSID_DBIRESULTPTR ");
00027 
00028 //  Instantiate associated Result Pointer class.
00029 //  *******************************************
00030 
00031 #include "DatabaseInterface/DbiResultPtr.tpl"
00032 template class  DbiResultPtr<CalStripToStrip>;
00033 
00034 #include "DatabaseInterface/DbiWriter.tpl"
00035 template class  DbiWriter<CalStripToStrip>;
00036 
00037 // Definition of member functions (alphabetical order)
00038 // ***************************************************
00039 
00040 
00041 //.....................................................................
00042 
00043 void CalStripToStrip::Fill(DbiResultSet& rs, 
00044                               const DbiValidityRec* /* vrec */) {
00045 
00046 //
00047 //
00048 //  Purpose:  Fill object from Result Set
00049 //
00050 //  Arguments: 
00051 //    rs           in    Result Set used to fill object
00052 //    vrec         in    Associated validity record (or 0 if filling
00053 //                                                    DbiValidityRec)
00054 //
00055 //  o Fill object from current row of Result Set.
00056 
00057 //  Program Notes:-
00058 //  =============
00059 
00060 //  This method demonstrates both the "dumb" fill method (just
00061 //  load the data as it comes) and the smart method (check column
00062 //  name and load according to column order). 
00063 
00064    if ( rs.TableName() == "CALSTRIPTOSTRIP" ) {
00065       // Dumb method.
00066      rs  >> fSEIdEncoded >> fResponse >> fResponseErr;
00067      fSEIdKey = PlexStripEndId(fSEIdEncoded).BuildPlnStripEndKey();
00068    }
00069 
00070    else {
00071       
00072       // Smart method
00073       Int_t numCol = rs.NumCols();
00074       //  The first column (SeqNo) has already been processed.
00075       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00076          string colName = rs.CurColName();
00077          if ( colName == "SEIDENCODED" ) {
00078            rs >> fSEIdEncoded; 
00079            fSEIdKey =  PlexStripEndId(fSEIdEncoded).BuildPlnStripEndKey();       
00080          }
00081          else if( colName == "RESPONSE" )       rs >> fResponse;
00082          else if( colName == "RESPONSEERR" )     rs >> fResponseErr;
00083          else {
00084            MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00085                                   << "(" << colName << ")"
00086                                   << "; not part of CalStripToStrip" 
00087                                   << endl;
00088            rs.IncrementCurCol();
00089          }
00090       }
00091    }
00092    
00093    
00094 }
00095 
00096 
00097 //.....................................................................
00098 void CalStripToStrip::Store(DbiOutRowStream& ors,
00099                                const DbiValidityRec* /* vrec */) const {
00100   //
00101   //
00102   //  Purpose:  Stream object to output row stream
00103   //
00104   //  Arguments: 
00105   //    ors          in     Output row stream.
00106   //    vrec         in    Associated validity record (or 0 if filling
00107   
00108   ors << fSEIdEncoded  << fResponse << fResponseErr; 
00109 }
00110 //.....................................................................

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