RawRecord Class Reference

#include <RawRecord.h>

Inheritance diagram for RawRecord:
RecMinos

List of all members.

Public Member Functions

 RawRecord ()
 RawRecord (RawHeader *rh)
virtual ~RawRecord ()
const RawHeaderGetRawHeader () const
const RawDataBlockFindRawBlock (const char *classname=0, const char *objname=0) const
const TObjArray & GetRawBlockList () const
TIter GetRawBlockIter (Bool_t dir=kIterForward) const
void AdoptRawBlock (RawDataBlock *rawblock)
virtual void Print (Option_t *option="") const
virtual const char * GetName () const

Static Public Member Functions

static void PrintPromotionCount ()

Protected Member Functions

void PromoteRawDataBlocks () const
void ListBlocks () const
 not part of actual record
virtual void AdoptComponent (TObject *component)

Protected Attributes

bool promotionChecked

Detailed Description

Definition at line 22 of file RawRecord.h.


Constructor & Destructor Documentation

RawRecord::RawRecord (  ) 

Definition at line 39 of file RawRecord.cxx.

00039                      : promotionChecked(false)
00040 {
00041    // Default constructor
00042 }

RawRecord::RawRecord ( RawHeader rh  ) 

Definition at line 45 of file RawRecord.cxx.

00045                                   : RecMinos(rh), promotionChecked(false)
00046 {
00047    // normal ctor, adopt the RawHeader for ownership
00048 }

RawRecord::~RawRecord (  )  [virtual]

Definition at line 52 of file RawRecord.cxx.

00053 {
00054    // dtor, no explicit deletion of header -- done by RecMinos
00055 }


Member Function Documentation

void RawRecord::AdoptComponent ( TObject *  component  )  [protected, virtual]

Reimplemented from RecMinos.

Definition at line 136 of file RawRecord.cxx.

References Msg::kFatal, and MSG.

Referenced by AdoptRawBlock().

00137 {
00138    // Adopt (to own) a random TObject derived object
00139    // RawRecord should only be adopting RawDataBlocks
00140    // so this will assert before actually adopting.
00141 
00142    MSG("Raw",Msg::kFatal)
00143       << "RawRecord::AdoptComponent(TObject*) was called"
00144       << endl;
00145    assert(0);
00146 
00147    RecMinos::AdoptComponent(component);
00148 }

void RawRecord::AdoptRawBlock ( RawDataBlock rawblock  ) 

Definition at line 108 of file RawRecord.cxx.

References AdoptComponent().

Referenced by RotoObjectifier::BuildRecord(), RerootToRawDataModule::Get(), DetSim::Get(), EvtAddRawDigitBlockModule::Reco(), and OltNewModule::WriteConfig().

00109 {
00110    // Adopt (to own) a RawDataBlock derived object
00111 
00112    RecMinos::AdoptComponent(rawblock);
00113 }

const RawDataBlock * RawRecord::FindRawBlock ( const char *  classname = 0,
const char *  objname = 0 
) const

Definition at line 75 of file RawRecord.cxx.

References RecMinos::FindComponent(), and PromoteRawDataBlocks().

Referenced by LIStreamHunter::Ana(), MergeEvent::Ana(), FilterRunType::Ana(), RunSummary::Ana(), CountPot::Ana(), RawLILooker::Ana(), CDAnaModule::Ana(), NoiseFilterModule::Ana(), PreFilter::Ana(), FitTrackMSListModule::Ana(), RateSummary::Ana(), FarDetShieldPlankListModule::Ana(), FarmListModule::Ana(), StripCands::Ana(), CDPreFilterModule::Ana(), CDTrackerModule::Ana(), LISummaryAnalyser::Ana(), PEGainModule::DoMeanSigmaFromData(), Cutter::Get(), AutoPIDMaker::Get(), EvtOverlaySingleton::GetClosestRawDigitDataBlock(), NtpSRBleachFiller::GetlateBucketPHFraction(), EvtOverlaySingleton::GetLowerBoundRawVtmTimeInfoBlock(), LISummaryModule::GetPulserBlocks(), LISummaryModule::GetSummaryBlocks(), PEGainModule::MakeDebugTree(), PEGainModule::MakeHistosFromData(), EvtOverlaySingleton::MapDaqFiles(), Cutter::NDErrorCutter(), RawTofConverter::RawTofConverter(), DigitListModule::Reco(), PulserFromRawModule::Reco(), OltNewModule::Reco(), PulserFromRawFilterModule::Reco(), and PulserSummaryModule::Reco().

