UgliDbiScintPlnStruct Class Reference

#include <UgliDbiScintPlnStruct.h>

Inheritance diagram for UgliDbiScintPlnStruct:
DbiTableRow

List of all members.

Public Member Functions

 UgliDbiScintPlnStruct ()
 UgliDbiScintPlnStruct (PlexPlaneId plnid, UInt_t nmodules)
 UgliDbiScintPlnStruct (Detector::Detector_t detector, PlaneView::PlaneView_t view, PlaneCoverage::PlaneCoverage_t coverage, Int_t nmodules)
virtual ~UgliDbiScintPlnStruct ()
UInt_t GetIndex (UInt_t defIndex) const
Detector::Detector_t GetDetector () const
PlaneView::PlaneView_t GetPlaneView () const
PlaneCoverage::PlaneCoverage_t GetPlaneCoverage () const
Short_t GetNModules () const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="", const DbiValidityRec *vrec=0) const
virtual void Print (Option_t *option="") const

Static Public Member Functions

static const char * GetTableDescr ()
static void SetDefensiveUnpkg (Bool_t defensive)
static Bool_t GetDefensiveUnpkg ()

Private Member Functions

 UgliDbiScintPlnStruct (const UgliDbiScintPlnStruct &from)

Private Attributes

UgliDbiStructHash fDetViewCover
UShort_t fNModules

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 28 of file UgliDbiScintPlnStruct.h.


Constructor & Destructor Documentation

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct (  )  [inline]

Definition at line 35 of file UgliDbiScintPlnStruct.h.

References LEA_CTOR.

00036       : fDetViewCover(), fNModules(0) { LEA_CTOR; };

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct ( PlexPlaneId  plnid,
UInt_t  nmodules 
) [inline]

Definition at line 38 of file UgliDbiScintPlnStruct.h.

References LEA_CTOR.

00039       : fDetViewCover(plnid), fNModules(nmodules) { LEA_CTOR; };

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct ( Detector::Detector_t  detector,
PlaneView::PlaneView_t  view,
PlaneCoverage::PlaneCoverage_t  coverage,
Int_t  nmodules 
) [inline]

Definition at line 41 of file UgliDbiScintPlnStruct.h.

References LEA_CTOR.

00045       : fDetViewCover(detector,view,coverage,0),
00046         fNModules(nmodules) { LEA_CTOR; };

virtual UgliDbiScintPlnStruct::~UgliDbiScintPlnStruct (  )  [inline, virtual]

Definition at line 48 of file UgliDbiScintPlnStruct.h.

References LEA_DTOR.

00048 { LEA_DTOR; };

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct ( const UgliDbiScintPlnStruct from  )  [inline, private]

Definition at line 83 of file UgliDbiScintPlnStruct.h.

References LEA_CTOR.

00084      : DbiTableRow(from) { LEA_CTOR; *this = from; }


Member Function Documentation

virtual DbiTableRow* UgliDbiScintPlnStruct::CreateTableRow (  )  const [inline, virtual]

Implements DbiTableRow.

Definition at line 60 of file UgliDbiScintPlnStruct.h.

00060 { return new UgliDbiScintPlnStruct; }

void UgliDbiScintPlnStruct::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

Implements DbiTableRow.

Definition at line 60 of file UgliDbiScintPlnStruct.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fDetViewCover, fgDefensiveUnpkg, fNModules, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), PlaneCoverage::kUnknown, PlaneView::kUnknown, Msg::kWarning, MSG, and DbiRowStream::NumCols().

