/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventFilter/HltUtilities/HltDataTypes/HltDataTypes-01-01-03/HltDataTypes/EventID.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  EventInfo Package
00003  -----------------------------------------
00004  Copyright (C) 2000 by ATLAS Collaboration
00005  ***************************************************************************/
00006 
00007 //<doc><file>   $Id: EventID.h,v 1.1.1.1 2007/04/25 11:46:57 zoujh Exp $
00008 //<version>     $Name: HltDataTypes-01-01-03 $
00009 
00010 #ifndef EVENTINFO_EVENTID_H
00011 # define EVENTINFO_EVENTID_H
00012 
00013 //<<<<<< INCLUDES                                                       >>>>>>
00014 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00015 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00016 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00017 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00018 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00019 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00020 
00021 #include <iostream>
00022 
00023 // 
00024 //  class EventID
00025 //
00026 //  This class provides a unique identification for each event.
00027 //
00028 class EventID {
00029 public:
00030 
00031   typedef unsigned int number_type;
00032   
00033   EventID();
00034   EventID(number_type run_number, 
00035           number_type event_number);
00036   EventID(number_type run_number, 
00037           number_type event_number,
00038           number_type time_stamp);
00039   explicit EventID(const EventID& id);
00040   virtual ~EventID();
00041   
00042   number_type   run_number      (void) const;
00043   number_type   event_number    (void) const;
00044   number_type   time_stamp      (void) const; // posix time in seconds from 1970
00045   
00046   // Comparison operators
00047   friend bool operator<(const EventID& lhs, const EventID& rhs);
00048   friend bool operator>(const EventID& lhs, const EventID& rhs);
00049   friend bool operator==(const EventID& lhs, const EventID& rhs);
00050   friend bool operator!=(const EventID& lhs, const EventID& rhs);
00051   friend bool operator<=(const EventID& lhs, const EventID& rhs);
00052   friend bool operator>=(const EventID& lhs, const EventID& rhs);
00053 
00054   // Insertion and extraction operators
00055   friend std::istream& operator>>(std::istream& is, EventID& rhs);
00056 
00057   template <class STR>
00058   friend STR& operator<<(STR& os, const EventID& rhs);
00059 
00060 private:
00061   number_type   m_run_number;
00062   number_type   m_event_number;
00063 
00064   // posix time in seconds since 1970/01/01
00065   number_type   m_time_stamp;
00066   
00067 };
00068 
00069 
00070 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00071 
00072 inline bool operator<(const EventID& lhs, const EventID& rhs) {
00073   // We are assuming that ALL events will have run and event numbers,
00074   // and never just a time stamp.
00075   return lhs.m_run_number<rhs.m_run_number ||
00076          ( lhs.m_run_number==rhs.m_run_number && 
00077            lhs.m_event_number<rhs.m_event_number) ;
00078 }
00079 inline bool operator==(const EventID& lhs, const EventID& rhs) {
00080   return lhs.m_run_number==rhs.m_run_number && 
00081          lhs.m_event_number==rhs.m_event_number ;
00082 }
00083 inline bool operator>(const EventID& lhs, const EventID& rhs) {
00084   return !( (lhs < rhs) || (lhs == rhs));
00085 }
00086 inline bool operator!=(const EventID& lhs, const EventID& rhs) {
00087   return !(lhs == rhs);
00088 }
00089 inline bool operator<=(const EventID& lhs, const EventID& rhs) {
00090   return !(lhs > rhs);
00091 }
00092 inline bool operator>=(const EventID& lhs, const EventID& rhs) {
00093   return !(lhs < rhs);
00094 }
00095 
00096 template <class STR>
00097 inline STR& operator<<(STR& os, const EventID& rhs) {
00098   os << "[R,E] = [" << rhs.m_run_number << "," << rhs.m_event_number << "]";
00099   return os;
00100 }
00101 
00102 inline std::istream& operator>>(std::istream& is, EventID& rhs) {
00103   is >> rhs.m_run_number >> rhs.m_event_number;
00104   return is;
00105 }
00106 
00107 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00108 
00109 #endif // EVENTINFO_EVENTID_H
00110 
00111 
00112 
00113 
00114 
00115 

Generated on Tue Nov 29 23:12:07 2016 for BOSS_7.0.2 by  doxygen 1.4.7