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

RawOvershootBlock.cxx

Go to the documentation of this file.
00001 
00002 // $Id: RawOvershootBlock.cxx,v 1.11 2005/08/26 19:04:53 rhatcher Exp $
00003 // 
00004 // RawOvershootBlock 
00005 // 
00006 // RawOvershootBlock holds list of delta-t's as gleaned from BRP info
00007 //
00008 // Author:  R. Hatcher 2001.11.07
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    // Default constructor
00036 }
00037 
00038 //_____________________________________________________________________________
00039 RawOvershootBlock::RawOvershootBlock(const Int_t *block)
00040    : RawDataBlock(block), fUnpacked(false)
00041 {
00042    //  stored block format is:
00043    //---------------------
00044    //  0   # words in block
00045    //  1   checksum
00046    //  2   Block Id
00047    //-----
00048    //  3      # dead chips in crate 0
00049    //  4      time <<13 || chad for channel hit in previous 55us
00050    //  5      time <<13 || chad ...
00051    //  3+N0   # dead chips in crate 1
00052    //  3+N0+1 time <<13 || chad ...
00053    //   ...
00054 }
00055 
00056 //_____________________________________________________________________________
00057 RawOvershootBlock::RawOvershootBlock(const VldContext& /* vldc */,
00058                                      const RCIdToTickMap& /* inmap */)
00059    : RawDataBlock(), fUnpacked(false)
00060 {
00061    // create a RawOvershootBlock from a STL map of <RawChannelId,UInt_t>'s
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    // dtor
00072 }
00073 
00074 //____________________________________________________________________________
00075 RawOvershootBlock& RawOvershootBlock::operator=(const RawOvershootBlock& rhs)
00076 {
00077    // deep copy assignment 
00078    if (this != &rhs) {
00079      RawDataBlock::operator=(rhs);
00080      // clear the unpacked info to allow it to be re-filled
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    // unpack the data into a STL map of <RawChannelId,UInt_t>'s
00112 
00113    Detector::Detector_t det = GetBlockId().GetDetector();
00114    // assume this block is only sensible for VA electronics
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       // start of new crate
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 //_____________________________________________________________________________

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