Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

DigiEvent.h

Go to the documentation of this file.
00001 #ifndef GLASTEVENT_DIGIEVENT_H
00002 #define GLASTEVENT_DIGIEVENT_H 1
00003 
00004 
00005 // Include files
00006 #include <iostream>
00007 #include "GaudiKernel/Kernel.h"
00008 #include "GaudiKernel/StreamBuffer.h"
00009 #include "GaudiKernel/DataObject.h"
00010 #include "GlastEvent/Utilities/TriggerPattern.h"
00011 #include "GlastEvent/TopLevel/Definitions.h"
00012 
00013 
00014 // Externals 
00015 extern const CLID& CLID_DigiEvent;
00016 
00017 
00018 //------------------------------------------------------------------------------
00019 //
00020 // ClassName:   DigiEvent
00021 //  
00022 // Description: Essential information of the Digi event
00023 //              It can be identified by "/Event/Digi"
00024 //
00025 //              It contains:
00026 //              - flag, if comming from Monte Carlo
00027 //
00028 // Author:      Heather Kelly
00029 //
00030 //------------------------------------------------------------------------------
00031 
00042 class DigiEvent : public DataObject                                             {
00043 
00044 public:
00046   DigiEvent(const char* name = "DigiEvent")
00047     : DataObject(name), 
00048       m_fromMC(false)                                                         { }
00050   virtual ~DigiEvent()                                                        { }
00051 
00053   virtual const CLID& clID() const               { return DigiEvent::classID(); }
00054   static const CLID& classID()                   { return CLID_DigiEvent; }
00055 
00057   bool fromMC () const                                                         {
00058     return m_fromMC;
00059   }
00061   void setFromMC (bool value)                                                  {
00062     m_fromMC = value;
00063   }
00064 
00066   virtual StreamBuffer& serialize( StreamBuffer& s ) const;
00068   virtual StreamBuffer& serialize( StreamBuffer& s );
00069 
00071   friend std::ostream& operator<< ( std::ostream& s, const DigiEvent& obj )     {
00072     return obj.fillStream(s);
00073   }
00075   virtual std::ostream& fillStream( std::ostream& s ) const;
00076 
00077 private: 
00079   bool m_fromMC;
00080 };
00081 
00082 
00083 //
00084 // Inline code must be outside the class definition
00085 //
00086 
00087 
00089 inline StreamBuffer& DigiEvent::serialize( StreamBuffer& s ) const              {
00090   DataObject::serialize(s);
00091   unsigned char u = (m_fromMC) ? 1 : 0;
00092   return s << u;
00093 }
00094 
00095 
00097 inline StreamBuffer& DigiEvent::serialize( StreamBuffer& s )                    {
00098   DataObject::serialize(s);
00099   unsigned char u;
00100   s >> u;
00101   m_fromMC = (u) ? true : false;
00102   return s;
00103 }
00104 
00105 
00107 inline std::ostream& DigiEvent::fillStream( std::ostream& s ) const             {
00108   s << "class DigiEvent :"
00109     << "\n    Flag of origin    = ";
00110   if( m_fromMC ) {
00111     s << " true";
00112   }
00113   else {
00114     s << "false";
00115   }
00116   return s;
00117 }
00118 
00119 
00120 #endif  // GLASTEVENT_DIGIEVENT_H

Generated at Wed Nov 21 12:22:49 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000