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

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

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

revision 1.1 by kusanagi, Sat Jul 17 20:03:48 2004 UTC revision 1.4 by kusanagi, Tue Aug 24 08:00:12 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $   * $Source: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v $
3   * $Id: TrackerReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $   * $Id: CalorimeterReader.cpp,v 1.3 2004/08/20 15:01:50 kusanagi Exp $
4   * $Author: kusanagi $   * $Author: kusanagi $
5   *   *
6   * Implementation of the CalorimeterReader class.   * Implementation of the CalorimeterReader class.
# Line 14  extern "C" { Line 14  extern "C" {
14        
15   extern struct {   extern struct {
16          int IEV2;          int IEV2;
17          int dexy[96][22][2];          int stwerr;
18          int dexyc[96][22][2];          int perror;
19          int base[96][22][2];          int dexy[2][22][96];
20          int calselftrig[7][4];          int dexyc[2][22][96];
21            int base[2][22][96];
22            int calselftrig[4][7];
23          int calIItrig[4];          int calIItrig[4];
24          int calstripshift[4];          int calstripshift[4];
25          int calDSPtaberr[4];          int calDSPtaberr[4];
26          int calevnum[4];          int calevnum[4];
27      } evento_;      } evento_;
28    
29      int calunpack_(unsigned short[], long int*, int*);      void calunpack_(short[], long int*, int*);
30      //Struct per il passaggio di dati da e verso la chiamata fortran      //Struct per il passaggio di dati da e verso la chiamata fortran
31  }  }
32    
# Line 47  CalorimeterReader::CalorimeterReader(voi Line 49  CalorimeterReader::CalorimeterReader(voi
49   */   */
50  std::string CalorimeterReader::GetVersionInfo(void) const {  std::string CalorimeterReader::GetVersionInfo(void) const {
51    return    return
52      "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $";      "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.3 2004/08/20 15:01:50 kusanagi Exp $";
53  }  }
54    
55  /**  /**
# Line 78  void CalorimeterReader::RunEvent(int Eve Line 80  void CalorimeterReader::RunEvent(int Eve
80      for (int i = 0; i<length; i++){      for (int i = 0; i<length; i++){
81          convdata[i] = (unsigned short)((unsigned char)subData[i]&0xFF);          convdata[i] = (unsigned short)((unsigned char)subData[i]&0xFF);
82      }      }
       
       
     //Call to the routine that unpack calorimeter events  
     ERROR = calunpack_(convdata, &length, &ERROR);  
83                    
84      calorimeter->IEV2 = evento_.IEV2;      //Call to the routine that unpack calorimeter events
85      memcpy(calorimeter->dexy,           evento_.dexy,           sizeof(calorimeter->dexy));      calunpack_((short*)convdata, &length, &ERROR);
86      memcpy(calorimeter->dexyc,          evento_.dexyc,          sizeof(calorimeter->dexyc));  
87      memcpy(calorimeter->base,           evento_.base,           sizeof(calorimeter->base));      if (ERROR != 0) {
88      memcpy(calorimeter->calselftrig,    evento_.calselftrig,    sizeof(calorimeter->calselftrig));          char *errmsg;
89      memcpy(calorimeter->calIItrig,      evento_.calIItrig,      sizeof(calorimeter->calIItrig));          switch (ERROR){
90      memcpy(calorimeter->calstripshift,  evento_.calstripshift,  sizeof(calorimeter->calstripshift));              case 1: errmsg = "CALORIMETER NOT FOUND";
91      memcpy(calorimeter->calDSPtaberr,   evento_.calDSPtaberr,   sizeof(calorimeter->calDSPtaberr));          }
92      memcpy(calorimeter->calevnum,       evento_.calevnum,       sizeof(calorimeter->calevnum));          cat <<  log4cpp::Priority::ERROR
93                <<  "Fortran77 function calunpack: " <<  errmsg
94      cat <<  log4cpp::Priority::ERROR              <<  "\n " << log4cpp::CategoryStream::ENDLINE;
95          <<  "Fortran77 function calunpack error code = " << ERROR      } else {
96          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          calorimeter->IEV2   = evento_.IEV2;
97            calorimeter->stwerr = evento_.stwerr;
98            calorimeter->perror = evento_.perror;
99    
100        //--------have to invert array because of FORTRAN <-> C different management of the indexes
101            int tempDexy[96][22][2];
102            int tempDexyc[96][22][2];
103            int tempBase[96][22][2];
104            int tempCalselftrig[7][4];
105            memcpy(tempDexy,           evento_.dexy,           sizeof(tempDexy));
106            memcpy(tempDexyc,          evento_.dexyc,          sizeof(tempDexyc));
107            memcpy(tempBase,           evento_.base,           sizeof(tempBase));
108            memcpy(tempCalselftrig,    evento_.calselftrig,    sizeof(tempCalselftrig));
109    
110            for (int i = 0; i < 4; i++){
111                for (int j = 0; j < 7; j++){
112                    calorimeter->calselftrig[i][j] = tempCalselftrig[j][i];
113                }
114            }
115    
116            for (int i = 0; i < 2; i++){
117                for (int j = 0; j < 22; j++){
118                    for (int z = 0; z < 96; z++){
119                        calorimeter->dexy[i][j][z] = tempDexy[z][j][i];
120                        calorimeter->dexyc[i][j][z] = tempDexyc[z][j][i];
121                        calorimeter->base[i][j][z] = tempBase[z][j][i];
122                    }
123                }
124            }
125        //-----------------------------------------------------------------------------------------
126    
127            memcpy(calorimeter->calIItrig,      evento_.calIItrig,      sizeof(calorimeter->calIItrig));
128            memcpy(calorimeter->calstripshift,  evento_.calstripshift,  sizeof(calorimeter->calstripshift));
129            memcpy(calorimeter->calDSPtaberr,   evento_.calDSPtaberr,   sizeof(calorimeter->calDSPtaberr));
130            memcpy(calorimeter->calevnum,       evento_.calevnum,       sizeof(calorimeter->calevnum));
131        }
132  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.23