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

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
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 (ostream &os, Option_t *option="") const
 RawDigitDataBlock (const RawDigitDataBlock &rhs)
RawDigitDataBlockoperator= (const RawDigitDataBlock &rhs)

Static Public Member Functions

void SetDebugFlags (const UInt_t dbgflgs)
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

UInt_t fgDebugFlags = 0
 mask of all error bits in blk

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 fRawCrateStatuses, and fRawDigits.

00095 {
00096    if (fRawDigits) {
00097       fRawDigits->Delete();
00098       delete fRawDigits;
00099       fRawDigits = 0;
00100    }
00101    if (fRawCrateStatuses) {
00102       fRawCrateStatuses->Delete();
00103       delete fRawCrateStatuses;
00104       fRawCrateStatuses = 0;
00105    }
00106    return;
00107 }

RawDigitDataBlock::RawDigitDataBlock const RawDigitDataBlock rhs  )  [inline]
 

Definition at line 57 of file RawDigitDataBlock.h.

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

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


Member Function Documentation

const RawDigit * RawDigitDataBlock::At Int_t  idx  )  const
 

Definition at line 259 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

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

00260 {
00261    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00262    // return pointer to the i-th element
00263    
00264    if ( ! fRawDigits ) FillRawDigits();
00265    return (RawDigit*) fRawDigits->At(idx);
00266 }

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

Definition at line 584 of file RawDigitDataBlock.cxx.

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

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

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

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

Definition at line 311 of file RawDigitDataBlock.cxx.

References Detector::AsString(), ElecType::AsString(), SimFlag::AsString(), RawBlockId::AsString(), fgDebugFlags, fRawCrateStatuses, fRawDigits, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), RawCrateStatus::GetElecType(), RawCrateStatus::GetEntries(), RawBlockId::GetSimFlag(), MSG, PostFillRawDigits(), RawDigit::Print(), and RawCrateStatus::Print().

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

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

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

Definition at line 611 of file RawDigitDataBlock.cxx.

References fgDebugFlags, RawDataBlock::FormatToOStream(), RawDigit::GetCrateStatus(), GetDatumIter(), GetNCommonModeCrates(), GetNPedModeCrates(), GetNSparsModeCrates(), GetNumberOfCrates(), GetNumberOfDigits(), GetNumOfErrorDigits(), GetSeenErrorMaskQIE(), GetSeenErrorMaskVA(), RawDigit::GetTDC(), IsOverlapTfBoundary(), and option.

00613 {
00614 
00615    RawDataBlock::FormatToOStream(os,option);
00616    if (strchr(option,'X')!=0) return os;
00617 
00618    // additional block specific formatted output is done here
00619 
00620    os << " NumDigits=" << GetNumberOfDigits()
00621       << " (w/Errors=" << GetNumOfErrorDigits() << ")"
00622       << " NumCrates=" << GetNumberOfCrates()
00623       << " (PedSub=" << GetNPedModeCrates()
00624       << ",Spars=" << GetNSparsModeCrates()
00625       << ",CommonMode=" << GetNCommonModeCrates()
00626       << ")"
00627       << endl;
00628    
00629    os << " SeenErrorMask " 
00630       << "QIE 0x" << hex << setfill('0') << setw(2) 
00631       << (int)GetSeenErrorMaskQIE() << setfill(' ') << dec << " "
00632       << "VA 0x" << hex << setfill('0') << setw(2) 
00633       << (int)GetSeenErrorMaskVA() << setfill(' ') << dec << ","
00634       << " OverlapTfBoundary: "
00635       << ((IsOverlapTfBoundary())?"Yes":"No")
00636       << endl;
00637 
00638    if (strchr(option,'-')!=0) return os;
00639    if (fgDebugFlags&dbg_DumpOnlyHeader) return os;
00640 
00641    const RawDigitCrateStatus *lastcrate = 0;
00642 
00643    RawDigit *rd, *rdprev = 0;
00644    TIter rditer = GetDatumIter();
00645    Int_t tmin=0x7fffffff, tmax=-1;
00646    while ( ( rd = dynamic_cast<RawDigit*>(rditer()) ) ) {
00647      if (rd->GetCrateStatus() != lastcrate) {
00648        if ((fgDebugFlags&dbg_DumpOnlyFirstLast) && rdprev )
00649            os << "  " << (*rdprev) << endl;
00650        lastcrate = rd->GetCrateStatus();
00651        os << " " << (*lastcrate) << endl;
00652        if (fgDebugFlags&dbg_DumpOnlyFirstLast)
00653            os << "  " << (*rd) << endl << "  ..." << endl;
00654      }
00655      if (!fgDebugFlags&dbg_DumpOnlyFirstLast)
00656          os << "  " << (*rd) << endl;
00657      rdprev = rd;
00658      Int_t tdc = rd->GetTDC();
00659      if (tdc<tmin) tmin = tdc;
00660      if (tdc>tmax) tmax = tdc;
00661    }
00662    if (fgDebugFlags&dbg_DumpOnlyFirstLast) {
00663        os << "  " << (*rdprev) << endl;
00664        os << "  TDC range all crates [" << tmin << ":" << tmax << "]" << endl;
00665    }
00666    os << endl;
00667    return os;
00668 }

