RawDigitDataBlock Class Reference

#include <RawDigitDataBlock.h>

Inheritance diagram for RawDigitDataBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawDigitDataBlock ()
 RawDigitDataBlock (const Int_t *block)
virtual ~RawDigitDataBlock ()
Int_t GetNumberOfDigits () const
Short_t GetNumberOfCrates () const
Short_t GetNPedModeCrates () const
Short_t GetNSparsModeCrates () const
Short_t GetNCommonModeCrates () const
Int_t GetNumOfErrorDigits () const
Char_t GetSeenErrorMaskQIE () const
Char_t GetSeenErrorMaskVA () const
Int_t IsOverlapTfBoundary () const
void ClearUnpackedRawDigits () const
const RawDigitAt (Int_t idx) const
virtual TIter GetDatumIter (Bool_t dir=kIterForward) const
Int_t IndexOf (RawDigit *rawdigit) const
VldContext GetVldContext () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawDigitDataBlock (const RawDigitDataBlock &rhs)
RawDigitDataBlockoperator= (const RawDigitDataBlock &rhs)

Static Public Member Functions

static void SetDebugFlags (const UInt_t dbgflgs)
static UInt_t GetDebugFlags ()

Protected Member Functions

virtual void FillRawDigits () const
virtual void PostFillRawDigits () const
virtual void FillCrateModes () const

Protected Attributes

TObjArray * fRawCrateStatuses
TObjArray * fRawDigits
 not written out
Short_t fCrates
 not written out
Short_t fNPedMode
 # of crates
Short_t fNSparsMode
 # crates w/ ped mode
Short_t fNCommonMode
 # crates w/ spars mode
Char_t fSeenErrorsQIE
 # crates w/ common mode
Char_t fSeenErrorsVA
 mask of all error bits in blk

Static Private Attributes

static UInt_t fgDebugFlags = 0
 mask of all error bits in blk

Detailed Description

Definition at line 27 of file RawDigitDataBlock.h.


Constructor & Destructor Documentation

RawDigitDataBlock::RawDigitDataBlock (  ) 

Definition at line 47 of file RawDigitDataBlock.cxx.

00047                                      :
00048    fRawCrateStatuses(0), fRawDigits(0), 
00049    fCrates(-1), fNPedMode(0), fNSparsMode(0), fNCommonMode(0),
00050    fSeenErrorsQIE(0), fSeenErrorsVA(0)
00051 {
00052    // Default constructor
00053 }

RawDigitDataBlock::RawDigitDataBlock ( const Int_t *  block  ) 

Definition at line 56 of file RawDigitDataBlock.cxx.

00057    : RawDataBlock(block), 
00058      fRawCrateStatuses(0), fRawDigits(0),
00059      fCrates(-1), fNPedMode(0), fNSparsMode(0), fNCommonMode(0),
00060      fSeenErrorsQIE(0), fSeenErrorsVA(0)
00061 {
00062    //  stored block format is:
00063    //---------------------
00064    //  0   # words in block
00065    //  1   checksum
00066    //  2   Block Id
00067    //-----
00068    //  3   Crate # i (+extra)
00069    //  4   # of crate entries (N_i)
00070    //  5   Crate T0_i sec
00071    //  6   Crate T0_i nsec
00072    //-----
00073    //  7   readout 1_i word 1
00074    //  8   readout 1_i word 2
00075    //      < truth PlexStripEndId if Reroot data>
00076    //      readout 2_i word 1
00077    //      readout 2_i word 2
00078    //      ...
00079    //      readout N_i word 1
00080    //      readout N_i word 2
00081    //-----
00082    //  x   Crate # j (+extra)
00083    //      # of crate entries (N_j)
00084    //      Crate T0_j sec
00085    //      Crate T0_j nsec
00086    //-----
00087    //      readout 1_j word 1
00088    //      readout 1_j word 2
00089    //  ...
00090 
00091 }

RawDigitDataBlock::~RawDigitDataBlock (  )  [virtual]

Definition at line 94 of file RawDigitDataBlock.cxx.

References ClearUnpackedRawDigits().

00095 {
00096    ClearUnpackedRawDigits();
00097    return;
00098 }

