LOGO

RestFrames  v1.0.0
RestFrames HEP Event Analysis Software Library
Jigsaw.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 Jigsaw_HH
31 #define Jigsaw_HH
32 
33 #include "RestFrames/RFBase.hh"
34 #include "RestFrames/Group.hh"
35 
36 namespace RestFrames {
37 
38  enum JigsawType { kVanillaJigsaw, kInvisibleJigsaw,
39  kCombinatoricJigsaw };
40 
42  // Jigsaw class
44  class Jigsaw : public RFBase {
45  public:
46  Jigsaw(const std::string& sname,
47  const std::string& stitle,
48  int Nchild, int Ndependancy);
49  Jigsaw();
50 
51  virtual ~Jigsaw();
52 
54  virtual void Clear();
55 
56  JigsawType GetType() const { return m_Type; }
57 
58  virtual std::string GetLabel() const { return "Jigsaw"; }
59 
61  virtual std::string PrintString(LogType type) const;
62 
63  bool IsInvisibleJigsaw() const;
64  bool IsCombinatoricJigsaw() const;
65 
66  virtual void SetGroup(Group& group = Group::Empty());
67  virtual Group& GetGroup() const;
68 
69  virtual ConstRestFrameList GetParentFrames() const;
70  virtual ConstRestFrameList const& GetChildFrames(int i) const;
71  virtual ConstRestFrameList const& GetDependancyFrames(int i) const;
72 
73  void RemoveFrame(const RestFrame& frame);
74  void RemoveFrames(const ConstRestFrameList& frames);
75 
76  static Jigsaw& Empty();
77 
78  protected:
79  JigsawType m_Type;
80  virtual bool IsSoundBody() const;
81 
82  virtual bool AnalyzeEvent() = 0;
83 
84  bool CanResolve(const State& state) const;
85  bool CanResolve(const ConstRestFrameList& frames) const;
86  bool DependsOnJigsaw(const Jigsaw& jigsaw) const;
87 
88  virtual bool InitializeTree();
89  virtual bool InitializeAnalysis();
90 
91  virtual bool InitializeDependancyJigsaws();
92  virtual bool InitializeJigsawExecutionList(JigsawList& exec_jigsaws) = 0;
93 
94  void AddChildFrame(const RestFrame& frame, int i = 0);
95  void AddDependancyFrame(const RestFrame& frame, int i = 0);
96 
97  virtual int GetNChildren() const;
98  virtual State& GetChildState(int i) const;
99  virtual StateList const& GetChildStates() const;
100 
101  int GetNDependancyStates() const;
102  virtual StateList const& GetDependancyStates(int i) const;
103 
104  void SetParentState();
105  virtual void SetParentState(State& state);
106  virtual State const& GetParentState() const;
107 
108  virtual State& GetNewChildState() = 0;
109 
110  virtual void FillGroupJigsawDependancies(JigsawList& jigsaws) const;
111  virtual void FillStateJigsawDependancies(JigsawList& jigsaws) const;
112 
113  private:
114  Group* m_GroupPtr;
115  State* m_ParentStatePtr;
116 
117  const int m_Nchild;
118  const int m_Ndeps;
119 
120  StateList m_ChildStates;
121  StateListList m_DependancyStates;
122 
123  std::vector<ConstRestFrameList> m_ChildFrames;
124  std::vector<ConstRestFrameList> m_DependancyFrames;
125 
126  JigsawList m_DependancyJigsaws;
127 
128  static int m_class_key;
129 
130  friend class TreePlot;
131  friend class Group;
132  friend class LabRecoFrame;
133  friend class InvisibleJigsaw;
134  friend class CombinatoricJigsaw;
135 
136  };
137 
138 }
139 
140 #endif
abstract base class for all Jigsaw objects
Definition: Jigsaw.hh:44
Base class for all RestFrame package objects.
Definition: RFBase.hh:53
abstract base class for all Group objects
Definition: Group.hh:46
virtual std::string PrintString(LogType type) const
String of information associated with Jigsaw.
Definition: Jigsaw.cc:100
abstract base class for all Frame objects
abstract base class for all State objects
Definition: State.hh:44
virtual void Clear()
Clears Jigsaw of all connections to other objects.
Definition: Jigsaw.cc:74