Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RawDcsCanMonitorBlock.cxx

Go to the documentation of this file.
00001 
00002 // $Id: RawDcsCanMonitorBlock.cxx,v 1.2 2004/08/24 20:11:36 ebeall Exp $
00003 // 
00004 // RawDcsCanMonitorBlock 
00005 // 
00006 // RawDcsCanMonitorBlock is a Dcs CANBUS System Monitor Block
00007 //
00008 // Author:  E. Beall 2004-02-04
00009 //
00011 
00012 #include "RawData/RawDcsCanMonitorBlock.h"
00013 
00014 UInt_t RawDcsCanMonitorBlock::fgDebugFlags = 0;
00015 
00016 #include "MessageService/MsgService.h"
00017 CVSID("$Id: RawDcsCanMonitorBlock.cxx,v 1.2 2004/08/24 20:11:36 ebeall Exp $");
00018 #include "MessageService/MsgFormat.h"
00019 
00020 #include "RawData/RawBlockRegistry.h"
00021 REGISTERRAWBLOCK(RawDcsCanMonitorBlock,kMdBlockDcsCanMonitor,kMdBlockSourceDcs);
00022 
00023 ClassImp(RawDcsCanMonitorBlock)
00024 
00025 //_____________________________________________________________________________
00026 RawDcsCanMonitorBlock::RawDcsCanMonitorBlock()
00027 {
00028    // Default constructor
00029 }
00030 
00031 //_____________________________________________________________________________
00032 RawDcsCanMonitorBlock::RawDcsCanMonitorBlock(const Int_t *block)
00033    : RawDataBlock(block)
00034 {
00035    //  stored block format is:
00036    //---------------------
00037    //  0   # words in block
00038    //  1   checksum
00039    //  2   Block Id
00040    //-----
00041 }
00042 
00043 //_____________________________________________________________________________
00044 RawDcsCanMonitorBlock::~RawDcsCanMonitorBlock()
00045 {
00046    // dtor
00047 }
00048 
00049 //_____________________________________________________________________________
00050 std::ostream& RawDcsCanMonitorBlock::FormatToOStream(ostream& os, 
00051                                                      Option_t *option) const
00052 {
00053         RawDataBlock::FormatToOStream(os,option);
00054         if (option[0] == 'X') return os;
00055 
00056         Int_t numEntries=GetNumEntries();
00057         os << " Number of Entries " << numEntries
00058         << " Number of Events " << GetNumEvents() << endl;
00059         for(Int_t i = 0; i < numEntries; i++)
00060         {
00061                 os << "Timestamp " << GetTimeStamp(i).AsString("c") 
00062                 << " Power Supply ID " << GetPowerSupplyId(i) 
00063                 << " Voltage1 " << GetVoltage1(i) << " Voltage2 " << GetVoltage2(i)
00064                 << " Voltage3 " << GetVoltage3(i) << " Voltage4 " << GetVoltage4(i)
00065                 << " Current1 " << GetCurrent1(i) << " Current2 " << GetCurrent2(i)
00066                 << " Current3 " << GetCurrent3(i) << " Current4 " << GetCurrent4(i)
00067                 << " Temperature (integer) " << GetTemperatureInt(i) << endl;
00068         }
00069         return os;
00070 }
00071 
00072 void RawDcsCanMonitorBlock::FillCanArray() const
00073 {
00074 //off by 3 since the first three are 1:num words, 2: checksum
00075 // and 3:block ID
00076         CanArray = 3 + GetData();
00077 }
00078 
00079 Int_t RawDcsCanMonitorBlock::GetNumEntries() const
00080 {
00081 // remember, all versions
00082 // have offset of 3 due to first 3 longs)
00083         if((fSize-3)%12)
00084         {
00085                 MSG("RawData",Msg::kError)
00086                 << " Size of Can Block screwed up.  Have: "
00087                 << (fSize-3)%12 << " left over from modulo 12."
00088                 << endl;
00089                 return -1;
00090         }
00091         return ((fSize-3)/12);
00092 }
00093 
00094 Int_t RawDcsCanMonitorBlock::GetNumEvents() const
00095 {
00096         Int_t numEvents = 1;
00097         Int_t numEntries = GetNumEntries();
00098         FillCanArray();
00099 
00100         //seek throughout for the number of events (not entries)
00101         //so look for entries where
00102         // FOR CHILLER THERE IS ONLY ONE EVENT PER BLOCK
00103 
00104         numEvents=numEntries;
00105         return numEvents;
00106 }
00107 
00108 VldContext RawDcsCanMonitorBlock::GetVldContext() const
00109 {
00110 // build validity context
00111         RawBlockId rbid = GetBlockId();
00112         return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp(0));
00113 }
00114 
00115 Float_t RawDcsCanMonitorBlock::GetVoltage1(Int_t indx) const
00116 {
00117         FillCanArray();
00118         Float_t fValue = 0.0;
00119         memcpy(&fValue,&CanArray[(indx*12)+3],4);
00120         return fValue;
00121 }
00122 
00123 Float_t RawDcsCanMonitorBlock::GetVoltage2(Int_t indx) const
00124 {
00125         FillCanArray();
00126         Float_t fValue = 0.0;
00127         memcpy(&fValue,&CanArray[(indx*12)+4],4);
00128         return fValue;
00129 }
00130 
00131 Float_t RawDcsCanMonitorBlock::GetVoltage3(Int_t indx) const
00132 {
00133         FillCanArray();
00134         Float_t fValue = 0.0;
00135         memcpy(&fValue,&CanArray[(indx*12)+5],4);
00136         return fValue;
00137 }
00138 
00139 Float_t RawDcsCanMonitorBlock::GetVoltage4(Int_t indx) const
00140 {
00141         FillCanArray();
00142         Float_t fValue = 0.0;
00143         memcpy(&fValue,&CanArray[(indx*12)+6],4);
00144         return fValue;
00145 }
00146 
00147 Float_t RawDcsCanMonitorBlock::GetCurrent1(Int_t indx) const
00148 {
00149         FillCanArray();
00150         Float_t fValue = 0.0;
00151         memcpy(&fValue,&CanArray[(indx*12)+7],4);
00152         return fValue;
00153 }
00154 
00155 Float_t RawDcsCanMonitorBlock::GetCurrent2(Int_t indx) const
00156 {
00157         FillCanArray();
00158         Float_t fValue = 0.0;
00159         memcpy(&fValue,&CanArray[(indx*12)+8],4);
00160         return fValue;
00161 }
00162 
00163 Float_t RawDcsCanMonitorBlock::GetCurrent3(Int_t indx) const
00164 {
00165         FillCanArray();
00166         Float_t fValue = 0.0;
00167         memcpy(&fValue,&CanArray[(indx*12)+9],4);
00168         return fValue;
00169 }
00170 
00171 Float_t RawDcsCanMonitorBlock::GetCurrent4(Int_t indx) const
00172 {
00173         FillCanArray();
00174         Float_t fValue = 0.0;
00175         memcpy(&fValue,&CanArray[(indx*12)+10],4);
00176         return fValue;
00177 }
00178 
00179 

Generated on Mon Feb 15 11:07:28 2010 for loon by  doxygen 1.3.9.1