TIter RawDigitDataBlock::GetDatumIter Bool_t  dir = kIterForward  )  const [virtual]
 

Definition at line 269 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

Referenced by PulserFromRawSummaryList::Add(), RunSummary::Ana(), RateSummary::Ana(), NoiseFilterModule::Ana(), MergeEvent::Ana(), LightInjector::Ana(), FarPlaneCheckout::Ana(), FarmListModule::Ana(), FarDetRawRateDump::Ana(), FarDetRawDigitDump::Ana(), CustomLightInjector::Ana(), CheckND::Ana(), CDTrackerModule::Ana(), CDAnaModule::Ana(), PEGainModule::DoMeanSigmaFromData(), NtpSRModule::FillNtpShieldStrip(), CDPreFilterModule::FilterOnSnarlSize(), CDPreFilterModule::FilterSnarlForErrors(), FormatToOStream(), Blinder::GetInfo(), GetNumOfErrorDigits(), SexyPedReco::GetSexyPedestals(), PEGainModule::MakeHistosFromData(), DQRawDigits::Process(), FillNearRunQuality::ProcessBlock(), FarDetDataQualityModule::ProcessBlock(), FiltSGateModule::ProcessDigitDataBlks(), RerootToRawDataModule::Reco(), OltTimeScan::Reco(), OltTimePlot::Reco(), OltRawLI::Reco(), OltEnds::Reco(), OltDataIntegrity::Reco(), OltBlockScan::Reco(), BiggestChopModule::Reco(), RejectHelper::reject_veto(), Truthifier::Reset(), AlgMCDigitList::RunAlg(), AlgDigitList::RunAlg(), and AlgCaldetDigitList::RunAlg().

00270 {
00271    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00272    // return an iterator to look over them
00273    
00274    if ( ! fRawDigits ) FillRawDigits();
00275    return TIter(fRawDigits,dir);
00276 }

UInt_t RawDigitDataBlock::GetDebugFlags  )  [inline, static]
 

Definition at line 54 of file RawDigitDataBlock.h.

00054 { return fgDebugFlags; }

Short_t RawDigitDataBlock::GetNCommonModeCrates  )  const
 

Definition at line 170 of file RawDigitDataBlock.cxx.

References fCrates, and FillCrateModes().

Referenced by DemoDataReject::FilterRawRecord(), and FormatToOStream().

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

Short_t RawDigitDataBlock::GetNPedModeCrates  )  const
 

Definition at line 154 of file RawDigitDataBlock.cxx.

References fCrates, and FillCrateModes().

