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

In This Package:

TagHeader.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 TagEvent_TagHeader_H
00016 #define TagEvent_TagHeader_H 1
00017 
00018 // Include files
00019 #include "Event/HeaderObject.h"
00020 #include "Event/TagData.h"
00021 #include "GaudiKernel/boost_allocator.h"
00022 #include <ostream>
00023 
00024 // Forward declarations
00025 
00026 namespace DayaBay 
00027 {
00028 
00029   // Forward declarations
00030   
00031   // Class ID definition
00032   static const CLID CLID_TagHeader = 51802;
00033   
00034   // Namespace for locations in TDS
00035   namespace TagHeaderLocation {
00036     static const std::string& Default = "/Event/Tags/Default";
00037   }
00038   
00039 
00049   class TagHeader: public HeaderObject
00050   {
00051   public:
00052 
00054   static const std::string& defaultLocation() { return TagHeaderLocation::Default; }
00055   virtual const std::string& defLoc() const { return TagHeaderLocation::Default; }
00056   
00058     enum TagType{ Unknown = 0,   // Undefined, indicates error
00059                   Generic,       // Generic Tag
00060                   AdEvent,       // An event in the AD
00061                   Positron,      // A positron
00062                   Neutron,       // A neutron capture
00063                   Radiation,     // An event due to a radioactive decay
00064                   MuonFragment,  // Event due to passage of a muon through a detector
00065                   Muon,          // One or more MuonFragments
00066                   MuonShower,    // A MuonTrack and one or more other things
00067                   MuonDecay,     // A MuonTrack and Michele electron
00068                   AdCoincidence, // Time-correlated AD events
00069                   IBD            // Set of inverse beta decay events
00070       };
00071   
00073     TagHeader() : m_tagID(Unknown),
00074                   m_isA(false),
00075                   m_data(0) {}
00076   
00078     virtual ~TagHeader() {}
00079   
00080     // Retrieve pointer to class definition structure
00081     virtual const CLID& clID() const;
00082     static const CLID& classID();
00083   
00085    virtual std::ostream& fillStream(std::ostream& s) const;
00086   
00088     template <class TDTYPE>
00089     TDTYPE* dataAs() const;
00090   
00092     std::string tagName() const;
00093   
00095     std::vector<const DayaBay::TagHeader*> taggedHeaders(const TagType& tagType) const;
00096   
00099   const TagType& tagID() const;
00100   
00103   void setTagID(const TagType& value);
00104   
00107   bool isA() const;
00108   
00111   void setIsA(bool value);
00112   
00115   const DayaBay::TagData* data() const;
00116   
00119   void setData(DayaBay::TagData* value);
00120   
00121   
00122   #ifndef GOD_NOALLOC
00124     static void* operator new ( size_t size )
00125     {
00126       return ( sizeof(TagHeader) == size ? 
00127                boost::singleton_pool<TagHeader, sizeof(TagHeader)>::malloc() :
00128                ::operator new(size) );
00129     }
00130   
00134     static void* operator new ( size_t size, void* pObj )
00135     {
00136       return ::operator new (size,pObj);
00137     }
00138   
00140     static void operator delete ( void* p )
00141     {
00142       boost::singleton_pool<TagHeader, sizeof(TagHeader)>::is_from(p) ?
00143       boost::singleton_pool<TagHeader, sizeof(TagHeader)>::free(p) :
00144       ::operator delete(p);
00145     }
00146   
00149     static void operator delete ( void* p, void* pObj )
00150     {
00151       ::operator delete (p, pObj);
00152     }
00153   #endif
00154   protected:
00155 
00156   private:
00157 
00158     TagType           m_tagID; 
00159     bool              m_isA;   
00160     DayaBay::TagData* m_data;  
00161   
00162   }; // class TagHeader
00163 
00164   inline std::ostream& operator<< (std::ostream& str, const TagHeader& obj)
00165   {
00166     return obj.fillStream(str);
00167   }
00168   
00169   inline std::ostream & operator << (std::ostream & s, DayaBay::TagHeader::TagType e) {
00170     switch (e) {
00171       case DayaBay::TagHeader::Unknown       : return s << "Unknown";
00172       case DayaBay::TagHeader::Generic       : return s << "Generic";
00173       case DayaBay::TagHeader::AdEvent       : return s << "AdEvent";
00174       case DayaBay::TagHeader::Positron      : return s << "Positron";
00175       case DayaBay::TagHeader::Neutron       : return s << "Neutron";
00176       case DayaBay::TagHeader::Radiation     : return s << "Radiation";
00177       case DayaBay::TagHeader::MuonFragment  : return s << "MuonFragment";
00178       case DayaBay::TagHeader::Muon          : return s << "Muon";
00179       case DayaBay::TagHeader::MuonShower    : return s << "MuonShower";
00180       case DayaBay::TagHeader::MuonDecay     : return s << "MuonDecay";
00181       case DayaBay::TagHeader::AdCoincidence : return s << "AdCoincidence";
00182       case DayaBay::TagHeader::IBD           : return s << "IBD";
00183       default : return s << "ERROR wrong value for enum DayaBay::TagHeader::TagType";
00184     }
00185   }
00186   
00187   
00188 } // namespace DayaBay;
00189 
00190 // -----------------------------------------------------------------------------
00191 // end of class
00192 // -----------------------------------------------------------------------------
00193 
00194 // Including forward declarations
00195 
00196 inline const CLID& DayaBay::TagHeader::clID() const
00197 {
00198   return DayaBay::TagHeader::classID();
00199 }
00200 
00201 inline const CLID& DayaBay::TagHeader::classID()
00202 {
00203   return CLID_TagHeader;
00204 }
00205 
00206 inline std::ostream& DayaBay::TagHeader::fillStream(std::ostream& s) const
00207 {
00208   char l_isA = (m_isA) ? 'T' : 'F';
00209   HeaderObject::fillStream(s);
00210   s << "{ " << "tagID : " << m_tagID << std::endl
00211             << "isA :   " << l_isA << std::endl
00212             << "data :  " << m_data << std::endl << " }";
00213   return s;
00214 }
00215 
00216 
00217 inline const DayaBay::TagHeader::TagType& DayaBay::TagHeader::tagID() const 
00218 {
00219   return m_tagID;
00220 }
00221 
00222 inline void DayaBay::TagHeader::setTagID(const TagType& value) 
00223 {
00224   m_tagID = value;
00225 }
00226 
00227 inline bool DayaBay::TagHeader::isA() const 
00228 {
00229   return m_isA;
00230 }
00231 
00232 inline void DayaBay::TagHeader::setIsA(bool value) 
00233 {
00234   m_isA = value;
00235 }
00236 
00237 inline const DayaBay::TagData* DayaBay::TagHeader::data() const 
00238 {
00239   return m_data;
00240 }
00241 
00242 inline void DayaBay::TagHeader::setData(DayaBay::TagData* value) 
00243 {
00244   m_data = value;
00245 }
00246 
00247 template <class TDTYPE>
00248 inline TDTYPE* DayaBay::TagHeader::dataAs() const 
00249 {
00250     return dynamic_cast<TDTYPE*>(m_data);
00251 }
00252 
00253 
00254 #endif 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:19:59 2011 for TagEvent by doxygen 1.4.7