00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include "RawData/RawOvershootBlock.h"
00013 #include <cassert>
00014
00015 UInt_t RawOvershootBlock::fgDebugFlags = 0;
00016
00017 #include "MessageService/MsgService.h"
00018 CVSID("$Id: RawOvershootBlock.cxx,v 1.11 2005/08/26 19:04:53 rhatcher Exp $");
00019
00020 #include "RawData/RawBlockRegistry.h"
00021 REGISTERRAWBLOCK(RawOvershootBlock,kMdBlockVaOvershoot,0);
00022
00023 ClassImp(RawOvershootBlock)
00024
00025 enum EOvershootBlkPos {
00026 indx_size = 0,
00027 indx_checksum = 1,
00028 indx_blockid = 2,
00029 zzzz_last = 3
00030 };
00031
00032
00033 RawOvershootBlock::RawOvershootBlock() : fUnpacked(false)
00034 {
00035
00036 }
00037
00038
00039 RawOvershootBlock::RawOvershootBlock(const Int_t *block)
00040 : RawDataBlock(block), fUnpacked(false)
00041 {
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 }
00055
00056
00057 RawOvershootBlock::RawOvershootBlock(const VldContext& ,
00058 const RCIdToTickMap& )
00059 : RawDataBlock(), fUnpacked(false)
00060 {
00061
00062 MSG("Raw",Msg::kError)
00063 << "RawOVershootBlock ctor using RCIdToTickMap is not yet implemented"
00064 << endl;
00065 assert(0);
00066 }
00067
00068
00069 RawOvershootBlock::~RawOvershootBlock()
00070 {
00071
00072 }
00073
00074
00075 RawOvershootBlock& RawOvershootBlock::operator=(const RawOvershootBlock& rhs)
00076 {
00077
00078 if (this != &rhs) {
00079 RawDataBlock::operator=(rhs);
00080
00081 fUnpacked = false;
00082 fOvershootChannels.clear();
00083 }
00084 return *this;
00085 }
00086
00087
00088 std::ostream& RawOvershootBlock::FormatToOStream(std::ostream& os,
00089 Option_t *option) const
00090 {
00091 RawDataBlock::FormatToOStream(os,option);
00092 if (option[0] == 'X') return os;
00093
00094 FillOvershootChannels();
00095 RCIdToTickMapConstIter iter = fOvershootChannels.begin();
00096 while (iter != fOvershootChannels.end()) {
00097 RCIdTickPair pair = *iter;
00098 os << " " << pair.first.AsString("e")
00099 << " was hits just " << pair.second << " ticks ago"
00100 << endl;
00101 iter++;
00102 }
00103 os << endl;
00104
00105 return os;
00106 }
00107
00108
00109 void RawOvershootBlock::FillOvershootChannels() const
00110 {
00111
00112
00113 Detector::Detector_t det = GetBlockId().GetDetector();
00114
00115 ElecType::Elec_t elec = ElecType::kVA;
00116
00117 Int_t crate = -1;
00118 Int_t* ptr = fRawBlock+zzzz_last;
00119 while (ptr < fRawBlock+fSize) {
00120
00121 crate++;
00122 int ndead = *ptr; ptr++;
00123 for (int i=0; i<ndead; i++) {
00124 Int_t tmp = *ptr; ptr++;
00125 Int_t chad = tmp & 0x1fff;
00126 Int_t ticks = tmp>>13;
00127 RawChannelId rcid(det,elec,crate,chad);
00128 fOvershootChannels[rcid] = ticks;
00129 }
00130 }
00131 }
00132
00133
00134