RawDigitDataBlock::RawDigitDataBlock ( const RawDigitDataBlock rhs  )  [inline]

Definition at line 60 of file RawDigitDataBlock.h.

00061      : RawDataBlock(rhs), fRawCrateStatuses(0), fRawDigits(0),
00062      fCrates(-1),fNPedMode(0), fNSparsMode(0), fNCommonMode(0) { ; }


Member Function Documentation

const RawDigit * RawDigitDataBlock::At ( Int_t  idx  )  const

Definition at line 266 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

Referenced by FitTrackMSListModule::Ana(), StripCands::Ana(), CandDigitModule::Ana(), NtpSRModule::FillNtpTimeStatus(), NtpSRBleachFiller::GetlateBucketPHFraction(), Truthifier::GetRawDigit(), Truthifier::GetSignal(), Cutter::NDErrorCutter(), Cutter::OverShootCutter(), MergeEvent::Reco(), AlgMergeEvent::RunAlg(), AlgStripSRList::RunAlg(), and AlgCalDetSI::RunAlg().

00267 {
00268    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00269    // return pointer to the i-th element
00270    
00271    if ( ! fRawDigits ) FillRawDigits();
00272    return (RawDigit*) fRawDigits->At(idx);
00273 }

void RawDigitDataBlock::ClearUnpackedRawDigits (  )  const

Definition at line 101 of file RawDigitDataBlock.cxx.

References fRawCrateStatuses, and fRawDigits.

Referenced by MnvRawDigitSuppression::ZeroDataBasedOnTDC(), and ~RawDigitDataBlock().

00102 {
00103    if (fRawDigits) {
00104       fRawDigits->Delete();
00105       delete fRawDigits;
00106       fRawDigits = 0;
00107    }
00108    if (fRawCrateStatuses) {
00109       fRawCrateStatuses->Delete();
00110       delete fRawCrateStatuses;
00111       fRawCrateStatuses = 0;
00112    }
00113    return;
00114 }

void RawDigitDataBlock::FillCrateModes (  )  const [protected, virtual]

Definition at line 591 of file RawDigitDataBlock.cxx.

References fCrates, FillRawDigits(), fNCommonMode, fNPedMode, fNSparsMode, fRawCrateStatuses, fRawDigits, RawCrateStatus::GetCommonMode(), RawCrateStatus::GetPedMode(), and RawCrateStatus::GetSparsMode().

Referenced by GetNCommonModeCrates(), GetNPedModeCrates(), GetNSparsModeCrates(), and GetNumberOfCrates().

00592 {
00593    // count the number of crates used and record what state they were in
00594    // (ped,spars,common)
00595    
00596    if ( ! fRawDigits ) FillRawDigits();
00597 
00598    fCrates = fNPedMode = fNSparsMode = fNCommonMode = 0;
00599 
00600    TIter citr(fRawCrateStatuses);
00601 
00602    TObject *tobj;
00603    RawDigitCrateStatus *cstat;
00604 
00605    while ( ( tobj = citr.Next() ) ) {
00606       cstat = dynamic_cast<RawDigitCrateStatus*>(tobj);
00607       if (cstat) {
00608          ++fCrates;
00609          if (cstat->GetPedMode())    ++fNPedMode;
00610          if (cstat->GetSparsMode())  ++fNSparsMode;
00611          if (cstat->GetCommonMode()) ++fNCommonMode;
00612       }
00613    }
00614 
00615 }

void RawDigitDataBlock::FillRawDigits (  )  const [protected, virtual]

Definition at line 318 of file RawDigitDataBlock.cxx.

References ElecType::AsString(), bfld::AsString(), RawBlockId::AsString(), dbg_DumpCrateOnUnpack, dbg_DumpDigitOnUnpack, dbg_DumpHeaderOnUnpack, fgDebugFlags, RawDataBlock::fRawBlock, fRawCrateStatuses, fRawDigits, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), RawCrateStatus::GetElecType(), RawCrateStatus::GetEntries(), RawBlockId::GetSimFlag(), SimFlag::kDaqFakeData, SimFlag::kData, Msg::kError, Msg::kInfo, SimFlag::kMC, Detector::kNear, ElecType::kQIE, ElecType::kReroot, SimFlag::kReroot, SimFlag::kUnknown, ElecType::kVA, Msg::kWarning, MSG, PostFillRawDigits(), RawCrateStatus::Print(), and RawDigit::Print().

