/[PAMELA software]/yoda/event/EventCounter.cpp
ViewVC logotype

Diff of /yoda/event/EventCounter.cpp

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

revision 1.3 by kusanagi, Tue Jul 6 14:07:24 2004 UTC revision 1.6 by kusanagi, Thu Aug 19 15:24:10 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvsmanager/yoda/event/EventCounter.cpp,v $   * $Source: /home/cvsmanager/yoda/event/EventCounter.cpp,v $
3   * $Id: EventCounter.cpp,v 1.2 2004/07/06 13:31:14 kusanagi Exp $   * $Id: EventCounter.cpp,v 1.5 2004/07/29 16:18:53 kusanagi Exp $
4   * $Author: kusanagi $   * $Author: kusanagi $
5   *   *
6   * Implementation of the EventCounter class.   * Implementation of the EventCounter class.
# Line 10  Line 10 
10  #include "EventCounter.h"  #include "EventCounter.h"
11  #include "PscuHeader.h"  #include "PscuHeader.h"
12    
13  static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.raw.EventCounter");    static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.EventCounter");  
14    
15  using namespace pamela;  using namespace pamela;
16    
# Line 20  using namespace pamela; Line 20  using namespace pamela;
20   */   */
21  EventCounter::EventCounter(int run):  EventCounter::EventCounter(int run):
22    // New Packets.    // New Packets.
23    Pscu(-1),    Pscu(0),
24    Physics(-1),    PhysEndRun(0),
25    Forced_Pkt(-1),    CalibCalPulse1(0),
26    Calib_Trk1(-1),    CalibCalPulse2(0),
27    Calib_Trk2(-1),    Physics(0),
28    Calib_Cal(-1),    CalibTrkBoth(0),
29    Calib_CalPed(-1),    Calib_Trk1(0),
30    Calib_Trd(-1),    Calib_Trk2(0),
31    Calib_Tof(-1),    Calib_Trd(0),
32    Calib_S4(-1),    Calib_Tof(0),
33    Run_Header(-1),    Calib_S4(0),
34    Run_Trailer(-1),    Calib_CalPed(0),
35    Alarm(-1),    Calib_Ac(0),
36    Khb(-1),    Run_Header(0),
37    Log(-1),    Run_Trailer(0),
38    VarDump(-1),    CalibHeader(0),
39    ArrDump(-1),    CalibTrailer(0),
40    TabDump(-1),    InitHeader(0),
41    Tmtc(-1),    InitTrailer(0),
42    Mcmd(-1),    EventTrk(0),
43    HA_Header_E5(-1),    TestTrk(0),
44      Log(0),
45      VarDump(0),
46      ArrDump(0),
47      TabDump(0),
48      Tmtc(0),
49      Mcmd(0),
50      ForcedFECmd(0),
51      AcInit(0),
52      CalInit(0),
53      TrkInit(0),
54      TofInit(0),
55      TrgInit(0),
56    RunNumber(run) {    RunNumber(run) {
57    CMap.insert(CounterMap::value_type(PacketType::Pscu, &Pscu));      CMap.insert(CounterMap::value_type(PacketType::Pscu,            &Pscu));
58    CMap.insert(CounterMap::value_type(PacketType::Physics, &Physics));      CMap.insert(CounterMap::value_type(PacketType::PhysEndRun,      &PhysEndRun));
59    CMap.insert(CounterMap::value_type(PacketType::ForcedPkt, &Forced_Pkt));      CMap.insert(CounterMap::value_type(PacketType::CalibCalPulse2,  &CalibCalPulse1));
60    CMap.insert(CounterMap::value_type(PacketType::CalibTrk1, &Calib_Trk1));      CMap.insert(CounterMap::value_type(PacketType::CalibCalPulse2,  &CalibCalPulse2));
61    CMap.insert(CounterMap::value_type(PacketType::CalibTrk2, &Calib_Trk2));      CMap.insert(CounterMap::value_type(PacketType::Physics,         &Physics));
62    CMap.insert(CounterMap::value_type(PacketType::CalibCal, &Calib_Cal));      CMap.insert(CounterMap::value_type(PacketType::CalibTrkBoth,    &CalibTrkBoth));
63    CMap.insert(CounterMap::value_type(PacketType::CalibTrd, &Calib_Trd));      CMap.insert(CounterMap::value_type(PacketType::CalibTrk1,       &Calib_Trk1));
64    CMap.insert(CounterMap::value_type(PacketType::CalibTof, &Calib_Tof));      CMap.insert(CounterMap::value_type(PacketType::CalibTrk2,       &Calib_Trk2));
65    CMap.insert(CounterMap::value_type(PacketType::CalibS4, &Calib_S4));      CMap.insert(CounterMap::value_type(PacketType::CalibTrd,        &Calib_Trd));
66    CMap.insert(CounterMap::value_type(PacketType::RunHeader, &Run_Header));      CMap.insert(CounterMap::value_type(PacketType::CalibTof,        &Calib_Tof));
67    CMap.insert(CounterMap::value_type(PacketType::RunTrailer, &Run_Trailer));      CMap.insert(CounterMap::value_type(PacketType::CalibS4,         &Calib_S4));
68    CMap.insert(CounterMap::value_type(PacketType::Alarm, &Alarm));      CMap.insert(CounterMap::value_type(PacketType::CalibCalPed,     &Calib_CalPed));
69    CMap.insert(CounterMap::value_type(PacketType::Khb, &Khb));      CMap.insert(CounterMap::value_type(PacketType::CalibAc,         &Calib_Ac));
70    CMap.insert(CounterMap::value_type(PacketType::Log, &Log));      CMap.insert(CounterMap::value_type(PacketType::RunHeader,       &Run_Header));
71    CMap.insert(CounterMap::value_type(PacketType::VarDump, &VarDump));      CMap.insert(CounterMap::value_type(PacketType::RunTrailer,      &Run_Trailer));
72    CMap.insert(CounterMap::value_type(PacketType::ArrDump, &ArrDump));      CMap.insert(CounterMap::value_type(PacketType::CalibHeader,     &CalibHeader));
73    CMap.insert(CounterMap::value_type(PacketType::TabDump, &TabDump));      CMap.insert(CounterMap::value_type(PacketType::CalibTrailer,    &CalibTrailer));  
74    CMap.insert(CounterMap::value_type(PacketType::Tmtc, &Tmtc));      CMap.insert(CounterMap::value_type(PacketType::InitHeader,      &InitHeader));
75    CMap.insert(CounterMap::value_type(PacketType::Mcmd, &Mcmd));      CMap.insert(CounterMap::value_type(PacketType::InitTrailer,     &InitTrailer));  
76    CMap.insert(CounterMap::value_type(PacketType::HA_Header_E5, &HA_Header_E5));      CMap.insert(CounterMap::value_type(PacketType::EventTrk,        &EventTrk));  
77        CMap.insert(CounterMap::value_type(PacketType::TestTrk,         &TestTrk));  
78        CMap.insert(CounterMap::value_type(PacketType::Log,             &Log));
79        CMap.insert(CounterMap::value_type(PacketType::VarDump,         &VarDump));
80        CMap.insert(CounterMap::value_type(PacketType::ArrDump,         &ArrDump));
81        CMap.insert(CounterMap::value_type(PacketType::TabDump,         &TabDump));
82        CMap.insert(CounterMap::value_type(PacketType::Tmtc,            &Tmtc));
83        CMap.insert(CounterMap::value_type(PacketType::Mcmd,            &Mcmd));
84        CMap.insert(CounterMap::value_type(PacketType::ForcedFECmd,     &ForcedFECmd));
85        CMap.insert(CounterMap::value_type(PacketType::AcInit,          &AcInit));
86        CMap.insert(CounterMap::value_type(PacketType::CalInit,         &CalInit));
87        CMap.insert(CounterMap::value_type(PacketType::TrkInit,         &TrkInit));
88        CMap.insert(CounterMap::value_type(PacketType::TofInit,         &TofInit));
89        CMap.insert(CounterMap::value_type(PacketType::TrgInit,         &TrgInit));
90  }  }
91    
92  /**  /**
# Line 73  void EventCounter::Increment(PacketType Line 98  void EventCounter::Increment(PacketType
98    if (p != CMap.end()) {    if (p != CMap.end()) {
99      int *counter = p->second;      int *counter = p->second;
100      (*counter)++;      (*counter)++;
101      cat <<  log4cpp::Priority::INFO      cat <<  log4cpp::Priority::DEBUG
102          <<  " Counter." <<  type->GetName() << " = " <<  (*counter)          <<  " Counter." <<  type->GetName() << " = " <<  (*counter)
103          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          <<  "\n " << log4cpp::CategoryStream::ENDLINE;
104    } else {    } else {
105      cat <<  log4cpp::Priority::INFO      cat <<  log4cpp::Priority::WARN
106          <<  " No counter for packet type " <<  type->GetName()          <<  " No counter for packet type " <<  type->GetName()
107          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          <<  "\n " << log4cpp::CategoryStream::ENDLINE;
108    }    }
# Line 97  int EventCounter::Get(PacketType const * Line 122  int EventCounter::Get(PacketType const *
122      const int *counter = p->second;      const int *counter = p->second;
123      return *counter;      return *counter;
124    } else {    } else {
125          cat <<  log4cpp::Priority::INFO          cat <<  log4cpp::Priority::WARN
126          <<  " No counter for packet type " <<  type->GetName()          <<  " No counter for packet type " <<  type->GetName()
127          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          <<  "\n " << log4cpp::CategoryStream::ENDLINE;
128      return -1;      return -1;

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

  ViewVC Help
Powered by ViewVC 1.1.23