/[PAMELA software]/yoda/techmodel/physics/TrackerReader.cpp
ViewVC logotype

Diff of /yoda/techmodel/physics/TrackerReader.cpp

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

revision 1.1 by kusanagi, Tue Jul 6 12:20:23 2004 UTC revision 1.4 by kusanagi, Thu Aug 19 15:24:58 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvspamela/yoda/techmodel/physics/tracker/TrackerPhysicsReader.cpp,v $   * $Source: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v $
3   * $Id: TrackerPhysicsReader.cpp,v 1.6 2004/03/16 10:18:28 nagni Exp $   * $Id: TrackerReader.cpp,v 1.3 2004/07/26 23:09:47 kusanagi Exp $
4   * $Author: nagni $   * $Author: kusanagi $
5   *   *
6   * Implementation of the TrackerPhysicsReader class.   * Implementation of the TrackerPhysicsReader class.
7   */   */
# Line 16  extern "C" { Line 16  extern "C" {
16      extern void trkeventpkt_(int*, char*);      extern void trkeventpkt_(int*, char*);
17      //Struct per il passaggio di dati da e verso la chiamata fortran      //Struct per il passaggio di dati da e verso la chiamata fortran
18      extern struct {      extern struct {
19          int good0;
20          int nev0;
21        int DAQmode[12];        int DAQmode[12];
22        int DSPnumber[12];        int DSPnumber[12];
23        int DATAlength[12];        int DATAlength[12];
# Line 33  extern "C" { Line 35  extern "C" {
35        int fl2[12];        int fl2[12];
36        int fl1[12];        int fl1[12];
37        int fl6[12];        int fl6[12];
       int checksum[12];  
38        int pnum[12];        int pnum[12];
39        int cmdnum[12];        int cmdnum[12];
40        int bid[12];        int bid[12];
41        int alarm[12];        int alarm[12];
42        int aswr[12];        int aswr[12];
43          int TOTDATAlength;
44          int datatracker[49152];
45      } level0_;      } level0_;
46    
47  #include <dirent.h>  #include <dirent.h>
# Line 63  TrackerReader::TrackerReader(void): Line 66  TrackerReader::TrackerReader(void):
66   */   */
67  std::string TrackerReader::GetVersionInfo(void) const {  std::string TrackerReader::GetVersionInfo(void) const {
68    return    return
69      "$Header: /home/cvspamela/yoda/techmodel/physics/tracker/TrackerPhysicsReader.cpp,v 1.6 2004/03/16 10:18:28 nagni Exp $";      "$Header: /home/cvsmanager/yoda/techmodel/physics/TrackerReader.cpp,v 1.3 2004/07/26 23:09:47 kusanagi Exp $";
70  }  }
71    
72  /**  /**
# Line 86  void TrackerReader::RunEvent(int EventNu Line 89  void TrackerReader::RunEvent(int EventNu
89   * Unpack the Tracker data event from the physical packet.   * Unpack the Tracker data event from the physical packet.
90   */   */
91  void TrackerReader::RunEvent(int EventNumber, const char subData[], long int length) {  void TrackerReader::RunEvent(int EventNumber, const char subData[], long int length) {
     char data[length];  
     memcpy(data, subData, length);  
92      int       ERROR;      int       ERROR;
93            
94      //Scrivo un file temporaneo per passarlo alla routine      //Scrivo un file temporaneo per passarlo alla routine
95      //Speriamo di cambiare la routine per passargli un buffer.....      //Speriamo di cambiare la routine per passargli un buffer.....
96          DIR *dirp;          DIR *dirp;
97      std::string pathDir((char*)getenv("YODA_DATA"));      std::string pathDir((char*)getenv("YODA_DATA"));
98      pathDir = pathDir + "/";      pathDir = pathDir + "/todatemp.dat";
     pathDir = pathDir + PamelaRun::GetRunName(EventNumber) + "/todatemp.dat";  
99      FILE *pfile;      FILE *pfile;
100      pfile = fopen((char*)pathDir.c_str(), "wb");      pfile = fopen((char*)pathDir.c_str(), "wb");
101      fwrite(subData, 1, length, pfile);      fwrite(subData, 1, length, pfile);
# Line 106  void TrackerReader::RunEvent(int EventNu Line 106  void TrackerReader::RunEvent(int EventNu
106            
107      remove((char*)pathDir.c_str());      remove((char*)pathDir.c_str());
108    
109        
110      //Store the unpacked data      //Store the unpacked data
111      memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode));      memcpy(tracker->DAQmode, level0_.DAQmode, sizeof(tracker->DAQmode));
112      memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber));      memcpy(tracker->DSPnumber, level0_.DSPnumber, sizeof(tracker->DSPnumber));
# Line 114  void TrackerReader::RunEvent(int EventNu Line 115  void TrackerReader::RunEvent(int EventNu
115      memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust));      memcpy(tracker->nclust, level0_.nclust, sizeof(tracker->nclust));
116      memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc));      memcpy(tracker->cutc, level0_.cutc, sizeof(tracker->cutc));
117      memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl));      memcpy(tracker->cutcl, level0_.cutcl, sizeof(tracker->cutcl));
118      memcpy(tracker->addrcluster, level0_.addrcluster, sizeof(tracker->addrcluster));  
119      memcpy(tracker->signcluster, level0_.signcluster, sizeof(tracker->signcluster));  //--------have to invert array because of FORTRAN <-> C different management of the indexes
120        int tempAddr[3][12];
121        int tempSign[3][12];
122        memcpy(tempAddr, (level0_.addrcluster), sizeof(tempAddr));
123        memcpy(tempSign, (level0_.signcluster), sizeof(tempSign));
124        for (int j = 0; j < 12; j++){
125            for (int i = 0; i < 3; i++){
126                tracker->addrcluster[j][i] = tempAddr[i][j];
127                tracker->signcluster[j][i] = tempSign[i][j];
128            }
129        }
130    //-----------------------------------------------------------------------------------------
131        
132      memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc));      memcpy(tracker->fc, level0_.fc, sizeof(tracker->fc));
133      memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime));      memcpy(tracker->compressiontime, level0_.compressiontime, sizeof(tracker->compressiontime));
134      memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1));      memcpy(tracker->fl1, level0_.fl1, sizeof(tracker->fl1));
# Line 124  void TrackerReader::RunEvent(int EventNu Line 137  void TrackerReader::RunEvent(int EventNu
137      memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4));      memcpy(tracker->fl4, level0_.fl4, sizeof(tracker->fl4));
138      memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5));      memcpy(tracker->fl5, level0_.fl5, sizeof(tracker->fl5));
139      memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6));      memcpy(tracker->fl6, level0_.fl6, sizeof(tracker->fl6));
     memcpy(tracker->checksum, level0_.checksum, sizeof(tracker->checksum));  
140      memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum));      memcpy(tracker->pnum, level0_.pnum, sizeof(tracker->pnum));
141      memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum));          memcpy(tracker->cmdnum, level0_.cmdnum, sizeof(tracker->cmdnum));    
142      memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid));          memcpy(tracker->bid, level0_.bid, sizeof(tracker->bid));    
143      memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm));          memcpy(tracker->alarm, level0_.alarm, sizeof(tracker->alarm));    
144      memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr));                memcpy(tracker->aswr, level0_.aswr, sizeof(tracker->aswr));          
145        tracker->TOTDATAlength = level0_.TOTDATAlength;
146        memcpy(tracker->datatracker, level0_.datatracker, sizeof(tracker->datatracker));          
147        
148      cat <<  log4cpp::Priority::ERROR      cat <<  log4cpp::Priority::ERROR
149          <<  "Fortran77 function trkcalibpkt error code = " << ERROR          <<  "Fortran77 function trkcalibpkt error code = " << ERROR
150          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          <<  "\n " << log4cpp::CategoryStream::ENDLINE;

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

  ViewVC Help
Powered by ViewVC 1.1.23