Referenced by At(), FillCrateModes(), GetDatumIter(), GetNumberOfDigits(), GetNumOfErrorDigits(), GetSeenErrorMaskQIE(), GetSeenErrorMaskVA(), GetVldContext(), IndexOf(), and IsOverlapTfBoundary().

00319 {
00320    // create the TObjArray of RawDigit (if it doesn't exist)
00321 
00322    if ( fRawDigits ) return;   // already filled
00323    if ( fSize <= 0 || fRawBlock == 0) {
00324       MSG("RawData",Msg::kWarning)
00325          << "RawDigitDataBlock::FillRawDigits empty block? "
00326          << fSize << " " << fRawBlock << endl;
00327       return;
00328    }
00329 
00330    fRawCrateStatuses = new TObjArray();
00331    fRawDigits        = new TObjArray();
00332    RawDigitCrateStatus *cratestatus = 0;
00333    RawDigit       *rawdigit       = 0;
00334    const Int_t    *p   = fRawBlock;
00335    const Int_t    *end = fRawBlock + fSize; // 1 beyond end
00336 
00337    RawBlockId rbid = GetBlockId();
00338    p += 3; // skip #words, blockid and checksum
00339 
00340    if (fgDebugFlags&dbg_DumpHeaderOnUnpack) {
00341       MSG("RawData",Msg::kInfo) 
00342          << "RawDigitDataBlock::FillRawDigits "
00343          << " fSize " << fSize 
00344          << " id " << rbid.AsString()
00345          << endl;
00346    }
00347 
00348    while (p<end) {
00349       // start a new crate (pointer advanced by RawCrateStatus ctor
00350       cratestatus = new RawDigitCrateStatus(rbid,p);
00351       fRawCrateStatuses->Add(cratestatus);
00352       Int_t npairs = cratestatus->GetEntries(); 
00353 
00354       if (fgDebugFlags&dbg_DumpCrateOnUnpack) cratestatus->Print();
00355 
00356       for (Int_t ipair = 0; ipair < npairs; ipair++) {
00357          // assume that the readout type is consistent for whole crate
00358          // and that the status block knows what it is
00359          ElecType::Elec_t etype = cratestatus->GetElecType();
00360 
00361          // pointer is advanced by RawDigit ctor
00362          // knowing how many words it needed to eat
00363          switch (rbid.GetSimFlag()) {
00364          case SimFlag::kData:
00365          case SimFlag::kDaqFakeData:
00366             switch (etype) {
00367             case ElecType::kVA:
00368                rawdigit = new RawVaDigit(p,cratestatus);
00369                break;
00370             case ElecType::kQIE:
00371                rawdigit = new RawQieDigit(p,cratestatus);
00372                break;
00373             default:
00374                rawdigit = new RawDigit(p,cratestatus);
00375                break;
00376             }
00377             break;
00378          case SimFlag::kMC:
00379            switch (etype) {
00380            case ElecType::kVA:
00381              rawdigit = new RawVaDigiDigit(p,cratestatus);
00382              break;
00383            case ElecType::kQIE:
00384              rawdigit = new RawQieDigiDigit(p,cratestatus);
00385              break;
00386            default:
00387              MSG("RawData",Msg::kError) 
00388                << "RawDigitDataBlock::FillRawDigits SimFlag "
00389                << SimFlag::AsString(rbid.GetSimFlag())
00390                << " ElecType " << ElecType::AsString(etype)
00391                << endl << "  attempt to move past problem " << endl;
00392              p += 3;
00393              break;          
00394            };
00395            break;
00396          case SimFlag::kReroot:
00397             switch (etype) {
00398             case ElecType::kVA:
00399                rawdigit = new RawVaMCDigit(p,cratestatus);
00400                break;
00401             case ElecType::kQIE:
00402                rawdigit = new RawQieMCDigit(p,cratestatus);
00403                break;
00404             case ElecType::kReroot:
00405               {
00406                 if (rbid.GetDetector() == Detector::kNear) {
00407                   static int nmsg = 10;
00408                   if (nmsg) {
00409                     MSG("RawData",Msg::kWarning)
00410                       << "RawDigitDataBlock::FillRawDigits SimFlag "
00411                       << SimFlag::AsString(rbid.GetSimFlag())
00412                       << " ElecType " << ElecType::AsString(etype)
00413                       << " in Detector " 
00414                       << Detector::AsString(rbid.GetDetector())
00415                       << endl
00416                       << " treat as kQIE for RawQieMCDigit creation"
00417                       << endl;
00418                     if (nmsg) {
00419                       if (--nmsg == 0)
00420                         MSG("RawData",Msg::kWarning)
00421                           << " ... last warning of this type" << endl;
00422                     }
00423                   }
00424                   rawdigit = new RawQieMCDigit(p,cratestatus);
00425                   break;
00426                 }
00427                 else 
00428                   MSG("RawData",Msg::kError) 
00429                     << "RawDigitDataBlock::FillRawDigits SimFlag "
00430                     << SimFlag::AsString(rbid.GetSimFlag())
00431                     << " ElecType " << ElecType::AsString(etype)
00432                     << endl << "  attempt to move past problem " << endl;
00433                 p += 3;
00434                 break;
00435               }
00436             default:
00437                MSG("RawData",Msg::kError) 
00438                   << "RawDigitDataBlock::FillRawDigits SimFlag "
00439                   << SimFlag::AsString(rbid.GetSimFlag())
00440                   << " ElecType " << ElecType::AsString(etype)
00441                   << endl << "  attempt to move past problem " << endl;
00442                p += 3;
00443                break;
00444             }
00445             break;
00446          case SimFlag::kUnknown:
00447                MSG("RawData",Msg::kError) 
00448                   << "RawDigitDataBlock::FillRawDigits SimFlag "
00449                   << SimFlag::AsString(rbid.GetSimFlag())
00450                   << endl << "  attempt to move past problem " << endl;
00451                p += 2;
00452                break;
00453          }
00454 
00455          fRawDigits->Add(rawdigit);
00456 
00457          if (fgDebugFlags&dbg_DumpDigitOnUnpack) rawdigit->Print();
00458          if (p>end) {
00459             MSG("RawData",Msg::kWarning)
00460                << "RawDigitDataBlock::FillRawDigits crate info seems trashed"
00461                << endl << " SimFlag " << SimFlag::AsString(rbid.GetSimFlag())
00462                << " ElecType " << ElecType::AsString(etype)
00463                << endl;
00464             break;
00465          }
00466       }
00467    }
00468 
00469    // post process digits
00470    // accumulate mask off all error bits seen in the block and
00471    // for cases of QIE CapIdError, ParityError and MisCountError
00472    // we also might tag other digits that share a Minder
00473    PostFillRawDigits();
00474 }