00077 {
00078 
00079 // Returns the *last* selected RawDataBlock.  If classname is a null ptr
00080 // or blank string, no class selection is done.  If classname is
00081 // provided, the qualifying object must InheritFrom() or be a classname.
00082 // The objname is optional, but, if filled, will further qualify the
00083 // selection by requiring agreement with the GetName() method of the
00084 // selected object.
00085 
00086 // RecMinos::FindComponent() returns a "const TObject *".  This gets
00087 // converted to a "RawDataBlock *" using dynamic_cast to make sure the
00088 // original is a "RawDataBlock *". 
00089 
00090   PromoteRawDataBlocks();  // make sure that blocks are specialized
00091 
00092   return dynamic_cast<const RawDataBlock *>
00093      (RecMinos::FindComponent(classname, objname));
00094 }

const char * RawRecord::GetName ( void   )  const [virtual]

Definition at line 225 of file RawRecord.cxx.

References Registry::Get(), RecMinos::GetTempTags(), and reg.

00226 {
00227   // Return the "name"
00228   // If the TNamed value has been set use that otherwise see if
00229   // one can determine a useful name from the stream recorded in
00230   // the registry.
00231 
00232   string recUserName = TNamed::GetName();
00233   if (recUserName != "") return recUserName.c_str();
00234   else{
00235     //MSG("Raw",Msg::kInfo) << "Record has no name" << endl;
00236     const char* unknownStream = "?stream?";
00237     const char* tmp = 0;
00238     string recStream(unknownStream);
00239 
00240     const Registry& reg = GetTempTags();
00241     if (reg.Get("stream",tmp)) recStream = tmp;
00242     if (recStream != unknownStream) {
00243       // this method is logical "const" but it does modify the object
00244       RawRecord* writeableSelf = const_cast<RawRecord*>(this);
00245       writeableSelf->SetName(recStream.c_str());
00246       //MSG("Raw",Msg::kInfo) << "Record has is now named \"" 
00247       //                      << TNamed::GetName() << "\"" << endl;
00248     }
00249   }
00250   return TNamed::GetName();
00251 }

TIter RawRecord::GetRawBlockIter ( Bool_t  dir = kIterForward  )  const

Definition at line 97 of file RawRecord.cxx.

References RecMinos::GetComponents(), and PromoteRawDataBlocks().

Referenced by AtNuTreeModule::Ana(), DumpBadElectronics::Ana(), FillBadChannelDB::Ana(), FarDetSliceListModule::Ana(), FilterRunType::Ana(), FiltMBSpillModule::Ana(), BDUniquifyTestModule::Ana(), FiltSGateModule::Ana(), RunSummary::Ana(), CustomLightInjector::Ana(), EvtAddRawDigitBlockModule::Ana(), FillNearRunQuality::Ana(), PulserTimingMaker::Ana(), RateSummary::Ana(), RecoTreeModule::Ana(), FarDetStripListModule::Ana(), FarmListModule::Ana(), FilterEvent::Ana(), FarDetRawDigitDump::Ana(), LightInjector::Ana(), PulserDDSCheck::Ana(), bd_text_dump(), RotoObjectifier::BufferSquish(), cfgtest(), convert_raw_to_bdtest(), DemoEventDump::DumpRawData(), DemoEventDump::DumpRawHeader(), NtpSRModule::FillNtpShieldStrip(), DemoDataReject::FilterRawRecord(), ValidateRawChecksums::FilterRawRecord(), FillFarRunQuality::Get(), DigitListModule::Get(), FillSpillServerMon::Get(), FillHvFromSingles::Get(), RecordSetupModule::Get(), get_block(), Blinder::GetInfo(), DataUtil::GetRawBlocks(), BDUniquify::GetUniqueBlocks(), Cutter::OverShootCutter(), Print(), RawRecCounts::ProcessBlocksInRecord(), Bdnt::ProcessFile(), BmntImp::ProcessFile(), DcsWriter::ProcessRawRecord(), DbuDaqMonitorModule::ProcessRawRecord(), DbuDaqFileModule::ProcessRawRecord(), OltNewModule::ProcessTimeframe(), OltDataIntegrity::Reco(), OltNewModule::Reco(), OltTimeScan::Reco(), OltEnds::Reco(), RerootToRawDataModule::Reco(), FarDetDataQualityModule::Reco(), MnvRawDigitSuppression::Reco(), OltRawLI::Reco(), OltBlockScan::Reco(), OltTimePlot::Reco(), MergeEvent::Reco(), Truthifier::Reset(), AlgCaldetDigitList::RunAlg(), AlgMergeEvent::RunAlg(), AlgDigitList::RunAlg(), AlgMCDigitList::RunAlg(), spew_record(), BDCheckDB::SpinFile(), and OltNewModule::WriteMom().

