UgliDbiGeometry Class Reference

#include <UgliDbiGeometry.h>

Inheritance diagram for UgliDbiGeometry:
DbiTableRow

List of all members.

Public Member Functions

 UgliDbiGeometry ()
 UgliDbiGeometry (Detector::Detector_t, Bool_t xyisuv, const Float_t *hall_xyz_min, const Float_t *hall_xyz_max)
virtual ~UgliDbiGeometry ()
Bool_t GetXYisUV () const
const Float_t * GetHallXYZMin () const
const Float_t * GetHallXYZMax () 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

 UgliDbiGeometry (const UgliDbiGeometry &from)

Private Attributes

Bool_t fXYisUV
Float_t fHallXYZMin [3]
Float_t fHallXYZMax [3]

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 29 of file UgliDbiGeometry.h.


Constructor & Destructor Documentation

UgliDbiGeometry::UgliDbiGeometry (  )  [inline]

Definition at line 36 of file UgliDbiGeometry.h.

References fHallXYZMax, fHallXYZMin, and LEA_CTOR.

00036                      : fXYisUV(false) 
00037       { LEA_CTOR; 
00038         for (int i=0; i<3; i++) {
00039            fHallXYZMin[i]=0;
00040            fHallXYZMax[i]=0;
00041         }
00042       };

UgliDbiGeometry::UgliDbiGeometry ( Detector::Detector_t  ,
Bool_t  xyisuv,
const Float_t *  hall_xyz_min,
const Float_t *  hall_xyz_max 
) [inline]

Definition at line 44 of file UgliDbiGeometry.h.

References fHallXYZMax, fHallXYZMin, and LEA_CTOR.

00045                                                                              : 
00046       fXYisUV(xyisuv) 
00047       { LEA_CTOR; 
00048         for (int i=0; i<3; i++) {
00049            fHallXYZMin[i]=hall_xyz_min[i];
00050            fHallXYZMax[i]=hall_xyz_max[i];
00051         }
00052       };

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

Definition at line 53 of file UgliDbiGeometry.h.

References LEA_DTOR.

00053 { LEA_DTOR; };

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

Definition at line 84 of file UgliDbiGeometry.h.

References LEA_CTOR.

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


Member Function Documentation

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

Implements DbiTableRow.

Definition at line 61 of file UgliDbiGeometry.h.

00061 { return new UgliDbiGeometry; }

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

Implements DbiTableRow.

Definition at line 54 of file UgliDbiGeometry.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), fgDefensiveUnpkg, fHallXYZMax, fHallXYZMin, fXYisUV, DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), Msg::kWarning, MSG, and DbiRowStream::NumCols().

00055                                                              {
00056 //
00057 //
00058 //  Purpose:  Fill object from Result Set
00059 //
00060 //  Arguments: 
00061 //    rs           in    Result Set used to fill object
00062 //    vrec         in    Associated validity record (or 0 if filling
00063 //                                                    DbiValidityRec)
00064 //
00065 //  Return:    
00066 //
00067 //  Contact:   R. Hatcher
00068 //
00069 //  Specification:-
00070 //  =============
00071 //
00072 //  o Fill object from current row of Result Set.
00073 
00074 //  Program Notes:-
00075 //  =============
00076 
00077 //  None.
00078 
00079    if (fgDefensiveUnpkg) {
00080 
00081       // unpack allowing for various column names and ordering
00082 
00083       Int_t numCol = rs.NumCols();
00084       //  The first column (SeqNo) has already been processed.
00085       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00086          string colName = rs.CurColName();
00087          if (      colName == "XYISUV"  ) {
00088             Short_t tmp; rs >> tmp; fXYisUV = Bool_t(tmp);
00089          }
00090          else if ( colName == "HALLXMIN") rs >> fHallXYZMin[0];
00091          else if ( colName == "HALLXMAX") rs >> fHallXYZMax[0];
00092          else if ( colName == "HALLYMIN") rs >> fHallXYZMin[1];
00093          else if ( colName == "HALLYMAX") rs >> fHallXYZMax[1];
00094          else if ( colName == "HALLZMIN") rs >> fHallXYZMin[2];
00095          else if ( colName == "HALLZMAX") rs >> fHallXYZMax[2];
00096          else {
00097             static int nmsg = 25;
00098             if (nmsg-- > 0) {
00099               MSG("Ugli",Msg::kWarning) 
00100                 << "Ignoring column " << rs.CurColNum() 
00101                 << " (of " << rs.NumCols() << ")"
00102                 << " \""<< colName << "\"; not part of "
00103                 << ClassName() << endl;
00104             }
00105             rs.IncrementCurCol();
00106          }
00107       }
00108    } // end defensive unpacking
00109    else {
00110       Short_t tmpxyisuv;
00111       rs >> tmpxyisuv
00112          >> fHallXYZMin[0]
00113          >> fHallXYZMax[0]
00114          >> fHallXYZMin[1]
00115          >> fHallXYZMax[1]
00116          >> fHallXYZMin[2]
00117          >> fHallXYZMax[2];
00118 
00119          fXYisUV = Bool_t(tmpxyisuv);
00120 
00121     }
00122 
00123 }

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

