| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RunData.h

Go to the documentation of this file.
00001 
00002 //   **************************************************************************
00003 //   *                                                                        *
00004 //   *                      ! ! ! A T T E N T I O N ! ! !                     *
00005 //   *                                                                        *
00006 //   *  This file was created automatically by GaudiObjDesc, please do not    *
00007 //   *  delete it or edit it by hand.                                         *
00008 //   *                                                                        *
00009 //   *  If you want to change this file, first change the corresponding       *
00010 //   *  xml-file and rerun the tools from GaudiObjDesc (or run make if you    *
00011 //   *  are using it from inside a Gaudi-package).                            *
00012 //   *                                                                        *
00013 //   **************************************************************************
00014 
00015 #ifndef RunData_RunData_H
00016 #define RunData_RunData_H 1
00017 
00018 // Include files
00019 #include "Context/TimeStamp.h"
00020 #include "Conventions/Detectors.h"
00021 #include "Conventions/RunType.h"
00022 #include "Event/CalibSource.h"
00023 #include "GaudiKernel/boost_allocator.h"
00024 #include <vector>
00025 #include <algorithm>
00026 #include <ostream>
00027 
00028 // Forward declarations
00029 
00030 namespace DayaBay 
00031 {
00032 
00033   // Forward declarations
00034 
00044   class RunData
00045   {
00046   public:
00047 
00049     typedef std::vector<DayaBay::Detector> DetectorContainer;
00051     typedef std::vector<DayaBay::CalibSource> CalibSources;
00052   
00054     RunData() : m_runNumber(0),
00055                 m_runType(DayaBay::RunType::kUnknown),
00056                 m_detectors(),
00057                 m_startTime(0),
00058                 m_endTime(0),
00059                 m_calibSources() {}
00060   
00062     RunData(const RunData & rh);
00063   
00065      RunData & operator=(const RunData & rh);
00066   
00068     virtual ~RunData() {}
00069   
00071     bool hasDetector(const DayaBay::Detector& detector) const;
00072   
00074     bool hasSource(const DayaBay::CalibSourceId& sourceId) const;
00075   
00077     CalibSource* getSource(const DayaBay::CalibSourceId& sourceId);
00078   
00080     std::ostream& fillStream(std::ostream& s) const;
00081   
00084   int runNumber() const;
00085   
00088   void setRunNumber(int value);
00089   
00092   const DayaBay::RunType::RunType_t& runType() const;
00093   
00096   void setRunType(const DayaBay::RunType::RunType_t& value);
00097   
00100   const DetectorContainer& detectors() const;
00101   
00104   void setDetectors(const DetectorContainer& value);
00105   
00108   const TimeStamp& startTime() const;
00109   
00112   void setStartTime(const TimeStamp& value);
00113   
00116   const TimeStamp& endTime() const;
00117   
00120   void setEndTime(const TimeStamp& value);
00121   
00124   const CalibSources& calibSources() const;
00125   
00128   void setCalibSources(const CalibSources& value);
00129   
00130   
00131   #ifndef GOD_NOALLOC
00133     static void* operator new ( size_t size )
00134     {
00135       return ( sizeof(RunData) == size ? 
00136                boost::singleton_pool<RunData, sizeof(RunData)>::malloc() :
00137                ::operator new(size) );
00138     }
00139   
00143     static void* operator new ( size_t size, void* pObj )
00144     {
00145       return ::operator new (size,pObj);
00146     }
00147   
00149     static void operator delete ( void* p )
00150     {
00151       boost::singleton_pool<RunData, sizeof(RunData)>::is_from(p) ?
00152       boost::singleton_pool<RunData, sizeof(RunData)>::free(p) :
00153       ::operator delete(p);
00154     }
00155   
00158     static void operator delete ( void* p, void* pObj )
00159     {
00160       ::operator delete (p, pObj);
00161     }
00162   #endif
00163   protected:
00164 
00165   private:
00166 
00167     int                         m_runNumber;    
00168     DayaBay::RunType::RunType_t m_runType;      
00169     DetectorContainer           m_detectors;    
00170     TimeStamp                   m_startTime;    
00171     TimeStamp                   m_endTime;      
00172     CalibSources                m_calibSources; 
00173   
00174   }; // class RunData
00175 
00176   inline std::ostream& operator<< (std::ostream& str, const RunData& obj)
00177   {
00178     return obj.fillStream(str);
00179   }
00180   
00181 } // namespace DayaBay;
00182 
00183 // -----------------------------------------------------------------------------
00184 // end of class
00185 // -----------------------------------------------------------------------------
00186 
00187 // Including forward declarations
00188 
00189 inline DayaBay::RunData::RunData(const DayaBay::RunData & rh) : 
00190    m_runNumber( rh.m_runNumber ),
00191    m_runType( rh.m_runType ),
00192    m_detectors( rh.m_detectors ),
00193    m_startTime( rh.m_startTime ),
00194    m_endTime( rh.m_endTime ),
00195    m_calibSources( rh.m_calibSources )
00196    {}
00197 
00198 inline DayaBay::RunData & DayaBay::RunData::operator=(const DayaBay::RunData & rh) {
00199   if ( this != &rh ) {
00200     m_runNumber    = rh.m_runNumber;
00201     m_runType      = rh.m_runType;
00202     m_detectors    = rh.m_detectors;
00203     m_startTime    = rh.m_startTime;
00204     m_endTime      = rh.m_endTime;
00205     m_calibSources = rh.m_calibSources;
00206   }
00207   return *this;
00208 }
00209 
00210 inline int DayaBay::RunData::runNumber() const 
00211 {
00212   return m_runNumber;
00213 }
00214 
00215 inline void DayaBay::RunData::setRunNumber(int value) 
00216 {
00217   m_runNumber = value;
00218 }
00219 
00220 inline const DayaBay::RunType::RunType_t& DayaBay::RunData::runType() const 
00221 {
00222   return m_runType;
00223 }
00224 
00225 inline void DayaBay::RunData::setRunType(const DayaBay::RunType::RunType_t& value) 
00226 {
00227   m_runType = value;
00228 }
00229 
00230 inline const DayaBay::RunData::DetectorContainer& DayaBay::RunData::detectors() const 
00231 {
00232   return m_detectors;
00233 }
00234 
00235 inline void DayaBay::RunData::setDetectors(const DetectorContainer& value) 
00236 {
00237   m_detectors = value;
00238 }
00239 
00240 inline const TimeStamp& DayaBay::RunData::startTime() const 
00241 {
00242   return m_startTime;
00243 }
00244 
00245 inline void DayaBay::RunData::setStartTime(const TimeStamp& value) 
00246 {
00247   m_startTime = value;
00248 }
00249 
00250 inline const TimeStamp& DayaBay::RunData::endTime() const 
00251 {
00252   return m_endTime;
00253 }
00254 
00255 inline void DayaBay::RunData::setEndTime(const TimeStamp& value) 
00256 {
00257   m_endTime = value;
00258 }
00259 
00260 inline const DayaBay::RunData::CalibSources& DayaBay::RunData::calibSources() const 
00261 {
00262   return m_calibSources;
00263 }
00264 
00265 inline void DayaBay::RunData::setCalibSources(const CalibSources& value) 
00266 {
00267   m_calibSources = value;
00268 }
00269 
00270 inline bool DayaBay::RunData::hasDetector(const DayaBay::Detector& detector) const 
00271 {
00272 
00273           return (std::find(m_detectors.begin(), m_detectors.end(), detector)
00274                   != m_detectors.end());
00275         
00276 }
00277 
00278 inline bool DayaBay::RunData::hasSource(const DayaBay::CalibSourceId& sourceId) const 
00279 {
00280 
00281             DayaBay::RunData::CalibSources::const_iterator srcIter, srcDone
00282                = m_calibSources.end();
00283             for (srcIter=m_calibSources.begin(); srcIter != srcDone; ++srcIter){
00284                 if( (*srcIter).id() == sourceId ) return true;
00285             }
00286             return false;
00287         
00288 }
00289 
00290 inline DayaBay::CalibSource* DayaBay::RunData::getSource(const DayaBay::CalibSourceId& sourceId) 
00291 {
00292 
00293             DayaBay::RunData::CalibSources::iterator srcIter, srcDone
00294                = m_calibSources.end();
00295             for (srcIter=m_calibSources.begin(); srcIter != srcDone; ++srcIter){
00296                 if( (*srcIter).id() == sourceId ) return &(*srcIter);
00297             }
00298             return 0;
00299         
00300 }
00301 
00302 
00303 #endif 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:22:13 2011 for RunData by doxygen 1.4.7