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

PlexVetoShieldMuxToMdl.cxx

Go to the documentation of this file.
00001 
00002 // $Id: PlexVetoShieldMuxToMdl.cxx,v 1.6 2005/08/26 18:47:04 rhatcher Exp $
00003 //
00004 // PlexVetoShieldMuxToMdl
00005 //
00006 // Package: Plex
00007 //
00008 // R. Hatcher  2002-11-25
00009 //
00010 // Concept:
00011 //   
00012 // Purpose:
00013 //
00015 
00016 #include "Plex/PlexVetoShieldMuxToMdl.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(PlexVetoShieldMuxToMdl)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: PlexVetoShieldMuxToMdl.cxx,v 1.6 2005/08/26 18:47:04 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00028 Bool_t PlexVetoShieldMuxToMdl::fgDefensiveUnpkg = kFALSE;
00029 
00030 //  Instantiate associated Result Pointer class.
00031 //  *******************************************
00032 
00033 #include "DatabaseInterface/DbiResultPtr.tpl"
00034 template class  DbiResultPtr<PlexVetoShieldMuxToMdl>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<PlexVetoShieldMuxToMdl>;
00038 
00039 //.....................................................................
00040 std::ostream& operator<<(std::ostream& os, const PlexVetoShieldMuxToMdl& m2m)
00041 {
00042   os << "VetoShield Mux " 
00043      << m2m.GetMuxPln() << "," 
00044      << m2m.GetMuxMdl() 
00045      << "(of " << std::setw(2) << m2m.GetCountDir() << ") maps to "
00046      << m2m.GetSingleMdlPlaneId().AsString("c")
00047      << std::endl;
00048   return os;
00049 }
00050 
00051 // Definition of member functions (alphabetical order)
00052 // ***************************************************
00053 
00054 //.....................................................................
00055 
00056 PlexScintMdlId PlexVetoShieldMuxToMdl::GetSingleMdlScintMdlId() const
00057 { return PlexScintMdlId(fSingleMdlPlaneId,0); }
00058 
00059 PlexPlaneId PlexVetoShieldMuxToMdl::GetMuxPlaneId() const
00060 {
00061 
00062   PlexPlaneId ambiguous = fSingleMdlPlaneId;
00063   ambiguous.SetPlane(fMuxPln,
00064                      fSingleMdlPlaneId.GetPlaneView(),
00065                      fSingleMdlPlaneId.GetPlaneCoverage());
00066   return ambiguous;
00067   
00068 }
00069 
00070 PlexScintMdlId PlexVetoShieldMuxToMdl::GetMuxScintMdlId() const
00071 { return PlexScintMdlId(GetMuxPlaneId(),fMuxMdl); }
00072 
00073 //.....................................................................
00074 
00075 void PlexVetoShieldMuxToMdl::Fill(DbiResultSet& rs,
00076                                       const DbiValidityRec* vrec) {
00077 //
00078 //
00079 //  Purpose:  Fill object from Result Set
00080 //
00081 //  Arguments: 
00082 //    rs           in    Result Set used to fill object
00083 //    vrec         in    Associated validity record (or 0 if filling
00084 //                                                    DbiValidityRec)
00085 //
00086 //  Return:    
00087 //
00088 //  Contact:   R. Hatcher
00089 //
00090 //  Specification:-
00091 //  =============
00092 //
00093 //  o Fill object from current row of Result Set.
00094 
00095 //  Program Notes:-
00096 //  =============
00097 
00098 //  None.
00099 
00100    Detector::Detector_t det =
00101       (Detector::Detector_t) 
00102       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00103 
00104    if (fgDefensiveUnpkg) {
00105 
00106       // unpack allowing for various column names and ordering
00107 
00108       Int_t numCol = rs.NumCols();
00109       //  The first column (SeqNo) has already been processed.
00110       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00111          string colName = rs.CurColName();
00112          if      ( colName == "MUXPLN"     ) rs >> fMuxPln;
00113          else if ( colName == "MUXMDL"     ) rs >> fMuxMdl;
00114          else if ( colName == "COUNTDIR"   ) rs >> fCountDir;
00115          else if ( colName == "MDLPLN"     ) rs >> fMdlPln;
00116          else if ( colName == "VIEWCHAR"   ) rs >> fViewChar;
00117          else if ( colName == "COVERCHAR"  ) rs >> fCoverChar;
00118          else if ( colName == "F1SIDECHAR" ) rs >> fF1SideChar;
00119          else {
00120             static int nmsg = 25;
00121             if (nmsg-- > 0) MSG("Plex",Msg::kWarning) 
00122                << "Ignoring column " << rs.CurColNum()
00123                << " (of " << rs.NumCols() << ")"
00124                << " \""<< colName << "\"; not part of "
00125                << ClassName() << endl;
00126             rs.IncrementCurCol();
00127          }
00128       }
00129    } // end defensive unpacking
00130    else {
00131 //       SeqNo         int,
00132 //       MuxPln        smallint unsigned,
00133 //       MuxMdl        smallint unsigned,
00134 //       CountDir      smallint,
00135 //       MdlPln        smallint unsigned,
00136 //       ViewChar      char(1),
00137 //       CoverChar     char(1),
00138 //       F1SideChar    char(1)
00139 
00140       rs >> fMuxPln
00141          >> fMuxMdl
00142          >> fCountDir
00143          >> fMdlPln
00144          >> fViewChar
00145          >> fCoverChar
00146          >> fF1SideChar;
00147    }
00148 
00149    // get the mdl-based plane id
00150 
00151    Char_t covername[3] = { '?','?','\0' };
00152    covername[0] = fCoverChar;
00153    covername[1] = fF1SideChar;
00154 
00155    fSingleMdlPlaneId = PlexPlaneId(det,fMdlPln,kFALSE,
00156                                    PlaneView::CharToEnum(fViewChar),
00157                                    PlaneCoverage::StringToEnum(covername));
00158 
00159    MSG("Plex",Msg::kDebug)
00160      << "PlexVetoShieldMuxToMdl::Fill  Mux ("
00161      << fMuxPln << "," << fMuxMdl << "of" << fCountDir << ") is " 
00162      << GetSingleMdlPlaneId() << endl;
00163 
00164 }
00165 //.....................................................................
00166 
00167 void PlexVetoShieldMuxToMdl::Store(DbiOutRowStream& ors,
00168                                    const DbiValidityRec* /* vrec */) const {
00169 //
00170 //
00171 //  Purpose:  Stream object to output row stream
00172 //
00173 //  Arguments: 
00174 //    ors          in     Output row stream.
00175 //    vrec         in     Associated validity record (or 0 if filling
00176 //                                                    DbiValidityRec)
00177 //
00178 //  Return:    
00179 //
00180 //  Contact:   R. Hatcher
00181 //
00182 //  Specification:-
00183 //  =============
00184 //
00185 //  o  Stream object to output row stream.
00186 
00187 //  Program Notes:-
00188 //  =============
00189 
00190 //  None.
00191 
00192    ors << fMuxPln
00193        << fMuxMdl
00194        << fCountDir
00195        << fMdlPln
00196        << fViewChar
00197        << fCoverChar
00198        << fF1SideChar;
00199 }
00200 
00201 /*    Template for New Member Function
00202 
00203 //.....................................................................
00204 
00205 PlexVetoShieldMuxToMdl:: {
00206 //
00207 //
00208 //  Purpose:  
00209 //
00210 //  Arguments: 
00211 //    xxxxxxxxx    in    yyyyyy
00212 //
00213 //  Return:    
00214 //
00215 //  Contact:   R. Hatcher
00216 //
00217 //  Specification:-
00218 //  =============
00219 //
00220 //  o 
00221 
00222 //  Program Notes:-
00223 //  =============
00224 
00225 //  None.
00226 
00227 
00228 }
00229 
00230 */
00231 

Generated on Mon Feb 15 11:07:23 2010 for loon by  doxygen 1.3.9.1