![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /BdbCond/BdbCondContainerProfile.hh
Go to the documentation of this file.00001 //----------------------------------------------------------------------------- 00002 // 00003 // File and Version Information: 00004 // $Id: BdbCondContainerProfile.hh,v 1.2 2002/06/21 18:46:51 ryd Exp $ 00005 // 00006 // Description: 00007 // This class is meant for the profiling of interval containers. 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author List: 00013 // Igor A. Gaponenko Original Author 00014 // 00015 // Copyright Information: 00016 // Copyright (C) 2000 Lawrence Berkeley Laboratory 00017 // 00018 //----------------------------------------------------------------------------- 00019 00020 #ifndef BDBCONDCONTAINERPROFILE_HH 00021 #define BDBCONDCONTAINERPROFILE_HH 00022 00023 // ------------------- 00024 // -- BaBar Headers -- 00025 // ------------------- 00026 00027 #include "BaBar/BaBar.hh" 00028 00029 // ---------------------------- 00030 // -- BaBar Database Headers -- 00031 // ---------------------------- 00032 00033 #include "BdbUtil/Bdb.hh" 00034 00035 // --------------- 00036 // -- C Headers -- 00037 // --------------- 00038 00039 extern "C" { 00040 #include <stddef.h> 00041 } 00042 00043 // --------------------------------- 00044 // -- Collaborating Class Headers -- 00045 // --------------------------------- 00046 00047 #include "BdbCond/BdbIntervalR.hh" 00048 #include "BdbTime/BdbTime.hh" 00049 00050 #include <string> 00051 #include <vector> 00052 00053 // --------------------- 00054 // -- Class Interface -- 00055 // --------------------- 00056 00057 class BdbCondContainerProfile { 00058 00059 public: 00060 00061 // Constructor(s) 00062 00063 BdbCondContainerProfile( ); 00064 00065 // Destructor 00066 00067 virtual ~BdbCondContainerProfile( ); 00068 00069 // Selectors (state & parameters of the profile) 00070 00071 inline bool isValid( ) const; 00072 00073 std::string detectorName ( ) const; 00074 std::string containerName( ) const; 00075 00076 BdbTime beginValidityTime( ) const; 00077 BdbTime endValidityTime ( ) const; 00078 00079 // Selectors (results of measurements) 00080 00081 inline int totalIntervals ( ) const; 00082 inline int totalBaseline ( ) const; 00083 inline int totalTopmost ( ) const; 00084 inline int totalRevised ( ) const; 00085 inline int totalNullObjects( ) const; 00086 00087 inline int maxWidth ( ) const; 00088 inline int maxLayers ( ) const; 00089 inline int maxVersions( ) const; 00090 00091 void getWidthHist ( std::vector<int>& theHist ); 00092 void getLayersHist ( std::vector<int>& theHist ); 00093 void getVersionsHist( std::vector<int>& theHist ); 00094 00095 // Operations 00096 00097 // Measure the profile for specified container. 00098 00099 BdbStatus measure( const char* theDetectorName, 00100 const char* theContainerName, 00101 const BdbTime& theBeginValidityTime = BdbTime::minusInfinity, 00102 const BdbTime& theEndValidityTime = BdbTime::plusInfinity ); 00103 00104 // Print the profile into specified output stream. 00105 00106 void print( ostream& stream ) const; 00107 00108 // Helpers (for histograms). 00109 00110 static int minForBin( int theBin ); 00111 static int maxForBin( int theBin ); 00112 00113 private: 00114 00115 // Helpers. 00116 00117 // Reset the internal state of the object. 00118 00119 void reset( ); 00120 00121 // Return the bin number for specified value. 00122 00123 static int calculateBin( int theValue ); 00124 00125 // Put a value into specified histogram. 00126 00127 static void addToHist( std::vector<int>& theHistogram, int theValue); 00128 00129 // Make a copy of a histogram. 00130 00131 static void copyHist( const std::vector<int>& theInputHist, 00132 std::vector<int>& theOutputHist ); 00133 00134 // Process a sub tree. 00135 00136 void measureSubTree( const BdbHandle(BdbIntervalR)& theIntervalH, 00137 int theLayer = 1 ); 00138 00139 private: 00140 00141 // The state of the profile. 00142 00143 bool _isValid; 00144 00145 // The parameters of the profile. 00146 00147 std::string _detectorName; 00148 std::string _containerName; 00149 00150 BdbTime _beginValidityTime; 00151 BdbTime _endValidityTime; 00152 00153 // The result of the profiling. 00154 00155 int _totalIntervals; // Total number of intervals in the container. 00156 int _totalBaseline; // Total number of BASELINE intervals. 00157 int _totalTopmost; // Total number of TOPMOST intervals. 00158 int _totalRevised; // Total number of revised intervals (NOTE: all BASELINE ones are always revised). 00159 int _totalNullObjects; // Total number of initervals having NULL object references (to BdbObject). 00160 int _maxWidth; // Maximum width of topmost intervals as a number of topmost ones). 00161 int _maxLayers; // The maximum number of version layers. 00162 int _maxVersions; // The maximum number of versions. 00163 00164 std::vector<int> _widthHist; 00165 std::vector<int> _layersHist; 00166 std::vector<int> _versionsHist; 00167 }; 00168 00169 // ----------------------------------- 00170 // -- Inline methods implementation -- 00171 // ----------------------------------- 00172 00173 inline bool 00174 BdbCondContainerProfile::isValid( ) const 00175 { 00176 return _isValid; 00177 } 00178 00179 inline std::string 00180 BdbCondContainerProfile::detectorName( ) const 00181 { 00182 return _detectorName; 00183 } 00184 00185 inline std::string 00186 BdbCondContainerProfile::containerName( ) const 00187 { 00188 return _containerName; 00189 } 00190 00191 inline BdbTime 00192 BdbCondContainerProfile::beginValidityTime( ) const 00193 { 00194 return _beginValidityTime; 00195 } 00196 00197 inline BdbTime 00198 BdbCondContainerProfile::endValidityTime( ) const 00199 { 00200 return _endValidityTime; 00201 } 00202 00203 inline int 00204 BdbCondContainerProfile::totalIntervals( ) const 00205 { 00206 return _totalIntervals; 00207 } 00208 00209 inline int 00210 BdbCondContainerProfile::totalBaseline( ) const 00211 { 00212 return _totalBaseline; 00213 } 00214 inline int 00215 BdbCondContainerProfile::totalTopmost( ) const 00216 { 00217 return _totalTopmost; 00218 } 00219 00220 inline int 00221 BdbCondContainerProfile::totalRevised( ) const 00222 { 00223 return _totalRevised; 00224 } 00225 00226 inline int 00227 BdbCondContainerProfile::totalNullObjects( ) const 00228 { 00229 return _totalNullObjects; 00230 } 00231 00232 inline int 00233 BdbCondContainerProfile::maxWidth( ) const 00234 { 00235 return _totalTopmost; 00236 00237 } 00238 00239 inline int 00240 BdbCondContainerProfile::maxLayers( ) const 00241 { 00242 return _maxLayers; 00243 } 00244 00245 inline int 00246 BdbCondContainerProfile::maxVersions( ) const 00247 { 00248 return _maxVersions; 00249 } 00250 00251 #endif /* BDBCONDCONTAINERPROFILE_HH */
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002