LOGO

RestFrames  v1.0.1
RestFrames HEP Event Analysis Software Library
CombinatoricState.cc
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 
31 #include "RestFrames/Jigsaw.hh"
33 #include "RestFrames/RestFrame.hh"
34 
35 namespace RestFrames {
36 
38  // CombinatoricState class
40 
41  CombinatoricState::CombinatoricState(const std::string& sname,
42  const std::string& stitle)
43  : State(sname, stitle)
44  {
45  m_Type = kCombinatoricState;
46  }
47 
48  CombinatoricState::CombinatoricState() : State() {}
49 
50  CombinatoricState::~CombinatoricState() {}
51 
52  CombinatoricState& CombinatoricState::Empty(){
53  return CombinatoricState::m_Empty;
54  }
55 
57  ClearElements();
58  State::Clear();
59  }
60 
61  void CombinatoricState::AddFrame(const RestFrame& frame){
62  if(IsEmpty()) return;
63 
64  if(!frame) return;
65  if(frame.IsVisibleFrame() &&
66  frame.IsRecoFrame())
67  m_Frames += frame;
68 
69  }
70 
71  void CombinatoricState::SetParentJigsaw(Jigsaw& jigsaw){
72  if(!jigsaw) return;
73  if(jigsaw.IsCombinatoricJigsaw())
74  State::SetParentJigsaw(jigsaw);
75  }
76 
77  void CombinatoricState::SetChildJigsaw(Jigsaw& jigsaw){
78  if(!jigsaw) return;
79  if(jigsaw.IsCombinatoricJigsaw())
80  State::SetChildJigsaw(jigsaw);
81  }
82 
83  void CombinatoricState::ClearElements(){
84  m_Elements.Clear();
85  }
86 
87  void CombinatoricState::AddElement(VisibleState& state){
88  if(IsEmpty()) return;
89  m_Elements += state;
90  }
91 
92  void CombinatoricState::AddElements(const VisibleStateList& states){
93  if(IsEmpty()) return;
94  m_Elements += states;
95  }
96 
97  VisibleStateList const& CombinatoricState::GetElements() const {
98  return m_Elements;
99  }
100 
101  int CombinatoricState::GetNElements() const {
102  return m_Elements.GetN();
103  }
104 
105  bool CombinatoricState::ContainsElement(const RFKey& key) const {
106  return m_Elements.Contains(key);
107  }
108 
109  bool CombinatoricState::ContainsElement(const State& state) const {
110  return m_Elements.Contains(state);
111  }
112 
113  VisibleState const& CombinatoricState::GetElement(const RFKey& key) const {
114  return m_Elements.Get(key);
115  }
116 
117  void CombinatoricState::Boost(const TVector3& B){
118  StateList(m_Elements).Boost(B);
119  State::Boost(B);
120  }
121 
122  TLorentzVector CombinatoricState::GetFourVector() const {
123  return StateList(m_Elements).GetFourVector();
124  }
125 
126  RFCharge CombinatoricState::GetCharge() const {
127  return StateList(m_Elements).GetCharge();
128  }
129 
130  CombinatoricState CombinatoricState::m_Empty;
131 
132 }
bool IsEmpty() const
Checks whether this is default (empty) instance of class.
Definition: RFBase.cc:84
virtual void Clear()
Clears RFBase of all connections to other objects.
Definition: State.cc:61
virtual void Clear()
Clears RFBase of all connections to other objects.
abstract base class for all Frame objects