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

CalADCtoPE.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalADCtoPE.cxx,v 1.9 2005/03/11 16:17:48 west Exp $
00003 //
00004 // CalADCtoPE
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/CalADCtoPE.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(CalADCtoPE)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: CalADCtoPE.cxx,v 1.9 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<CalADCtoPE>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<CalADCtoPE>;
00038 
00039 
00040 // Definition of member functions (alphabetical order)
00041 // ***************************************************
00042 
00043 
00044 //.....................................................................
00045 
00046 void CalADCtoPE::Fill(DbiResultSet& rs, 
00047                       const DbiValidityRec* /* vrec */) {
00048 
00049 //
00050 //
00051 //  Purpose:  Fill object from Result Set
00052 //
00053 //  Arguments: 
00054 //    rs           in    Result Set used to fill object
00055 //    vrec         in    Associated validity record (or 0 if filling
00056 //                                                    DbiValidityRec)
00057 //  Return:    
00058 //
00059 //  Contact:   N. West
00060 //
00061 //  Specification:-
00062 //  =============
00063 //
00064 //  o Fill object from current row of Result Set.
00065 
00066 //  Program Notes:-
00067 //  =============
00068 
00069 //  This method demonstrates both the "dumb" fill method (just
00070 //  load the data as it comes) and the smart method (check column
00071 //  name and load according to column order). 
00072 
00073    if ( rs.TableName() == "CALADCTOPE" ) {
00074       // Dumb method.
00075      rs >> fSEIDkey >> fStripEndId >> fGain >> fGainErr >> fSPEWidth;
00076    }
00077    else {
00078       
00079       // Smart method
00080       Int_t numCol = rs.NumCols();
00081       //  The first column (SeqNo) has already been processed.
00082       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00083          string colName = rs.CurColName();
00084          if (      colName == "STRIPENDID" ) rs >> fStripEndId;
00085          else if ( colName == "SEIDKEY" )       rs >> fSEIDkey;
00086          else if ( colName == "GAIN" )       rs >> fGain;
00087          else if ( colName == "GAINERR" )    rs >> fGainErr;
00088          else if ( colName == "WIDTH1PE" )   rs >> fSPEWidth;
00089          else {
00090             MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00091                                    << "(" << colName << ")"
00092                                    << "; not part of CalADCtoPE" 
00093                                    << endl;
00094          rs.IncrementCurCol();
00095          }
00096       }
00097    }
00098    
00099    
00100 }
00101 
00102 
00103 //.....................................................................
00104 void CalADCtoPE::Store(DbiOutRowStream& ors,
00105                        const DbiValidityRec* /* vrec */) const {
00106    //
00107 //
00108 //  Purpose:  Stream object to output row stream
00109 //
00110 //  Arguments: 
00111 //    ors          in     Output row stream.
00112 //    vrec         in    Associated validity record (or 0 if filling
00113 //                                                    DbiValidityRec)
00114 //
00115 //  Return:    
00116 //
00117 //  Contact:   N. West
00118 //
00119 //  Specification:-
00120 //  =============
00121 //
00122 //  o  Stream object to output row stream.
00123 
00124 //  Program Notes:-
00125 //  =============
00126 
00127 //  None.
00128 
00129   ors  << fSEIDkey << fStripEndId << fGain << fGainErr << fSPEWidth;
00130     
00131 }
00132 
00133 //.....................................................................
00134 
00135 
00136 Float_t CalADCtoPE::GetPE(const Float_t rawcharge) const {
00137 //
00138 //
00139 //  Purpose: To apply pe 2 adc calibration to the raw charge  
00140 //
00141 //  Arguments: 
00142 //    xxxxxxxxx    in    yyyyyy
00143 //
00144 //  Return:    
00145 //
00146 //  Contact:   R.Nichol
00147 //
00148 //  Specification:-
00149 //  =============
00150 //
00151 //  o 
00152 
00153 //  Program Notes:-
00154 //  =============
00155 
00156 //  None.
00157    MSG("Calib",Msg::kVerbose) << "StripEndId " << fStripEndId 
00158                                    << " raw charge " << rawcharge
00159                                    << " Gain " << fGain
00160                                    << " Photoelectrons " 
00161                                    << rawcharge/fGain << "\n";
00162    return (rawcharge / fGain);
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 

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