virtual std::ostream& RawDigitDataBlock::FormatToOStream ( std::ostream &  os,
Option_t *  option = "" 
) const [virtual]

Reimplemented from RawDataBlock.

TIter RawDigitDataBlock::GetDatumIter ( Bool_t  dir = kIterForward  )  const [virtual]
static UInt_t RawDigitDataBlock::GetDebugFlags (  )  [inline, static]

Definition at line 57 of file RawDigitDataBlock.h.

References fgDebugFlags.

00057 { return fgDebugFlags; }

Short_t RawDigitDataBlock::GetNCommonModeCrates (  )  const

Definition at line 177 of file RawDigitDataBlock.cxx.

References fCrates, FillCrateModes(), and fNCommonMode.

Referenced by DemoDataReject::FilterRawRecord().

00178 {
00179    // return number of crates involved
00180    if ( fCrates < 0 ) FillCrateModes();
00181    return fNCommonMode;
00182 }

Short_t RawDigitDataBlock::GetNPedModeCrates (  )  const

Definition at line 161 of file RawDigitDataBlock.cxx.

References fCrates, FillCrateModes(), and fNPedMode.

Referenced by DemoDataReject::FilterRawRecord().

00162 {
00163    // return number of crates involved
00164    if ( fCrates < 0 ) FillCrateModes();
00165    return fNPedMode;
00166 }

