/[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.3 by kusanagi, Fri Aug 20 15:01:50 2004 UTC revision 1.5 by kusanagi, Tue Sep 21 20:24:53 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v $   * $Source: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v $
3   * $Id: CalorimeterReader.cpp,v 1.2 2004/08/19 15:24:58 kusanagi Exp $   * $Id: CalorimeterReader.cpp,v 1.4 2004/08/24 08:00:12 kusanagi Exp $
4   * $Author: kusanagi $   * $Author: kusanagi $
5   *   *
6   * Implementation of the CalorimeterReader class.   * Implementation of the CalorimeterReader class.
7   */   */
8    
9    
10    #include <iostream>
11  #include <string>  #include <string>
12  #include <log4cpp/Category.hh>  #include <log4cxx/logger.h>
13  #include "CalorimeterReader.h"  #include "CalorimeterReader.h"
14    
15  extern "C" {  extern "C" {
# Line 33  extern "C" { Line 35  extern "C" {
35  using namespace pamela;  using namespace pamela;
36  using namespace pamela::calorimeter;  using namespace pamela::calorimeter;
37    
38  static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.calorimeter.CalorimeterReader");    static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.calorimeter.CalorimeterReader"));
39    
40  /**  /**
41   * Constructor.       * Constructor.    
42   */   */
43  CalorimeterReader::CalorimeterReader(void):  CalorimeterReader::CalorimeterReader(void):
44    TechmodelAlgorithm(PacketType::Physics, "TechmodelCalorimeterReader") {    TechmodelAlgorithm(PacketType::Physics, "TechmodelCalorimeterReader") {
45    cat.debug("Constructor");    logger->debug(_T("Construnctor"));
46    calorimeter = new CalorimeterEvent();    calorimeter = new CalorimeterEvent();
47  }  }
48    
# Line 49  CalorimeterReader::CalorimeterReader(voi Line 51  CalorimeterReader::CalorimeterReader(voi
51   */   */
52  std::string CalorimeterReader::GetVersionInfo(void) const {  std::string CalorimeterReader::GetVersionInfo(void) const {
53    return    return
54      "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.2 2004/08/19 15:24:58 kusanagi Exp $";      "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.4 2004/08/24 08:00:12 kusanagi Exp $";
55  }  }
56    
57  /**  /**
# Line 57  std::string CalorimeterReader::GetVersio Line 59  std::string CalorimeterReader::GetVersio
59   * event reader routines for all packet types.   * event reader routines for all packet types.
60   */   */
61  void CalorimeterReader::Init(PamelaRun *run) {  void CalorimeterReader::Init(PamelaRun *run) {
62      logger->debug(_T("Initialize"));
63    SetInputStream(run);    SetInputStream(run);
64    run->WriteSubPacket(this, &calorimeter, calorimeter->Class());    run->WriteSubPacket(this, &calorimeter, calorimeter->Class());
65  }  }
# Line 72  void CalorimeterReader::RunEvent(int Eve Line 75  void CalorimeterReader::RunEvent(int Eve
75   * Unpack the Calorimeter data event from the physical packet.   * Unpack the Calorimeter data event from the physical packet.
76   */   */
77  void CalorimeterReader::RunEvent(int EventNumber, const char subData[], long int length) {  void CalorimeterReader::RunEvent(int EventNumber, const char subData[], long int length) {
78      char data[length];      std::stringstream oss;      
79        char *data = new char[length];
80      memcpy(data, subData, length);      memcpy(data, subData, length);
81      int  ERROR = 0;      int  ERROR = 0;
82            
# Line 89  void CalorimeterReader::RunEvent(int Eve Line 93  void CalorimeterReader::RunEvent(int Eve
93          switch (ERROR){          switch (ERROR){
94              case 1: errmsg = "CALORIMETER NOT FOUND";              case 1: errmsg = "CALORIMETER NOT FOUND";
95          }          }
96          cat <<  log4cpp::Priority::ERROR          oss.flush();
97              <<  "Fortran77 function calunpack error code = " << ERROR          oss << "Fortran77 function calunpack: " <<  errmsg;
98              <<  errmsg          logger->warn(oss.str().c_str());
             <<  "\n " << log4cpp::CategoryStream::ENDLINE;  
99      } else {      } else {
100          calorimeter->IEV2   = evento_.IEV2;          calorimeter->IEV2   = evento_.IEV2;
101          calorimeter->stwerr = evento_.stwerr;          calorimeter->stwerr = evento_.stwerr;
# Line 130  void CalorimeterReader::RunEvent(int Eve Line 133  void CalorimeterReader::RunEvent(int Eve
133          memcpy(calorimeter->calDSPtaberr,   evento_.calDSPtaberr,   sizeof(calorimeter->calDSPtaberr));          memcpy(calorimeter->calDSPtaberr,   evento_.calDSPtaberr,   sizeof(calorimeter->calDSPtaberr));
134          memcpy(calorimeter->calevnum,       evento_.calevnum,       sizeof(calorimeter->calevnum));          memcpy(calorimeter->calevnum,       evento_.calevnum,       sizeof(calorimeter->calevnum));
135      }      }
136        delete[] data;
137  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.23