11 |
TrkProcess::TrkProcess(){ |
TrkProcess::TrkProcess(){ |
12 |
|
|
13 |
idrun = 0; |
idrun = 0; |
|
// DEBUG = false; |
|
|
// VERBOSE = false; |
|
14 |
dbg_mode.SetNone(); |
dbg_mode.SetNone(); |
15 |
get1 = 0; |
get1 = 0; |
16 |
get2 = 1; |
full1 = 0; |
17 |
|
geth = 0; |
18 |
|
get2 = 1; |
19 |
standalone = false; |
standalone = false; |
20 |
frame2 = "root"; |
frame2 = "root"; |
21 |
frame1 = "hbook"; |
frame1 = "root"; |
22 |
|
frameh = "root"; |
23 |
outdir = gSystem->WorkingDirectory(); |
outdir = gSystem->WorkingDirectory(); |
24 |
pfolder = "/TrackerFolder"; |
pfolder = "/TrackerFolder"; |
25 |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
28 |
if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true; |
if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true; |
29 |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 = false; |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 = false; |
30 |
|
|
31 |
|
if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true; |
32 |
|
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth = false; |
33 |
|
|
34 |
file1 = ""; |
file1 = ""; |
35 |
file2 = ""; |
file2 = ""; |
36 |
|
|
48 |
// DEBUG = false; |
// DEBUG = false; |
49 |
// VERBOSE = false; |
// VERBOSE = false; |
50 |
dbg_mode.SetWarning(); |
dbg_mode.SetWarning(); |
51 |
get1 = 0; |
get1 = 0; |
52 |
|
full1 = 0; |
53 |
get2 = 1; |
get2 = 1; |
54 |
|
geth = 0; |
55 |
standalone = false; |
standalone = false; |
56 |
frame2 = "root"; |
frame2 = "root"; |
57 |
frame1 = "root"; |
frame1 = "root"; |
58 |
// ifroot1 = false; |
frameh = "root"; |
59 |
// ifroot2 = true; |
pfolder = "/TrackerFolder"; |
60 |
pfolder = "/TrackerFolder"; |
file1 = ""; |
|
file1 = ""; |
|
61 |
if(f2->IsOpen()){ |
if(f2->IsOpen()){ |
62 |
file2 = f2->GetPath(); |
file2 = f2->GetPath(); |
63 |
outdir = gSystem->DirName(gSystem->DirName(file2)); |
outdir = gSystem->DirName(gSystem->DirName(file2)); |
64 |
// check if the indicated output directory exists |
// check if the indicated output directory exists |
65 |
FileStat_t t; |
FileStat_t t; |
66 |
if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12; |
if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12; |
67 |
}else{ |
}else{ |
68 |
file2 = ""; |
file2 = ""; |
69 |
outdir = gSystem->WorkingDirectory(); |
outdir = gSystem->WorkingDirectory(); |
70 |
}; |
}; |
71 |
|
|
72 |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
75 |
if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true; |
if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true; |
76 |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false; |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false; |
77 |
|
|
78 |
|
if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true; |
79 |
|
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
80 |
|
|
81 |
ostatus = 0; |
ostatus = 0; |
82 |
|
|
83 |
}; |
}; |
95 |
continue; |
continue; |
96 |
} |
} |
97 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
98 |
if (!strcmp(vcustom[i], "--get1")){ |
if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){ |
99 |
get1 = 1; |
get1 = 1; |
100 |
|
full1 = 0; |
101 |
continue; |
continue; |
102 |
} |
} |
103 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
104 |
if (!strcmp(vcustom[i], "--dontget2")){ |
if (!strcmp(vcustom[i], "--get1-full") || !strcmp(vcustom[i], "--get-level1-full") ){ |
105 |
|
get1 = 1; |
106 |
|
full1 = 1; |
107 |
|
continue; |
108 |
|
} |
109 |
|
// -----------------------------------------------------// |
110 |
|
if (!strcmp(vcustom[i], "--geth") || !strcmp(vcustom[i], "--get-hough") ){ |
111 |
|
geth = 1; |
112 |
|
continue; |
113 |
|
} |
114 |
|
// -----------------------------------------------------// |
115 |
|
if (!strcmp(vcustom[i], "--dontget2") ||!strcmp(vcustom[i], "--dontget-level2") ){ |
116 |
get2 = 0; |
get2 = 0; |
117 |
continue; |
continue; |
118 |
} |
} |
164 |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false; |
else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false; |
165 |
else throw -201; |
else throw -201; |
166 |
|
|
167 |
if(get1){ |
if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true; |
168 |
|
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
169 |
TString filety; |
else throw -201; |
|
if ( ifroot1) filety=".root"; |
|
|
else if (!ifroot1) filety=".rz"; |
|
|
else throw -200; |
|
|
|
|
|
// file1 = outdir + "/"+ gSystem->BaseName(pfolder) + "/" + file2(file2.Last('/')+1,file2.Last('.')) + ".Level1" + filety; |
|
|
TString base = file2; |
|
|
if(base.Contains(".Level2.root"))base = base(0,base.Index(".Level2.root")); |
|
|
else base = base(0,base.Index(".root")); |
|
|
base = gSystem->BaseName(base); |
|
|
file1 = outdir + "/"+ gSystem->BaseName(pfolder) + "/" + base +".Level1"+filety; |
|
|
// cout << "Requested Level1 output. "<< endl << "Level1 File: "<< file1 << endl; |
|
|
TString path = gSystem->DirName(file1); |
|
|
FileStat_t t; |
|
|
// check if processFolder directory exists, and possibly create it |
|
|
if( gSystem->GetPathInfo(path.Data(),t) ) { |
|
|
if( gSystem->MakeDirectory(path.Data()) == -1)throw -13; |
|
|
}; |
|
|
// if it does, open/create teh putput file |
|
170 |
|
|
171 |
}; |
if(get1 && !get2)full1=true; |
172 |
|
|
173 |
ostatus = 0; |
ostatus = 0; |
174 |
|
|
182 |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
183 |
|
|
184 |
// fill Level0 common from Level0 object |
// fill Level0 common from Level0 object |
185 |
l0_event->GetCommonVar(&level0event_); |
// l0_event->GetCommonVar(&level0event_); |
186 |
|
l0_event->GetLevel0Struct(); |
187 |
// process the event Level0->Level1->Level2 |
// process the event Level0->Level1->Level2 |
188 |
int F77err = 0; |
int F77err = 0; |
189 |
// |
// |
190 |
reductionflight_(&F77err); |
reductionflight_(&F77err); |
191 |
if(F77err < 0)throw F77err; |
if(F77err < 0)throw F77err; |
|
// else if(F77err > 0 && WarningMode())cout<<" WARNING ("<<F77err<<") - TrkCore - Level1 reduction (CN computation failure, ...)"<<endl; |
|
192 |
// |
// |
193 |
if(get2) analysisflight_(); |
int pfa=0; |
194 |
// if(F77err < 0)throw F77err; |
if(get2) analysisflight_(&pfa); |
|
// else if(F77err > 0 && WarningMode())cout<<" WARNING ("<<F77err<<") - TrkCore - @ Level2 reduction "<<endl; |
|
195 |
// |
// |
196 |
ostatus = F77err; |
ostatus = F77err; |
197 |
|
|
201 |
|
|
202 |
cout <<endl<< "Tracker process parameters: "<< endl; |
cout <<endl<< "Tracker process parameters: "<< endl; |
203 |
cout << " idRun " << idrun << endl; |
cout << " idRun " << idrun << endl; |
204 |
cout << " get1 " << get1 << endl; |
cout << " get level1 " << get1 << endl; |
205 |
cout << " get2 " << get2 << endl; |
cout << " full level1 " << full1 << endl; |
206 |
|
cout << " get level2 " << get2 << endl; |
207 |
|
cout << " get hough " << geth << endl; |
208 |
cout << " frame1 " << frame1 << endl; |
cout << " frame1 " << frame1 << endl; |
209 |
cout << " frame2 " << frame2 << endl; |
cout << " frame2 " << frame2 << endl; |
210 |
|
cout << " frameh " << frame2 << endl; |
211 |
cout << " file1 " << file1 << endl; |
cout << " file1 " << file1 << endl; |
212 |
cout << " file2 " << file2 << endl; |
cout << " file2 " << file2 << endl; |
213 |
cout << " outdir " << outdir << endl; |
cout << " outdir " << outdir << endl; |