00061                                                                   {
00062 //
00063 //
00064 //  Purpose:  Fill object from Result Set
00065 //
00066 //  Arguments: 
00067 //    rs           in    Result Set used to fill object
00068 //    vrec         in    Associated validity record (or 0 if filling
00069 //                                                    DbiValidityRec)
00070 //
00071 //  Return:    
00072 //
00073 //  Contact:   R. Hatcher
00074 //
00075 //  Specification:-
00076 //  =============
00077 //
00078 //  o Fill object from current row of Result Set.
00079 
00080 //  Program Notes:-
00081 //  =============
00082 
00083 //  None.
00084 
00085    Detector::Detector_t det =
00086       (Detector::Detector_t) 
00087       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00088 
00089    UInt_t hashv = 0;
00090    UInt_t tmpdet = det;
00091    UInt_t tmpview = PlaneView::kUnknown;
00092     Int_t tmpcoverage = PlaneCoverage::kUnknown;
00093 
00094    if (fgDefensiveUnpkg) {
00095 
00096       // unpack allowing for various column names and ordering
00097 
00098       Int_t numCol = rs.NumCols();
00099       //  The first column (SeqNo) has already been processed.
00100       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00101          string colName = rs.CurColName();
00102          if      ( colName == "HASHVAL" ) rs.IncrementCurCol();
00103          else if ( colName == "DETECTOR") rs >> tmpdet; 
00104          else if ( colName == "PLNVIEW" ) rs >> tmpview;
00105          else if ( colName == "COVERAGE") rs >> tmpcoverage;
00106          else if ( colName == "NMODULES") rs >> fNModules;
00107          else {
00108             static int nmsg = 25;
00109             if (nmsg-- > 0) {
00110               MSG("Ugli",Msg::kWarning) 
00111                 << "Ignoring column " << rs.CurColNum() 
00112                 << " (of " << rs.NumCols() << ")"
00113                 << " \""<< colName << "\"; not part of "
00114                 << ClassName() << endl;
00115             }
00116             rs.IncrementCurCol();
00117          }
00118       }
00119    } // end defensive unpacking
00120    else {
00121       rs >> hashv
00122          >> tmpdet
00123          >> tmpview
00124          >> tmpcoverage
00125          >> fNModules;
00126    }
00127       
00128    UInt_t part = 0;
00129 
00130    fDetViewCover = 
00131      UgliDbiStructHash( (Detector::Detector_t)tmpdet,
00132                         (PlaneView::PlaneView_t)tmpview,
00133                         (PlaneCoverage::PlaneCoverage_t)tmpcoverage,
00134                         part );
00135 
00136 }

std::ostream & UgliDbiScintPlnStruct::FormatToOStream ( std::ostream &  os,
Option_t *  option = "",
const DbiValidityRec vrec = 0 
) const [virtual]

Definition at line 198 of file UgliDbiScintPlnStruct.cxx.

References fNModules, GetDetector(), GetPlaneCoverage(), GetPlaneView(), DbiValidityRec::GetSeqNo(), GetTableDescr(), UgliDbiTableDescr::ParseTableDescr(), and UgliDbiTableDescr::TextTableDescrLine().

Referenced by operator<<(), and Print().

00201 {
00202 //
00203 //
00204 //  Purpose:  Print the current row
00205 //
00206 //  Return:   nothing
00207 //
00208 //  Contact:   R. Hatcher
00209 //
00210 //  Specification:-
00211 //  =============
00212 //
00213 
00214 //  Program Notes:-
00215 //  =============
00216 
00217 //  None.
00218 
00219   string opt = option;
00220 
00221   if ( opt.find("H") != string::npos ) {
00222      string tabledescr = GetTableDescr();
00223      tabledescr = UgliDbiTableDescr::TextTableDescrLine(tabledescr);
00224      os << tabledescr << endl;
00225   }
00226   else if ( opt.find("h") != string::npos ) {
00227     string tabledescr = GetTableDescr();
00228     vector< pair<string,string> > components = 
00229         UgliDbiTableDescr::ParseTableDescr(tabledescr);
00230     for (unsigned int ic = 0; ic < components.size(); ++ic) 
00231         os << components[ic].first << '\t';
00232     os << endl;
00233   }
00234 
00235   char sep = '\t';
00236   if ( opt.find(",") != string::npos ) sep = ',';
00237 
00238   if ( ! dvr ) {
00239       os << "SeqNo"         << sep;  // no way of knowing the SEQNO?
00240   }
00241   else {
00242       os << dvr->GetSeqNo() << sep;
00243   }
00244 
00245   os   << "ROW_COUNTER" << sep  // ???
00246        << -1            << sep  // Hashval is obsolete
00247        << (int)GetDetector()      << sep
00248        << (int)GetPlaneView()     << sep
00249        << (int)GetPlaneCoverage() << sep
00250        << fNModules               << endl;
00251 
00252   return os;
00253 }

static Bool_t UgliDbiScintPlnStruct::GetDefensiveUnpkg (  )  [inline, static]

Definition at line 77 of file UgliDbiScintPlnStruct.h.

References fgDefensiveUnpkg.

00077 { return fgDefensiveUnpkg; }

Detector::Detector_t UgliDbiScintPlnStruct::GetDetector ( void   )  const [inline]
UInt_t UgliDbiScintPlnStruct::GetIndex ( UInt_t  defIndex  )  const [inline, virtual]
Short_t UgliDbiScintPlnStruct::GetNModules (  )  const [inline]

Definition at line 108 of file UgliDbiScintPlnStruct.h.

References fNModules.

Referenced by UgliScintPlnNode::BuildStrips(), and UgliGeometryReroot::MakeTempDbiPosInfo().

00109 { return fNModules; }