00098 {
00099 
00100    // Get an iterator over the raw blocks
00101 
00102    PromoteRawDataBlocks();  // make sure that blocks are specialized
00103 
00104    return TIter(&RecMinos::GetComponents(),dir);
00105 }

const TObjArray & RawRecord::GetRawBlockList (  )  const [inline]

Definition at line 61 of file RawRecord.h.

References RecMinos::GetComponents(), and PromoteRawDataBlocks().

const RawHeader * RawRecord::GetRawHeader (  )  const

Definition at line 58 of file RawRecord.cxx.

References RecMinos::GetHeader(), Msg::kWarning, and MSG.

Referenced by Cutter::Ana(), LIStreamHunter::Ana(), AtNuTreeModule::Ana(), DumpBadElectronics::Ana(), MergeEvent::Ana(), FillBadChannelDB::Ana(), FarDetSliceListModule::Ana(), FilterRunType::Ana(), PrintStat::Ana(), SelectSpillTriggers::Ana(), RunFileModule::Ana(), RunSummary::Ana(), FilterLIModule::Ana(), CDAnaModule::Ana(), EvtAddRawDigitBlockModule::Ana(), AtNuDisplayModule::Ana(), DemoSnarlList::Ana(), FillNearRunQuality::Ana(), NoiseFilterModule::Ana(), NtpMaker::Ana(), FitTrackMSListModule::Ana(), PreFilter::Ana(), FarDetShieldPlankListModule::Ana(), PulserTimingMaker::Ana(), RateSummary::Ana(), RecoTreeModule::Ana(), DatabaseToucher::Ana(), FarDetStripListModule::Ana(), FarmListModule::Ana(), FilterEvent::Ana(), SelectSpillTimes::Ana(), CDPreFilterModule::Ana(), FarDetRawDigitDump::Ana(), AltDeMuxDisplay::Ana(), LightInjector::Ana(), PulserDDSCheck::Ana(), RawRecCounts::Ana(), CDTrackerModule::Ana(), RotoObjectifier::BuildDaqHeaderBlock(), RotoObjectifier::BuildSnarlHeaderBlock(), cfgtest(), RotoServer::ChooseStreamName(), PEGainModule::DoMeanSigmaFromData(), PEGainModule::DoMeanSigmaFromRawSums(), PEGainModule::DoMeanSigmaFromSums(), DataUtil::dump_mom(), DemoEventDump::DumpRawHeader(), DbuDaqFileModule::ExtractRunAndFile(), DemoDataReject::FilterRawRecord(), FillFarRunQuality::Get(), DigitListModule::Get(), RecordSetupModule::Get(), UberModule::Get(), Blinder::GetInfo(), LISummaryModule::GetPulserBlocks(), DataUtil::GetRawHeader(), DataUtil::GetUgliGeomHandle(), PEGainModule::MakeDebugTree(), PEGainModule::MakeHistosFromData(), DbuDaqMonitorModule::ProcessRawRecord(), DbuDaqFileModule::ProcessRawRecord(), RotoClientModule::Put(), LISummaryModule::Reco(), TrackCamListModule::Reco(), DemuxFast::Reco(), PulserFromRawModule::Reco(), RerootToRawDataModule::Reco(), FitTrackCamListModule::Reco(), PulserDBModule::Reco(), EvtAddRawDigitBlockModule::Reco(), FarDetDataQualityModule::Reco(), MnvRawDigitSuppression::Reco(), AutoPIDMaker::Reco(), AtmosShowerListModule::Reco(), PulserFromRawFilterModule::Reco(), PulserSummaryModule::Reco(), DetectorAlignmentModule::Reco(), Truthifier::Reset(), sepruns(), AlgCalDetSI::SetDataPointers(), and PreFilter::SimCheck().

