LOGO

RestFrames  v1.0.1
RestFrames HEP Event Analysis Software Library
VisibleFrame.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 
33 
34 namespace RestFrames {
36  // VisibleFrame class methods
38  template <class T>
39  VisibleFrame<T>::VisibleFrame(const std::string& sname,
40  const std::string& stitle)
41  : T(sname, stitle)
42  {
43  T::m_Type = kVisibleFrame;
44  m_Charge = 0;
45  }
46 
47  template <class T>
48  VisibleFrame<T>::VisibleFrame() : T() {}
49 
50  template <class T>
51  VisibleFrame<T>::~VisibleFrame() {}
52 
53  template <class T>
54  bool VisibleFrame<T>::IsSoundBody() const {
55  if(RFBase::IsSoundBody())
56  return true;
57  if(!RestFrame::IsSoundBody())
58  return T::SetBody(false);
59 
60  int Nchild = T::GetNChildren();
61  if(Nchild > 0 || !T::GetParentFrame()){
62  T::m_Log << LogWarning << "Problem with parent or child frames" << LogEnd;
63  return T::SetBody(false);
64  }
65  return T::SetBody(true);
66  }
67 
68  template <class T>
69  void VisibleFrame<T>::SetCharge(const RFCharge& charge){
70  m_Charge = charge;
71  }
72 
73  template <class T>
74  void VisibleFrame<T>::SetCharge(int charge){
75  m_Charge = charge;
76  }
77 
78  template <class T>
79  void VisibleFrame<T>::SetCharge(int charge_num, int charge_den){
80  RFCharge charge(charge_num, charge_den);
81  m_Charge = charge;
82  }
83 
84  template <class T>
85  RFCharge VisibleFrame<T>::GetCharge() const {
86  return m_Charge;
87  }
88 
89  template <class T>
90  void VisibleFrame<T>::SetLabFrameFourVector(const TLorentzVector& V,
91  const RFCharge& charge){
92  m_Lab_P.SetVectM(V.Vect(),V.M());
93  SetCharge(charge);
94  }
95 
96  template <class T>
97  void VisibleFrame<T>::SetLabFrameFourVector(const TLorentzVector& V,
98  int charge){
99  SetLabFrameFourVector(V, RFCharge(charge));
100  }
101 
102  template <class T>
103  void VisibleFrame<T>::SetLabFrameFourVector(const TLorentzVector& V,
104  int charge_num,
105  int charge_den){
106  SetLabFrameFourVector(V, RFCharge(charge_num,charge_den));
107  }
108 
109  template <class T>
110  TLorentzVector VisibleFrame<T>::GetLabFrameFourVector() const {
111  TLorentzVector V;
112  V.SetVectM(m_Lab_P.Vect(),m_Lab_P.M());
113  return V;
114  }
115 
116  template class VisibleFrame<ReconstructionFrame>;
117  template class VisibleFrame<GeneratorFrame>;
118 
119 }