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

CalPmtDrift.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalPmtDrift.cxx,v 1.5 2005/09/12 19:47:31 tagg Exp $
00003 //
00004 // CalPmtDrift
00005 //
00006 // DB Row class corresponding to the double-exponential attenuation curve along a strip.
00007 //
00008 // Nathaniel Tagg n.tagg1@physics.ox.ac.uk
00010 
00011 #include "Calibrator/CalPmtDrift.h"
00012 #include "MessageService/MsgService.h"
00013 #include "DatabaseInterface/DbiOutRowStream.h"
00014 #include "DatabaseInterface/DbiResultSet.h"
00015 #include "DatabaseInterface/DbiValidityRec.h"
00016 #include <iostream>
00017 
00018 ClassImp(CalPmtDrift)
00019 
00020 //   Definition of static data members
00021 //   *********************************
00022 
00023 CVSID("$Id: CalPmtDrift.cxx,v 1.5 2005/09/12 19:47:31 tagg Exp $\n  \
00024       CVSID_DBIRESULTPTR ");
00025 
00026 //  Instantiate associated Result Pointer class.
00027 //  *******************************************
00028 
00029 #include "DatabaseInterface/DbiResultPtr.tpl"
00030 template class  DbiResultPtr<CalPmtDrift>;
00031 
00032 #include "DatabaseInterface/DbiWriter.tpl"
00033 template class  DbiWriter<CalPmtDrift>;
00034 
00035 CalPmtDrift::CalPmtDrift(PlexPixelSpotId psid, RawChannelId rcid,
00036                          Float_t drift, Float_t statError,
00037                          Float_t sysError, Float_t spotsUsed,
00038                          Float_t spotsAvailable, Float_t crudeDrift,
00039                          Float_t minDrift, Float_t maxDrift)
00040   : fPmtId( psid.GetUniquePmtEncodedValue()),
00041     fChannelId( 0 ),
00042     fDrift(drift),
00043     fStatError(statError),
00044     fSysError(sysError),
00045     fSpotsUsed(spotsUsed),
00046     fSpotsAvailable(spotsAvailable),
00047     fCrudeDrift(crudeDrift),
00048     fMinDrift(minDrift),
00049     fMaxDrift(maxDrift)
00050 {
00051   rcid.ClearModeBits();
00052   fChannelId = rcid.GetEncoded();
00053 }
00054 
00055 //.....................................................................
00056 
00057 void CalPmtDrift::Fill(DbiResultSet& rs, 
00058                               const DbiValidityRec* /* vrec */) {
00059 
00060 //
00061 //
00062 //  Purpose:  Fill object from Result Set
00063 //
00064 //  Arguments: 
00065 //    rs           in    Result Set used to fill object
00066 //    vrec         in    Associated validity record (or 0 if filling
00067 //                                                    DbiValidityRec)
00068 //
00069 //  o Fill object from current row of Result Set.
00070 
00071 //  Program Notes:-
00072 //  =============
00073 
00074 //  This method demonstrates both the "dumb" fill method (just
00075 //  load the data as it comes) and the smart method (check column
00076 //  name and load according to column order). 
00077 
00078    if ( rs.TableName() == "CALPMTDRIFT" ) {
00079       // Dumb method.
00080      rs  >> fPmtId >> fChannelId >> fDrift >> fStatError >> fSysError >> fSpotsUsed 
00081          >> fSpotsAvailable >> fCrudeDrift >> fMinDrift >> fMaxDrift;
00082    }
00083 
00084    else {
00085       
00086       // Smart method
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 == "PMT" )  rs >> fPmtId; 
00092          else if( colName == "CHANNEL" )   rs >> fChannelId;
00093          else if( colName == "DRIFT" )     rs >> fDrift;
00094          else if( colName == "STATERROR" )     rs >> fStatError;
00095          else if( colName == "SYSERROR"   )     rs >> fSysError;
00096          else if( colName == "SPOTSUSED" )     rs >> fSpotsUsed;
00097          else if( colName == "SPOTSAVAIL" )     rs >> fSpotsAvailable;
00098          else if( colName == "CRUDEDRIFT"   )     rs >> fCrudeDrift;
00099          else if( colName == "MINDRIFT"   )     rs >> fMinDrift;
00100          else if( colName == "MAXDRIFT"   )     rs >> fMaxDrift;
00101 
00102          else {
00103            MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00104                                   << "(" << colName << ")"
00105                                   << "; not part of CalPmtDrift" 
00106                                   << endl;
00107            rs.IncrementCurCol();
00108          }
00109       }
00110    }
00111    
00112    
00113 }
00114 
00115 
00116 //.....................................................................
00117 void CalPmtDrift::Store(DbiOutRowStream& ors,
00118                                const DbiValidityRec* /* vrec */) const {
00119   //
00120   //
00121   //  Purpose:  Stream object to output row stream
00122   //
00123   //  Arguments: 
00124   //    ors          in     Output row stream.
00125   //    vrec         in    Associated validity record (or 0 if filling
00126   
00127   ors << fPmtId << fChannelId << fDrift << fStatError << fSysError
00128       << fSpotsUsed << fSpotsAvailable << fCrudeDrift << fMinDrift << fMaxDrift; 
00129 }
00130 //.....................................................................
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 

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