Referenced by DemoDataReject::FilterRawRecord(), and FormatToOStream().

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

Short_t RawDigitDataBlock::GetNSparsModeCrates  )  const
 

Definition at line 162 of file RawDigitDataBlock.cxx.

References fCrates, and FillCrateModes().

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

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

Short_t RawDigitDataBlock::GetNumberOfCrates  )  const
 

Definition at line 146 of file RawDigitDataBlock.cxx.

References fCrates, and FillCrateModes().

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

00147 {
00148    // return number of crates involved
00149    if ( fCrates < 0 ) FillCrateModes();
00150    return fCrates;
00151 }

Int_t RawDigitDataBlock::GetNumberOfDigits  )  const
 

Definition at line 136 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

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

00137 {
00138    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00139    // return number of entries
00140    
00141    if ( ! fRawDigits ) FillRawDigits();
00142    return fRawDigits->GetEntriesFast(); // known not to have gaps
00143 }

Int_t RawDigitDataBlock::GetNumOfErrorDigits  )  const
 

Definition at line 178 of file RawDigitDataBlock.cxx.

References FillRawDigits(), GetDatumIter(), and RawDigit::GetErrorCode().

Referenced by FormatToOStream(), and DbuDaqFileModule::ProcessRawBlock().

00179 {
00180    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00181    // return number of entries with a error bit set
00182    
00183    if ( ! fRawDigits ) FillRawDigits();
00184 
00185    Int_t nerrDigits = 0;
00186    TIter rditer = GetDatumIter();
00187    while ( RawDigit *rd = dynamic_cast<RawDigit*>(rditer()) ) {
00188      if (rd->GetErrorCode()) nerrDigits++;
00189    }
00190    return nerrDigits;
00191 }

Char_t RawDigitDataBlock::GetSeenErrorMaskQIE  )  const
 

Definition at line 194 of file RawDigitDataBlock.cxx.

References FillRawDigits().

Referenced by FormatToOStream().

00195 {
00196    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00197    // return mask of all errors encountered
00198    
00199    if ( ! fRawDigits ) FillRawDigits();
00200    return fSeenErrorsQIE;
00201 }

Char_t RawDigitDataBlock::GetSeenErrorMaskVA  )  const
 

Definition at line 204 of file RawDigitDataBlock.cxx.

References FillRawDigits().

Referenced by FormatToOStream().

00205 {
00206    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00207    // return mask of all errors encountered
00208    
00209    if ( ! fRawDigits ) FillRawDigits();
00210    return fSeenErrorsVA;
00211 }

VldContext RawDigitDataBlock::GetVldContext  )  const
 

Definition at line 289 of file RawDigitDataBlock.cxx.

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

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

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

Int_t RawDigitDataBlock::IndexOf RawDigit rawdigit  )  const
 

Definition at line 279 of file RawDigitDataBlock.cxx.

References FillRawDigits(), and fRawDigits.

00280 {
00281    // create/fill the TObjArray of RawDigit (if it doesn't exist)
00282    // return the index for this object (if contained in the list)
00283 
00284    if ( ! fRawDigits ) FillRawDigits();
00285    return fRawDigits->IndexOf(rawdigit);
00286 }

Int_t RawDigitDataBlock::IsOverlapTfBoundary  )  const
 

Definition at line 214 of file RawDigitDataBlock.cxx.

References FillRawDigits(), fRawCrateStatuses, RawCrateStatus::GetCrate(), RawDigitCrateStatus::GetCrateT0(), GetNumberOfCrates(), and MSG.

Referenced by FormatToOStream().

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

RawDigitDataBlock & RawDigitDataBlock::operator= const RawDigitDataBlock rhs  ) 
 

Definition at line 110 of file RawDigitDataBlock.cxx.

References fCrates, fNCommonMode, fNPedMode, fNSparsMode, fRawCrateStatuses, fRawDigits, fSeenErrorsQIE, fSeenErrorsVA, and RawDataBlock::operator=().