00059 {
00060 
00061    // Return the RawHeader
00062 
00063    const RawHeader* rawHeader =
00064      dynamic_cast<const RawHeader *>(RecMinos::GetHeader());
00065    
00066    if (!rawHeader) {
00067      const RecMinosHdr* recHeader = RecMinos::GetHeader();
00068      MSG("RawData",Msg::kWarning)
00069        << "RawRecord::GetRawHeader found no RawHeader*, "
00070        << "RecMinosHdr* was " << recHeader << endl;
00071    }
00072    return rawHeader;
00073 }

void RawRecord::ListBlocks (  )  const [protected]

not part of actual record

Definition at line 254 of file RawRecord.cxx.

References RecMinos::fComponents, RawDataBlock::GetBlockId(), Msg::kInfo, and MSG.

Referenced by Print().

00255 {
00256   // Lump the classname and block id for all the elements in fComponents.
00257   // Avoid anything that would promote generic blocks.
00258 
00259   MSG("Raw",Msg::kInfo)
00260     << "   index ClassName                 RawBlockId" 
00261     << endl;
00262 
00263    Int_t last = fComponents.GetLast();
00264    for (Int_t idx=0; idx <= last; ++idx) {
00265      TObject* tobj = fComponents[idx];
00266      if ( ! tobj ) continue;
00267      RawDataBlock* rdb = dynamic_cast<RawDataBlock*>(tobj);
00268      if (rdb) {
00269        RawBlockId rbid = rdb->GetBlockId();
00270        MSG("Raw",Msg::kInfo)
00271          << "    [" << setw(2) << idx << "] " 
00272          << left << setw(25) << tobj->ClassName()
00273          << resetiosflags(ios::adjustfield) // reset "left"
00274          << " " << rbid
00275          << endl;
00276      }
00277      else {
00278        MSG("Raw",Msg::kInfo)
00279          << "    [" << setw(2) << idx << "] " 
00280          << left << setw(25) << tobj->ClassName()
00281          << resetiosflags(ios::adjustfield) // reset "left"
00282          << " is not a RawDataBlock."
00283          << endl;
00284      }
00285    }
00286    
00287    MSG("Raw",Msg::kInfo) << endl;
00288 }

void RawRecord::Print ( Option_t *  option = ""  )  const [virtual]

Reimplemented from RecMinos.

Definition at line 116 of file RawRecord.cxx.

References RecMinos::fHeader, RecMinos::GetJobHistory(), GetRawBlockIter(), ListBlocks(), RecMinosHdr::Print(), and RecJobHistory::Print().

Referenced by EvtOverlaySingleton::MapDaqFiles().

00117 {
00118    // Print header, loop over raw blocks, print those
00119    // unless passed "l" option, then just list the blocks.
00120 
00121    if (fHeader) fHeader->Print();
00122    else cout << "RawRecord: has no header";
00123    cout << endl;  // header doesn't terminate the line
00124    GetJobHistory().Print();
00125    
00126    string opt = option;
00127    if ( opt.find("l") != string::npos ) ListBlocks();
00128    else {
00129      TIter iter = this->GetRawBlockIter();
00130      TObject *tobj = 0;
00131      while ((tobj = iter())) tobj->Print(option);
00132    }
00133 }

void RawRecord::PrintPromotionCount (  )  [static]

Definition at line 291 of file RawRecord.cxx.

References fgPromoteCount, Msg::kInfo, and MSG.