Short_t RawDigitDataBlock::GetNSparsModeCrates (  )  const

Definition at line 169 of file RawDigitDataBlock.cxx.

References fCrates, FillCrateModes(), and fNSparsMode.

Referenced by DemoDataReject::FilterRawRecord(), AlgCaldetDigitList::RunAlg(), and AlgDigitList::RunAlg().

00170 {
00171    // return number of crates involved
00172    if ( fCrates < 0 ) FillCrateModes();
00173    return fNSparsMode;
00174 }

Short_t RawDigitDataBlock::GetNumberOfCrates (  )  const

Definition at line 153 of file RawDigitDataBlock.cxx.

References fCrates, and FillCrateModes().

Referenced by DemoDataReject::FilterRawRecord(), IsOverlapTfBoundary(), AlgCaldetDigitList::RunAlg(), and AlgDigitList::RunAlg().

00154 {
00155    // return number of crates involved
00156    if ( fCrates < 0 ) FillCrateModes();
00157    return fCrates;
00158 }

Int_t RawDigitDataBlock::GetNumberOfDigits ( void   )  const

Definition at line 143 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

Referenced by PulserFromRawSummaryList::Add(), CDAnaModule::Ana(), PEGainModule::DoMeanSigmaFromData(), CDPreFilterModule::FilterOnSnarlSize(), RerootToRawDataModule::Get(), DetSim::Get(), PEGainModule::MakeHistosFromData(), Cutter::NDErrorCutter(), Cutter::OverShootCutter(), DQRawDigits::Process(), AlgCaldetDigitList::RunAlg(), AlgDigitList::RunAlg(), and AlgCalDetSI::RunAlg().

00144 {
00145    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00146    // return number of entries
00147    
00148    if ( ! fRawDigits ) FillRawDigits();
00149    return fRawDigits->GetEntriesFast(); // known not to have gaps
00150 }

Int_t RawDigitDataBlock::GetNumOfErrorDigits (  )  const

Definition at line 185 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawDigits, and GetDatumIter().

00186 {
00187    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00188    // return number of entries with a error bit set
00189    
00190    if ( ! fRawDigits ) FillRawDigits();
00191 
00192    Int_t nerrDigits = 0;
00193    TIter rditer = GetDatumIter();
00194    while ( RawDigit *rd = dynamic_cast<RawDigit*>(rditer()) ) {
00195      if (rd->GetErrorCode()) nerrDigits++;
00196    }
00197    return nerrDigits;
00198 }

Char_t RawDigitDataBlock::GetSeenErrorMaskQIE (  )  const

Definition at line 201 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawDigits, and fSeenErrorsQIE.

00202 {
00203    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00204    // return mask of all errors encountered
00205    
00206    if ( ! fRawDigits ) FillRawDigits();
00207    return fSeenErrorsQIE;
00208 }

Char_t RawDigitDataBlock::GetSeenErrorMaskVA (  )  const

Definition at line 211 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawDigits, and fSeenErrorsVA.

00212 {
00213    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00214    // return mask of all errors encountered
00215    
00216    if ( ! fRawDigits ) FillRawDigits();
00217    return fSeenErrorsVA;
00218 }

VldContext RawDigitDataBlock::GetVldContext (  )  const

Definition at line 296 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawCrateStatuses, fRawDigits, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), and RawBlockId::GetSimFlag().

Referenced by PEGainModule::DoMeanSigmaFromData(), PEGainModule::MakeHistosFromData(), DQRawDigits::Process(), and RejectHelper::reject_veto().

00297 {
00298    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00299    // return the VldContext (with earliest timestamp of any crate)
00300 
00301    if ( ! fRawDigits ) FillRawDigits();
00302    
00303    VldTimeStamp vts(2038,1,18,0,0,0); // far future
00304 
00305    TIter citr(fRawCrateStatuses);
00306    while ( RawDigitCrateStatus* cstat = 
00307            dynamic_cast<RawDigitCrateStatus*>(citr()) ) {
00308      VldTimeStamp t0 = cstat->GetCrateT0();
00309      if (t0<vts) vts = t0;
00310    }
00311    
00312    RawBlockId rbid = GetBlockId();
00313    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),vts);
00314 
00315 }

