UgliDbiStripStruct Class Reference

#include <UgliDbiStripStruct.h>

Inheritance diagram for UgliDbiStripStruct:

DbiTableRow List of all members.

Public Member Functions

 UgliDbiStripStruct ()
 UgliDbiStripStruct (PlexStripEndId strip, UShort_t inmodule, Float_t totlen, Float_t wls_east, Float_t wls_west, Float_t len_east, Float_t len_west, Float_t len_bypass)
 UgliDbiStripStruct (Detector::Detector_t detector, PlaneView::PlaneView_t view, PlaneCoverage::PlaneCoverage_t coverage, UShort_t strip, UShort_t inmodule, Float_t totlen, Float_t wls_east, Float_t wls_west, Float_t len_east, Float_t len_west, Float_t len_bypass)
virtual ~UgliDbiStripStruct ()
UInt_t GetIndex (UInt_t defIndex) const
Detector::Detector_t GetDetector () const
PlaneView::PlaneView_t GetPlaneView () const
PlaneCoverage::PlaneCoverage_t GetPlaneCoverage () const
UShort_t GetStrip () const
Short_t GetInModule () const
Float_t GetTotalLen () const
Float_t GetWlsLenEast () const
Float_t GetWlsLenWest () const
Float_t GetLenEastPart () const
Float_t GetLenWestPart () const
Float_t GetWlsLenBypass () const
std::string GetShapeName () 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

 UgliDbiStripStruct (const UgliDbiStripStruct &from)

Private Attributes

UgliDbiStructHash fDetViewCoverStrip
UShort_t fInModule
Float_t fTotalLen
Float_t fWlsLenEast
Float_t fWlsLenWest
Float_t fLenEastPart
Float_t fLenWestPart
Float_t fWlsLenBypass

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 28 of file UgliDbiStripStruct.h.


Constructor & Destructor Documentation

UgliDbiStripStruct::UgliDbiStripStruct (  )  [inline]

Definition at line 35 of file UgliDbiStripStruct.h.

References LEA_CTOR.

00036       : fDetViewCoverStrip(),
00037         fTotalLen(-1), fWlsLenEast(-1), fWlsLenWest(-1),
00038         fLenEastPart(-1), fLenWestPart(-1), fWlsLenBypass(-1)
00039       { LEA_CTOR; };

UgliDbiStripStruct::UgliDbiStripStruct ( PlexStripEndId  strip,
UShort_t  inmodule,
Float_t  totlen,
Float_t  wls_east,
Float_t  wls_west,
Float_t  len_east,
Float_t  len_west,
Float_t  len_bypass 
) [inline]

Definition at line 42 of file UgliDbiStripStruct.h.

References LEA_CTOR.

00045       : fDetViewCoverStrip(strip), fInModule(inmodule), fTotalLen(totlen), 
00046         fWlsLenEast(wls_east), fWlsLenWest(wls_west),
00047         fLenEastPart(len_east), fLenWestPart(len_west),
00048         fWlsLenBypass(len_bypass)
00049       { LEA_CTOR; };

UgliDbiStripStruct::UgliDbiStripStruct ( Detector::Detector_t  detector,
PlaneView::PlaneView_t  view,
PlaneCoverage::PlaneCoverage_t  coverage,
UShort_t  strip,
UShort_t  inmodule,
Float_t  totlen,
Float_t  wls_east,
Float_t  wls_west,
Float_t  len_east,
Float_t  len_west,
Float_t  len_bypass 
) [inline]

Definition at line 51 of file UgliDbiStripStruct.h.

References LEA_CTOR.

00057       : fDetViewCoverStrip(detector,view,coverage,strip),
00058         fInModule(inmodule), fTotalLen(totlen),
00059         fWlsLenEast(wls_east), fWlsLenWest(wls_west),
00060         fLenEastPart(len_east), fLenWestPart(len_west),
00061         fWlsLenBypass(len_bypass)
00062      { LEA_CTOR; }

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

Definition at line 64 of file UgliDbiStripStruct.h.

References LEA_DTOR.

00064 { LEA_DTOR; };

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

Definition at line 110 of file UgliDbiStripStruct.h.

References LEA_CTOR.

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


Member Function Documentation

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

Implements DbiTableRow.

Definition at line 87 of file UgliDbiStripStruct.h.

