RestFrames
v1.0.1
RestFrames HEP Event Analysis Software Library
|
Go to the documentation of this file.
36 namespace RestFrames {
42 const std::string& stitle)
52 ReconstructionFrame::~ReconstructionFrame(){
58 m_ChildStates.clear();
74 bool contains = m_ChildFrames.Contains(frame);
75 m_ChildBoosts.erase(&frame);
76 m_ChildStates.erase(&frame);
77 m_ChildFrames.Remove(frame);
86 m_ChildFrames.Clear();
87 m_ChildBoosts.clear();
88 m_ChildStates.clear();
113 StateList const& ReconstructionFrame::GetChildStates(
int i)
const {
117 StateList
const& ReconstructionFrame::GetChildStates(
const RestFrame& child)
const {
118 if(m_ChildStates.count(&child) <= 0)
121 return m_ChildStates[&child];
130 if(*m_GroupPtr != group){
131 Group* groupPtr = m_GroupPtr;
132 m_GroupPtr =
nullptr;
137 m_GroupPtr =
nullptr;
151 FillListGroupsRecursive(groups);
155 void ReconstructionFrame::FillListGroupsRecursive(
GroupList& groups)
const {
156 if(m_GroupPtr) groups.Add(*m_GroupPtr);
158 for(
int i = 0; i < Nchild; i++)
162 bool ReconstructionFrame::InitializeVisibleStates(){
163 m_ChildStates.clear();
167 const VisibleStateList& states =
168 static_cast<const LabRecoFrame&
>(
GetLabFrame()).GetTreeStates();
171 for(
int i = 0; i < Nchild; i++){
173 m_ChildStates[&child] = StateList();
174 RFList<ReconstructionFrame> frames = child.GetListVisibleFrames();
175 int Nf = frames.GetN();
176 for(
int f = 0; f < Nf; f++)
178 if(!m_ChildStates[&child].Add(StateList(states).GetFrame(frames[f]))){
180 m_Log <<
"Unable to associate State with Group-less Frame:";
181 m_Log << Log(frames[f]) << LogEnd;
188 bool ReconstructionFrame::InitializeGroupStates(){
190 int Ngroup = groups.GetN();
193 for(
int c = 0; c < Nchild; c++){
194 RestFrameList frames =
197 int Nframe = frames.GetN();
198 for(
int f = 0; f < Nframe; f++){
199 for(
int g = 0; g < Ngroup; g++){
200 if(groups[g].ContainsFrame(frames[f])){
201 State& state = groups[g].GetChildState(frames[f]);
204 m_Log <<
"Unable to get State associated with Group Frame: " << std::endl;
205 m_Log <<
" Frame:" << Log(frames[f]);
206 m_Log <<
" Group:" << Log(groups[g]) << LogEnd;
220 UnSoundBody(RF_FUNCTION);
221 return SetMind(
false);
224 if(!InitializeVisibleStates())
225 return SetMind(
false);
226 if(!InitializeGroupStates())
227 return SetMind(
false);
230 for(
int i = 0; i < Nchild; i++)
233 m_Log <<
"Unable to recursively initialize analysis for frame:";
235 return SetMind(
false);
238 return SetMind(
true);
241 bool ReconstructionFrame::ResetRecoFrame(){
247 UnSoundMind(RF_FUNCTION);
251 if(!ResetRecoFrame())
255 for(
int i = 0; i < Nf; i++)
262 bool ReconstructionFrame::ReconstructFrame(){
264 UnSoundMind(RF_FUNCTION);
265 return SetSpirit(
false);
268 TLorentzVector Ptot(0,0,0,0);
271 for(
int i = 0; i < Nchild; i++){
274 TLorentzVector P = m_ChildStates[&child].GetFourVector();
277 bool terminal = child.IsVisibleFrame() || child.IsInvisibleFrame();
278 if(terminal || P.M() <= 1e-5){
279 SetChildBoostVector(child, m_Empty3Vector);
280 P.SetVectM(P.Vect(), std::max(0.,P.M()));
281 child.SetFourVector(P, *
this);
283 SetChildBoostVector(child, P.BoostVector());
284 P.SetVectM(P.Vect(), std::max(0.,P.M()));
285 child.SetFourVector(P, *
this);
290 if(child.IsVisibleFrame())
291 static_cast<VisibleRecoFrame&
>(child).
292 SetCharge(m_ChildStates[&child].
GetCharge());
297 return SetSpirit(
true);
302 UnSoundMind(RF_FUNCTION);
303 return SetSpirit(
false);
305 if(!ReconstructFrame()){
307 m_Log <<
"Unable to reconstruct event for this frame.";
309 return SetSpirit(
false);
313 for(
int i = 0; i < Nchild; i++){
315 TVector3 boost = GetChildBoostVector(child);
321 m_ChildStates[&child].Boost(boost);
325 return SetSpirit(
false);
330 m_ChildStates[&child].Boost(boost);
334 return SetSpirit(
true);
bool AnalyzeEventRecursive()
Recursively analyze event in this frame and its children.
virtual RestFrame const & GetLabFrame() const
Returns the LabFrame that this frame inherits from.
virtual void SetParentFrame(RestFrame &frame=RestFrame::Empty())
Sets the parent frame for this frame.
virtual RestFrame & GetChildFrame(int i=0) const
Get the RestFrame of the i th child.
bool ClearEventRecursive()
Recursively clear event information from this frame and its children.
virtual RestFrameList GetListInvisibleFrames() const
Returns a list of InvisibleFrame s inheriting from this.
static StateList const & EmptyList()
Returns empty StateList.
virtual ReconstructionFrame const & GetParentFrame() const
Returns the parent of this frame.
static Group & Empty()
Returns empty Group.
bool InitializeAnalysisRecursive()
Recursively initialize this frame and its children for analysis.
bool IsRecoFrame() const
Is this an ReconstructionFrame ? (yes/no)
abstract base class for all Frame objects
virtual void AddChildFrame(RestFrame &frame)
Adds a child RestFrame to this frame.
abstract base class for all Group objects
bool IsEmpty() const
Checks whether this is default (empty) instance of class.
virtual void SetParentFrame(RestFrame &frame=RestFrame::Empty())
Set the parent frame for this frame.
virtual void RemoveFrame(RestFrame &frame)
Removes a frame (RestFrame) from this group.
virtual void AddChildFrame(RestFrame &frame)
Add a child RestFrame to this frame.
int GetNChildren() const
Returns the number of child frames inheriting from this one.
ReconstructionFrame()
Empty constructor.
virtual RestFrame const & GetParentFrame() const
Returns the parent of this frame.
bool IsInvisibleFrame() const
Is this an InvisibleFrame ? (yes/no)
virtual ReconstructionFrame & GetChildFrame(int i=0) const
Get the frame of the i th child.
virtual RFCharge GetCharge() const
Returns the charge of this frame.
virtual void RemoveChildFrame(RestFrame &frame)
Remove a child of this frame.
virtual void Clear()
Clears RestFrame of all connections to other objects.
virtual RestFrameList GetListVisibleFrames() const
Returns a list of VisibleFrame s inheriting from this.
virtual void SetGroup(Group &group=Group::Empty())
Sets group of this frame.
bool IsVisibleFrame() const
Is this a VisibleFrame ? (yes/no)
RestFrame()
Empty constructor.
GroupList GetListGroups() const
Returns a list of groups (GroupList) of this class.
static VisibleRecoFrame & Empty()
Returns empty VisibleRecoFrame.
bool IsLabFrame() const
Is this a LabFrame ? (yes/no)
static ReconstructionFrame & Empty()
Returns empty ReconstructionFrame.
Group & GetGroup() const
Returns group of this class.
void RemoveChildFrames()
Remove all the children of this frame.
virtual void Clear()
Clears ReconstructionFrame of all connections to other objects.