#include <RotoObjectifier.h>
Public Member Functions | |
| RotoObjectifier () | |
| virtual | ~RotoObjectifier () |
Static Public Member Functions | |
| MomNavigator * | BufferInflate (const Char_t *buffer, Int_t nbytes, Int_t &status) |
| void | SysLogRawBlockRegistry () |
| Int_t | BufferSquish (const RawRecord *rawrec, Char_t *buffer, Int_t maxbytes) |
| void | FormattedIntDump (void *buffer, Int_t nwords, Bool_t extra_endl) |
| UInt_t | GetDebugFlags () |
| void | SetDebugFlags (UInt_t dbgflgs) |
| void | SetForceDetector (Detector::Detector_t detector=Detector::kUnknown) |
| void | SetForceSimFlag (SimFlag::SimFlag_t simflag=SimFlag::kUnknown) |
Static Private Member Functions | |
| MomNavigator * | BuildRecord (TObjArray *tobjarray, Int_t &status) |
| RawDaqHeaderBlock * | BuildDaqHeaderBlock (const TObject *tobj) |
| RawSnarlHeaderBlock * | BuildSnarlHeaderBlock (const TObject *tobj) |
| Int_t | ExtractEncodedRawBlockId (Int_t *block) |
| void | DebugDumpInflateBlock (Int_t *iptr, RawDataBlock *rawBlock) |
| void | DebugDumpSquishBlock (Int_t *iptr, RawDataBlock *rawBlock) |
Static Private Attributes | |
| UInt_t | fgDebugFlags = 0 |
| Detector::Detector_t | fgForceDetector = Detector::kUnknown |
| SimFlag::SimFlag_t | fgForceSimFlag = SimFlag::kUnknown |
|
|
Definition at line 49 of file RotoObjectifier.h. 00049 { }
|
|
|
Definition at line 50 of file RotoObjectifier.h. 00050 { }
|
|
||||||||||||||||
|
Definition at line 76 of file RotoObjectifier.cxx. References RawBlockId::AsString(), RawBlockProxy::CreateRawDataBlock(), RawDataBlock::GetChecksum(), RawBlockId::GetMajor(), RawDataBlock::GetSize(), RawBlockRegistry::Instance(), RawBlockId::IsDCS(), logError(), logNotice(), RawBlockRegistry::LookUp(), and RawDataBlock::TestChecksum(). Referenced by RotoServer::ProcessBuffer(), and OltNewModule::WriteEvent(). 00079 {
00080 //
00081 // Purpose: Turn flat buffer into objects held by a MOM
00082 //
00083 // Argument: buffer ptr to buffer
00084 // nbytes number of bytes used in buffer
00085 // status (return value) 0 = success
00086 // 1 = had unknown block id
00087 // 2 = had bad checksum in a block
00088 // 4 = had to skip to end-of-buffer
00089 // 8 = unknown record type
00090 // none of:
00091 // RawDaqHeaderBlock
00092 // RawSnarlHeaderBlock
00093 //
00094 // Return: MomNavigator holding RawRecord (gives up ownership)
00095 //
00096 // Contact: R. Hatcher
00097 //
00098 static int nrec = 0;
00099 nrec++;
00100
00101 //if (fgDebugFlags) MSG("Roto", Msg::kInfo)
00102 // << "RotoObjectifier::BufferInflate " << nbytes << " bytes ("
00103 // << nbytes/4 << " words)" << endl;
00104
00105 TObjArray tmpArray;
00106 RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00107 RawBlockProxy* rbp_generic = rbr.LookUp(0,0);
00108
00109 Int_t *iptr_begin = (Int_t*) buffer;
00110 Int_t *iptr_end = (Int_t*)(buffer+nbytes);
00111
00112 Int_t *iptr = iptr_begin;
00113 status = 0;
00114
00115 Int_t nblk = -1;
00116 Int_t last_id = 0;
00117 Int_t last_nwords = 0;
00118
00119 while ( iptr < iptr_end ) {
00120 nblk++;
00121
00122 //
00123 // Build next individual RawBlock out of the buffer
00124 //
00125
00126 if ( iptr_end-iptr < 3 ) {
00127 // real blocks are at least three words long:
00128 // (size,checksum,blockid)
00129 logError("REC %d BLK %d, size %d, too few words (%d) at BUF end",
00130 nrec,nblk,nbytes,iptr_end-iptr);
00131 status |= kPartialRecord;
00132 break;
00133 }
00134
00135 int nwords = iptr[0];
00136 if (nwords < 3) {
00137 // real blocks are at least three words long
00138 logError("REC %d BLK %d, blocksize %d (0x%8.8x) too short",
00139 nrec,nblk,nwords,nwords);
00140 logError(" at BUF index 0x%x of 0x%x",
00141 iptr-iptr_begin,iptr_end-iptr_begin);
00142
00143 if (nblk > 0)
00144 logError(" previous BLK id 0x%8.8x, size 0x%x",
00145 last_id,last_nwords);
00146
00147 if (iptr_end-iptr > 3 ) {
00148 Int_t encoded_id = ExtractEncodedRawBlockId(iptr);
00149 logError(" current BLK id 0x%8.8x",encoded_id);
00150 }
00151 // FormattedIntDump(iptr_begin,iptr_end-iptr_begin,true);
00152
00153 // there isn't any way to recover from this as we don't
00154 // know where the next block might begin
00155 status |= kPartialRecord;
00156 break;
00157 }
00158
00159 Int_t encoded_id = ExtractEncodedRawBlockId(iptr);
00160 RawBlockId rbid(encoded_id);
00161
00162 RawBlockProxy* rbp = rbr.LookUp(rbid.IsDCS(),rbid.GetMajor());
00163 if (!rbp) {
00164 // couldn't find an appropriate block id
00165 logNotice("REC %d, BUF index %d, no PROXY for RawBlockId 0x%8.8x",
00166 nrec,iptr-iptr_begin,encoded_id);
00167 // use generic block as a fall back
00168 rbp = rbp_generic;
00169 status |= kUnknownId;
00170 }
00171
00172 RawDataBlock *rawBlock = rbp->CreateRawDataBlock(iptr);
00173
00174 if (rawBlock->TestChecksum()) {
00175 status |= kBadCheckSum;
00176 static int nmsg = 5;
00177 if (nmsg>0) {
00178 nmsg--;
00179 if (rawBlock->GetChecksum() == 0)
00180 logNotice("REC %d, unset checksum on %s",nrec,rbid.AsString());
00181 else
00182 logNotice("REC %d, checksum err on %s",nrec,rbid.AsString());
00183 if (nmsg==0)
00184 logNotice("...last checksum error message");
00185 }
00186 }
00187
00188 // add the block to our temporary container
00189 tmpArray.Add(rawBlock);
00190
00191 // advance the buffer pointer, size includes the word count
00192 iptr += rawBlock->GetSize();
00193
00194 last_id = encoded_id;
00195 last_nwords = nwords;
00196
00197 // if (fgDebugFlags)
00198 // DebugDumpInflateBlock(iptr_bsize,rawBlock);
00199
00200 }
00201
00202 // All possible blocks have been unpacked
00203 // now attempt to make a record of some type
00204
00205 return BuildRecord(&tmpArray,status);
00206 }
|
|
||||||||||||||||
|
Definition at line 282 of file RotoObjectifier.cxx. References RawDataBlock::AppendToBuffer(), BuildDaqHeaderBlock(), BuildSnarlHeaderBlock(), DebugDumpSquishBlock(), RawRecord::GetRawBlockIter(), RawDataBlock::GetSize(), and MSG. Referenced by RotoClientModule::Put(). 00284 {
00285 //
00286 // Purpose: Flatten RawRecord
00287 //
00288 // Argument: rawrec ptr to RawRecord
00289 // buffer buffer array to fill
00290 // maxbytes maximum space (bytes) in buffer
00291 //
00292 // Return: number of bytes used
00293 //
00294 // Contact: R. Hatcher
00295 //
00296
00297 MSG("Roto", Msg::kDebug) << "RotoObjectifier::BufferSquish" << endl;
00298
00299 if (rawrec == 0) {
00300 MSG("Root", Msg::kWarning) << "No RawRecord in MOM." << endl;
00301 return 0;
00302 }
00303
00304 Int_t* iptr_begin = (Int_t*) buffer;
00305 Int_t* iptr_end = (Int_t*)(buffer+maxbytes);
00306 Bool_t partial = false;
00307
00308 Int_t* iptr = iptr_begin;
00309
00310 TObject *tobj;
00311
00312 // look for a RawSnarlHeaderBlock, RawDaqHeaderBlock, or ...
00313 RawSnarlHeaderBlock* snarlHdrBlk = 0;
00314 RawDaqHeaderBlock* daqHdrBlk = 0;
00315 TIter rbi = rawrec->GetRawBlockIter();
00316 while ((tobj = rbi())) {
00317 if ((snarlHdrBlk = dynamic_cast<RawSnarlHeaderBlock*>(tobj))) break;
00318 if ((daqHdrBlk = dynamic_cast<RawDaqHeaderBlock*>(tobj) )) break;
00319 }
00320 // push Record header information into buffer as a block if such
00321 // a block doesn't already exist
00322 if ( ! snarlHdrBlk && ! daqHdrBlk ) {
00323
00324 // perhaps we can build a block out of an existing
00325 // RawDaqSnarlHeader
00326 snarlHdrBlk = BuildSnarlHeaderBlock(rawrec);
00327
00328 if (snarlHdrBlk) {
00329 iptr = snarlHdrBlk->AppendToBuffer(iptr);
00330 if (fgDebugFlags) {
00331 Int_t* iptr_bsize = iptr; // pointer to where block size lives
00332 DebugDumpSquishBlock(iptr_bsize,snarlHdrBlk);
00333 }
00334 delete snarlHdrBlk; // clean up!
00335 }
00336 else {
00337
00338 // perhaps we can build a block out of an existing
00339 // RawDaqHeader
00340 daqHdrBlk = BuildDaqHeaderBlock(rawrec);
00341
00342 if (daqHdrBlk) {
00343 iptr = daqHdrBlk->AppendToBuffer(iptr);
00344 if (fgDebugFlags) {
00345 Int_t* iptr_bsize = iptr; // pointer to where block size lives
00346 DebugDumpSquishBlock(iptr_bsize,daqHdrBlk);
00347 }
00348 delete daqHdrBlk; // clean up!
00349 }
00350 }
00351 }
00352
00353 // Iterate over RawRecord's RawDataBlockList
00354 // process all RawDataBlocks.
00355 TIter rawBlockIter = rawrec->GetRawBlockIter();
00356 RawDataBlock *rawBlock;
00357 while ((tobj = rawBlockIter())) {
00358 if ((rawBlock = dynamic_cast<RawDataBlock*>(tobj))) {
00359
00360 int size = rawBlock->GetSize();
00361
00362 if (iptr+size < iptr_end) {
00363
00364 Int_t* iptr_bsize = iptr; // pointer to where block size lives
00365
00366 iptr = rawBlock->AppendToBuffer(iptr);
00367
00368 if (fgDebugFlags) DebugDumpSquishBlock(iptr_bsize,rawBlock);
00369
00370 } else {
00371
00372 if ( ! partial ) {
00373 partial = true;
00374 MSG("Roto", Msg::kWarning)
00375 << "RotoObjectifier::BufferSquish adding " << size
00376 << " words would exceed buffer - "
00377 << " current index " << iptr-iptr_begin << endl;
00378 // don't break out of loop, perhaps there's a smaller block
00379 // that will fit ... the record is still partial
00380 // but at least we'll have a bit more
00381 }
00382 }
00383 }
00384 }
00385
00386 // return the number of bytes used
00387 return (iptr-iptr_begin)*sizeof(Int_t)/sizeof(Char_t);
00388
00389 }
|
|
|
Definition at line 750 of file RotoObjectifier.cxx. References RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), RawDaqHeader::GetRunType(), RawDaqHeader::GetSubRun(), RecMinosHdr::GetVldContext(), and run(). Referenced by BufferSquish(). 00751 {
00752 //
00753 // Purpose: Generate a RawDaqHeaderBlock from information
00754 // found in TObject (hopefully a RawRecord or such)
00755 //
00756 // Argument: tobj (a RawRecord perhaps?)
00757 //
00758 // Return: new RawDaqHeaderBlock (give up ownership)
00759 //
00760 // Contact: R. Hatcher
00761 //
00762 RawDaqHeaderBlock *daqHdrBlk = 0;
00763
00764 // Perhaps we were passed a RawRecord
00765 // then the info we want should be in the RawDaqHeader
00766
00767 const RawRecord *rr = dynamic_cast<const RawRecord *>(tobj);
00768
00769 if (rr) {
00770 const RawDaqHeader* daqHdr =
00771 dynamic_cast<const RawDaqHeader*>(rr->GetRawHeader());
00772
00773 if (daqHdr) {
00774 VldContext vldc = daqHdr->GetVldContext();
00775 Int_t run = daqHdr->GetRun();
00776 Short_t subrun = daqHdr->GetSubRun();
00777 Short_t runtype = daqHdr->GetRunType();
00778 Int_t timeframe = -1;
00779
00780 daqHdrBlk =
00781 new RawDaqHeaderBlock(vldc,run,subrun,runtype,timeframe);
00782
00783 }
00784 }
00785
00786 return daqHdrBlk;
00787 }
|
|
||||||||||||
|
Definition at line 536 of file RotoObjectifier.cxx. References MomNavigator::AdoptFragment(), RawRecord::AdoptRawBlock(), RecJobHistory::CreateJobRecord(), RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), RawSnarlHeaderBlock::GetErrorCode(), RecMinos::GetJobHistory(), RawSnarlHeaderBlock::GetNumRawDigits(), RawSnarlHeaderBlock::GetRemoteSpillType(), RawRunEndBlock::GetRun(), RawRunStartBlock::GetRun(), RawDaqHeaderBlock::GetRun(), RawSnarlHeaderBlock::GetRun(), RawRunEndBlock::GetRunType(), RawRunStartBlock::GetRunType(), RawDaqHeaderBlock::GetRunType(), RawSnarlHeaderBlock::GetRunType(), RawBlockId::GetSimFlag(), RawSnarlHeaderBlock::GetSnarl(), RawBeamMonHeaderBlock::GetSpillCountNum(), RawRunEndBlock::GetSubRun(), RawRunStartBlock::GetSubRun(), RawDaqHeaderBlock::GetSubRun(), RawSnarlHeaderBlock::GetSubRun(), RawDaqHeaderBlock::GetTimeFrameNum(), RawSnarlHeaderBlock::GetTimeFrameNum(), RawLITimingSummaryBlock::GetTimeStamp(), RawLIAdcSummaryBlock::GetTimeStamp(), RawRunEndBlock::GetTotalTimeFrames(), RawSnarlHeaderBlock::GetTriggerSource(), RawRunEndBlock::GetVldContext(), RawRunStartBlock::GetVldContext(), RawBeamMonHeaderBlock::GetVldContext(), RawDcsHeaderBlock::GetVldContext(), RawDaqHeaderBlock::GetVldContext(), RawSnarlHeaderBlock::GetVldContext(), logWarn(), MSG, and run(). 00538 {
00539 //
00540 // Purpose: Generate the Record from the RawDataBlocks
00541 //
00542 // Argument: tobjarray array of RawDataBlocks
00543 //
00544 // Return: new MomNavigator (give up ownership)
00545 // status (return value) 0 = success
00546 // 8 = unknown record type
00547 // (none of RawSnarlHeaderBlock, ...)
00548 //
00549 // Contact: R. Hatcher
00550 //
00551
00552 MomNavigator* mom = 0;
00553
00554 TObject *tobj = 0;
00555 RawSnarlHeaderBlock *snarlHdrBlk = 0;
00556 RawDaqHeaderBlock *daqHdrBlk = 0;
00557 RawDcsHeaderBlock *dcsHdrBlk = 0;
00558 RawBeamMonHeaderBlock *beamHdrBlk = 0;
00559 RawLIAdcSummaryBlock *liAdcBlk = 0;
00560 RawLITimingSummaryBlock *liTimingBlk = 0;
00561 RawRunStartBlock *startBlk = 0;
00562 RawRunEndBlock *endBlk = 0;
00563
00564 // look for special blocks
00565 TIter iter_quick(tobjarray);
00566 while ((tobj = iter_quick())) {
00567 if (!snarlHdrBlk)
00568 snarlHdrBlk = dynamic_cast<RawSnarlHeaderBlock*>(tobj);
00569 if (!daqHdrBlk)
00570 daqHdrBlk = dynamic_cast<RawDaqHeaderBlock*>(tobj);
00571 if (!dcsHdrBlk)
00572 dcsHdrBlk = dynamic_cast<RawDcsHeaderBlock*>(tobj);
00573 if (!beamHdrBlk)
00574 beamHdrBlk = dynamic_cast<RawBeamMonHeaderBlock*>(tobj);
00575
00576 // these are a kludge ...
00577 // we *should* be getting some other "header" block
00578 if (!liAdcBlk)
00579 liAdcBlk = dynamic_cast<RawLIAdcSummaryBlock*>(tobj);
00580 if (!liTimingBlk)
00581 liTimingBlk = dynamic_cast<RawLITimingSummaryBlock*>(tobj);
00582 if (!startBlk)
00583 startBlk = dynamic_cast<RawRunStartBlock*>(tobj);
00584 if (!endBlk)
00585 endBlk = dynamic_cast<RawRunEndBlock*>(tobj);
00586 }
00587
00588 RawHeader* rawhead = 0;
00589
00590 if (snarlHdrBlk) {
00591 //
00592 // if there was a snarl block, then build a RawDaqSnarlHeader ...
00593 //
00594 VldContext vldc = snarlHdrBlk->GetVldContext();
00595 Int_t run = snarlHdrBlk->GetRun();
00596 Short_t subrun = snarlHdrBlk->GetSubRun();
00597 Short_t runtype = snarlHdrBlk->GetRunType();
00598 Int_t tf = snarlHdrBlk->GetTimeFrameNum();
00599 Int_t snarl = snarlHdrBlk->GetSnarl();
00600 Int_t trigsrc = snarlHdrBlk->GetTriggerSource();
00601 Int_t errcode = snarlHdrBlk->GetErrorCode();
00602 Int_t nrdigit = snarlHdrBlk->GetNumRawDigits();
00603 Int_t spilltype = snarlHdrBlk->GetRemoteSpillType();
00604
00605 rawhead = new RawDaqSnarlHeader(vldc,run,subrun,runtype,tf,
00606 snarl,trigsrc,errcode,nrdigit,spilltype);
00607 }
00608 else
00609 if (daqHdrBlk) {
00610 //
00611 // if there was a snarl block, then build a RawDaqHeader ...
00612 //
00613 VldContext vldc = daqHdrBlk->GetVldContext();
00614 Int_t run = daqHdrBlk->GetRun();
00615 Short_t subrun = daqHdrBlk->GetSubRun();
00616 Short_t runtype = daqHdrBlk->GetRunType();
00617 Int_t tf = daqHdrBlk->GetTimeFrameNum();
00618
00619 rawhead = new RawDaqHeader(vldc,run,subrun,runtype,tf);
00620 }
00621 else
00622 if (dcsHdrBlk) {
00623 //
00624 // if there was a dcs header block, then build a plain ol' RawHeader ...
00625 //
00626 VldContext vldc = dcsHdrBlk->GetVldContext();
00627
00628 rawhead = new RawHeader(vldc);
00629 }
00630 else
00631 if (beamHdrBlk) {
00632 //
00633 // if there was a beam monitor header block
00634 //
00635 VldContext vldc = beamHdrBlk->GetVldContext();
00636 UInt_t spillcnt = beamHdrBlk->GetSpillCountNum();
00637
00638 rawhead = new RawBeamMonHeader(vldc,spillcnt);
00639 }
00640 else
00641 if (startBlk) {
00642 //
00643 // if there was a RunStart block, build a RawDaqHeader ...
00644 //
00645
00646 logWarn("BuildRecord missing HeaderBlock, use RunStart");
00647
00648 VldContext vldc = startBlk->GetVldContext();
00649 Int_t run = startBlk->GetRun();
00650 Short_t subrun = startBlk->GetSubRun();
00651 Short_t runtype = startBlk->GetRunType();
00652 Int_t tf = 0; // bogus value
00653
00654 rawhead = new RawDaqHeader(vldc,run,subrun,runtype,tf);
00655 }
00656 else
00657 if (endBlk) {
00658 //
00659 // if there was a RunEnd block, build a RawDaqHeader ...
00660 //
00661
00662 logWarn("BuildRecord missing HeaderBlock, use RunEnd");
00663
00664 VldContext vldc = endBlk->GetVldContext();
00665 Int_t run = endBlk->GetRun();
00666 Short_t subrun = endBlk->GetSubRun();
00667 Short_t runtype = endBlk->GetRunType();
00668 Int_t tf = endBlk->GetTotalTimeFrames(); // bogus value
00669
00670 rawhead = new RawDaqHeader(vldc,run,subrun,runtype,tf);
00671 }
00672 else
00673 if (liAdcBlk || liTimingBlk) {
00674 //
00675 // if there was a LI block, then build a RawDaqHeader ...
00676 //
00677
00678 logWarn("BuildRecord missing HeaderBlock, attempt to use LI");
00679
00680 Int_t run = -1; // undetermined from LI block
00681 Short_t subrun = -1;
00682 Short_t runtype = -1;
00683 Int_t tf = -1; // bogus time frame #
00684 VldContext vldc;
00685 if (liAdcBlk) {
00686 RawBlockId rbid = liAdcBlk->GetBlockId();
00687 vldc = VldContext(rbid.GetDetector(),rbid.GetSimFlag(),
00688 liAdcBlk->GetTimeStamp());
00689 }
00690 else if (liTimingBlk) {
00691 RawBlockId rbid = liTimingBlk->GetBlockId();
00692 vldc = VldContext(rbid.GetDetector(),rbid.GetSimFlag(),
00693 liTimingBlk->GetTimeStamp());
00694 }
00695 rawhead = new RawDaqHeader(vldc,run,subrun,runtype,tf);
00696
00697 }
00698
00699 if (!rawhead) {
00700 //
00701 // there was nothing to use to build a RawHeader ...
00702 // ... fake something up as a final resort
00703 //
00704 Int_t run = -1;
00705 Short_t subrun = -1;
00706 Short_t runtype = -1;
00707 Int_t tf = -1;
00708 VldTimeStamp ts; // use a timestamp of "now"
00709 VldContext vldc = VldContext(Detector::kUnknown,
00710 SimFlag::kUnknown,ts);
00711
00712 rawhead = new RawDaqHeader(vldc,run,subrun,runtype,tf);
00713
00714 }
00715
00716 // produce a RawRecord, have it adopt the header
00717
00718 RawRecord *rawRec = new RawRecord(rawhead);
00719 RecJobHistory& jobhist
00720 = const_cast<RecJobHistory&>(rawRec->GetJobHistory());
00721 jobhist.CreateJobRecord(RecJobHistory::kRaw);
00722
00723 // give the blocks to the RawRecord
00724 TIter iter(tobjarray);
00725 while ((tobj = iter())) {
00726 RawDataBlock* rawBlock =
00727 dynamic_cast<RawDataBlock*>(tobj);
00728 if (rawBlock) {
00729 rawRec->AdoptRawBlock(rawBlock);
00730 tobjarray->Remove(tobj);
00731 } else {
00732 MSG("Roto", Msg::kWarning)
00733 << "Saw something other than RawDataBlock" << endl;
00734 }
00735 }
00736
00737 // create a MOM and give the RawRecord to MOM to hold as a "fragment"
00738 mom = new MomNavigator;
00739 mom->AdoptFragment(rawRec);
00740
00741 // make sure tobjarray no longer holds anything
00742 // all RawDataBlocks should have been removed by above loop
00743 // so "Delete" is okay.
00744 tobjarray->Delete();
00745
00746 return mom;
00747
00748 }
|
|
|
Definition at line 789 of file RotoObjectifier.cxx. References RawDaqSnarlHeader::GetErrorCode(), RawDaqSnarlHeader::GetNumRawDigits(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), RawDaqHeader::GetRunType(), RawDaqSnarlHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RawDaqHeader::GetTimeFrameNum(), RawDaqSnarlHeader::GetTrigSrc(), RecMinosHdr::GetVldContext(), and run(). Referenced by BufferSquish(). 00790 {
00791 //
00792 // Purpose: Generate a RawSnarlHeaderBlock from information
00793 // found in TObject (hopefully a RawRecord or such)
00794 //
00795 // Argument: tobj (a RawRecord perhaps?)
00796 //
00797 // Return: new RawSnarlHeaderBlock (give up ownership)
00798 //
00799 // Contact: R. Hatcher
00800 //
00801 RawSnarlHeaderBlock *snarlHdrBlk = 0;
00802
00803 // Perhaps we were passed a RawRecord
00804 // then the info we want should be in the RawDaqSnarlHeader
00805
00806 const RawRecord *rr = dynamic_cast<const RawRecord *>(tobj);
00807
00808 if (rr) {
00809 const RawDaqSnarlHeader* snarlHdr =
00810 dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00811
00812 if (snarlHdr) {
00813 VldContext vldc = snarlHdr->GetVldContext();
00814 Int_t run = snarlHdr->GetRun();
00815 Short_t subrun = snarlHdr->GetSubRun();
00816 Short_t runtype = snarlHdr->GetRunType();
00817 Int_t timeframe = snarlHdr->GetTimeFrameNum();
00818 Int_t snarl = snarlHdr->GetSnarl();
00819 Int_t trigsrc = snarlHdr->GetTrigSrc();
00820 Int_t err = snarlHdr->GetErrorCode();
00821 Int_t nrawdigit = snarlHdr->GetNumRawDigits();
00822
00823 snarlHdrBlk =
00824 new RawSnarlHeaderBlock(vldc,run,subrun,runtype,timeframe,
00825 snarl,trigsrc,err,nrawdigit);
00826
00827 }
00828 }
00829
00830 return snarlHdrBlk;
00831 }
|
|
||||||||||||
|
Definition at line 481 of file RotoObjectifier.cxx. References dbg_InflatePrintBlockType, fgDebugFlags, FormattedIntDump(), RawDataBlock::GetSize(), headSize, and RawDataBlock::Print(). 00482 {
00483 //
00484 // Purpose: Common place for generating some debugging dumps
00485 // to be called during inflation process
00486 //
00487 // Argument: iptr ptr to start of memory that might be dumped
00488 // rawBlock ptr to a RawDataBlock of interest
00489 //
00490 // Return: (none)
00491 //
00492 // Contact: R. Hatcher
00493 //
00494
00495 if (fgDebugFlags & dbg_InflatePrintBlockType && rawBlock)
00496 cout << " Built " << rawBlock->GetName()
00497 << " size " << rawBlock->GetSize()
00498 << endl;
00499
00500 if (fgDebugFlags & dbg_InflateDumpBufferHeads)
00501 FormattedIntDump(iptr,headSize,true);
00502
00503 if (fgDebugFlags & dbg_InflatePrintWholeBlock)
00504 rawBlock->Print();
00505
00506 }
|
|
||||||||||||
|
Definition at line 509 of file RotoObjectifier.cxx. References dbg_SquishDumpBufferHeads, dbg_SquishPrintBlockType, dbg_SquishPrintWholeBlock, fgDebugFlags, FormattedIntDump(), RawDataBlock::GetSize(), headSize, and RawDataBlock::Print(). Referenced by BufferSquish(). 00510 {
00511 //
00512 // Purpose: Common place for generating some debugging dumps
00513 // to be called during squishing process
00514 //
00515 // Argument: iptr ptr to start of memory that might be dumped
00516 // rawBlock ptr to a RawDataBlock of interest
00517 //
00518 // Return: (none)
00519 //
00520 // Contact: R. Hatcher
00521 //
00522
00523 if (fgDebugFlags & dbg_SquishPrintBlockType && rawBlock)
00524 cout << " Squish " << rawBlock->GetName()
00525 << " size " << rawBlock->GetSize() << endl;
00526
00527 if (fgDebugFlags & dbg_SquishDumpBufferHeads && iptr)
00528 FormattedIntDump(iptr,headSize,true);
00529
00530 if (fgDebugFlags & dbg_SquishPrintWholeBlock && rawBlock)
00531 rawBlock->Print();
00532
00533 }
|
|
|
Definition at line 239 of file RotoObjectifier.cxx. References SimFlag::Compact(), fgForceDetector, and fgForceSimFlag. 00240 {
00241 //
00242 // Purpose: Extract the encoded RawBlockId for this block from the buffer
00243 //
00244 // *POSSIBLY* modifying the Detector and/or the SimFlag
00245 // values in the underlying block itself (as well as returned
00246 // value). This hack might be necessitated by incorrect settings
00247 // in the DAQ/DCS system when forming the blocks.
00248 //
00249 // Argument: block pointer to first word of block
00250 //
00251 // Return: the extracted (and possibly modified) id
00252 //
00253 // Contact: R. Hatcher
00254 //
00255
00256 // MSB LSB
00257 // 3 2 1 0
00258 // 10987654321098765432109876543210
00259 // --xxCFNSMMMMMMMMMMMMMMMMmmmmmmmm
00260 //
00261 // xx: compactSimFlag: {00=data, 01=fakedaqdata, 10=MC, 11=Reroot}
00262 // CFN: Detector & 0x07 (CalDet,Far,Near bits)
00263 // S: Source (0=DAQ, 1=DCS)
00264 // MMMMMMMM: major block id
00265 // mmmmmmmm: minor block id
00266
00267 Int_t* encodedId = block + 2; // block id after # words & checksum
00268
00269 if (Detector::kUnknown != fgForceDetector) {
00270 *encodedId &= ~maskRawBlkIdDetector; // remove existing value
00271 *encodedId |= ((fgForceDetector & 0x07) << shiftRawBlkIdDetector);
00272 }
00273 if (SimFlag::kUnknown != fgForceSimFlag) {
00274 *encodedId &= ~maskRawBlkIdCSimFlag; // remove existing value
00275 *encodedId |= ((SimFlag::Compact(fgForceSimFlag) & 0x03)
00276 << shiftRawBlkIdCSimFlag);
00277 }
00278
00279 return *encodedId;
00280 }
|
|
||||||||||||||||
|
Definition at line 392 of file RotoObjectifier.cxx. Referenced by DebugDumpInflateBlock(), and DebugDumpSquishBlock(). 00394 {
00395 //
00396 // Purpose: A formatted hex dump of a block of data under the
00397 // assumption that it is a block of Int_t's
00398 //
00399 // Argument: buffer ptr to start of memory
00400 // nwords number of words
00401 // extra_endl if true follow dump with empty line
00402 //
00403 // Return: (none)
00404 //
00405 // Contact: R. Hatcher
00406 //
00407
00408 #ifdef OLDCODE
00409 Int_t *iptr = (Int_t*)buffer;
00410 int nperline = 4;
00411 int online = 0;
00412 for (int i=0; i<nwords; i++) {
00413 printf(" 0x%8.8x",*iptr++);
00414 online++;
00415 if (online == nperline) { printf("\n"); online=0; }
00416 }
00417 if (online != 0) printf("\n");
00418 #else
00419 Int_t* start = (Int_t*)buffer;
00420
00421 // format into columns, suppress duplicate lines unless
00422 // it is the last line
00423 // -- this could probably be done in a cleaner fashion
00424 Int_t ncol = 4;
00425 Int_t ncol_last = (nwords+ncol-1)%ncol + 1;
00426 Bool_t lastmatch = false;
00427 Bool_t lastline = false;
00428 Int_t *next_word = start;
00429 Int_t nfull_lines = nwords/ncol;
00430 if (ncol_last == ncol) nfull_lines--; // if exact, pretend last is partial
00431 Int_t *start_last = start + ncol*nfull_lines;
00432 Int_t nbytes = 0;
00433
00434 while (next_word < start+nwords) {
00435 // adjust down the number of columns if this is the last line
00436 if (next_word == start_last) {
00437 lastline = true;
00438 ncol = ncol_last;
00439 }
00440
00441 Int_t *prev = next_word - ncol;
00442 if (prev >= start && !lastline ) {
00443 // check for match of previous line
00444 Bool_t linematch = true;
00445 Int_t *chek = next_word;
00446 for (int i=0; i<ncol; i++)
00447 linematch = ( *prev++ == *chek++ ) ? linematch : false;
00448 if (linematch) {
00449 next_word += ncol;
00450 nbytes += sizeof(Int_t)*ncol;
00451 if (!lastmatch) {
00452 // was a match, but previous line wasn't also "*"
00453 // and it isn't the very last line
00454 printf(" *\n");
00455 }
00456 lastmatch = true;
00457 continue;
00458 }
00459 else lastmatch = false;
00460
00461 }
00462 // print offset info
00463 //rwh: we want "index" no byte offset// printf(" 0x%6.6x:",nbytes);
00464 printf(" 0x%6.6x:",nbytes/4);
00465 // print elements of line (advance pointer and count)
00466 for (int i=0; i<ncol; i++) {
00467 printf(" %8.8x",*next_word);
00468 next_word++;
00469 nbytes += sizeof(Int_t);
00470 }
00471 // end the line
00472 printf("\n");
00473 }
00474
00475 #endif
00476
00477 if (extra_endl) printf("\n");
00478 }
|
|
|
Definition at line 38 of file RotoObjectifier.h. 00038 { return fgDebugFlags; }
|
|
|
Definition at line 39 of file RotoObjectifier.h. Referenced by RotoClientModule::HandleCommand(). 00039 { fgDebugFlags = dbgflgs; }
|
|
|
Definition at line 44 of file RotoObjectifier.h. Referenced by main(). 00045 { fgForceDetector = detector; }
|
|
|
Definition at line 46 of file RotoObjectifier.h. Referenced by main(). 00047 { fgForceSimFlag = simflag; }
|
|
|
Definition at line 209 of file RotoObjectifier.cxx. References RawBlockProxy::GetMajorId(), RawBlockProxy::GetName(), RawBlockRegistry::GetProxyList(), RawBlockRegistry::Instance(), RawBlockProxy::IsDCS(), and logInfo(). Referenced by RotoServer::Init(). 00210 {
00211 //
00212 // Purpose: Send the list of RawBlockProxies in the RawBlockRegistry
00213 // to msgLog service
00214 //
00215 // Argument: none
00216 //
00217 // Return: none
00218 //
00219 // Contact: R. Hatcher
00220 //
00221 RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00222
00223 logInfo("RawBlockProxies in the RawBlockRegistry:");
00224 list<RawBlockProxy*> proxyTable = rbr.GetProxyList();
00225 list<RawBlockProxy*>::iterator itrProxyTable;
00226 for (itrProxyTable = proxyTable.begin();
00227 itrProxyTable != proxyTable.end();
00228 ++itrProxyTable) {
00229 const RawBlockProxy& proxy = (*(*itrProxyTable));
00230 const char* dataSrc = ((proxy.IsDCS()) ? "DCS" : "DAQ");
00231 int majorid = proxy.GetMajorId();
00232 const char* proxyName = proxy.GetName();
00233 logInfo(" %s 0x%4.4x %s",dataSrc,majorid,proxyName);
00234
00235 }
00236 }
|
|
|
Definition at line 49 of file RotoObjectifier.cxx. Referenced by DebugDumpInflateBlock(), and DebugDumpSquishBlock(). |
|
|
Definition at line 59 of file RotoObjectifier.cxx. Referenced by ExtractEncodedRawBlockId(). |
|
|
Definition at line 61 of file RotoObjectifier.cxx. Referenced by ExtractEncodedRawBlockId(). |
1.3.9.1