00087 { return new UgliDbiStripStruct; }

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

Implements DbiTableRow.

Definition at line 85 of file UgliDbiStripStruct.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fDetViewCoverStrip, fgDefensiveUnpkg, fInModule, fLenEastPart, fLenWestPart, fTotalLen, fWlsLenBypass, fWlsLenEast, fWlsLenWest, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), PlaneCoverage::kUnknown, PlaneView::kUnknown, Msg::kWarning, MSG, and DbiRowStream::NumCols().

00086                                                                   {
00087 //
00088 //
00089 //  Purpose:  Fill object from Result Set
00090 //
00091 //  Arguments: 
00092 //    rs           in    Result Set used to fill object
00093 //    vrec         in    Associated validity record (or 0 if filling
00094 //                                                    DbiValidityRec)
00095 //
00096 //  Return:    
00097 //
00098 //  Contact:   R. Hatcher
00099 //
00100 //  Specification:-
00101 //  =============
00102 //
00103 //  o Fill object from current row of Result Set.
00104 
00105 //  Program Notes:-
00106 //  =============
00107 
00108 //  None.
00109 
00110    Detector::Detector_t det =
00111       (Detector::Detector_t) 
00112       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00113 
00114    UInt_t   hashv = 0;
00115    UInt_t   tmpdet = det;
00116    UInt_t   tmpview = PlaneView::kUnknown;
00117     Int_t   tmpcoverage = PlaneCoverage::kUnknown;
00118    UShort_t stripinpln = 0xffff;
00119 
00120    if (fgDefensiveUnpkg) {
00121 
00122       // unpack allowing for various column names and ordering
00123 
00124       Int_t numCol = rs.NumCols();
00125       //  The first column (SeqNo) has already been processed.
00126       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00127          string colName = rs.CurColName();
00128          if      ( colName == "HASHVAL"     ) rs.IncrementCurCol();
00129          else if ( colName == "DETECTOR"    ) rs >> tmpdet;
00130          else if ( colName == "PLNVIEW"     ) rs >> tmpview;
00131          else if ( colName == "COVERAGE"    ) rs >> tmpcoverage;
00132          else if ( colName == "STRIP"       ) rs >> stripinpln;
00133          else if ( colName == "INMODULE"    ) rs >> fInModule;
00134          else if ( colName == "TOTALLEN"    ) rs >> fTotalLen;
00135          else if ( colName == "WLSLENEAST"  ) rs >> fWlsLenEast;
00136          else if ( colName == "WLSLENWEST"  ) rs >> fWlsLenWest;
00137          else if ( colName == "LENEASTPART" ) rs >> fLenEastPart;
00138          else if ( colName == "LENWESTPART" ) rs >> fLenWestPart;
00139          else if ( colName == "WLSLENBYPASS") rs >> fWlsLenBypass;
00140          else {
00141             static int nmsg = 25;
00142             if (nmsg-- > 0) {
00143               MSG("Ugli",Msg::kWarning) 
00144                 << "Ignoring column " << rs.CurColNum() 
00145                 << " (of " << rs.NumCols() << ")"
00146                 << " \""<< colName << "\"; not part of "
00147                 << ClassName() << endl;
00148             }
00149             rs.IncrementCurCol();
00150          }
00151       }
00152    } // end defensive unpacking
00153    else {
00154       rs >> hashv
00155          >> tmpdet
00156          >> tmpview
00157          >> tmpcoverage
00158          >> fInModule
00159          >> stripinpln
00160          >> fTotalLen
00161          >> fWlsLenEast
00162          >> fWlsLenWest
00163          >> fLenEastPart
00164          >> fLenWestPart
00165          >> fWlsLenBypass;
00166    }
00167 
00168    fDetViewCoverStrip =
00169      UgliDbiStructHash( (Detector::Detector_t)tmpdet,
00170                         (PlaneView::PlaneView_t)tmpview,
00171                         (PlaneCoverage::PlaneCoverage_t)tmpcoverage,
00172                         stripinpln );
00173 }

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

Definition at line 245 of file UgliDbiStripStruct.cxx.

References fInModule, fLenEastPart, fLenWestPart, fTotalLen, fWlsLenBypass, fWlsLenEast, fWlsLenWest, GetDetector(), GetPlaneCoverage(), GetPlaneView(), DbiValidityRec::GetSeqNo(), GetStrip(), GetTableDescr(), UgliDbiTableDescr::ParseTableDescr(), and UgliDbiTableDescr::TextTableDescrLine().

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