00111 {
00112    // deep copy assignment 
00113    if (this != &rhs) {
00114      RawDataBlock::operator=(rhs);
00115      if (fRawDigits) { 
00116        fRawDigits->Delete();
00117        delete fRawDigits;
00118        fRawDigits = 0;
00119      }
00120      if (fRawCrateStatuses) {
00121        fRawCrateStatuses->Delete();
00122        delete fRawCrateStatuses;
00123        fRawCrateStatuses = 0;
00124      }
00125      fCrates        = -1;
00126      fNPedMode      =  0;
00127      fNSparsMode    =  0;
00128      fNCommonMode   =  0;
00129      fSeenErrorsQIE =  0;
00130      fSeenErrorsVA  =  0;
00131    }
00132    return *this;
00133 }

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

Definition at line 470 of file RawDigitDataBlock.cxx.

References RawQieDigit::AsString(), RawChannelId::AsString(), RawChannelId::ClearModeBits(), fRawDigits, fSeenErrorsQIE, fSeenErrorsVA, RawDigit::GetChannel(), RawChannelId::GetElecType(), RawDigit::GetErrorCode(), RawChannelId::IsSameMinder(), MAXMSG, MSG, RawQieDigit::SetCapIdSameMenuError(), RawQieDigit::SetCapIdSharedMinderError(), and RawQieDigit::SetTransferSharedMinderError().

Referenced by FillRawDigits().

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

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

Definition at line 53 of file RawDigitDataBlock.h.

References fgDebugFlags.

Referenced by CheckND::Ana().

00053 {fgDebugFlags=dbgflgs;}


Member Data Documentation

Short_t RawDigitDataBlock::fCrates [mutable, protected]
 

not written out

Definition at line 74 of file RawDigitDataBlock.h.

Referenced by FillCrateModes(), GetNCommonModeCrates(), GetNPedModeCrates(), GetNSparsModeCrates(), GetNumberOfCrates(), operator=(), and RawDigitDataBlock().

UInt_t RawDigitDataBlock::fgDebugFlags = 0 [static, private]
 

mask of all error bits in blk

Definition at line 23 of file RawDigitDataBlock.cxx.

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

Short_t RawDigitDataBlock::fNCommonMode [mutable, protected]
 

# crates w/ spars mode

Definition at line 77 of file RawDigitDataBlock.h.

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

Short_t RawDigitDataBlock::fNPedMode [mutable, protected]
 

# of crates

Definition at line 75 of file RawDigitDataBlock.h.

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

Short_t RawDigitDataBlock::fNSparsMode [mutable, protected]
 

# crates w/ ped mode

Definition at line 76 of file RawDigitDataBlock.h.

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

TObjArray* RawDigitDataBlock::fRawCrateStatuses [mutable, protected]
 

Definition at line 71 of file RawDigitDataBlock.h.

Referenced by FillCrateModes(), FillRawDigits(), GetVldContext(), IsOverlapTfBoundary(), operator=(), RawDigitDataBlock(), and ~RawDigitDataBlock().

TObjArray* RawDigitDataBlock::fRawDigits [mutable, protected]
 

not written out

Definition at line 72 of file RawDigitDataBlock.h.

Referenced by At(), FillRawDigits(), GetDatumIter(), GetNumberOfDigits(), IndexOf(), operator=(), PostFillRawDigits(), RawDigitDataBlock(), and ~RawDigitDataBlock().

Char_t RawDigitDataBlock::fSeenErrorsQIE [mutable, protected]
 

# crates w/ common mode

Definition at line 79 of file RawDigitDataBlock.h.

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

Char_t RawDigitDataBlock::fSeenErrorsVA [mutable, protected]
 

mask of all error bits in blk

Definition at line 80 of file RawDigitDataBlock.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 05:32:50 2009 for loon by  doxygen 1.3.9.1