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

CalTimeCalibration.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalTimeCalibration.cxx,v 1.12 2005/03/11 16:17:48 west Exp $
00003 //
00004 // CalTimeCalibration
00005 //
00006 // Package: Dbi (Database Interface).
00007 
00008 // Begin_Html<img src="../../pedestrians.gif" align=center>
00009 // <a href="../source_warning.html">Warning for beginners</a>.<br>
00010 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and
00011 // <a href="../index.html">The MINOS Class User Guide</a>End_Html
00012 //
00013 //rjn@hep.ucl.ac.uk
00015 
00016 #include "Calibrator/CalTimeCalibration.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(CalTimeCalibration)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: CalTimeCalibration.cxx,v 1.12 2005/03/11 16:17:48 west Exp $\n  \
00028       CVSID_DBIRESULTPTR ");
00029 
00030 //  Instantiate associated Result Pointer class.
00031 //  *******************************************
00032 
00033 #include "DatabaseInterface/DbiResultPtr.tpl"
00034 template class  DbiResultPtr<CalTimeCalibration>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<CalTimeCalibration>;
00038 
00039 // Definition of member functions (alphabetical order)
00040 // ***************************************************
00041 
00042 
00043 //.....................................................................
00044 
00045 void CalTimeCalibration::Fill(DbiResultSet& rs, 
00046                               const DbiValidityRec* /* vrec */) {
00047 
00048 //
00049 //
00050 //  Purpose:  Fill object from Result Set
00051 //
00052 //  Arguments: 
00053 //    rs           in    Result Set used to fill object
00054 //    vrec         in    Associated validity record (or 0 if filling
00055 //                                                    DbiValidityRec)
00056 //  Return:    
00057 //
00058 //  Contact:   N. West
00059 //
00060 //  Specification:-
00061 //  =============
00062 //
00063 //  o Fill object from current row of Result Set.
00064 
00065 //  Program Notes:-
00066 //  =============
00067 
00068 //  This method demonstrates both the "dumb" fill method (just
00069 //  load the data as it comes) and the smart method (check column
00070 //  name and load according to column order). 
00071 
00072    if ( rs.TableName() == "CALTIMECALIBRATION" ) {
00073       // Dumb method.
00074      rs >> fSEIDkey >> fStripEndId >> fScale >> fOffset >> fSlewC1 >> fSlewC2 >> fSlewC3 >> fSlewC4;
00075    }
00076    else {
00077       
00078       // Smart method
00079       Int_t numCol = rs.NumCols();
00080       //  The first column (SeqNo) has already been processed.
00081       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00082          string colName = rs.CurColName();
00083          if (      colName == "STRIPENDID" ) rs >> fStripEndId;
00084          else if ( colName == "SEIDKEY" )       rs >> fSEIDkey;
00085          else if ( colName == "SCALE" )       rs >> fScale;
00086          else if ( colName == "OFFSET" )    rs >> fOffset;
00087          else if ( colName == "SLEWCONST1" )    rs >> fSlewC1;
00088          else if ( colName == "SLEWCONST2" )    rs >> fSlewC2;
00089          else if ( colName == "SLEWCONST3" )    rs >> fSlewC3;
00090          else if ( colName == "SLEWCONST4" )    rs >> fSlewC4;
00091 
00092          else {
00093             MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00094                                    << "(" << colName << ")"
00095                                    << "; not part of CalTimeCalibration" 
00096                                    << endl;
00097          rs.IncrementCurCol();
00098          }
00099       }
00100    }
00101    
00102    
00103 }
00104 
00105 
00106 //.....................................................................
00107 void CalTimeCalibration::Store(DbiOutRowStream& ors,
00108                                const DbiValidityRec* /* vrec */) const {
00109    //
00110 //
00111 //  Purpose:  Stream object to output row stream
00112 //
00113 //  Arguments: 
00114 //    ors          in     Output row stream.
00115 //    vrec         in    Associated validity record (or 0 if filling
00116 //                                                    DbiValidityRec)
00117 //
00118 //  Return:    
00119 //
00120 //  Contact:   N. West
00121 //
00122 //  Specification:-
00123 //  =============
00124 //
00125 //  o  Stream object to output row stream.
00126 
00127 //  Program Notes:-
00128 //  =============
00129 
00130 //  None.
00131 
00132   ors << fSEIDkey  << fStripEndId << fScale << fOffset <<fSlewC1 <<fSlewC2 <<fSlewC3 <<fSlewC4 ;
00133     
00134 }
00135 
00136 //.....................................................................
00137 
00138 
00139 Double_t CalTimeCalibration::GetTime(const Double_t rawtime) const {
00140 //
00141 //
00142 //  Purpose: To apply sume dummy calibration to the linear charge  
00143 //
00144 //  Arguments: 
00145 //    xxxxxxxxx    in    yyyyyy
00146 //
00147 //  Return:    
00148 //
00149 //  Contact:   R.Nichol
00150 //
00151 //  Specification:-
00152 //  =============
00153 //
00154 //  o 
00155 
00156 //  Program Notes:-
00157 //  =============
00158 
00159 //  None.
00160    MSG("Calib",Msg::kVerbose) << "StripEndId " << fStripEndId 
00161                               << " raw time " << rawtime
00162                               << " Scale " << fScale
00163                               << " Offse t" << fOffset
00164                               << " Time " 
00165                               << rawtime/fScale - fOffset << "\n";
00166    return (rawtime/(Double_t)fScale - (Double_t)fOffset);
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 

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