LOGO

RestFrames  v1.0.0
RestFrames HEP Event Analysis Software Library
CombinatoricJigsaw.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 CombinatoricJigsaw_HH
31 #define CombinatoricJigsaw_HH
32 
33 #include "RestFrames/RestFrame.hh"
34 #include "RestFrames/Jigsaw.hh"
37 
38 namespace RestFrames {
39 
40  class CombinatoricJigsaw : public Jigsaw {
41  public:
42  //constructor and destructor
43  CombinatoricJigsaw(const std::string& sname,
44  const std::string& stitle,
45  int Ncomb, int Nobject);
47  virtual ~CombinatoricJigsaw();
48 
49  virtual void Clear();
50 
51  static CombinatoricJigsaw& Empty();
52 
53  virtual void SetGroup(Group& group = Group::Empty());
54  virtual CombinatoricGroup& GetGroup() const;
55 
56  virtual void AddCombFrame(const RestFrame& frame, int i = 0);
57  void AddCombFrames(const ConstRestFrameList& frames, int i = 0);
58 
59  virtual void AddObjectFrame(const RestFrame& frame, int i = 0);
60  void AddObjectFrames(const ConstRestFrameList& frames, int i = 0);
61 
62  void SetCombCharge(const RFCharge& charge, int i);
63  void SetCombCharge(int charge, int i);
64  void SetCombCharge(int charge_num, int charge_den, int i);
65  void UnsetCombCharge(int i);
66 
67  void SetObjectCharge(const RFCharge& charge, int i);
68  void SetObjectCharge(int charge, int i);
69  void SetObjectCharge(int charge_num, int charge_den, int i);
70  void UnsetObjectCharge(int i);
71 
72  protected:
73  virtual bool IsSoundBody() const;
74  CombinatoricState& GetNewChildState();
75 
76  virtual bool InitializeAnalysis();
77 
78  virtual bool InitializeCombinatoric();
79  virtual bool LoopCombinatoric();
80 
81  virtual bool EvaluateMetric(double& metric) const = 0;
82 
83  virtual bool AnalyzeEvent();
84 
85  int GetNInputStates() const;
86  VisibleState& GetInputState(int i = 0) const;
87 
88  int GetNinputForChild(int i = 0) const;
89  bool IsNinputExclForChild(int i = 0) const;
90 
91  bool IsChargeSetForChild(int i = 0) const;
92  RFCharge GetChargeForChild(int i = 0) const;
93  bool IsChargeSetForObject(int i = 0) const;
94  RFCharge GetChargeForObject(int i = 0) const;
95 
96  void SetParentState(State& state = State::Empty());
97  CombinatoricState const& GetParentState() const;
98 
99  CombinatoricState& GetChildState(int i) const;
100 
101  bool InitializeJigsawExecutionList(JigsawList& exec_jigsaws);
102 
103  JigsawList m_ExecuteJigsaws;
104  bool ExecuteDependancyJigsaws();
105 
106  private:
107  const int m_Ncomb;
108  const int m_Nobj;
109 
110  VisibleStateList m_InputStates;
111 
112  int m_NinputTOT;
113  bool m_NExclusiveTOT;
114  std::vector<int> m_NForChild;
115  std::vector<int> m_NExclusive;
116  mutable std::map<int, RFCharge> m_ChargeForChild;
117  mutable std::map<int, RFCharge> m_ChargeForObject;
118  };
119 
120 }
121 
122 #endif
abstract base class for all Jigsaw objects
Definition: Jigsaw.hh:44
virtual void Clear()
Clears Jigsaw of all connections to other objects.
abstract base class for all Group objects
Definition: Group.hh:46
abstract base class for all Frame objects
abstract base class for all State objects
Definition: State.hh:44