LOGO

RestFrames  v1.0.1
RestFrames HEP Event Analysis Software Library
Group.hh
Go to the documentation of this file.
1 // RestFrames: particle physics event analysis library
3 // --------------------------------------------------------------------
4 // Copyright (c) 2014-2016, Christopher Rogan
14 // This file is part of RestFrames.
15 //
16 // RestFrames is free software; you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation; either version 2 of the License, or
19 // (at your option) any later version.
20 //
21 // RestFrames is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with RestFrames. If not, see <http://www.gnu.org/licenses/>.
29 
30 #ifndef Group_HH
31 #define Group_HH
32 
33 #include "RestFrames/RFBase.hh"
34 
35 namespace RestFrames {
36 
37  class Jigsaw;
38  class RestFrame;
39 
40  enum GroupType { kVanillaGroup, kInvisibleGroup,
41  kCombinatoricGroup };
42 
44  // Group class
46  class Group : public RFBase {
47 
48  public:
49 
54  Group(const std::string& sname, const std::string& stitle);
55 
57  Group();
58 
59  virtual ~Group();
60 
62  virtual void Clear();
63 
65  bool IsInvisibleGroup() const;
66 
68  bool IsCombinatoricGroup() const;
69 
73  GroupType GetType() const { return m_Type; }
74 
84  virtual void AddFrame(RestFrame& frame);
85 
92  virtual void AddFrames(const RestFrameList& frames);
93 
104  virtual void AddJigsaw(Jigsaw& jigsaw);
105 
113  virtual void RemoveFrame(RestFrame& frame);
114 
119  void RemoveFrames();
120 
128  void RemoveJigsaw(Jigsaw& jigsaw);
129 
134  void RemoveJigsaws();
135 
139  bool ContainsFrame(const RestFrame& frame) const;
140 
144  int GetNFrames() const;
145 
146 
150  const RestFrameList& GetListFrames() const;
151 
155  const JigsawList& GetListJigsaws() const;
156 
160  static Group& Empty();
161 
162  protected:
163  GroupType m_Type;
164  State* m_GroupStatePtr;
165 
166  virtual bool InitializeAnalysis();
167  virtual bool ClearEvent() = 0;
168  virtual bool AnalyzeEvent() = 0;
169 
170  virtual State& InitializeParentState() = 0;
171  virtual State& GetParentState() const;
172 
173  int GetNChildStates() const;
174  virtual State& GetChildState(int i) const;
175 
176  State& GetChildState(const RestFrame& frame) const;
177  StateList GetChildStates(const RestFrameList& frames) const;
178 
179  RestFrame const& GetLabFrame() const;
180 
181  private:
182  RestFrameList m_Frames;
183  JigsawList m_Jigsaws;
184  StateList m_States;
185 
186  StateList m_StatesToResolve;
187  JigsawList m_JigsawsToUse;
188 
189  bool ResolveUnknowns();
190  bool ResolveState(const State& state);
191  bool InitializeJigsaw(Jigsaw& jigsaw);
192 
193  static int m_class_key;
194 
195  friend class TreePlot;
196  friend class ReconstructionFrame;
197  friend class LabRecoFrame;
198  friend class Jigsaw;
199 
200  };
201 
202 }
203 
204 #endif
RestFrames::Group::GetListJigsaws
const JigsawList & GetListJigsaws() const
Returns a list of jigsaws (Jigsaw) contained in this group.
Definition: Group.cc:169
RestFrames::Group::Empty
static Group & Empty()
Returns empty Group.
Definition: Group.cc:58
RestFrames::Group::RemoveFrames
void RemoveFrames()
Removes all frames (RestFrame) from this group.
Definition: Group.cc:127
RestFrames::Group::Clear
virtual void Clear()
Clears Group of all connections to other objects.
Definition: Group.cc:62
RestFrames::RestFrame
abstract base class for all Frame objects
Definition: RestFrame.hh:45
RestFrames::Group
abstract base class for all Group objects
Definition: Group.hh:46
RestFrames::RFList< RestFrame >
RestFrames::RFBase
Base class for all RestFrame package objects.
Definition: RFBase.hh:53
RestFrames::Group::RemoveJigsaws
void RemoveJigsaws()
Removes all jigsaws (Jigsaw) from current group.
Definition: Group.cc:146
RestFrames::Group::RemoveFrame
virtual void RemoveFrame(RestFrame &frame)
Removes a frame (RestFrame) from this group.
Definition: Group.cc:117
RestFrames::Group::AddJigsaw
virtual void AddJigsaw(Jigsaw &jigsaw)
Adds a jigsaw (Jigsaw) to current group.
Definition: Group.cc:99
RestFrames::Group::RemoveJigsaw
void RemoveJigsaw(Jigsaw &jigsaw)
Removes a jigsaw (Jigsaw) from this group.
Definition: Group.cc:134
RestFrames::Group::GetNFrames
int GetNFrames() const
Returns the number of frames (RestFrame) contained in this group.
Definition: Group.cc:161
RestFrames::LabRecoFrame
Definition: LabRecoFrame.hh:44
RestFrames::Group::AddFrame
virtual void AddFrame(RestFrame &frame)
Adds a frame (RestFrame) to this group.
Definition: Group.cc:83
RFBase.hh
RestFrames::TreePlot
Definition: TreePlot.hh:50
RestFrames::Group::Group
Group()
Empty constructor.
Definition: Group.cc:49
RestFrames::Group::GetListFrames
const RestFrameList & GetListFrames() const
Returns a list of frames (RestFrame) contained in this group.
Definition: Group.cc:165
RestFrames::Group::ContainsFrame
bool ContainsFrame(const RestFrame &frame) const
Is frame (RestFrame) contained in this group? (true/false)
Definition: Group.cc:157
RestFrames::Jigsaw
abstract base class for all Jigsaw objects
Definition: Jigsaw.hh:44
RestFrames::State
Abstract base class for all State objects.
Definition: State.hh:47
RestFrames::Group::IsCombinatoricGroup
bool IsCombinatoricGroup() const
Is this a CombinatoricGroup? (true/false)
Definition: Group.cc:79
RestFrames::Group::AddFrames
virtual void AddFrames(const RestFrameList &frames)
Adds a list of RestFrames to this group.
Definition: Group.cc:93
RestFrames::Group::GetType
GroupType GetType() const
Returns group (GroupType) type.
Definition: Group.hh:73
RestFrames::ReconstructionFrame
Definition: ReconstructionFrame.hh:41
RestFrames::Group::IsInvisibleGroup
bool IsInvisibleGroup() const
Is this an InvisibleGroup? (true/false)
Definition: Group.cc:75