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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by pam-fi, Tue Sep 5 12:52:20 2006 UTC revision 1.11 by pam-fi, Mon Aug 20 16:07:16 2007 UTC
# Line 11  using namespace std; Line 11  using namespace std;
11  TrkProcess::TrkProcess(){  TrkProcess::TrkProcess(){
12            
13      idrun = 0;      idrun = 0;
14  //    DEBUG = false;  //    dbg_mode.SetNone();
15  //    VERBOSE = false;      get1  = 0;
16      dbg_mode.SetNone();      full1 = 0;
17      get1 = 0;      geth  = 0;
18      get2 = 1;      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;          
# Line 27  TrkProcess::TrkProcess(){ Line 28  TrkProcess::TrkProcess(){
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            
37      ostatus = 0;      ostatus = 0;
38    
39        npar=0;
40    
41        TrkParams::SetTrackingMode();
42        TrkParams::SetPrecisionFactor();
43        TrkParams::SetStepMin();  
44        TrkParams::SetPFA();
45  };  };
46                    
47  /**  /**
# Line 43  TrkProcess::TrkProcess(ULong64_t run, TF Line 54  TrkProcess::TrkProcess(ULong64_t run, TF
54      idrun = run;      idrun = run;
55  //    DEBUG = false;  //    DEBUG = false;
56  //    VERBOSE = false;  //    VERBOSE = false;
57      dbg_mode.SetWarning();  //    dbg_mode.SetWarning();
58      get1 = 0;      get1  = 0;
59        full1 = 0;
60      get2 = 1;      get2 = 1;
61        geth = 0;
62      standalone = false;      standalone = false;
63      frame2 = "root";      frame2 = "root";
64      frame1 = "root";      frame1 = "root";
65  //    ifroot1 = false;      frameh = "root";
66  //    ifroot2 = true;      pfolder = "/TrackerFolder";
67          pfolder = "/TrackerFolder";      file1 = "";
         file1 = "";  
68      if(f2->IsOpen()){      if(f2->IsOpen()){
69                  file2  = f2->GetPath();          file2  = f2->GetPath();
70                  outdir = gSystem->DirName(gSystem->DirName(file2));          outdir = gSystem->DirName(gSystem->DirName(file2));
71          // check if the indicated output directory exists          // check if the indicated output directory exists
72                  FileStat_t t;          FileStat_t t;
73                  if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12;          if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12;
74      }else{      }else{
75                  file2 = "";              file2 = "";    
76                  outdir =  gSystem->WorkingDirectory();          outdir =  gSystem->WorkingDirectory();
77      };      };
78    
79      if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;                if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;          
# Line 70  TrkProcess::TrkProcess(ULong64_t run, TF Line 82  TrkProcess::TrkProcess(ULong64_t run, TF
82      if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;                if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;          
83      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
84    
85        if      (!frameh.CompareTo("root", TString::kIgnoreCase))  ifrooth = true;          
86        else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
87    
88      ostatus = 0;      ostatus = 0;
89        
90        npar=0;
91                    
92        TrkParams::SetTrackingMode();
93        TrkParams::SetPrecisionFactor();
94        TrkParams::SetStepMin();  
95        TrkParams::SetPFA();
96    
97  };  };
98  /**  /**
99   * Set processing variables according to input custom parameters   * Set processing variables according to input custom parameters
# Line 87  void TrkProcess::HandleCustomPar(int ncu Line 109  void TrkProcess::HandleCustomPar(int ncu
109              continue;              continue;
110          }            }  
111          // -----------------------------------------------------//              // -----------------------------------------------------//    
112          if (!strcmp(vcustom[i], "--get1")){          if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){
113              get1 = 1;              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              continue;              continue;
122          }            }  
123          // -----------------------------------------------------//              // -----------------------------------------------------//    
124          if (!strcmp(vcustom[i], "--dontget2")){          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              get2 = 0;              get2 = 0;
131              continue;              continue;
132          }            }  
# Line 123  void TrkProcess::HandleCustomPar(int ncu Line 157  void TrkProcess::HandleCustomPar(int ncu
157              continue;              continue;
158          }            }  
159          // -----------------------------------------------------//              // -----------------------------------------------------//    
160            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          if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){          if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){
169  //          VERBOSE = true;              TrkParams::SetVerboseMode();
             this->SetVerboseMode();  
170              continue;              continue;
171          }          }
172          // -----------------------------------------------------//              // -----------------------------------------------------//    
173          else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){          else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){
174  //          DEBUG = true;              TrkParams::SetDebugMode();
             this->SetDebugMode();  
175              continue;              continue;
176          };          };
177      }        }  
# Line 144  void TrkProcess::HandleCustomPar(int ncu Line 184  void TrkProcess::HandleCustomPar(int ncu
184      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
185      else    throw -201;      else    throw -201;
186                    
187      if(get1){      if      (!frameh.CompareTo("root", TString::kIgnoreCase))  ifrooth = true;          
188                        else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
189                  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  
190    
191      };      if(get1 && !get2)full1=true;
192    
193      ostatus = 0;      ostatus = 0;
194    
# Line 180  void TrkProcess::HandleCustomPar(int ncu Line 202  void TrkProcess::HandleCustomPar(int ncu
202  void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){  void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){
203    
204      // fill Level0 common from Level0 object      // fill Level0 common from Level0 object
205      l0_event->GetCommonVar(&level0event_);      l0_event->GetLevel0Struct();
   
206      // process the event Level0->Level1->Level2      // process the event Level0->Level1->Level2
207      int F77err = 0;      int F77err = 0;
208      //      //
209      reductionflight_(&F77err);      reductionflight_(&F77err);
210      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;  
211      //      //
212      if(get2) analysisflight_();      if(get2) analysisflight_();
 //    if(F77err < 0)throw F77err;  
 //    else if(F77err > 0 && WarningMode())cout<<" WARNING ("<<F77err<<") - TrkCore - @ Level2 reduction "<<endl;  
213      //      //
214      ostatus = F77err;      ostatus = F77err;
215            
216  };  };
217                                    
218  void TrkProcess::Dump(){  void TrkProcess::Dump(){
219        cout << endl;
220      cout <<endl<< "Tracker process parameters: "<< endl;      cout << " |-------------------------------------| "<<endl;
221      cout << " idRun           " << idrun << endl;      cout << "   tracker-processing input-parameters   "<< endl;
222      cout << " get1            " << get1 << endl;      cout << " |-------------------------------------| "<<endl;
223      cout << " get2            " << get2 << endl;      cout << "   idRun           " << idrun << endl;
224      cout << " frame1          " << frame1 << endl;      cout << "   get level1      " << get1 << endl;
225      cout << " frame2          " << frame2 << endl;      cout << "   full level1     " << full1 << endl;
226      cout << " file1           " << file1 << endl;      cout << "   get level2      " << get2 << endl;
227      cout << " file2           " << file2 << endl;      cout << "   get hough       " << geth << endl;
228      cout << " outdir          " << outdir << endl;  //    cout << " frame1          " << frame1 << endl;
229      cout << " process folder  " << pfolder << endl;  //    cout << " frame2          " << frame2 << endl;
230      cout << " standalone mode " << standalone << endl;  //    cout << " frameh          " << frame2 << endl;
231      cout << " debug mode      warning " << dbg_mode.warning << endl;  //    cout << " file1           " << file1 << endl;
232      cout << " debug mode      verbose " << dbg_mode.verbose << endl;      cout << "   output file     " << file2 << endl;
233      cout << " debug mode      debug   " << dbg_mode.debug << endl << endl;  //    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            
244  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.23