Int_t RawDigitDataBlock::IndexOf ( RawDigit rawdigit  )  const

Definition at line 286 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

00287 {
00288    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00289    // return the index for this object (if contained in the list)
00290 
00291    if ( ! fRawDigits ) FillRawDigits();
00292    return fRawDigits->IndexOf(rawdigit);
00293 }

Int_t RawDigitDataBlock::IsOverlapTfBoundary (  )  const

Definition at line 221 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawCrateStatuses, fRawDigits, GetNumberOfCrates(), Msg::kDebug, and MSG.

00222 {
00223    // determine if digits exist in adjacent TimeFrames
00224    // 0 = no overlap
00225    // 1 = different crates have different TF's
00226    // 2 = at least one crate saw digits in both TF's
00227   //  3 = 1 + 2
00228 
00229    if ( ! fRawDigits ) FillRawDigits();
00230 
00231    MSG("RawData",Msg::kDebug)
00232      << " NCrates " << GetNumberOfCrates() << endl;
00233 
00234    Int_t overlapCode = 0;
00235 
00236    map<VldTimeStamp,UInt_t> timestampCnt;
00237    map<Int_t,UInt_t>       crateCnt;
00238 
00239    TIter citr(fRawCrateStatuses);
00240    while ( RawDigitCrateStatus* cstat = 
00241            dynamic_cast<RawDigitCrateStatus*>(citr()) ) {
00242      VldTimeStamp crateT0  = cstat->GetCrateT0();
00243      Int_t        crateNum = cstat->GetCrate();
00244      timestampCnt[crateT0]++;
00245      crateCnt[crateNum]++;
00246      MSG("RawData",Msg::kDebug)
00247        << "   crateNum " << crateNum << " to " << crateT0 << endl;
00248    }
00249 
00250    // condition 1 is if we saw different T0's
00251    if ( timestampCnt.size() > 1 ) overlapCode += 1;
00252 
00253    // condition 2 is seeing the same crate twice
00254    map<Int_t,UInt_t>::const_iterator crateCntItr = crateCnt.begin();
00255    while ( crateCntItr != crateCnt.end() ) {
00256      if ( (*crateCntItr).second != 1 ) overlapCode += 2;
00257      crateCntItr++;
00258    }
00259 
00260    MSG("RawData",Msg::kDebug)
00261      << "  return code " << overlapCode << endl;
00262    return overlapCode;
00263 }

RawDigitDataBlock & RawDigitDataBlock::operator= ( const RawDigitDataBlock rhs  ) 

Reimplemented from RawDataBlock.

Definition at line 117 of file RawDigitDataBlock.cxx.

References fCrates, fNCommonMode, fNPedMode, fNSparsMode, fRawCrateStatuses, fRawDigits, fSeenErrorsQIE, and fSeenErrorsVA.

00118 {
00119    // deep copy assignment 
00120    if (this != &rhs) {
00121      RawDataBlock::operator=(rhs);
00122      if (fRawDigits) { 
00123        fRawDigits->Delete();
00124        delete fRawDigits;
00125        fRawDigits = 0;
00126      }
00127      if (fRawCrateStatuses) {
00128        fRawCrateStatuses->Delete();
00129        delete fRawCrateStatuses;
00130        fRawCrateStatuses = 0;
00131      }
00132      fCrates        = -1;
00133      fNPedMode      =  0;
00134      fNSparsMode    =  0;
00135      fNCommonMode   =  0;
00136      fSeenErrorsQIE =  0;
00137      fSeenErrorsVA  =  0;
00138    }
00139    return *this;
00140 }

void RawDigitDataBlock::PostFillRawDigits (  )  const [protected, virtual]

Definition at line 477 of file RawDigitDataBlock.cxx.

