36 namespace RestFrames {
42 const std::string& stitle)
47 LabRecoFrame::~LabRecoFrame(){
53 m_TreeJigsaws.Clear();
59 m_TreeStates += state;
63 m_TreeStates += states;
67 m_TreeStates -= state;
71 m_TreeStates -= states;
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);
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();
121 int Ngroup = m_TreeGroups.GetN();
122 for(
int i = 0; i < Ngroup; i++){
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();
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]);
154 m_TreeStates += state;
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++)
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 JigsawList todo_jigsaws;
216 int Nj = m_TreeJigsaws.GetN();
217 for(
int j = 0; j < Nj; j++){
218 if(!m_TreeJigsaws[j].InitializeJigsawExecutionList(exec_jigsaws, todo_jigsaws)){
219 m_TreeJigsaws.Clear();
221 m_Log <<
"Unable to initialize Jigsaw execution list in Jigsaw:" << std::endl;
222 m_Log << Log(m_TreeJigsaws[j]) << LogEnd;
226 m_TreeJigsaws.Clear();
227 m_TreeJigsaws += todo_jigsaws;
229 m_Log << LogVerbose <<
"...Done initializing Jigsaws" << LogEnd;
236 UnSoundMind(RF_FUNCTION);
237 return SetMind(
false);
240 int Ng = m_TreeGroups.GetN();
241 for(
int i = 0; i < Ng; i++)
243 return SetMind(
false);
246 return SetMind(
false);
248 return SetMind(
true);
253 UnSoundMind(RF_FUNCTION);
254 return SetSpirit(
false);
257 int Ns = m_TreeStates.GetN();
258 for(
int i = 0; i < Ns; i++){
259 m_TreeStates[i].SetLabFrameFourVector();
262 int Ng = m_TreeGroups.GetN();
263 for(
int i = 0; i < Ng; i++){
266 m_Log <<
"Unable to analyze event for Group: ";
267 m_Log << Log(m_TreeGroups[i]) << LogEnd;
268 return SetSpirit(
false);
271 int Nj = m_TreeJigsaws.GetN();
272 for(
int i = 0; i < Nj; i++){
275 m_Log <<
"Unable to analyze event for Jigsaw: ";
276 m_Log << Log(m_TreeJigsaws[i]) << LogEnd;
277 return SetSpirit(
false);
282 m_Log <<
"Unable to recursively analyze event" << LogEnd;
283 return SetSpirit(
false);
285 return SetSpirit(
true);
289 if(m_TreeStates.GetN() < m_InitStates.GetN())
290 return m_InitStates[m_TreeStates.GetN()];
292 sprintf(strn,
"%d",m_TreeStates.GetN()+1);
293 std::string name =
GetName()+
"_"+std::string(strn);
296 m_InitStates.Add(*statePtr);