/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventFilter/HltUtilities/HltDataTypes/HltDataTypes-01-01-03/src/EventType.cxx

Go to the documentation of this file.
00001 /***************************************************************************
00002  Event Info Package
00003  -----------------------------------------
00004  Copyright (C) 2000 by ATLAS Collaboration
00005  ***************************************************************************/
00006 
00007 
00008 //<<<<<< INCLUDES                                                       >>>>>>
00009 
00010 #include "HltDataTypes/EventType.h"
00011 
00012 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00013 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00014 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00015 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00016 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00017 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00018 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00019 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00020 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00021 
00022 // List of EventTypeCodes
00023 //   To add on a new code, simply extend at the end 
00024 const EventType::EventTypeCode  EventType::IS_SIMULATION        = 0;
00025 const EventType::EventTypeCode  EventType::IS_TESTBEAM          = 1;
00026 const EventType::EventTypeCode  EventType::IS_CALIBRATION       = 2;
00027 
00028 
00029 EventType::EventType()
00030 {}
00031 
00032 
00033 EventType::~EventType()
00034 {}
00035 
00036 
00037 void            
00038 EventType::add_type (EventTypeCode type_code)
00039 {
00040     if(m_bit_mask.size() <= type_code) m_bit_mask.resize(type_code + 1, false);
00041     m_bit_mask[type_code] = true;
00042 }
00043 
00044 void            
00045 EventType::set_user_type        (const std::string& user_type)
00046 {
00047     m_user_type = user_type;
00048 }
00049 
00050 void                
00051 EventType::set_detdescr_tags(const NameTagPairVec& pairs)
00052 {
00053     // We must save in m_user_type the dd tags for the moment to avoid
00054     // schema evolution. Overwrite if existing "sep" is found.
00055 
00056     // Force overwrite:
00057     m_user_type = user_type(); 
00058 
00059     char sep = '#';
00060     for (unsigned int i = 0; i < pairs.size(); ++i) {
00061         m_user_type += sep;
00062         m_user_type += pairs[i].first;
00063         m_user_type += sep;
00064         m_user_type += pairs[i].second;
00065     }
00066 }
00067 
00068 
00069 bool            
00070 EventType::test         (EventTypeCode type_code) const
00071 {
00072     if (m_bit_mask.size() <= type_code) return false;
00073     return m_bit_mask[type_code];
00074 }
00075 
00076 const std::string&      
00077 EventType::user_type    (void) const
00078 {
00079     char sep = '#';
00080     std::string::size_type beg = m_user_type.find(sep);
00081     static std::string user_type;
00082     if (beg != std::string::npos) {
00083         user_type = m_user_type.substr(0, beg);
00084     }
00085     else {
00086         user_type = m_user_type;
00087     }
00088     return user_type;
00089 }
00090 
00091 
00092 void       
00093 EventType::get_detdescr_tags(NameTagPairVec& pairs)
00094 {
00095     // We must extract from m_user_type the dd tags for the moment to
00096     // avoid schema evolution.
00097 
00098     char sep = '#';
00099     bool done = false;
00100     std::string::size_type beg = m_user_type.find(sep);
00101     do {
00102         if (beg != std::string::npos) {
00103           std::string::size_type end1 = m_user_type.find(sep, beg+1);
00104             if (end1 != std::string::npos) {
00105               std::string::size_type end2 = m_user_type.find(sep, end1+1);
00106                 if (end2 != std::string::npos) {
00107                     // end2 is a new separator
00108                     std::string first  = m_user_type.substr(beg+1, end1-beg-1);
00109                     std::string second = m_user_type.substr(end1+1, end2-end1-1);
00110                     pairs.push_back(NameTagPair(first,second));
00111 
00112                     // continue with new beg
00113                     beg = end2;
00114                 }
00115                 else {
00116                     // end2 is the end of the string
00117                     std::string first  = m_user_type.substr(beg+1, end1-beg-1);
00118                     std::string second = m_user_type.substr(end1+1, m_user_type.size()-1);
00119                     pairs.push_back(NameTagPair(first,second));
00120                     done = true; // finished
00121                 }
00122             }
00123             else {
00124                 done = true; // finished
00125             }
00126         }
00127         else {
00128             done = true; // finished
00129         }
00130     } while (!done);
00131 }
00132 
00133 
00134 EventType::BitMaskIterator      
00135 EventType::bit_mask_begin       (void) const
00136 {
00137     return m_bit_mask.begin();
00138 }
00139 
00140 EventType::BitMaskIterator      
00141 EventType::bit_mask_end         (void) const
00142 {
00143     return m_bit_mask.end();
00144 }

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