00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00015
00016 #include "Plex/PlexStripEndToLed.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 #include "Plex/PlexLoanPool.h"
00022
00023 ClassImp(PlexStripEndToLed)
00024
00025
00026
00027
00028 CVSID("$Id: PlexStripEndToLed.cxx,v 1.5 2005/08/26 18:47:04 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00029 Bool_t PlexStripEndToLed::fgDefensiveUnpkg = kFALSE;
00030
00031
00032
00033
00034 #include "DatabaseInterface/DbiResultPtr.tpl"
00035 template class DbiResultPtr<PlexStripEndToLed>;
00036
00037 #include "DatabaseInterface/DbiWriter.tpl"
00038 template class DbiWriter<PlexStripEndToLed>;
00039
00040
00041
00042
00043 void PlexStripEndToLed::Fill(DbiResultSet& rs,
00044 const DbiValidityRec* vrec) {
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 Detector::Detector_t det =
00069 (Detector::Detector_t)
00070 ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00071
00072 int plane, strip, pulserBox, ledInBox;
00073 char endchar;
00074
00075 if (fgDefensiveUnpkg) {
00076
00077
00078
00079 Int_t numCol = rs.NumCols();
00080
00081 for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00082 string colName = rs.CurColName();
00083 if ( colName == "AGGREGATENO" ) rs >> fAggregate;
00084 else if ( colName == "PLANE" ) rs >> plane;
00085 else if ( colName == "STRIP" ) rs >> strip;
00086 else if ( colName == "STRIPEND" ) rs >> endchar;
00087 else if ( colName == "PULSERBOX" ) rs >> pulserBox;
00088 else if ( colName == "LEDINBOX" ) rs >> ledInBox;
00089 else {
00090 static int nmsg = 25;
00091 if (nmsg-- > 0) MSG("Plex",Msg::kWarning)
00092 << "Ignoring column " << rs.CurColNum()
00093 << " (of " << rs.NumCols() << ")"
00094 << " \""<< colName << "\"; not part of "
00095 << ClassName() << endl;
00096 rs.IncrementCurCol();
00097 }
00098 }
00099 }
00100 else {
00101
00102
00103
00104
00105
00106
00107
00108
00109 rs >> fAggregate
00110 >> plane
00111 >> strip
00112 >> endchar
00113 >> pulserBox
00114 >> ledInBox;
00115
00116 }
00117
00118 StripEnd::StripEnd_t end = StripEnd::CharToEnum(endchar);
00119
00120 fPlexStripEndId = PlexStripEndId(det,plane,strip,end);
00121 fPlexLedId = PlexLedId(det,pulserBox,ledInBox);
00122
00123 }
00124
00125
00126 void PlexStripEndToLed::Store(DbiOutRowStream& ors,
00127 const DbiValidityRec* ) const {
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 ors << fAggregate
00152 << fPlexStripEndId.GetPlane()
00153 << fPlexStripEndId.GetStrip()
00154 << StripEnd::AsString(fPlexStripEndId.GetEnd())[0]
00155 << fPlexLedId.GetPulserBox()
00156 << fPlexLedId.GetLedInBox();
00157
00158 }
00159
00160
00161
00162
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
00190