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

CalMIPCalibration.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalMIPCalibration.cxx,v 1.10 2005/03/11 16:17:48 west Exp $
00003 //
00004 // CalMIPCalibration
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/CalMIPCalibration.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(CalMIPCalibration)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: CalMIPCalibration.cxx,v 1.10 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<CalMIPCalibration>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<CalMIPCalibration>;
00038 
00039 // Definition of member functions (alphabetical order)
00040 // ***************************************************
00041 
00042 
00043 //.....................................................................
00044 
00045 void CalMIPCalibration::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() == "CALMIPCALIBRATION" ) {
00073       // Dumb method.
00074      rs  >> fSEIDkey   >> fStripEndId >> fMIPScale;
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 >> fMIPScale;
00086          else {
00087             MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00088                                    << "(" << colName << ")"
00089                                    << "; not part of CalMIPCalibration" 
00090                                    << endl;
00091          rs.IncrementCurCol();
00092          }
00093       }
00094    }
00095    
00096    
00097 }
00098 
00099 
00100 //.....................................................................
00101 void CalMIPCalibration::Store(DbiOutRowStream& ors,
00102                               const DbiValidityRec* /* vrec */) const {
00103    //
00104 //
00105 //  Purpose:  Stream object to output row stream
00106 //
00107 //  Arguments: 
00108 //    ors          in     Output row stream.
00109 //    vrec         in    Associated validity record (or 0 if filling
00110 //                                                    DbiValidityRec)
00111 //
00112 //  Return:    
00113 //
00114 //  Contact:   N. West
00115 //
00116 //  Specification:-
00117 //  =============
00118 //
00119 //  o  Stream object to output row stream.
00120 
00121 //  Program Notes:-
00122 //  =============
00123 
00124 //  None.
00125 
00126   ors << fSEIDkey  << fStripEndId << fMIPScale;
00127     
00128 }
00129 
00130 //.....................................................................
00131 
00132 
00133 
00134 Float_t CalMIPCalibration::GetMIP(const Float_t rawcharge) const {
00135 //
00136 //
00137 //  Purpose: To apply sume dummy calibration to the linear charge  
00138 //
00139 //  Arguments: 
00140 //    xxxxxxxxx    in    yyyyyy
00141 //
00142 //  Return:    
00143 //
00144 //  Contact:   R.Nichol
00145 //
00146 //  Specification:-
00147 //  =============
00148 //
00149 //  o 
00150 
00151 //  Program Notes:-
00152 //  =============
00153 
00154 //  None.
00155 
00156   if(fMIPScale==0) return rawcharge;
00157 
00158   MSG("Calib",Msg::kVerbose) << "StripEndId " << fStripEndId 
00159                              << " raw charge " << rawcharge
00160     
00161                              << " MIPs " 
00162                              << rawcharge/fMIPScale << "\n";
00163    return rawcharge/fMIPScale;
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 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 
00238 
00239 

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