52 template <
class T,
class Derived>
67 for(
int i = 0; i < N; i++)
68 if(!Add((T&)objs[i])) ret =
false;
72 int Remove(
const T& obj);
77 for(
int i = 0; i < N; i++)
81 int GetN()
const {
return m_Objs.size(); }
85 T& Get(
const RFKey& key)
const;
87 int GetIndex(
const RFKey& key)
const;
89 int GetIndex(
const T& obj)
const;
92 bool Contains(
const U& obj)
const{
94 for(
int i = 0; i < N; i++)
95 if(*m_Objs[i] == obj)
return true;
100 bool Contains(
const RFList<U>& objs)
const {
102 for(
int i = 0; i < N; i++)
103 if(!Contains(objs[i]))
109 bool IsSame(
const RFList<U>& objs)
const {
110 return Union(objs).GetN() == Intersection(objs).GetN();
114 Derived Union(
const RFList<U>& objs)
const {
115 Derived objs_this =
static_cast<const Derived&
>(*this);
121 Derived Intersection(
const RFList<U>& objs)
const {
124 for(
int i = 0; i < N; i++)
125 if(Contains(objs[i])) inter.Add(objs[i]);
130 Derived Complement(
const RFList<U>& objs)
const {
131 Derived comp =
static_cast<Derived&
>(*this);
133 for(
int i = 0; i < N; i++)
134 if(comp.Contains(objs.Get(i)))
135 comp.Remove(objs.Get(i));
139 Derived& operator = (T& obj){
142 return static_cast<Derived&
>(*this);
146 Derived& operator = (
const RFList<U>& objs){
149 return static_cast<Derived&
>(*this);
152 T& operator [] (
int i)
const;
154 T& operator [] (
const RFKey& key)
const;
156 bool operator == (
const T& obj)
const;
159 bool operator == (
const RFList<U>& objs)
const {
163 bool operator != (
const T& obj)
const;
166 bool operator != (
const RFList<U>& objs)
const {
167 return !IsSame(objs);
170 Derived operator + (T& obj)
const;
173 Derived operator + (
const RFList<U>& objs)
const {
174 Derived list =
static_cast<const Derived&
>(*this);
179 Derived operator - (
const T& obj)
const;
182 Derived operator-(
const RFList<U>& objs)
const;
184 Derived& operator += (T& obj);
187 Derived& operator += (
const RFList<U>& objs){
189 return static_cast<Derived&
>(*this);
192 Derived& operator -= (
const T& obj);
195 Derived& operator -= (
const RFList<U>& objs){
197 return static_cast<Derived&
>(*this);
201 std::vector<T*> m_Objs;
214 RFList(
const RFList<U>& objs) : RFListBase<T,RFList<T> >() {
215 RFListBase<T,RFList<T> >::Add(objs);
223 :
public RFListBase<State,RFList<RestFrames::State> > {
235 TLorentzVector GetFourVector()
const;
237 void Boost(
const TVector3& B)
const;
242 :
public RFListBase<RestFrame,RFList<RestFrames::RestFrame> > {
253 double GetMass()
const;
255 TLorentzVector GetFourVector()
const;
256 TLorentzVector GetFourVector(
const RestFrame& frame)
const;
257 TLorentzVector GetVisibleFourVector()
const;
258 TLorentzVector GetVisibleFourVector(
const RestFrame& frame)
const;
259 TLorentzVector GetInvisibleFourVector()
const;
260 TLorentzVector GetInvisibleFourVector(
const RestFrame& frame)
const;
261 double GetEnergy(
const RestFrame& frame)
const;
262 double GetMomentum(
const RestFrame& frame)
const;
285 typedef std::vector<RestFrames::RFList<RestFrame> > RestFrameListList;
286 typedef std::vector<RestFrames::RFList<State> > StateListList;
abstract base class for all Jigsaw objects
Base class for all RestFrame package objects.
abstract base class for all Group objects
abstract base class for all Frame objects
abstract base class for all State objects