00292 {
00293   // Print the number of times each type of RawDataBlock had to
00294   // be promoted to the non-generic class type
00295 
00296   if (fgPromoteCount.empty()) {
00297     MSG("Raw",Msg::kInfo)
00298       << "RawRecord promoted no RawDataBlocks to derived types"
00299       << endl;
00300   }
00301   else {
00302     MSG("Raw",Msg::kInfo)
00303       << "RawRecord promoted RawDataBlocks to derived types:"
00304       << endl;
00305 
00306     std::map<std::string,unsigned long int>::const_iterator pc_itr = 
00307       fgPromoteCount.begin();
00308     while (pc_itr != fgPromoteCount.end()) {
00309       MSG("Raw",Msg::kInfo)
00310         << "   " << pc_itr->first << " " 
00311         << pc_itr->second << " times "
00312         << endl;
00313       pc_itr++;
00314     }
00315   }
00316 }

void RawRecord::PromoteRawDataBlocks (  )  const [protected]

Definition at line 151 of file RawRecord.cxx.

References RawBlockProxy::CreateRawDataBlock(), RecMinos::fComponents, fgPromoteCount, RawDataBlock::GetBlockId(), RawDataBlock::GetData(), RawBlockId::GetMajor(), RawBlockRegistry::Instance(), RawBlockId::IsDCS(), Msg::kInfo, Msg::kWarning, RawBlockRegistry::LookUp(), MSG, and promotionChecked.

Referenced by FindRawBlock(), GetRawBlockIter(), and GetRawBlockList().

00152 {
00153    // Look through list of blocks for generic 'RawDataBlock' objects;
00154    // convert these to specialized blocks based on block id.
00155 
00156   if (promotionChecked) return;
00157 
00158   const TString generic = "RawDataBlock";
00159   RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00160 
00161   Int_t last = fComponents.GetLast();
00162   for (Int_t idx=0; idx <= last; ++idx) {
00163 
00164     TObject* tobj = fComponents[idx];
00165     if ( ! tobj ) continue;
00166 
00167     RawDataBlock* rdb = dynamic_cast<RawDataBlock*>(tobj);
00168     if ( ! rdb ) {
00169       // protect against serious suprises
00170       MSG("Raw",Msg::kWarning)
00171         << "Element " << idx << " in fComponents was not a RawDataBlock!"
00172         << endl;
00173       continue; 
00174     }
00175 
00176     if (generic != rdb->ClassName()) continue;
00177 
00178     // if we're here then the block is unspecialized
00179 
00180     RawBlockId rbid    = rdb->GetBlockId();
00181     RawBlockProxy* rbp = rbr.LookUp(rbid.IsDCS(),rbid.GetMajor());
00182 
00183     if (rbp) {
00184       // create a block of the right type
00185       RawDataBlock *specialBlk = rbp->CreateRawDataBlock(rdb->GetData());
00186       
00187       // a bit of nasty code so that this method can be considered
00188       // logical const even though it changes fComponents
00189       // we do it by index so that no ordering is changed in any way
00190       
00191       TObjArray& writable = const_cast<TObjArray&>(fComponents);
00192       
00193       writable.RemoveAt(idx);          // remove generic version
00194       writable.AddAt(specialBlk,idx);  // replace with specialized copy
00195       delete rdb;                      // delete generic version
00196 
00197       std::string finalClass = specialBlk->ClassName();
00198       unsigned long int curcount = (++fgPromoteCount[finalClass]);
00199 
00200       const unsigned long int maxmsg = 10;
00201       if (curcount <= maxmsg) {
00202         MSG("Raw",Msg::kInfo)
00203           << "RawRecord promoted generic 'RawDataBlock'"
00204           << " to '" << finalClass << "'"
00205           << endl;
00206       }
00207       if (curcount == maxmsg) {
00208         MSG("Raw",Msg::kInfo) << "... last message for " << finalClass << endl;
00209       }
00210     }
00211     else {
00212       // couldn't find an appropriate block id in the registry
00213       MSG("Raw",Msg::kWarning) 
00214         << "No proxy for RawBlockId "
00215         << "0x" << hex << rbid.GetMajor() << dec
00216         << ", can not promote to specialized block."
00217         << endl;
00218     }
00219     
00220   }  // loop over entries
00221 
00222   promotionChecked = true;
00223 }


Member Data Documentation

bool RawRecord::promotionChecked [mutable, protected]

Definition at line 48 of file RawRecord.h.

Referenced by PromoteRawDataBlocks().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1