00248 {
00249 //
00250 //
00251 //  Purpose:  Print the current row
00252 //
00253 //  Return:   nothing
00254 //
00255 //  Contact:   R. Hatcher
00256 //
00257 //  Specification:-
00258 //  =============
00259 //
00260 
00261 //  Program Notes:-
00262 //  =============
00263 
00264 //  None.
00265 
00266   string opt = option;
00267 
00268   if ( opt.find("H") != string::npos ) {
00269      string tabledescr = GetTableDescr();
00270      tabledescr = UgliDbiTableDescr::TextTableDescrLine(tabledescr);
00271      os << tabledescr << endl;
00272   }
00273   else if ( opt.find("h") != string::npos ) {
00274     string tabledescr = GetTableDescr();
00275     vector< pair<string,string> > components = 
00276         UgliDbiTableDescr::ParseTableDescr(tabledescr);
00277     for (unsigned int ic = 0; ic < components.size(); ++ic) 
00278         os << components[ic].first << '\t';
00279     os << endl;
00280   }
00281 
00282   char sep = '\t';
00283   if ( opt.find(",") != string::npos ) sep = ',';
00284 
00285   if ( ! dvr ) {
00286       os << "SeqNo"         << sep;  // no way of knowing the SEQNO?
00287   }
00288   else {
00289       os << dvr->GetSeqNo() << sep;
00290   }
00291 
00292   os   << GetStrip() << sep  // within aggregate(=plane) strip => row_counter
00293        << -1         << sep  // Hashval is obsolete
00294        << (int)GetDetector()      << sep
00295        << (int)GetPlaneView()     << sep
00296        << (int)GetPlaneCoverage() << sep
00297        << fInModule             << sep
00298        << GetStrip()            << sep
00299        << fTotalLen             << sep
00300        << fWlsLenEast           << sep
00301        << fWlsLenWest           << sep
00302        << fLenEastPart          << sep
00303        << fLenWestPart          << sep
00304        << fWlsLenBypass         << endl;
00305 
00306   return os;
00307 }

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

Definition at line 104 of file UgliDbiStripStruct.h.

References fgDefensiveUnpkg.

00104 { return fgDefensiveUnpkg; }

Detector::Detector_t UgliDbiStripStruct::GetDetector (  )  const [inline]

Definition at line 132 of file UgliDbiStripStruct.h.

References fDetViewCoverStrip, and UgliDbiStructHash::GetDetector().

Referenced by FormatToOStream(), GetShapeName(), and Store().

00133 { return fDetViewCoverStrip.GetDetector(); }

UInt_t UgliDbiStripStruct::GetIndex ( UInt_t  defIndex  )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 144 of file UgliDbiStripStruct.h.

References fDetViewCoverStrip, and UgliDbiStructHash::HashAsStrip().

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

00145 { return fDetViewCoverStrip.HashAsStrip(); }

Short_t UgliDbiStripStruct::GetInModule (  )  const [inline]

Definition at line 78 of file UgliDbiStripStruct.h.

References fInModule.

Referenced by UgliStripNode::ClearFiber(), UgliStripNode::UgliStripNode(), and UgliStripNode::WlsPigtail().

00078 { return fInModule; }

Float_t UgliDbiStripStruct::GetLenEastPart (  )  const [inline]

Definition at line 82 of file UgliDbiStripStruct.h.

References fLenEastPart.

Referenced by UgliStripNode::PartialLength().

00082 { return fLenEastPart; }

Float_t UgliDbiStripStruct::GetLenWestPart (  )  const [inline]

Definition at line 83 of file UgliDbiStripStruct.h.

References fLenWestPart.

Referenced by UgliStripNode::PartialLength().

00083 { return fLenWestPart; }

PlaneCoverage::PlaneCoverage_t UgliDbiStripStruct::GetPlaneCoverage (  )  const [inline]

Definition at line 138 of file UgliDbiStripStruct.h.

References fDetViewCoverStrip, and UgliDbiStructHash::GetPlaneCoverage().

Referenced by FormatToOStream(), GetShapeName(), and Store().