References bfld::AsString(), RawChannelId::AsString(), RawChannelId::ClearModeBits(), err(), fRawDigits, fSeenErrorsQIE, fSeenErrorsVA, RawDigit::GetChannel(), RawChannelId::GetElecType(), RawChannelId::IsSameMinder(), RawQieDigit::kCapIdError, RawQieDigit::kCapIdSameMenuError, RawQieDigit::kCapIdSharedMinderError, Msg::kInfo, RawQieDigit::kMisCountError, RawQieDigit::kParityError, ElecType::kQIE, RawQieDigit::kTransferSharedMinderError, ElecType::kVA, Msg::kVerbose, MAXMSG, MSG, RawQieDigit::SetCapIdSameMenuError(), RawQieDigit::SetCapIdSharedMinderError(), and RawQieDigit::SetTransferSharedMinderError().

Referenced by FillRawDigits().

00478 {
00479   // Post-process RawDigits after unpacking
00480   // In particular we are looking for QIE digits in the same
00481   //   Minder as those with CapIdErrors, ParityErrors or MisCountErrors
00482   // We also fill fSeenErrors (mask of all error bits seen in this block)
00483 
00484   UInt_t ncaperr=0, ncapmenuerr=0, ncapsharederr=0;
00485   UInt_t ntranserr=0, ntranssharederr=0;
00486 
00487   // Collect all problematic RawChannelId addresses.
00488   // Make a list of all QIE RawDigits without known 
00489   //   CapIdError, ParityError or MisCountError for 2nd pass
00490   set<RawChannelId>    rcidCapIdErrors;
00491   set<RawChannelId>    rcidTransferErrors;
00492   vector<RawQieDigit*> otherQieDigitsCapId;
00493   vector<RawQieDigit*> otherQieDigitsTrans;
00494   otherQieDigitsCapId.reserve(fRawDigits->GetLast()+1); // reserve enough space
00495   otherQieDigitsTrans.reserve(fRawDigits->GetLast()+1); // reserve enough space
00496 
00497   TIter rditr(fRawDigits);
00498   while ( RawDigit* rd = dynamic_cast<RawDigit*>(rditr()) ) { 
00499     RawChannelId rcid = rd->GetChannel();
00500     Char_t       err  = rd->GetErrorCode();
00501 
00502     ElecType::Elec_t etype = rcid.GetElecType();
00503     // masks of all error coded encountered in block
00504     if      ( etype == ElecType::kVA  ) fSeenErrorsVA  |= err;
00505     else if ( etype == ElecType::kQIE ) fSeenErrorsQIE |= err;
00506 
00507     // the rest of the processing is only relevant for QIE digits
00508     if ( etype != ElecType::kQIE ) continue;
00509     RawQieDigit* rdqie = dynamic_cast<RawQieDigit*>(rd);
00510     if ( !rdqie ) continue;
00511 
00512     if ( err & RawQieDigit::kCapIdError ) {
00513       // problem channel for CapId
00514       ncaperr++;
00515       MSG("Raw",Msg::kVerbose)
00516         << "raw CapIdError on rcid " << rcid.AsString("c") << endl;
00517       rcid.ClearModeBits();
00518       rcidCapIdErrors.insert(rcid);
00519     }
00520     else otherQieDigitsCapId.push_back(rdqie);
00521 
00522     if ( err & (RawQieDigit::kParityError|RawQieDigit::kMisCountError) ) {
00523       // problem channel for data transfer
00524       ntranserr++;
00525       MSG("Raw",Msg::kVerbose)
00526         << "raw " << RawQieDigit::AsString((RawQieDigit::EQieErrorCode)err)
00527         << " (" << (int)err << ") on rcid " << rcid.AsString("c") << endl;
00528       rcid.ClearModeBits();
00529       rcidTransferErrors.insert(rcid);
00530     }
00531     else otherQieDigitsTrans.push_back(rdqie);
00532 
00533   } // loop over all digits
00534 
00535   // Find and set error condition on all digits in problematic minders
00536   set<RawChannelId>::const_iterator rcidItr;
00537 
00538   // CapId errors
00539   rcidItr = rcidCapIdErrors.begin();
00540   while ( rcidItr != rcidCapIdErrors.end() ) {
00541     RawChannelId rcidBadMenu = *rcidItr++;
00542     for (size_t iqied=0; iqied < otherQieDigitsCapId.size(); ++iqied) {
00543       RawQieDigit* rdqie = otherQieDigitsCapId[iqied];
00544       RawChannelId rcid  = rdqie->GetChannel();
00545       rcid.ClearModeBits();
00546       if      ( rcid == rcidBadMenu ) {
00547         rdqie->SetCapIdSameMenuError(); 
00548         ncapmenuerr++; 
00549         fSeenErrorsQIE |= RawQieDigit::kCapIdSameMenuError;
00550       }
00551       else if ( rcid.IsSameMinder(rcidBadMenu) ) {
00552         rdqie->SetCapIdSharedMinderError();
00553         ncapsharederr++;
00554         fSeenErrorsQIE |= RawQieDigit::kCapIdSharedMinderError;
00555       }
00556     } // loop over qie digits without errors
00557   }  // loop over bad capid minder addresses
00558 
00559   // transfer errors
00560   rcidItr = rcidTransferErrors.begin();
00561   while ( rcidItr != rcidTransferErrors.end() ) {
00562     RawChannelId rcidBadMenu = *rcidItr++;
00563     for (size_t iqied=0; iqied < otherQieDigitsTrans.size(); ++iqied) {
00564       RawQieDigit* rdqie = otherQieDigitsTrans[iqied];
00565       RawChannelId rcid  = rdqie->GetChannel();
00566       if ( rcid.IsSameMinder(rcidBadMenu) ) {
00567         rdqie->SetTransferSharedMinderError();
00568         ntranssharederr++;
00569         fSeenErrorsQIE |= RawQieDigit::kTransferSharedMinderError;
00570       }
00571     } // loop over qie digits without errors
00572   }  // loop over bad transfer minder addresses
00573 
00574   if ( ncaperr > 0 ) {
00575     MAXMSG("Raw",Msg::kInfo,10)
00576       << "CapId Error on " << ncaperr <<" digits, "
00577       << ncapmenuerr << "," << ncapsharederr 
00578       << " other digits shared same menus,minders."
00579       << endl;
00580   }
00581   if ( ntranserr > 0 ) {
00582     MAXMSG("Raw",Msg::kInfo,10)
00583       << "Transfer Error on " << ntranserr <<" digits, "
00584       << ntranssharederr
00585       << " other digits shared same minders."
00586       << endl;
00587   }
00588 }