Definition at line 187 of file UgliDbiGeometry.cxx.

References fHallXYZMax, fHallXYZMin, fXYisUV, DbiValidityRec::GetSeqNo(), GetTableDescr(), UgliDbiTableDescr::ParseTableDescr(), and UgliDbiTableDescr::TextTableDescrLine().

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

00190 {
00191 //
00192 //
00193 //  Purpose:  Print the current row to an ostream
00194 //
00195 //  Return:   nothing
00196 //
00197 //  Contact:   R. Hatcher
00198 //
00199 //  Specification:-
00200 //  =============
00201 //
00202  
00203 //  Program Notes:-
00204 //  =============
00205  
00206 //  None.
00207  
00208   string opt = option;
00209 
00210   if ( opt.find("H") != string::npos ) {
00211      string tabledescr = GetTableDescr();
00212      tabledescr = UgliDbiTableDescr::TextTableDescrLine(tabledescr);
00213      os << tabledescr << endl;
00214   }
00215   else if ( opt.find("h") != string::npos ) {
00216     string tabledescr = GetTableDescr();
00217     vector< pair<string,string> > components =
00218         UgliDbiTableDescr::ParseTableDescr(tabledescr);
00219     for (unsigned int ic = 0; ic < components.size(); ++ic)
00220         os << components[ic].first << '\t';
00221     os << endl;
00222   }
00223 
00224   char sep = '\t';
00225   if ( opt.find(",") != string::npos ) sep = ',';
00226 
00227   if ( ! dvr ) {
00228       os << "SeqNo"         << sep;  // no way of knowing the SEQNO?
00229   }
00230   else {
00231       os << dvr->GetSeqNo() << sep;
00232   }
00233 
00234   os   <<  0  << sep  // only ever one row for an agg
00235        << (int)fXYisUV     << sep
00236        << fHallXYZMin[0]   << sep
00237        << fHallXYZMax[0]   << sep
00238        << fHallXYZMin[1]   << sep
00239        << fHallXYZMax[1]   << sep
00240        << fHallXYZMin[2]   << sep
00241        << fHallXYZMax[2]   << endl;
00242 
00243   return os;
00244 }

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

Definition at line 78 of file UgliDbiGeometry.h.

References fgDefensiveUnpkg.

00078 { return fgDefensiveUnpkg; }

const Float_t* UgliDbiGeometry::GetHallXYZMax (  )  const [inline]

Definition at line 59 of file UgliDbiGeometry.h.

References fHallXYZMax.

Referenced by GeoGeometry::BuildGeometry(), and UgliGeometry::BuildNodes().

00059 { return fHallXYZMax; }

const Float_t* UgliDbiGeometry::GetHallXYZMin (  )  const [inline]

Definition at line 58 of file UgliDbiGeometry.h.

References fHallXYZMin.

Referenced by GeoGeometry::BuildGeometry(), and UgliGeometry::BuildNodes().

00058 { return fHallXYZMin; }

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

Definition at line 248 of file UgliDbiGeometry.cxx.

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

