All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
include/N3AnaBase/event/tracking.h
00001 #ifndef __N3AnaBase__tracking_h
00002 #define __N3AnaBase__tracking_h 1
00003 
00004 #include <stdexcept>
00005 #include <iostream>
00006 #include <sstream>
00007 #include <string>
00008 #include <list>
00009 
00010 #include <datatools/serialization/serialization.h>
00011 #include <datatools/utils/properties.h>
00012 
00013 #include <N3AnaBase/event/hit_info.h>
00014 #include <N3AnaBase/event/track.h>
00015 
00016 namespace nemo3 {
00017 
00018   class ana_event;
00019   
00034 
00035   class tracking :
00036     public datatools::utils::i_tree_dumpable,
00037     public datatools::utils::i_clear,
00038     public datatools::serialization::i_serializable
00039   {
00040   public:
00041 
00042     static const size_t MAX_NUMBER_OF_TRACKS_NEMOS = 9;
00043 
00045     typedef std::list<track> track_col;
00046 
00048     typedef std::list<int> scin_hit_number_col;
00049 
00050   private:
00051 
00052     bool                         __debug;
00053     std::string                  __name;
00054     datatools::utils::properties __properties;
00055     track_col                    __tracks;
00056     gg_hit_info_col              __unassociated_gg_hits;
00057     scin_hit_info_col            __unassociated_scin_hits;
00058     scin_hit_number_col         __associated_scin_numbers;
00059 
00060   public:
00061 
00063     bool is_debug () const;
00064 
00066     void set_debug (bool);
00067 
00069     const std::string & get_name () const;
00070 
00072     void set_name (const std::string & name_);
00073 
00075     const track_col & tracks () const;
00076 
00078     track_col & tracks ();
00079 
00081     int get_number_of_tracks () const
00082     {
00083       return __tracks.size ();
00084     }
00085 
00087     int get_number_of_unassociated_gg_hits () const
00088     {
00089       return __unassociated_gg_hits.size ();
00090     }
00091 
00093     int get_number_of_unassociated_scin_hits () const
00094     {
00095       return __unassociated_scin_hits.size ();
00096     }
00097 
00099     void add_track (const track &);
00100 
00102     const track & get_track (int i_) const;
00103 
00105     track_col::const_iterator get_track_with_scin_nb (int i_) const;
00106 
00108     track & get_track_no_const (int i_);
00109 
00111     const gg_hit & get_unassociated_gg_hit (int i_) const;
00112 
00114     const scin_hit & get_unassociated_scin_hit (int i_) const;
00115 
00117     const scin_hit_info & get_unassociated_scin_info (int i_) const;
00118 
00120     const gg_hit_info_col & get_unassociated_gg_hits () const;
00121     
00123     gg_hit_info_col & get_unassociated_gg_hits ();
00124 
00126     const scin_hit_info_col & get_unassociated_scin_hits () const;
00127 
00129     scin_hit_info_col & get_unassociated_scin_hits ();
00130 
00132     scin_hit_number_col & get_associated_scin_numbers () {return __associated_scin_numbers;};
00133 
00135     const scin_hit_number_col & get_associated_scin_numbers () const
00136     {return __associated_scin_numbers;}
00137 
00139     int get_number_of_associated_scin () const
00140     {return __associated_scin_numbers.size();}
00141 
00143     const datatools::utils::properties & properties () const;
00144 
00146     const datatools::utils::properties & get_properties_const () const
00147     {
00148       return properties ();
00149     }
00150 
00152     const datatools::utils::properties & get_properties_ro () const
00153     {
00154       return properties ();
00155     }
00156 
00158     datatools::utils::properties & properties ();
00159 
00161     datatools::utils::properties & get_properties ()
00162     {
00163       return properties ();
00164     }
00165 
00167     datatools::utils::properties & get_properties_rw ()
00168     {
00169       return properties ();
00170     }
00171 
00172   public:
00173     
00175     tracking (const std::string & name_ = "", bool debug_ = false);
00176 
00178     virtual ~tracking ();
00179 
00181     virtual void clear ();
00182 
00184     virtual void tree_dump (std::ostream & out_         = std::cerr,
00185                             const std::string & title_  = "",
00186                             const std::string & indent_ = "",
00187                             bool inherit_               = false) const;
00188 
00190     void dump () const
00191     {
00192       tree_dump (std::clog);
00193     }
00195     static const std::string SERIAL_TAG;
00196 
00198     virtual const std::string & get_serial_tag () const;
00199 
00200   private:
00201 
00203     friend class boost::serialization::access;
00204 
00206     template<class Archive>
00207     void serialize (Archive            & ar_,
00208                     const unsigned int version_)
00209     {
00210       ar_ & boost::serialization::make_nvp ("name",       __name);
00211       ar_ & boost::serialization::make_nvp ("properties", __properties);
00212       ar_ & boost::serialization::make_nvp ("tracks",     __tracks);
00213       ar_ & boost::serialization::make_nvp ("unassociated_gg_hits",
00214                                             __unassociated_gg_hits);
00215       ar_ & boost::serialization::make_nvp ("unassociated_scin_hits",
00216                                             __unassociated_scin_hits);
00217       if (version_>0)
00218         {
00219           ar_ & boost::serialization::make_nvp ("associated_scin_numbers",   __associated_scin_numbers);
00220         }
00221     }
00222 
00223   };
00224 
00225 } // end of namespace nemo3
00226 
00227 BOOST_CLASS_VERSION(nemo3::tracking, 1)
00228 #endif // __N3AnaBase__tracking_h
00229 
00230 // end of tracking.h