PlaneView::PlaneView_t UgliDbiStripStruct::GetPlaneView (  )  const [inline]

Definition at line 135 of file UgliDbiStripStruct.h.

References fDetViewCoverStrip, and UgliDbiStructHash::GetPlaneView().

Referenced by FormatToOStream(), GetShapeName(), and Store().

00136 { return fDetViewCoverStrip.GetPlaneView(); }

string UgliDbiStripStruct::GetShapeName (  )  const

Definition at line 62 of file UgliDbiStripStruct.cxx.

References PlexStripEndId::AsString(), GetDetector(), GetPlaneCoverage(), GetPlaneView(), GetStrip(), Detector::kFar, PlaneCoverage::kVScN, PlaneView::kVSTopFlat, PlexPlaneId::SetPlaneCoverage(), and PlexPlaneId::SetPlaneView().

Referenced by UgliGeometry::BuildStripShapes().

00063 {
00064    // make a name for this configuration
00065    
00066    // no meaningful plane #, but we don't care 
00067    // except for veto configurations
00068    UInt_t apln = 0;
00069    // use an arbitrary plane ... execpt in case of veto stuff
00070    if (Detector::kFar == GetDetector()) {
00071      // more work if far
00072      if (GetPlaneView()     >= PlaneView::kVSTopFlat || 
00073          GetPlaneCoverage() >= PlaneCoverage::kVScN      ) apln = 512;
00074    }
00075 
00076    PlexStripEndId seid(GetDetector(),apln,GetStrip());
00077    seid.SetPlaneView(GetPlaneView());
00078    seid.SetPlaneCoverage(GetPlaneCoverage());
00079 
00080    return seid.AsString("s");
00081 }

UShort_t UgliDbiStripStruct::GetStrip (  )  const [inline]

Definition at line 141 of file UgliDbiStripStruct.h.

References fDetViewCoverStrip, and UgliDbiStructHash::GetPart().

Referenced by FormatToOStream(), GetShapeName(), and Store().

00142 { return fDetViewCoverStrip.GetPart(); }

const char * UgliDbiStripStruct::GetTableDescr (  )  [static]

Definition at line 311 of file UgliDbiStripStruct.cxx.

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

00312 {
00313 //
00314 //
00315 //  Purpose:  Return a string describing rows in the table
00316 //            Used in creating temporary tables
00317 //
00318 //  Return:   const char* to parenthesized comma separated list
00319 //            of column name and type pairs
00320 //
00321 //  Contact:   R. Hatcher
00322 //
00323 //  Specification:-
00324 //  =============
00325 //
00326 
00327 //  Program Notes:-
00328 //  =============
00329 
00330 //  None.
00331 
00332    const char* const_tabledescr = "(\
00333        SEQNO         int,      \
00334        ROW_COUNTER   int,      \
00335        HASHVAL       int,      \
00336        DETECTOR      tinyint,  \
00337        PLNVIEW       tinyint,  \
00338        COVERAGE      tinyint,  \
00339        INMODULE      tinyint,  \
00340        STRIP         smallint, \
00341        TOTALLEN      float,    \
00342        WLSLENEAST    float,    \
00343        WLSLENWEST    float,    \
00344        LENEASTPART   float,    \
00345        LENWESTPART   float,    \
00346        WLSLENBYPASS  float,    \
00347        primary key (SEQNO,ROW_COUNTER) \
00348        )";
00349 
00350    return const_tabledescr;
00351 }

Float_t UgliDbiStripStruct::GetTotalLen (  )  const [inline]

Definition at line 79 of file UgliDbiStripStruct.h.

References fTotalLen.

00079 { return fTotalLen; }

Float_t UgliDbiStripStruct::GetWlsLenBypass (  )  const [inline]

Definition at line 84 of file UgliDbiStripStruct.h.

References fWlsLenBypass.

Referenced by UgliStripNode::WlsBypass().

00084 { return fWlsLenBypass; }

Float_t UgliDbiStripStruct::GetWlsLenEast (  )  const [inline]

Definition at line 80 of file UgliDbiStripStruct.h.

References fWlsLenEast.

Referenced by UgliStripNode::WlsPigtail().

00080 { return fWlsLenEast; }

Float_t UgliDbiStripStruct::GetWlsLenWest (  )  const [inline]

Definition at line 81 of file UgliDbiStripStruct.h.

