Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PhysicsNtuple/Event.h

Go to the documentation of this file.
00001 #ifndef ANP_EVENT_H
00002 #define ANP_EVENT_H
00003 
00004 // $Id: Event.h,v 1.21 2009/10/15 18:30:13 jyuko Exp $
00005 //
00006 // Reconstucted neutrino event
00007 //
00008 
00009 // C++
00010 #include <vector>
00011 
00012 // ROOT
00013 #include "Rtypes.h"
00014 
00015 // Local
00016 #include "PhysicsNtuple/DataItem.h"
00017 #include "PhysicsNtuple/Basic.h"
00018 #include "PhysicsNtuple/RecoNu.h"
00019 #include "PhysicsNtuple/Vertex.h"
00020 
00021 namespace Anp
00022 {
00023    class Shower;
00024    class Track;
00025 
00026    class Event
00027    {
00028    public:
00029       
00030       Event();
00031       ~Event();
00032       
00033       bool Add(int key, float data);
00034 
00035       void SetNu(const RecoNu &value);
00036       void SetPid(float value);
00037       void SetWeight(double value);
00038 
00039       void Clear();
00040       void ClearData();
00041       
00042       DataIterator DataBegIterator();
00043       DataIterator DataEndIterator();
00044       DataIterator Erase(DataIterator it);
00045       DataIterator Erase(DataIterator ibeg, DataIterator iend);
00046 
00047       RecoNu& GetRecoNu();
00048 
00049       const Basic&  GetBasic() const;
00050       const RecoNu& GetNu()    const;
00051       const Vertex& GetVtx()   const;
00052 
00053       short GetNShowers() const;
00054       short GetNTracks()  const;
00055 
00056       short EventIndex() const;
00057       float Gev() const;
00058       float Pid() const;
00059 
00060       double Weight() const;
00061 
00062       bool MatchTrack (short index) const;
00063       bool MatchShower(short index) const;
00064       bool FirstShower(short index) const;
00065 
00066       DataIter DataBeg() const;
00067       DataIter DataEnd() const;
00068 
00069       bool KeyExists(short key) const;
00070       float operator[](short key) const;
00071       float DataAt(short key) const;
00072 
00073       void Print(std::ostream &os = std::cout) const;
00074 
00075    private:
00076       
00077       friend class FillEvent;
00078 
00079       Basic    fBasic;
00080       RecoNu   fNu;
00081       Vertex   fVtx;
00082 
00083       Short_t  index;    // event index in a snarl
00084       Float_t  gev;      // default event energy
00085       Float_t  pid;      // classification decision value
00086 
00087       DataVec  fData;    // vector of DataItem<short,float>
00088 
00089       std::vector<Short_t> fShower;
00090       std::vector<Short_t> fTrack;      
00091    };
00092 
00093    bool operator==(short index, const Event &event);
00094    bool operator==(const Event &event, short index);
00095    bool operator==(const Event &lhs, const Event &rhs);
00096 
00097    bool operator==(const Event  &event,  const Shower &shower);
00098    bool operator==(const Shower &shower, const Event  &event);
00099 
00100    bool operator==(const Track &track, const Event &event);
00101    bool operator==(const Event &event, const Track &track);
00102 
00103    //
00104    // Inlined member functions
00105    //
00106    inline void Event::SetNu(const RecoNu &value)    { fNu = value; }
00107    inline void Event::SetPid(const float value)     { pid = value; }
00108    inline void Event::SetWeight(const double value) { fNu.SetWeight(value); }
00109 
00110    inline DataIterator Event::DataBegIterator() { return fData.begin(); }
00111    inline DataIterator Event::DataEndIterator() { return fData.end(); }
00112 
00113    inline DataIterator Event::Erase(DataIterator it) { return fData.erase(it); }
00114    inline DataIterator Event::Erase(DataIterator ibeg, DataIterator iend)
00115    {
00116       return fData.erase(ibeg, iend);
00117    }
00118 
00119    inline DataIter Event::DataBeg() const { return fData.begin(); }
00120    inline DataIter Event::DataEnd() const { return fData.end(); }
00121    
00122    inline bool Event::MatchTrack(const short index) const
00123    {
00124       return (std::find(fTrack.begin(), fTrack.end(), index) != fTrack.end());
00125    }
00126    inline bool Event::MatchShower(const short index) const
00127    {
00128       return (std::find(fShower.begin(), fShower.end(), index) != fShower.end());
00129    }
00130 
00131    inline RecoNu& Event::GetRecoNu() { return fNu; }
00132 
00133    inline const Basic&  Event::GetBasic() const { return fBasic; }
00134    inline const RecoNu& Event::GetNu()    const { return fNu; }
00135    inline const Vertex& Event::GetVtx()   const { return fVtx; }
00136 
00137    inline short Event::GetNShowers() const { return fShower.size(); }
00138    inline short Event::GetNTracks()  const { return fTrack.size(); }
00139 
00140    inline short Event::EventIndex() const { return index; }
00141    inline float Event::Gev() const { return gev; }
00142    inline float Event::Pid() const { return pid; }
00143 
00144    inline double Event::Weight() const { return fNu.Weight(); }
00145 
00146    inline bool Event::KeyExists(const short key) const
00147    {
00148       return (std::find(fData.begin(), fData.end(), key) != fData.end());
00149    }
00150    inline float Event::operator[](const short key) const
00151    {
00152       return DataAt(key);
00153    }
00154 
00155    //
00156    // Inlined global operators
00157    //
00158    inline bool operator==(const short index, const Event &event)
00159    {
00160       return (index == event.EventIndex());
00161    }
00162    inline bool operator==(const Event &event, const short index)
00163    {
00164       return (index == event.EventIndex());
00165    }
00166    inline bool operator==(const Event &lhs, const Event &rhs)
00167    {
00168       return (lhs.EventIndex() == rhs.EventIndex());
00169    }
00170 }
00171 
00172 #endif

Generated on Mon Feb 15 11:06:39 2010 for loon by  doxygen 1.3.9.1