/[PAMELA software]/chewbacca/PamOffLineSW/techmodel/EventReader.cpp
ViewVC logotype

Diff of /chewbacca/PamOffLineSW/techmodel/EventReader.cpp

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

revision 1.3 by mocchiut, Fri Jul 24 13:53:45 2009 UTC revision 1.5 by mocchiut, Thu Feb 11 09:02:11 2010 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Author: mocchiut $   * $Author: mocchiut $
3   * $Date: 2008/11/04 09:44:36 $   * $Date: 2009/08/04 13:58:12 $
4   * $Revision: 1.2 $   * $Revision: 1.4 $
5   *   *
6   * Implementation of the functions of a sample Algorithm class.   * Implementation of the functions of a sample Algorithm class.
7   * This file can be used as a templace to develop your own algorithm.   * This file can be used as a templace to develop your own algorithm.
# Line 9  Line 9 
9    
10  #include "EventReader.h"  #include "EventReader.h"
11  #include "ReaderAlgorithms.h"  #include "ReaderAlgorithms.h"
12    #include <TObjectTable.h>
13    
14  extern "C" {  extern "C" {
15      #include "CRC.h"      #include "CRC.h"
# Line 85  EventReader::EventReader(): Line 86  EventReader::EventReader():
86   * Initialize the algorithm with a special run. This will initialize the   * Initialize the algorithm with a special run. This will initialize the
87   * event reader routines for all packet types.   * event reader routines for all packet types.
88   */   */
89  void EventReader::Init(PamelaRun *run) {          TObject *EventReader::GetPtr(TString name){    
90          //Create the structure of directories and create xxx.Header.root files    for (AlgorithmMap::iterator i = TechmodelAlgorithmMap.begin(); i != TechmodelAlgorithmMap.end(); i++) {
91            run->WriteHeaders(this, &Header);        if ( !strcmp(i->second->GetAlgorithmName(),name.Data()) ){
92      //Create the xxx.root in it's specific directory        //      cout << " Retrieving pointer of " << i->second->GetAlgorithmName()<<endl;
93      for (AlgorithmMap::iterator i = TechmodelAlgorithmMap.begin();        TechmodelAlgorithm* EventAlgorithm(i->second);
94         i != TechmodelAlgorithmMap.end(); i++) {        return(EventAlgorithm->GetPtr(""));
95         // cout << " Initializing algo " << i->second->GetAlgorithmName()<<endl;      };
96         i->second->Init(run);    };
97      }    return(NULL);
98    }
99    
     if ( Header ) { delete Header; Header = new EventHeader(); };  // EMILIANO, reset Counter when opening a new file  
100    
101      Run=run;  void EventReader::Init(PamelaRun *run) {        
102      //Create the structure of directories and create xxx.Header.root files
103      //  printf(" init er \n");
104      run->WriteHeaders(this, &Header);  
105      //  printf(" init er wrote \n");
106      //Create the xxx.root in it's specific directory
107      //  gObjectTable->Print();
108      //  Int_t yy = 0;
109      for (AlgorithmMap::iterator i = TechmodelAlgorithmMap.begin();
110           i != TechmodelAlgorithmMap.end(); i++) {
111        //    cout << " Initializing algo " << i->second->GetAlgorithmName()<<endl;
112        i->second->Init(run);
113        //    printf(" algo %i \n",yy);
114        //    yy++;
115      }
116      //  printf(" init er header  \n");
117      if ( Header ) { delete Header; Header = new EventHeader(); };  // EMILIANO, reset Counter when opening a new file
118      //  printf(" init er header done %p  \n",run);
119      
120      Run=run;
121  }  }
122    
123    
# Line 184  int EventReader::PKT_RunEvent(char* head Line 204  int EventReader::PKT_RunEvent(char* head
204                  // catch (NotExistingAlgorithmException exc) {}                  // catch (NotExistingAlgorithmException exc) {}
205    
206                  Run->FillTrees(type);                  Run->FillTrees(type);
207                    //              cout << Header->GetCounter()->Get(type) << endl;
208                  Header->GetCounter()->Increment(type);                  Header->GetCounter()->Increment(type);
209                    //              cout << Header->GetCounter()->Get(type) << endl;
210          }          }
211          else          else
212          {          {
# Line 232  void EventReader::PKT_UnpackPscuHeader(c Line 254  void EventReader::PKT_UnpackPscuHeader(c
254   */   */
255  std::string EventReader::GetVersionInfo(void) const {  std::string EventReader::GetVersionInfo(void) const {
256          return          return
257      "$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/EventReader.cpp,v 1.2 2008/11/04 09:44:36 mocchiut Exp $\n";      "$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/EventReader.cpp,v 1.4 2009/08/04 13:58:12 mocchiut Exp $\n";
258  }  }
259    
260    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23