/[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.1 by mocchiut, Fri May 19 13:15:54 2006 UTC revision 1.10 by pam-fi, Mon May 14 11:03:06 2007 UTC
# Line 5  Line 5 
5  #include <TrkProcess.h>  #include <TrkProcess.h>
6  #include <iostream>  #include <iostream>
7  using namespace std;  using namespace std;
8    /**
9     * Create TrkProcess object, initializing the tracker processing variables at default values
10     */
11  TrkProcess::TrkProcess(){  TrkProcess::TrkProcess(){
12            
13      idrun = 0;      idrun = 0;
14      DEBUG = false;      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;          
26      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 = false;
27            
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;
38    
39        TrkParams::SetTrackingMode();
40        TrkParams::SetPrecisionFactor();
41        TrkParams::SetStepMin();  
42        TrkParams::SetPFA();
43  };  };
44                    
45    /**
46     * Create TrkProcess object, initializing the tracker processing variables according to input parameters.
47     * @param run Run ID
48     * @param f2 Pointer to output level2 file
49     */
50  TrkProcess::TrkProcess(ULong64_t run, TFile *f2){  TrkProcess::TrkProcess(ULong64_t run, TFile *f2){
51                    
52      idrun = run;      idrun = run;
53      DEBUG = false;  //    DEBUG = false;
54      get1 = 0;  //    VERBOSE = false;
55        dbg_mode.SetWarning();
56        get1  = 0;
57        full1 = 0;
58      get2 = 1;      get2 = 1;
59        geth = 0;
60      standalone = false;      standalone = false;
61      frame2 = "root";      frame2 = "root";
62      frame1 = "hbook";      frame1 = "root";
63      ifroot1 = false;      frameh = "root";
64      ifroot2 = true;      pfolder = "/TrackerFolder";
65      file1 = "";      file1 = "";
66      if(f2->IsOpen()){      if(f2->IsOpen()){
67          file2  = f2->GetPath();          file2  = f2->GetPath();
 //      TString temp = file2(0,file2.Last(':'));  
 //      outdir = temp(0,temp.Last('/'));  
68          outdir = gSystem->DirName(gSystem->DirName(file2));          outdir = gSystem->DirName(gSystem->DirName(file2));
69  // check if the indicated output directory exists          // check if the indicated output directory exists
70          FileStat_t t;          FileStat_t t;
71          if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12;          if( gSystem->GetPathInfo(outdir.Data(),t) )throw -12;
72      }else{      }else{
73          file2 = "";              file2 = "";    
74          outdir =  gSystem->WorkingDirectory();          outdir =  gSystem->WorkingDirectory();
75      };      };
     pfolder = "/TrackerFolder";  
76    
77      if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;                if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;          
78      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;
# Line 60  TrkProcess::TrkProcess(ULong64_t run, TF Line 80  TrkProcess::TrkProcess(ULong64_t run, TF
80      if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;                if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;          
81      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
82    
83        if      (!frameh.CompareTo("root", TString::kIgnoreCase))  ifrooth = true;          
84        else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
85    
86        ostatus = 0;
87                    
88        TrkParams::SetTrackingMode();
89        TrkParams::SetPrecisionFactor();
90        TrkParams::SetStepMin();  
91        TrkParams::SetPFA();
92    
93  };  };
94            /**
95  int TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){   * Set processing variables according to input custom parameters
96     */    
97    void TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){
98    
99      for (int i=0; i< ncustom; i++){      for (int i=0; i< ncustom; i++){
100                    
101          // -----------------------------------------------------//          // -----------------------------------------------------//
102          if (!strcmp(vcustom[i], "-processFolder")){          if (!strcmp(vcustom[i], "-processFolder")){
103              if (++i >= ncustom) throw -3;              if (++i >= ncustom) throw -3;
# Line 74  int TrkProcess::HandleCustomPar(int ncus Line 105  int TrkProcess::HandleCustomPar(int ncus
105              continue;              continue;
106          }            }  
107          // -----------------------------------------------------//              // -----------------------------------------------------//    
108          if (!strcmp(vcustom[i], "--get1")){          if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){
109              get1 = 1;              get1  = 1;  
110                full1 = 0;
111              continue;              continue;
112          }            }  
113          // -----------------------------------------------------//              // -----------------------------------------------------//    
114          if (!strcmp(vcustom[i], "--dontget2")){          if (!strcmp(vcustom[i], "--get1-full") || !strcmp(vcustom[i], "--get-level1-full") ){
115                get1  = 1;      
116                full1 = 1;
117                continue;
118            }  
119            // -----------------------------------------------------//    
120            if (!strcmp(vcustom[i], "--geth") || !strcmp(vcustom[i], "--get-hough") ){
121                geth = 1;
122                continue;
123            }  
124            // -----------------------------------------------------//    
125            if (!strcmp(vcustom[i], "--dontget2") ||!strcmp(vcustom[i], "--dontget-level2") ){
126              get2 = 0;              get2 = 0;
127              continue;              continue;
128          }            }  
# Line 110  int TrkProcess::HandleCustomPar(int ncus Line 153  int TrkProcess::HandleCustomPar(int ncus
153              continue;              continue;
154          }            }  
155          // -----------------------------------------------------//              // -----------------------------------------------------//    
156          else if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){          if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){
157              DEBUG = true;  //          VERBOSE = true;
158                this->SetVerboseMode();
159              continue;              continue;
160          }            }
161            // -----------------------------------------------------//    
162            else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){
163    //          DEBUG = true;
164                this->SetDebugMode();
165                continue;
166            };
167      }        }  
168                        
169      if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;                if      (!frame2.CompareTo("root", TString::kIgnoreCase))  ifroot2 = true;          
170      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;      else if (!frame2.CompareTo("hbook", TString::kIgnoreCase)) ifroot2 =false;
171      else    throw -201;      else    throw -201;
# Line 123  int TrkProcess::HandleCustomPar(int ncus Line 173  int TrkProcess::HandleCustomPar(int ncus
173      if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;                if      (!frame1.CompareTo("root", TString::kIgnoreCase))  ifroot1 = true;          
174      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;      else if (!frame1.CompareTo("hbook", TString::kIgnoreCase)) ifroot1 =false;
175      else    throw -201;      else    throw -201;
176                
177      if(get1){      if      (!frameh.CompareTo("root", TString::kIgnoreCase))  ifrooth = true;          
178          TString filety;      else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false;
179          if      ( ifroot1)  filety=".root";                  else    throw -201;
         else if (!ifroot1)  filety=".rz";  
         else    throw -200;  
 //      file1 = outdir + "/"+ pfolder + "/" + file2(file2.Last('/')+1,file2.Last('.')) + ".Level1" + filety;  
 //      cout << p->file1 << endl;  
 //      TString path = gSystem->DirName(p->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  
180    
181      };      if(get1 && !get2)full1=true;
182    
183        ostatus = 0;
184    
185      return 0;  };
186    /**
187     * \brief Process Level0 event
188     * @param l0_event Pointer to an object of the tracker level0 class
189     * Starting from a Level0 object, this routine fills the level0 common, then calls
190     * the fortran routines, which process the event and fill level1 and level2 commons.
191     */
192    void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){
193    
194        // fill Level0 common from Level0 object
195    //    l0_event->GetCommonVar(&level0event_);
196        l0_event->GetLevel0Struct();
197        // process the event Level0->Level1->Level2
198        int F77err = 0;
199        //
200        reductionflight_(&F77err);
201        if(F77err < 0)throw F77err;
202        //
203    //    int pfa=0; //<<< ETA
204    //    int pfa=14;//<<< COG4
205    //    if(get2) analysisflight_(&pfa);
206        if(get2) analysisflight_();
207        //
208        ostatus = F77err;
209        
210  };  };
211                                    
212  void TrkProcess::Dump(){  void TrkProcess::Dump(){
213    
214      cout <<endl<< "Tracker process parameters: "<< endl;      cout <<endl<< "Tracker process parameters: "<< endl;
215      cout << " idRun           " << idrun << endl;      cout << " idRun           " << idrun << endl;
216      cout << " get1            " << get1 << endl;      cout << " get level1      " << get1 << endl;
217      cout << " get2            " << get2 << endl;      cout << " full level1     " << full1 << endl;
218        cout << " get level2      " << get2 << endl;
219        cout << " get hough       " << geth << endl;
220      cout << " frame1          " << frame1 << endl;      cout << " frame1          " << frame1 << endl;
221      cout << " frame2          " << frame2 << endl;      cout << " frame2          " << frame2 << endl;
222        cout << " frameh          " << frame2 << endl;
223      cout << " file1           " << file1 << endl;      cout << " file1           " << file1 << endl;
224      cout << " file2           " << file2 << endl;      cout << " file2           " << file2 << endl;
225      cout << " outdir          " << outdir << endl;      cout << " outdir          " << outdir << endl;
226      cout << " process folder  " << pfolder << endl;          cout << " process folder  " << pfolder << endl;
227      cout << " standalone mode " << standalone << endl;      cout << " standalone mode " << standalone << endl;
228      cout << " debug mode      " << DEBUG << endl<< endl;      cout << " debug mode      warning " << dbg_mode.warning << endl;
229        cout << " debug mode      verbose " << dbg_mode.verbose << endl;
230        cout << " debug mode      debug   " << dbg_mode.debug << endl << endl;
231            
232  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.23