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

CalADCtoPEs.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalADCtoPEs.cxx,v 1.1 2006/07/20 03:09:59 mskim Exp $
00003 //
00004 // CalADCtoPEs
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 //mskim@farfalle.phyast.pitt.edu
00015 
00016 #include "Calibrator/CalADCtoPEs.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(CalADCtoPEs)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: CalADCtoPEs.cxx,v 1.1 2006/07/20 03:09:59 mskim Exp $\n  \
00028       CVSID_DBIRESULTPTR ");
00029 
00030 //  Instantiate associated Result Pointer class.
00031 //  *******************************************
00032 
00033 #include "DatabaseInterface/DbiResultPtr.tpl"
00034 template class  DbiResultPtr<CalADCtoPEs>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<CalADCtoPEs>;
00038 
00039 
00040 // Definition of member functions (alphabetical order)
00041 // ***************************************************
00042 
00043 
00044 //.....................................................................
00045 
00046 void CalADCtoPEs::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() == "CALADCTOPES" ) {
00074       // Dumb method.
00075      rs >> fAggregate >> fSEIDkey >> fGain >> fGainErr >> fSPEWidth >> fSPEWidthErr;
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 == "AGGREGATENO" ) rs >> fAggregate;
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 if ( colName == "WIDTH1PEERR" ) rs >> fSPEWidthErr;
00090          else {
00091             MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00092                                    << "(" << colName << ")"
00093                                    << "; not part of CalADCtoPEs" 
00094                                    << endl;
00095          rs.IncrementCurCol();
00096          }
00097       }
00098    }
00099    
00100    
00101 }
00102 
00103 
00104 //.....................................................................
00105 void CalADCtoPEs::Store(DbiOutRowStream& ors,
00106                        const DbiValidityRec* /* vrec */) const {
00107    //
00108 //
00109 //  Purpose:  Stream object to output row stream
00110 //
00111 //  Arguments: 
00112 //    ors          in     Output row stream.
00113 //    vrec         in    Associated validity record (or 0 if filling
00114 //                                                    DbiValidityRec)
00115 //
00116 //  Return:    
00117 //
00118 //  Contact:   N. West
00119 //
00120 //  Specification:-
00121 //  =============
00122 //
00123 //  o  Stream object to output row stream.
00124 
00125 //  Program Notes:-
00126 //  =============
00127 
00128 //  None.
00129 
00130   ors  << fAggregate << fSEIDkey << fGain << fGainErr << fSPEWidth << fSPEWidthErr;
00131     
00132 }
00133 
00134 //.....................................................................
00135 
00136 
00137 Float_t CalADCtoPEs::GetPE(const Float_t rawcharge) const {
00138 //
00139 //
00140 //  Purpose: To apply pe 2 adc calibration to the raw charge  
00141 //
00142 //  Arguments: 
00143 //    xxxxxxxxx    in    yyyyyy
00144 //
00145 //  Return:    
00146 //
00147 //  Contact:   R.Nichol
00148 //
00149 //  Specification:-
00150 //  =============
00151 //
00152 //  o 
00153 
00154 //  Program Notes:-
00155 //  =============
00156 
00157 //  None.
00158    MSG("Calib",Msg::kVerbose) << " raw charge " << rawcharge
00159                               << " Gain " << fGain
00160                               << " Photoelectrons " 
00161                               << rawcharge/fGain << "\n";
00162    return (rawcharge / fGain);
00163 }
00164 

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