LOGO

RestFrames  v1.0.0
RestFrames HEP Event Analysis Software Library
InvisibleGroup.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 #include "RestFrames/Jigsaw.hh"
34 
35 namespace RestFrames {
36 
38  // InvisibleGroup class
40 
41  InvisibleGroup::InvisibleGroup(const std::string& sname,
42  const std::string& stitle) :
43  Group(sname, stitle)
44  {
45  m_Type = kInvisibleGroup;
46  }
47 
48  InvisibleGroup::InvisibleGroup() : Group() {}
49 
50 
51  InvisibleGroup::~InvisibleGroup() {}
52 
53  InvisibleGroup& InvisibleGroup::Empty(){
54  return InvisibleGroup::m_Empty;
55  }
56 
58  Group::Clear();
59  }
60 
61  void InvisibleGroup::AddFrame(RestFrame& frame){
62  if(!frame) return;
63  if(!frame.IsInvisibleFrame()) return;
64  if(!frame.IsRecoFrame()) return;
65  Group::AddFrame(frame);
66  }
67 
68  void InvisibleGroup::AddJigsaw(Jigsaw& jigsaw){
69  if(!jigsaw) return;
70  if(!jigsaw.IsInvisibleJigsaw()) return;
71  Group::AddJigsaw(jigsaw);
72  }
73 
74  InvisibleState& InvisibleGroup::InitializeParentState(){
75  std::string name = GetName()+"_parent";
76  InvisibleState* statePtr = new InvisibleState(name, name);
77  AddDependent(statePtr);
78  return *statePtr;
79  }
80 
81  InvisibleState& InvisibleGroup::GetParentState() const {
82  if(m_GroupStatePtr)
83  return static_cast<InvisibleState&>(*m_GroupStatePtr);
84  else
85  return InvisibleState::Empty();
86  }
87 
88  InvisibleState& InvisibleGroup::GetChildState(int i) const {
89  if(!Group::GetChildState(i))
90  return InvisibleState::Empty();
91  else
92  return static_cast<InvisibleState&>(Group::GetChildState(i));
93  }
94 
95  bool InvisibleGroup::ClearEvent(){
96  SetSpirit(false);
97  if(!IsSoundMind())
98  return SetSpirit(false);
99  m_Lab_P.SetPxPyPzE(0.,0.,0.,0.);
100  return true;
101  }
102 
103  void InvisibleGroup::SetMass(double M){
104  m_Lab_P.SetVectM(m_Lab_P.Vect(), std::max(0., M));
105  }
106 
107  void InvisibleGroup::SetLabFrameFourVector(const TLorentzVector& V){
108  m_Lab_P.SetVectM(V.Vect(), std::max(0., V.M()));
109  }
110 
111  void InvisibleGroup::SetLabFrameThreeVector(const TVector3& V){
112  m_Lab_P.SetVectM(V, m_Lab_P.M());
113  }
114 
115  TLorentzVector InvisibleGroup::GetLabFrameFourVector() const {
116  return m_Lab_P;
117  }
118 
119  bool InvisibleGroup::AnalyzeEvent(){
120  if(!IsSoundMind()){
121  UnSoundMind(RF_FUNCTION);
122  return SetSpirit(false);
123  }
124  m_GroupStatePtr->SetFourVector(m_Lab_P);
125  return SetSpirit(true);
126  }
127 
128  InvisibleGroup InvisibleGroup::m_Empty;
129 
130 }
std::string GetName() const
Returns object name.
Definition: RFBase.cc:104
virtual void Clear()
Clears Group of all connections to other objects.
void AddDependent(RFBase *dep)
pointer to RFBase object owned by this one
Definition: RFBase.cc:88
virtual void Clear()
Clears Group of all connections to other objects.
Definition: Group.cc:62
abstract base class for all Frame objects