LOGO

RestFrames  v1.0.1
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 
49  CombinatoricJigsaw(const std::string& sname,
50  const std::string& stitle,
51  int Ncomb, int Nobject);
52 
55  virtual ~CombinatoricJigsaw();
56 
58  virtual void Clear();
59 
63  static CombinatoricJigsaw& Empty();
64 
74  virtual void SetGroup(Group& group = Group::Empty());
75 
79  virtual CombinatoricGroup& GetGroup() const;
80 
91  virtual void AddCombFrame(const RestFrame& frame, int i = 0);
92 
103  void AddCombFrames(const ConstRestFrameList& frames, int i = 0);
104 
115  virtual void AddObjectFrame(const RestFrame& frame, int i = 0);
116 
127  void AddObjectFrames(const ConstRestFrameList& frames, int i = 0);
128 
136  void SetCombCharge(const RFCharge& charge, int i);
137 
145  void SetCombCharge(int charge, int i);
146 
155  void SetCombCharge(int charge_num, int charge_den, int i);
156 
160  void UnsetCombCharge(int i);
161 
169  void SetObjectCharge(const RFCharge& charge, int i);
170 
178  void SetObjectCharge(int charge, int i);
179 
188  void SetObjectCharge(int charge_num, int charge_den, int i);
189 
193  void UnsetObjectCharge(int i);
194 
199  void SetTransverse(bool tran = true, const TVector3& axis = RestFrame::GetAxis());
200 
201  protected:
202  virtual bool IsSoundBody() const;
203  CombinatoricState& GetNewChildState();
204 
205  virtual bool InitializeAnalysis();
206 
207  virtual bool InitializeCombinatoric();
208  virtual bool LoopCombinatoric();
209 
210  virtual bool EvaluateMetric(double& metric) const = 0;
211 
212  virtual bool AnalyzeEvent();
213 
214  int GetNInputStates() const;
215  VisibleState& GetInputState(int i = 0) const;
216 
217  int GetNinputForChild(int i = 0) const;
218  bool IsNinputExclForChild(int i = 0) const;
219 
220  bool IsChargeSetForChild(int i = 0) const;
221  RFCharge GetChargeForChild(int i = 0) const;
222  bool IsChargeSetForObject(int i = 0) const;
223  RFCharge GetChargeForObject(int i = 0) const;
224 
225  void SetParentState(State& state = State::Empty());
226  CombinatoricState const& GetParentState() const;
227 
228  CombinatoricState& GetChildState(int i) const;
229 
230  bool InitializeJigsawExecutionList(JigsawList& exec_jigsaws, JigsawList& todo_jigsaws);
231 
232  JigsawList m_ExecuteJigsaws;
233  bool ExecuteDependancyJigsaws();
234 
235  bool IsTransverse() const;
236  const TVector3& GetTransverseAxis() const;
237 
238  private:
239  const int m_Ncomb;
240  const int m_Nobj;
241 
242  VisibleStateList m_InputStates;
243 
244  int m_NinputTOT;
245  bool m_NExclusiveTOT;
246  std::vector<int> m_NForChild;
247  std::vector<int> m_NExclusive;
248  mutable std::map<int, RFCharge> m_ChargeForChild;
249  mutable std::map<int, RFCharge> m_ChargeForObject;
250 
251  bool m_SetTransverse;
252  TVector3 m_TranAxis;
253  };
254 
255 }
256 
257 #endif
RestFrames::CombinatoricState
Definition: CombinatoricState.hh:43
RestFrames::RFCharge
Definition: RFCharge.hh:40
RestFrames::Group::Empty
static Group & Empty()
Returns empty Group.
Definition: Group.cc:58
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< const RestFrame >
RestFrames::CombinatoricJigsaw::SetTransverse
void SetTransverse(bool tran=true, const TVector3 &axis=RestFrame::GetAxis())
Sets transverse momentum.
Definition: CombinatoricJigsaw.cc:328
RestFrames::CombinatoricJigsaw::SetObjectCharge
void SetObjectCharge(const RFCharge &charge, int i)
Sets charge of ith object frame.
Definition: CombinatoricJigsaw.cc:147
RestFrames::VisibleState
Definition: VisibleState.hh:39
RestFrames::CombinatoricJigsaw::Empty
static CombinatoricJigsaw & Empty()
Returns empty CombinatoricJigsaw.
Definition: CombinatoricJigsaw.cc:57
RestFrames::CombinatoricJigsaw::AddCombFrames
void AddCombFrames(const ConstRestFrameList &frames, int i=0)
Adds a list of frames (RestFrame) to this jigsaw.
Definition: CombinatoricJigsaw.cc:104
Jigsaw.hh
RestFrames::CombinatoricJigsaw::AddCombFrame
virtual void AddCombFrame(const RestFrame &frame, int i=0)
Adds a frame (RestFrame) to this jigsaw.
Definition: CombinatoricJigsaw.cc:94
RestFrames::CombinatoricJigsaw::CombinatoricJigsaw
CombinatoricJigsaw()
Empty constructor.
Definition: CombinatoricJigsaw.cc:48
RestFrames::CombinatoricJigsaw::GetGroup
virtual CombinatoricGroup & GetGroup() const
Returns group (Group) associated with this jigsaw.
Definition: CombinatoricJigsaw.cc:67
CombinatoricState.hh
CombinatoricGroup.hh
RestFrames::CombinatoricJigsaw::AddObjectFrames
void AddObjectFrames(const ConstRestFrameList &frames, int i=0)
Adds a frame to this jigsaw.
Definition: CombinatoricJigsaw.cc:121
RestFrames::CombinatoricJigsaw::Clear
virtual void Clear()
Clears CombinatoricJigsaw from all connections to other objects.
Definition: CombinatoricJigsaw.cc:53
RestFrames::State::Empty
static State & Empty()
Returns empty state.
Definition: State.cc:68
RestFrames::CombinatoricJigsaw
Definition: CombinatoricJigsaw.hh:40
RestFrames::CombinatoricJigsaw::AddObjectFrame
virtual void AddObjectFrame(const RestFrame &frame, int i=0)
Adds a frame to this jigsaw.
Definition: CombinatoricJigsaw.cc:110
RestFrames::RestFrame::GetAxis
static TVector3 const & GetAxis()
Retrieve axis which defines transverse plane.
Definition: RestFrame.cc:76
RestFrames::CombinatoricJigsaw::SetGroup
virtual void SetGroup(Group &group=Group::Empty())
Sets group (Group) to current jigsaw.
Definition: CombinatoricJigsaw.cc:61
RestFrames::CombinatoricJigsaw::UnsetObjectCharge
void UnsetObjectCharge(int i)
Unsets charge of the ith object frame.
Definition: CombinatoricJigsaw.cc:162
RestFrames::CombinatoricJigsaw::UnsetCombCharge
void UnsetCombCharge(int i)
Unsets charge of the ith combinatoric frame.
Definition: CombinatoricJigsaw.cc:142
RestFrames::CombinatoricGroup
Definition: CombinatoricGroup.hh:39
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::CombinatoricJigsaw::SetCombCharge
void SetCombCharge(const RFCharge &charge, int i)
Sets charge of ith combinatoric frame.
Definition: CombinatoricJigsaw.cc:127
RestFrame.hh