static void RawDigitDataBlock::SetDebugFlags ( const UInt_t  dbgflgs  )  [inline, static]

Definition at line 56 of file RawDigitDataBlock.h.

References fgDebugFlags.

Referenced by CheckND::Ana().

00056 {fgDebugFlags=dbgflgs;}


Member Data Documentation

Short_t RawDigitDataBlock::fCrates [mutable, protected]
UInt_t RawDigitDataBlock::fgDebugFlags = 0 [static, private]

mask of all error bits in blk

Definition at line 88 of file RawDigitDataBlock.h.

Referenced by FillRawDigits(), GetDebugFlags(), and SetDebugFlags().

Short_t RawDigitDataBlock::fNCommonMode [mutable, protected]

# crates w/ spars mode

Definition at line 80 of file RawDigitDataBlock.h.

Referenced by FillCrateModes(), GetNCommonModeCrates(), and operator=().

Short_t RawDigitDataBlock::fNPedMode [mutable, protected]

# of crates

Definition at line 78 of file RawDigitDataBlock.h.

Referenced by FillCrateModes(), GetNPedModeCrates(), and operator=().

Short_t RawDigitDataBlock::fNSparsMode [mutable, protected]

# crates w/ ped mode

Definition at line 79 of file RawDigitDataBlock.h.

Referenced by FillCrateModes(), GetNSparsModeCrates(), and operator=().

TObjArray* RawDigitDataBlock::fRawCrateStatuses [mutable, protected]
TObjArray* RawDigitDataBlock::fRawDigits [mutable, protected]
Char_t RawDigitDataBlock::fSeenErrorsQIE [mutable, protected]

# crates w/ common mode

Definition at line 82 of file RawDigitDataBlock.h.

Referenced by GetSeenErrorMaskQIE(), operator=(), and PostFillRawDigits().

Char_t RawDigitDataBlock::fSeenErrorsVA [mutable, protected]

mask of all error bits in blk

Definition at line 83 of file RawDigitDataBlock.h.

Referenced by GetSeenErrorMaskVA(), operator=(), and PostFillRawDigits().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1