41 LabRecoFrame::LabRecoFrame(
const std::string& sname,
42 const std::string& stitle)
43 : LabFrame<ReconstructionFrame>(sname, stitle) {}
45 LabRecoFrame::LabRecoFrame() : LabFrame<ReconstructionFrame>() {}
47 LabRecoFrame::~LabRecoFrame(){
53 m_TreeJigsaws.Clear();
58 void LabRecoFrame::AddTreeState(
VisibleState& state)
const {
59 m_TreeStates += state;
62 void LabRecoFrame::AddTreeStates(
const VisibleStateList& states)
const {
63 m_TreeStates += states;
66 void LabRecoFrame::RemoveTreeState(
const VisibleState& state)
const {
67 m_TreeStates -= state;
70 void LabRecoFrame::RemoveTreeStates(
const VisibleStateList& states)
const {
71 m_TreeStates -= states;
74 VisibleStateList
const& LabRecoFrame::GetTreeStates()
const {
78 bool LabRecoFrame::InitializeAnalysis(){
79 m_Log << LogVerbose <<
"Initializing this tree for analysis..." << LogEnd;
82 UnSoundBody(RF_FUNCTION);
83 return SetMind(
false);
86 if(!InitializeTreeGroups()){
88 m_Log <<
"Unable to intialize Groups for analysis" << LogEnd;
89 return SetMind(
false);
92 if(!InitializeTreeStates()){
94 m_Log <<
"Unable to intialize States for analysis" << LogEnd;
95 return SetMind(
false);
98 if(!InitializeTreeJigsaws()){
100 m_Log <<
"Unable to intialize Jigsaws for analysis" << LogEnd;
101 return SetMind(
false);
104 if(!InitializeAnalysisRecursive()){
106 m_Log <<
"Unable to recursively initialize tree for analysis";
108 return SetMind(
false);
111 m_Log << LogVerbose <<
"...Done initializing tree for analysis" << LogEnd;
112 return SetMind(
true);
115 bool LabRecoFrame::InitializeTreeGroups(){
116 m_Log << LogVerbose <<
"Initializing Groups for analysis..." << LogEnd;
118 m_TreeGroups.Clear();
119 m_TreeGroups += GetListGroups();
121 int Ngroup = m_TreeGroups.GetN();
122 for(
int i = 0; i < Ngroup; i++){
123 if(!m_TreeGroups[i].InitializeAnalysis()){
125 m_Log <<
"Unable to initialize analysis for Group ";
126 m_Log << Log(m_TreeGroups[i]) << LogEnd;
130 m_Log << LogVerbose <<
"...Done initializing Groups for analysis" << LogEnd;
134 bool LabRecoFrame::InitializeTreeStates(){
135 m_Log << LogVerbose <<
"Initializing States for analysis..." << LogEnd;
137 m_TreeStates.Clear();
138 int Ng = m_TreeGroups.GetN();
140 RFList<ReconstructionFrame> frames = GetListVisibleFrames();
141 int Nf = frames.GetN();
142 for(
int f = 0; f < Nf; f++){
143 bool has_group =
false;
144 for(
int g = 0; g < Ng; g++){
145 if(m_TreeGroups[g].ContainsFrame(frames[f])){
151 VisibleState& state = GetNewVisibleState();
152 state.AddFrame(frames[f]);
153 state.SetCharge(frames[f].GetCharge());
154 m_TreeStates += state;
158 frames = GetListInvisibleFrames();
160 for(
int f = 0; f < Nf; f++){
161 bool has_group =
false;
162 for(
int g = 0; g < Ng; g++){
163 if(m_TreeGroups[g].ContainsFrame(frames[f])){
170 m_Log <<
"Found InvisibleRecoFrame without an assigned group: " << std::endl;
171 m_Log << Log(frames[f]) << LogEnd;
175 m_Log << LogVerbose <<
"...Done initializing States" << LogEnd;
179 bool LabRecoFrame::InitializeTreeJigsaws(){
180 m_Log << LogVerbose <<
"Initializing Jigsaws for analysis..." << LogEnd;
182 m_TreeJigsaws.Clear();
184 int Ng = m_TreeGroups.GetN();
187 for(
int g = 0; g < Ng; g++){
188 JigsawList jigsaws = m_TreeGroups[g].GetListJigsaws();
189 int Nj = jigsaws.GetN();
190 for(
int j = 0; j < Nj; j++)
191 if(!jigsaws[j].InitializeAnalysis()){
193 m_Log <<
"Unable to initialize Jigsaw for analysis:" << std::endl;
194 m_Log << Log(jigsaws[j]) << LogEnd;
199 for(
int g = 0; g < Ng; g++){
200 JigsawList jigsaws = m_TreeGroups[g].GetListJigsaws();
201 int Nj = jigsaws.GetN();
202 for(
int j = 0; j < Nj; j++){
203 Jigsaw& jigsaw = jigsaws[j];
204 if(!jigsaw.InitializeDependancyJigsaws()){
206 m_Log <<
"Unable to initialize dependancy Jigsaw list for Jigsaw:" << std::endl;
207 m_Log << Log(jigsaw) << LogEnd;
210 m_TreeJigsaws.Add(jigsaw);
214 JigsawList exec_jigsaws;
215 int Nj = m_TreeJigsaws.GetN();
216 for(
int j = 0; j < Nj; j++){
217 if(!m_TreeJigsaws[j].InitializeJigsawExecutionList(exec_jigsaws)){
218 m_TreeJigsaws.Clear();
220 m_Log <<
"Unable to initialize Jigsaw execution list in Jigsaw:" << std::endl;
221 m_Log << Log(m_TreeJigsaws[j]) << LogEnd;
225 m_TreeJigsaws.Clear();
226 m_TreeJigsaws += exec_jigsaws;
228 m_Log << LogVerbose <<
"...Done initializing Jigsaws" << LogEnd;
232 bool LabRecoFrame::ClearEvent(){
235 UnSoundMind(RF_FUNCTION);
236 return SetMind(
false);
239 int Ng = m_TreeGroups.GetN();
240 for(
int i = 0; i < Ng; i++)
241 if(!m_TreeGroups[i].ClearEvent())
242 return SetMind(
false);
244 if(!ClearEventRecursive())
245 return SetMind(
false);
247 return SetMind(
true);
250 bool LabRecoFrame::AnalyzeEvent(){
252 UnSoundMind(RF_FUNCTION);
253 return SetSpirit(
false);
256 int Ns = m_TreeStates.GetN();
257 for(
int i = 0; i < Ns; i++){
258 m_TreeStates[i].SetLabFrameFourVector();
261 int Ng = m_TreeGroups.GetN();
262 for(
int i = 0; i < Ng; i++){
263 if(!m_TreeGroups[i].AnalyzeEvent()){
265 m_Log <<
"Unable to analyze event for Group: ";
266 m_Log << Log(m_TreeGroups[i]) << LogEnd;
267 return SetSpirit(
false);
270 int Nj = m_TreeJigsaws.GetN();
271 for(
int i = 0; i < Nj; i++){
272 if(!m_TreeJigsaws[i].AnalyzeEvent()){
274 m_Log <<
"Unable to analyze event for Jigsaw: ";
275 m_Log << Log(m_TreeJigsaws[i]) << LogEnd;
276 return SetSpirit(
false);
279 if(!AnalyzeEventRecursive()){
281 m_Log <<
"Unable to recursively analyze event" << LogEnd;
282 return SetSpirit(
false);
284 return SetSpirit(
true);
287 VisibleState& LabRecoFrame::GetNewVisibleState(){
288 if(m_TreeStates.GetN() < m_InitStates.GetN())
289 return m_InitStates[m_TreeStates.GetN()];
291 sprintf(strn,
"%d",m_TreeStates.GetN()+1);
292 std::string name = GetName()+
"_"+std::string(strn);
293 VisibleState* statePtr =
new VisibleState(name, name);
294 AddDependent(statePtr);
295 m_InitStates.Add(*statePtr);
virtual void Clear()
Clears ReconstructionFrame of all connections to other objects.
virtual void Clear()
Clears ReconstructionFrame of all connections to other objects.