/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkProcess.cpp
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/TrkProcess.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (hide annotations) (download)
Mon Aug 20 16:07:16 2007 UTC (17 years, 3 months ago) by pam-fi
Branch: MAIN
Changes since 1.10: +40 -28 lines
missing-image bug fixed + other changes

1 mocchiut 1.1 /**
2     * \file TrkProcess.cpp
3     * \author Elena Vannuccini
4     */
5     #include <TrkProcess.h>
6     #include <iostream>
7     using namespace std;
8 pam-fi 1.2 /**
9     * Create TrkProcess object, initializing the tracker processing variables at default values
10     */
11 mocchiut 1.1 TrkProcess::TrkProcess(){
12    
13     idrun = 0;
14 pam-fi 1.11 // dbg_mode.SetNone();
15 pam-fi 1.7 get1 = 0;
16     full1 = 0;
17     geth = 0;
18     get2 = 1;
19 mocchiut 1.1 standalone = false;
20     frame2 = "root";
21 pam-fi 1.6 frame1 = "root";
22     frameh = "root";
23 mocchiut 1.1 outdir = gSystem->WorkingDirectory();
24     pfolder = "/TrackerFolder";
25     if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true;
26 pam-fi 1.2 else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 = false;
27 mocchiut 1.1
28     if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true;
29 pam-fi 1.2 else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 = false;
30 mocchiut 1.1
31 pam-fi 1.6 if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true;
32     else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth = false;
33    
34 mocchiut 1.1 file1 = "";
35     file2 = "";
36    
37 pam-fi 1.2 ostatus = 0;
38 pam-fi 1.10
39 pam-fi 1.11 npar=0;
40    
41 pam-fi 1.10 TrkParams::SetTrackingMode();
42     TrkParams::SetPrecisionFactor();
43     TrkParams::SetStepMin();
44     TrkParams::SetPFA();
45 mocchiut 1.1 };
46    
47 pam-fi 1.2 /**
48     * Create TrkProcess object, initializing the tracker processing variables according to input parameters.
49     * @param run Run ID
50     * @param f2 Pointer to output level2 file
51     */
52 mocchiut 1.1 TrkProcess::TrkProcess(ULong64_t run, TFile *f2){
53    
54     idrun = run;
55 pam-fi 1.2 // DEBUG = false;
56     // VERBOSE = false;
57 pam-fi 1.11 // dbg_mode.SetWarning();
58 pam-fi 1.7 get1 = 0;
59     full1 = 0;
60 mocchiut 1.1 get2 = 1;
61 pam-fi 1.6 geth = 0;
62 mocchiut 1.1 standalone = false;
63     frame2 = "root";
64 pam-fi 1.4 frame1 = "root";
65 pam-fi 1.6 frameh = "root";
66     pfolder = "/TrackerFolder";
67     file1 = "";
68 mocchiut 1.1 if(f2->IsOpen()){
69 pam-fi 1.6 file2 = f2->GetPath();
70     outdir = gSystem->DirName(gSystem->DirName(file2));
71 pam-fi 1.4 // check if the indicated output directory exists
72 pam-fi 1.6 FileStat_t t;
73     if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12;
74 mocchiut 1.1 }else{
75 pam-fi 1.6 file2 = "";
76     outdir = gSystem->WorkingDirectory();
77 mocchiut 1.1 };
78    
79     if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true;
80     else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;
81    
82     if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true;
83     else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
84    
85 pam-fi 1.6 if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true;
86     else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
87    
88 pam-fi 1.2 ostatus = 0;
89 pam-fi 1.11
90     npar=0;
91 mocchiut 1.1
92 pam-fi 1.10 TrkParams::SetTrackingMode();
93     TrkParams::SetPrecisionFactor();
94     TrkParams::SetStepMin();
95     TrkParams::SetPFA();
96    
97 mocchiut 1.1 };
98 pam-fi 1.2 /**
99     * Set processing variables according to input custom parameters
100     */
101     void TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){
102 mocchiut 1.1
103     for (int i=0; i< ncustom; i++){
104 pam-fi 1.4
105 mocchiut 1.1 // -----------------------------------------------------//
106     if (!strcmp(vcustom[i], "-processFolder")){
107     if (++i >= ncustom) throw -3;
108     pfolder = vcustom[i];
109     continue;
110     }
111     // -----------------------------------------------------//
112 pam-fi 1.6 if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){
113 pam-fi 1.7 get1 = 1;
114     full1 = 0;
115     continue;
116     }
117     // -----------------------------------------------------//
118     if (!strcmp(vcustom[i], "--get1-full") || !strcmp(vcustom[i], "--get-level1-full") ){
119     get1 = 1;
120     full1 = 1;
121 mocchiut 1.1 continue;
122     }
123     // -----------------------------------------------------//
124 pam-fi 1.6 if (!strcmp(vcustom[i], "--geth") || !strcmp(vcustom[i], "--get-hough") ){
125     geth = 1;
126     continue;
127     }
128     // -----------------------------------------------------//
129     if (!strcmp(vcustom[i], "--dontget2") ||!strcmp(vcustom[i], "--dontget-level2") ){
130 mocchiut 1.1 get2 = 0;
131     continue;
132     }
133     // -----------------------------------------------------//
134     if (!strcmp(vcustom[i], "--standalone") || !strcmp(vcustom[i], "-s")){
135     standalone = true;
136     continue;
137     }
138     // -----------------------------------------------------//
139     if (!strcmp(vcustom[i], "-processFile1")){
140     if (++i >= ncustom) throw -3;
141     get1 = 1;
142     file1 = vcustom[i];
143     continue;
144     }
145     // -----------------------------------------------------//
146     if (!strcmp(vcustom[i], "-frame1")){
147     if (++i >= ncustom)throw -3;
148     get1 = 1;
149     frame1 = vcustom[i];
150     continue;
151     }
152     // -----------------------------------------------------//
153     if (!strcmp(vcustom[i], "-frame2")){
154     if (++i >= ncustom)throw -3;
155     get2 = 1;
156     frame2 = vcustom[i];
157     continue;
158     }
159     // -----------------------------------------------------//
160 pam-fi 1.11 if ( atoi(vcustom[i]) < 0){
161     if (++i >= ncustom)throw -3;
162     partype[npar]=-1*atoi(vcustom[i-1]);
163     parpath[npar]=vcustom[i];
164     npar++;
165     continue;
166     }
167     // -----------------------------------------------------//
168 pam-fi 1.2 if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){
169 pam-fi 1.11 TrkParams::SetVerboseMode();
170 pam-fi 1.2 continue;
171     }
172     // -----------------------------------------------------//
173     else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){
174 pam-fi 1.11 TrkParams::SetDebugMode();
175 mocchiut 1.1 continue;
176 pam-fi 1.2 };
177 mocchiut 1.1 }
178 pam-fi 1.4
179 mocchiut 1.1 if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true;
180     else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;
181     else throw -201;
182    
183     if (!frame1.CompareTo("root", TString::kIgnoreCase)) ifroot1 = true;
184     else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
185     else throw -201;
186 pam-fi 1.4
187 pam-fi 1.6 if (!frameh.CompareTo("root", TString::kIgnoreCase)) ifrooth = true;
188     else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
189     else throw -201;
190 mocchiut 1.1
191 pam-fi 1.7 if(get1 && !get2)full1=true;
192    
193 pam-fi 1.2 ostatus = 0;
194 mocchiut 1.1
195 pam-fi 1.2 };
196     /**
197     * \brief Process Level0 event
198     * @param l0_event Pointer to an object of the tracker level0 class
199     * Starting from a Level0 object, this routine fills the level0 common, then calls
200     * the fortran routines, which process the event and fill level1 and level2 commons.
201     */
202     void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){
203    
204     // fill Level0 common from Level0 object
205 pam-fi 1.8 l0_event->GetLevel0Struct();
206 pam-fi 1.2 // process the event Level0->Level1->Level2
207     int F77err = 0;
208     //
209     reductionflight_(&F77err);
210     if(F77err < 0)throw F77err;
211     //
212 pam-fi 1.10 if(get2) analysisflight_();
213 pam-fi 1.2 //
214     ostatus = F77err;
215    
216 mocchiut 1.1 };
217    
218     void TrkProcess::Dump(){
219 pam-fi 1.11 cout << endl;
220     cout << " |-------------------------------------| "<<endl;
221     cout << " tracker-processing input-parameters "<< endl;
222     cout << " |-------------------------------------| "<<endl;
223     cout << " idRun " << idrun << endl;
224     cout << " get level1 " << get1 << endl;
225     cout << " full level1 " << full1 << endl;
226     cout << " get level2 " << get2 << endl;
227     cout << " get hough " << geth << endl;
228     // cout << " frame1 " << frame1 << endl;
229     // cout << " frame2 " << frame2 << endl;
230     // cout << " frameh " << frame2 << endl;
231     // cout << " file1 " << file1 << endl;
232     cout << " output file " << file2 << endl;
233     // cout << " outdir " << outdir << endl;
234     // cout << " process folder " << pfolder << endl;
235     // cout << " standalone mode " << standalone << endl;
236     for(int i=0; i<npar; i++)
237     cout << " force loading parameters of type "<<partype[i]<<" from <--- "<<parpath[i]<<endl;
238     cout<<endl;
239    
240     // cout << " debug mode warning " << dbg_mode.warning << endl;
241     // cout << " debug mode verbose " << dbg_mode.verbose << endl;
242     // cout << " debug mode debug " << dbg_mode.debug << endl << endl;
243 mocchiut 1.1
244     }

  ViewVC Help
Powered by ViewVC 1.1.23