PlaneCoverage::PlaneCoverage_t UgliDbiScintPlnStruct::GetPlaneCoverage (  )  const [inline]
PlaneView::PlaneView_t UgliDbiScintPlnStruct::GetPlaneView ( void   )  const [inline]
const char * UgliDbiScintPlnStruct::GetTableDescr (  )  [static]

Definition at line 257 of file UgliDbiScintPlnStruct.cxx.

Referenced by FormatToOStream(), UgliGeometryReroot::MakeTempDbiScintStruct(), and Store().

00258 {
00259 //
00260 //
00261 //  Purpose:  Return a string describing rows in the table
00262 //            Used in creating temporary tables
00263 //
00264 //  Return:   const char* to parenthesized comma separated list
00265 //            of column name and type pairs
00266 //
00267 //  Contact:   R. Hatcher
00268 //
00269 //  Specification:-
00270 //  =============
00271 //
00272 
00273 //  Program Notes:-
00274 //  =============
00275 
00276 //  None.
00277 
00278    const char* const_tabledescr = "(\
00279        SEQNO         int,     \
00280        ROW_COUNTER   int,     \
00281        HASHVAL       int,     \
00282        DETECTOR      tinyint, \
00283        PLNVIEW       tinyint, \
00284        COVERAGE      tinyint, \
00285        NMODULES      tinyint, \
00286        primary key (SEQNO,ROW_COUNTER) \
00287        )";
00288 
00289    return const_tabledescr;
00290 }

void UgliDbiScintPlnStruct::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 191 of file UgliDbiScintPlnStruct.cxx.

References FormatToOStream().

00192 {
00193     FormatToOStream(cout,option);
00194 }

static void UgliDbiScintPlnStruct::SetDefensiveUnpkg ( Bool_t  defensive  )  [inline, static]

Definition at line 75 of file UgliDbiScintPlnStruct.h.

References fgDefensiveUnpkg.

00076       { fgDefensiveUnpkg = defensive; }

void UgliDbiScintPlnStruct::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

Reimplemented from DbiTableRow.

Definition at line 140 of file UgliDbiScintPlnStruct.cxx.

References fDetViewCover, fNModules, UgliDbiStructHash::GetDetector(), GetIndex(), UgliDbiStructHash::GetPlaneCoverage(), UgliDbiStructHash::GetPlaneView(), GetTableDescr(), Msg::kFatal, MSG, n, and UgliDbiTableDescr::ParseTableDescr().

00141                                                                           {
00142 //
00143 //
00144 //  Purpose:  Stream object to output row stream
00145 //
00146 //  Arguments: 
00147 //    ors          in     Output row stream.
00148 //    vrec         in     Associated validity record (or 0 if filling
00149 //                                                    DbiValidityRec)
00150 //
00151 //  Return:    
00152 //
00153 //  Contact:   R. Hatcher
00154 //
00155 //  Specification:-
00156 //  =============
00157 //
00158 //  o  Stream object to output row stream.
00159 
00160 //  Program Notes:-
00161 //  =============
00162 
00163 //  None.
00164 
00165    const char* tabledescr = GetTableDescr();
00166    vector< pair<string,string> > components = 
00167       UgliDbiTableDescr::ParseTableDescr(tabledescr);
00168    int n = components.size();
00169 
00170    for (int i=0; i<n; i++) {
00171       pair<string,string> colPair = components[i];
00172       string colName = colPair.first;
00173       if      ( colName == "HASHVAL" ) ors << (int)GetIndex(0);
00174       else if ( colName == "DETECTOR") ors << (int)fDetViewCover.GetDetector();
00175       else if ( colName == "PLNVIEW" ) ors << (int)fDetViewCover.GetPlaneView();
00176       else if ( colName == "COVERAGE") ors << (int)fDetViewCover.GetPlaneCoverage();
00177       else if ( colName == "NMODULES") ors << fNModules;
00178 
00179       else if ( colName == "ROW_COUNTER"     ) {;}
00180       else if ( colName == "SEQNO"           ) {;}
00181       else {
00182          MSG("Ugli",Msg::kFatal)
00183             << "Column name '" << colName << "' not correctly handled" << endl;
00184          assert(0);
00185       }
00186    }
00187 }


Member Data Documentation

Bool_t UgliDbiScintPlnStruct::fgDefensiveUnpkg = kFALSE [static, private]

Definition at line 93 of file UgliDbiScintPlnStruct.h.

Referenced by Fill(), GetDefensiveUnpkg(), and SetDefensiveUnpkg().

Definition at line 89 of file UgliDbiScintPlnStruct.h.

Referenced by Fill(), FormatToOStream(), GetNModules(), and Store().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1