00249 {
00250 //
00251 //
00252 //  Purpose:  Return a string describing rows in the table
00253 //            Used in creating temporary tables
00254 //
00255 //  Return:   const char* to parenthesized comma separated list
00256 //            of column name and type pairs
00257 //
00258 //  Contact:   R. Hatcher
00259 //
00260 //  Specification:-
00261 //  =============
00262 //
00263 
00264 //  Program Notes:-
00265 //  =============
00266 
00267 //  None.
00268 
00269    const char* const_tabledescr = "(\
00270        SEQNO             int,     \
00271        ROW_COUNTER       int,     \
00272        XYISUV            tinyint, \
00273        HALLXMIN          float,   \
00274        HALLXMAX          float,   \
00275        HALLYMIN          float,   \
00276        HALLYMAX          float,   \
00277        HALLZMIN          float,   \
00278        HALLZMAX          float,   \
00279        primary key (SEQNO,ROW_COUNTER) \
00280        )";
00281 
00282    return const_tabledescr;
00283 }

Bool_t UgliDbiGeometry::GetXYisUV (  )  const [inline]

Definition at line 57 of file UgliDbiGeometry.h.

References fXYisUV.

00057 { return fXYisUV; }

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

Definition at line 180 of file UgliDbiGeometry.cxx.

References FormatToOStream().

00181 {
00182     FormatToOStream(cout,option);
00183 }

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

Definition at line 76 of file UgliDbiGeometry.h.

References fgDefensiveUnpkg.

00077       { fgDefensiveUnpkg = defensive; }

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

Reimplemented from DbiTableRow.

Definition at line 127 of file UgliDbiGeometry.cxx.

References fHallXYZMax, fHallXYZMin, fXYisUV, GetTableDescr(), Msg::kFatal, MSG, n, and UgliDbiTableDescr::ParseTableDescr().

00128                                                                     {
00129 //
00130 //
00131 //  Purpose:  Stream object to output row stream
00132 //
00133 //  Arguments: 
00134 //    ors          in     Output row stream.
00135 //    vrec         in     Associated validity record (or 0 if filling
00136 //                                                    DbiValidityRec)
00137 //
00138 //  Return:    
00139 //
00140 //  Contact:   R. Hatcher
00141 //
00142 //  Specification:-
00143 //  =============
00144 //
00145 //  o  Stream object to output row stream.
00146 
00147 //  Program Notes:-
00148 //  =============
00149 
00150 //  None.
00151 
00152    const char* tabledescr = GetTableDescr();
00153    vector< pair<string,string> > components = 
00154       UgliDbiTableDescr::ParseTableDescr(tabledescr);
00155    int n = components.size();
00156 
00157    for (int i=0; i<n; i++) {
00158       pair<string,string> colPair = components[i];
00159       string colName = colPair.first;
00160       if (      colName == "XYISUV"  ) ors << (short)fXYisUV;
00161       else if ( colName == "HALLXMIN") ors << fHallXYZMin[0];
00162       else if ( colName == "HALLXMAX") ors << fHallXYZMax[0];
00163       else if ( colName == "HALLYMIN") ors << fHallXYZMin[1];
00164       else if ( colName == "HALLYMAX") ors << fHallXYZMax[1];
00165       else if ( colName == "HALLZMIN") ors << fHallXYZMin[2];
00166       else if ( colName == "HALLZMAX") ors << fHallXYZMax[2];
00167 
00168       else if ( colName == "ROW_COUNTER"     ) {;}
00169       else if ( colName == "SEQNO"           ) {;}
00170       else {
00171          MSG("Ugli",Msg::kFatal)
00172             << "Column name '" << colName << "' not correctly handled" << endl;
00173          assert(0);
00174       }
00175    }
00176 }


Member Data Documentation

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

Definition at line 95 of file UgliDbiGeometry.h.

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

Float_t UgliDbiGeometry::fHallXYZMax[3] [private]

Definition at line 91 of file UgliDbiGeometry.h.

Referenced by Fill(), FormatToOStream(), GetHallXYZMax(), Store(), and UgliDbiGeometry().

Float_t UgliDbiGeometry::fHallXYZMin[3] [private]

Definition at line 90 of file UgliDbiGeometry.h.

Referenced by Fill(), FormatToOStream(), GetHallXYZMin(), Store(), and UgliDbiGeometry().

Bool_t UgliDbiGeometry::fXYisUV [private]

Definition at line 89 of file UgliDbiGeometry.h.

Referenced by Fill(), FormatToOStream(), GetXYisUV(), 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