/[PAMELA software]/yoda/techmodel/CalibCalPedReader.cpp
ViewVC logotype

Diff of /yoda/techmodel/CalibCalPedReader.cpp

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

revision 1.6 by kusanagi, Tue Aug 24 16:01:57 2004 UTC revision 1.7 by kusanagi, Tue Sep 21 20:24:33 2004 UTC
# Line 1  Line 1 
1    
2  #define BYTE  unsigned char  #define BYTE  unsigned char
3  #include <string>  #include <string>
4  #include <log4cpp/Category.hh>  #include <log4cxx/logger.h>
5  #include <fstream>  #include <fstream>
6  #include "stdio.h"  #include "stdio.h"
7  extern "C" {  extern "C" {
# Line 29  extern "C" { Line 29  extern "C" {
29  using namespace pamela;  using namespace pamela;
30  using namespace pamela::techmodel;  using namespace pamela::techmodel;
31    
32  static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibCalPedReader");    static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.CalibCalPedReader"));
33    
34  /**  /**
35   * Constructor.   * Constructor.
36   */   */
37  CalibCalPedReader::CalibCalPedReader(void):  CalibCalPedReader::CalibCalPedReader(void):
38    TechmodelAlgorithm(PacketType::Log, "TechmodelCalibCalPedReader") {    TechmodelAlgorithm(PacketType::Log, "TechmodelCalibCalPedReader") {
39    cat <<  log4cpp::Priority::DEBUG    logger->debug(_T("Constructor"));
       <<  "Constructor "  
       <<  "\n " << log4cpp::CategoryStream::ENDLINE;  
40    calibCalPed = new CalibCalPedEvent();    calibCalPed = new CalibCalPedEvent();
41  }  }
42    
# Line 47  CalibCalPedReader::CalibCalPedReader(voi Line 45  CalibCalPedReader::CalibCalPedReader(voi
45   */   */
46  std::string CalibCalPedReader::GetVersionInfo(void) const {  std::string CalibCalPedReader::GetVersionInfo(void) const {
47    return    return
48      "$Header: /home/cvsmanager/yoda/techmodel/CalibCalPedReader.cpp,v 1.5 2004/08/20 15:01:41 kusanagi Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/CalibCalPedReader.cpp,v 1.6 2004/08/24 16:01:57 kusanagi Exp $\n";
49  }  }
50    
51  /**  /**
# Line 55  std::string CalibCalPedReader::GetVersio Line 53  std::string CalibCalPedReader::GetVersio
53   * event reader routines for all packet types.   * event reader routines for all packet types.
54   */   */
55  void CalibCalPedReader::Init(PamelaRun *run) {  void CalibCalPedReader::Init(PamelaRun *run) {
56      logger->debug(_T("Initialize"));
57    SetInputStream(run);    SetInputStream(run);
58    run->WriteSubPacket(this, &calibCalPed, calibCalPed->Class());    run->WriteSubPacket(this, &calibCalPed, calibCalPed->Class());
59  }  }
# Line 63  void CalibCalPedReader::Init(PamelaRun * Line 62  void CalibCalPedReader::Init(PamelaRun *
62   * Unpack the CalibCalPed event from an input file.   * Unpack the CalibCalPed event from an input file.
63   */   */
64  void CalibCalPedReader::RunEvent(int EventNumber, long int length) {  void CalibCalPedReader::RunEvent(int EventNumber, long int length) {
65        stringstream oss;      
66      char        *packetData;      char        *packetData;
67      char        CRCevent[2];      char        CRCevent[2];
68      UINT16      calculatedCRC    = 0;   //calculated CRC      UINT16      calculatedCRC    = 0;   //calculated CRC
# Line 86  void CalibCalPedReader::RunEvent(int Eve Line 85  void CalibCalPedReader::RunEvent(int Eve
85              switch (ERROR){              switch (ERROR){
86                  case 1: errmsg = "CALORIMETER NOT FOUND";                  case 1: errmsg = "CALORIMETER NOT FOUND";
87              }              }
88              cat <<  log4cpp::Priority::ERROR              oss.flush();
89                  <<  "Fortran77 function calpedestal error code = " << ERROR              oss << "Fortran77 function calpulse error code = " << ERROR
90                  <<  errmsg                  <<  errmsg;
91                  <<  "\n " << log4cpp::CategoryStream::ENDLINE;              logger->warn(oss.str().c_str());
92          } else {          } else {
93            //Store the unpacked data            //Store the unpacked data
94              calibCalPed->IEV2 = calib_.IEV2;              calibCalPed->IEV2 = calib_.IEV2;
# Line 133  void CalibCalPedReader::RunEvent(int Eve Line 132  void CalibCalPedReader::RunEvent(int Eve
132          //-----------------------------------------------------------------------------------------          //-----------------------------------------------------------------------------------------
133          }          }
134      } else {      } else {
135              cat <<  log4cpp::Priority::ERROR          logger->warn(_T("The test of calculated CRC with one wrote on file FAILED!!"));
             <<  "The test of calculated CRC with one wrote on file FAILED!!"  
             <<  "\n " << log4cpp::CategoryStream::ENDLINE;      
136      }      }
137      delete [] packetData;      delete [] packetData;
138  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23