LOGO

RestFrames  v1.0.1
RestFrames HEP Event Analysis Software Library
VisibleState.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 
32 #include "RestFrames/Jigsaw.hh"
33 
34 namespace RestFrames {
35 
36  VisibleState::VisibleState(const std::string& sname,
37  const std::string& stitle)
38  : State(sname, stitle)
39  {
40  m_Type = kVisibleState;
41  m_FramePtr = nullptr;
42  }
43 
45 
46  VisibleState::~VisibleState() {}
47 
49  m_FramePtr = nullptr;
50  State::Clear();
51  }
52 
54  return VisibleState::m_Empty;
55  }
56 
57  void VisibleState::AddFrame(const RestFrame& frame){
58  if(IsEmpty()) return;
59 
60  if(!frame) return;
61  if(!frame.IsVisibleFrame() || !frame.IsRecoFrame()) return;
62  m_FramePtr = static_cast<const VisibleRecoFrame*>(&frame);
63  m_Frames.Clear();
64  m_Frames += frame;
65  }
66 
67  bool VisibleState::IsFrame(const RestFrame& frame) const {
68  if(!frame) return false;
69  if(!m_FramePtr) return false;
70  return *m_FramePtr == frame;
71  }
72 
73  bool VisibleState::IsFrames(const ConstRestFrameList& frames) const {
74  return IsFrame(frames[0]);
75  }
76 
78  if(m_FramePtr)
79  return *m_FramePtr;
80  else
81  return RestFrame::Empty();
82  }
83 
85  if(!m_FramePtr) return;
86  SetFourVector(m_FramePtr->GetLabFrameFourVector());
87  SetCharge(m_FramePtr->GetCharge());
88  }
89 
90  void VisibleState::SetCharge(const RFCharge& charge){
91  m_Charge = charge;
92  }
93 
94  void VisibleState::SetCharge(int charge){
95  m_Charge = charge;
96  }
97 
98  void VisibleState::SetCharge(int charge_num, int charge_den){
99  m_Charge = RFCharge(charge_num, charge_den);
100  }
101 
102  VisibleState VisibleState::m_Empty;
103 }
RestFrames::VisibleState::AddFrame
virtual void AddFrame(const RestFrame &frame)
Adds a frame (RestFrame) to this state.
Definition: VisibleState.cc:57
RestFrames::RFCharge
Definition: RFCharge.hh:40
VisibleRecoFrame.hh
RestFrames::VisibleState::VisibleState
VisibleState()
Empty constructor.
Definition: VisibleState.cc:44
RestFrames::VisibleFrame::GetCharge
virtual RFCharge GetCharge() const
Returns charge of current frame.
Definition: VisibleFrame.cc:85
RestFrames::VisibleState::SetLabFrameFourVector
virtual void SetLabFrameFourVector()
Sets four-vector of lab frame.
Definition: VisibleState.cc:84
RestFrames::RestFrame::IsRecoFrame
bool IsRecoFrame() const
Is this an ReconstructionFrame ? (yes/no)
Definition: RestFrame.cc:113
RestFrames::RestFrame
abstract base class for all Frame objects
Definition: RestFrame.hh:45
RestFrames::RFBase::IsEmpty
bool IsEmpty() const
Checks whether this is default (empty) instance of class.
Definition: RFBase.cc:84
RestFrames::State::SetFourVector
virtual void SetFourVector(const TLorentzVector &V)
Sets four-vector of this frame.
Definition: State.cc:161
RestFrames::RFList< const RestFrame >
RestFrames::VisibleFrame::GetLabFrameFourVector
virtual TLorentzVector GetLabFrameFourVector() const
Returns lab frame's four-vector.
Definition: VisibleFrame.cc:110
RestFrames::VisibleRecoFrame
Definition: VisibleRecoFrame.hh:41
RestFrames::VisibleState::IsFrame
virtual bool IsFrame(const RestFrame &frame) const
Checks if frame of state corresponds to frame
Definition: VisibleState.cc:67
RestFrames::VisibleState::Empty
static VisibleState & Empty()
Returns empty VisibleState.
Definition: VisibleState.cc:53
RestFrames::VisibleState
Definition: VisibleState.hh:39
Jigsaw.hh
RestFrames::State::Clear
virtual void Clear()
Clears State of all connections to other objects.
Definition: State.cc:61
RestFrames::VisibleState::Clear
virtual void Clear()
Clears Visible State to all connections to other objects.
Definition: VisibleState.cc:48
VisibleState.hh
RestFrames::RestFrame::IsVisibleFrame
bool IsVisibleFrame() const
Is this a VisibleFrame ? (yes/no)
Definition: RestFrame.cc:97
RestFrames::VisibleState::SetCharge
virtual void SetCharge(const RFCharge &charge)
Sets charge of this state.
Definition: VisibleState.cc:90
RestFrames::State
Abstract base class for all State objects.
Definition: State.hh:47
RestFrames::RestFrame::Empty
static RestFrame & Empty()
Returns empty RestFrame.
Definition: RestFrame.cc:62
RestFrames::VisibleState::GetFrame
virtual RestFrame const & GetFrame() const
Returns frame (RestFrame) of this state.
Definition: VisibleState.cc:77
RestFrames::VisibleState::IsFrames
virtual bool IsFrames(const ConstRestFrameList &frames) const
Checks if frames lists of state corresponds frames
Definition: VisibleState.cc:73