00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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
00025
00026
00027 CVSID("$Id: CalADCtoPEs.cxx,v 1.1 2006/07/20 03:09:59 mskim Exp $\n \
00028 CVSID_DBIRESULTPTR ");
00029
00030
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
00041
00042
00043
00044
00045
00046 void CalADCtoPEs::Fill(DbiResultSet& rs,
00047 const DbiValidityRec* ) {
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 if ( rs.TableName() == "CALADCTOPES" ) {
00074
00075 rs >> fAggregate >> fSEIDkey >> fGain >> fGainErr >> fSPEWidth >> fSPEWidthErr;
00076 }
00077 else {
00078
00079
00080 Int_t numCol = rs.NumCols();
00081
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* ) const {
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
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
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 MSG("Calib",Msg::kVerbose) << " raw charge " << rawcharge
00159 << " Gain " << fGain
00160 << " Photoelectrons "
00161 << rawcharge/fGain << "\n";
00162 return (rawcharge / fGain);
00163 }
00164