References fWlsLenWest.

Referenced by UgliStripNode::WlsPigtail().

00081 { return fWlsLenWest; }

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

Definition at line 238 of file UgliDbiStripStruct.cxx.

References FormatToOStream().

00239 {
00240     FormatToOStream(cout,option);
00241 }

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

Definition at line 102 of file UgliDbiStripStruct.h.

References fgDefensiveUnpkg.

00103       { fgDefensiveUnpkg = defensive; }

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

Reimplemented from DbiTableRow.

Definition at line 177 of file UgliDbiStripStruct.cxx.

References fInModule, fLenEastPart, fLenWestPart, fTotalLen, fWlsLenBypass, fWlsLenEast, fWlsLenWest, GetDetector(), GetIndex(), GetPlaneCoverage(), GetPlaneView(), GetStrip(), GetTableDescr(), Msg::kFatal, MSG, and UgliDbiTableDescr::ParseTableDescr().

00178                                                                        {
00179 //
00180 //
00181 //  Purpose:  Stream object to output row stream
00182 //
00183 //  Arguments: 
00184 //    ors          in     Output row stream.
00185 //    vrec         in     Associated validity record (or 0 if filling
00186 //                                                    DbiValidityRec)
00187 //
00188 //  Return:    
00189 //
00190 //  Contact:   R. Hatcher
00191 //
00192 //  Specification:-
00193 //  =============
00194 //
00195 //  o  Stream object to output row stream.
00196 
00197 //  Program Notes:-
00198 //  =============
00199 
00200 //  None.
00201 
00202    const char* tabledescr = GetTableDescr();
00203    vector< pair<string,string> > components = 
00204       UgliDbiTableDescr::ParseTableDescr(tabledescr);
00205    int n = components.size();
00206 
00207    for (int i=0; i<n; i++) {
00208       pair<string,string> colPair = components[i];
00209       string colName = colPair.first;
00210       if      ( colName == "HASHVAL"      ) ors << (int)GetIndex(0);
00211       else if ( colName == "DETECTOR"     ) 
00212                         ors << (int)GetDetector();
00213       else if ( colName == "PLNVIEW"      ) 
00214                         ors << (int)GetPlaneView();
00215       else if ( colName == "COVERAGE"     ) 
00216                         ors << (int)GetPlaneCoverage();
00217       else if ( colName == "INMODULE"     ) ors << fInModule;
00218       else if ( colName == "STRIP"        ) ors << GetStrip();
00219       else if ( colName == "TOTALLEN"     ) ors << fTotalLen;
00220       else if ( colName == "WLSLENEAST"   ) ors << fWlsLenEast;
00221       else if ( colName == "WLSLENWEST"   ) ors << fWlsLenWest;
00222       else if ( colName == "LENEASTPART"  ) ors << fLenEastPart;
00223       else if ( colName == "LENWESTPART"  ) ors << fLenWestPart;
00224       else if ( colName == "WLSLENBYPASS" ) ors << fWlsLenBypass;
00225 
00226       else if ( colName == "ROW_COUNTER"  ) {;}
00227       else if ( colName == "SEQNO"        ) {;}
00228       else {
00229          MSG("Ugli",Msg::kFatal)
00230             << "Column name '" << colName << "' not correctly handled" << endl;
00231          assert(0);
00232       }
00233    }
00234 }


Member Data Documentation

UgliDbiStructHash UgliDbiStripStruct::fDetViewCoverStrip [private]

Definition at line 115 of file UgliDbiStripStruct.h.

Referenced by Fill(), GetDetector(), GetIndex(), GetPlaneCoverage(), GetPlaneView(), and GetStrip().

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

Definition at line 126 of file UgliDbiStripStruct.h.

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

UShort_t UgliDbiStripStruct::fInModule [private]

Definition at line 116 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fLenEastPart [private]

Definition at line 120 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fLenWestPart [private]

Definition at line 121 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fTotalLen [private]

Definition at line 117 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fWlsLenBypass [private]

Definition at line 122 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fWlsLenEast [private]

Definition at line 118 of file UgliDbiStripStruct.h.

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

Float_t UgliDbiStripStruct::fWlsLenWest [private]

Definition at line 119 of file UgliDbiStripStruct.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Aug 11 01:07:06 2014 for loon by  doxygen 1.4.7