RawTpSinglesSummaryBlock Class Reference

#include <RawTpSinglesSummaryBlock.h>

Inheritance diagram for RawTpSinglesSummaryBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawTpSinglesSummaryBlock ()
 RawTpSinglesSummaryBlock (const Int_t *block)
 RawTpSinglesSummaryBlock (Detector::Detector_t detector, SimFlag::SimFlag_t simflg, Int_t run, Short_t subrun, Short_t runtype, VldTimeStamp start, VldTimeStamp end, Int_t source, Int_t ncrates, Int_t *hitsPerSec)
virtual ~RawTpSinglesSummaryBlock ()
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
VldTimeStamp GetStartTimeStamp () const
VldTimeStamp GetEndTimeStamp () const
Int_t GetSource () const
Int_t GetNumberOfCrates () const
const Int_t * GetHitsPerSecArray () const
Int_t GetHitsPerSecByCrate (Int_t crate) const
const std::map< RawChannelId,
UInt_t > & 
GetChannelRates () const
const std::vector< UInt_t > & GetPlaneRates () const
const std::map< RawChannelId,
UInt_t > & 
GetRates () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawTpSinglesSummaryBlock (const RawTpSinglesSummaryBlock &rhs)

Static Public Member Functions

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

Protected Member Functions

virtual void UnpackRates () const
virtual void UnpackVaRates () const
virtual void UnpackPlaneRates () const
virtual void UnpackQieRates () const
bool AddVaRate (Detector::Detector_t det, Int_t crateid, UInt_t varcid, UInt_t vfb, UInt_t vachip, UInt_t rate) const
bool AddQieRate (Detector::Detector_t det, Int_t crateid, UInt_t master, UInt_t minder, UInt_t menu, UInt_t rate) const
bool AddChannelRate (RawChannelId rcid, UInt_t rate) const

Protected Attributes

std::map< RawChannelId, UInt_t > fChannelRates
std::vector< UInt_t > fPlaneRates
 unpacked rates

Static Private Attributes

static UInt_t fgDebugFlags = 0
 unpacked rates

Detailed Description

Definition at line 25 of file RawTpSinglesSummaryBlock.h.


Constructor & Destructor Documentation

RawTpSinglesSummaryBlock::RawTpSinglesSummaryBlock (  ) 

Definition at line 49 of file RawTpSinglesSummaryBlock.cxx.

00049                                                    : RawDataBlock()
00050 {
00051    // Default constructor
00052 }

RawTpSinglesSummaryBlock::RawTpSinglesSummaryBlock ( const Int_t *  block  ) 

Definition at line 55 of file RawTpSinglesSummaryBlock.cxx.

00056    : RawDataBlock(block)
00057 {
00058    //  stored block format is:
00059    //---------------------
00060    //  0   # words in block
00061    //  1   checksum
00062    //  2   Block Id
00063    //-----
00064    //  3   run #
00065    //  4   {subrun #| run type}
00066    //  5   start time (sec)
00067    //  6   start time (nsec)
00068    //  7   end time (sec)
00069    //  8   end time (nsec)
00070    //  9   source
00071    // 10   number of crates
00072    // 11   hits/sec from crate 0
00073    // 12   hits/sec from crate 1
00074    //      ...
00075 
00076 }

RawTpSinglesSummaryBlock::RawTpSinglesSummaryBlock ( Detector::Detector_t  detector,
SimFlag::SimFlag_t  simflg,
Int_t  run,
Short_t  subrun,
Short_t  runtype,
VldTimeStamp  start,
VldTimeStamp  end,
Int_t  source,
Int_t  ncrates,
Int_t *  hitsPerSec 
)

Definition at line 78 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawBlockId::GetEncoded(), RawBlockProxy::GetMajorId(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), indx_endnsec, indx_endsec, indx_ncrates, indx_run, indx_src, indx_startnsec, indx_startsec, indx_subrun, RawBlockRegistry::Instance(), RawBlockProxy::IsDCS(), RawBlockRegistry::LookUp(), rdxsum_fill(), and zzzz_last.

00083    : RawDataBlock()
00084 {
00085    // Component ctor
00086 
00087    fSize = zzzz_last + ncrates;
00088    if (fRawBlock) delete [] fRawBlock;
00089    fRawBlock = new Int_t [fSize];
00090 
00091    fRawBlock[0] = fSize;
00092 // fRawBlock[1] = checksum... see below
00093 
00094    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00095    RawBlockProxy*    rbp = rbr.LookUp("RawTpSinglesSummaryBlock");
00096 
00097    Bool_t isDCS   = rbp->IsDCS();
00098    Int_t  majorId = rbp->GetMajorId();
00099    Int_t  minorId = 0;
00100    RawBlockId rbid(majorId,minorId,isDCS,detector,simflg);
00101    fRawBlock[2] = rbid.GetEncoded();
00102 
00103    fRawBlock[indx_run]    = run;
00104    fRawBlock[indx_subrun] = (subrun&0xffff)<<16 | (runtype&0xffff);
00105 
00106    fRawBlock[indx_startsec]  = start.GetSec();
00107    fRawBlock[indx_startnsec] = start.GetNanoSec();
00108 
00109    fRawBlock[indx_endsec]  = end.GetSec();
00110    fRawBlock[indx_endnsec] = end.GetNanoSec();
00111 
00112    fRawBlock[indx_src] = src;
00113 
00114    fRawBlock[indx_ncrates] = ncrates;
00115 
00116    for (Int_t i=0; i<ncrates; i++) 
00117       fRawBlock[zzzz_last+i] = hitsPerSec[i];
00118    
00119    // fill checksum
00120    rdxsum_fill((int32_t*)fRawBlock,0); 
00121 
00122 }

RawTpSinglesSummaryBlock::~RawTpSinglesSummaryBlock (  )  [virtual]

Definition at line 125 of file RawTpSinglesSummaryBlock.cxx.

00126 {
00127    // dtor
00128 }

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

Definition at line 66 of file RawTpSinglesSummaryBlock.h.

00067      : RawDataBlock(rhs) { ; }


Member Function Documentation

bool RawTpSinglesSummaryBlock::AddChannelRate ( RawChannelId  rcid,
UInt_t  rate 
) const [protected]

Definition at line 637 of file RawTpSinglesSummaryBlock.cxx.

References RawChannelId::AsString(), fChannelRates, Msg::kWarning, and MSG.

Referenced by AddQieRate(), and AddVaRate().

00639 {
00640   // add an entry to the rates map
00641 
00642   typedef std::map<RawChannelId,UInt_t> RCIdToRateMap;
00643   RCIdToRateMap::const_iterator itr;
00644 
00645   if ( (itr = fChannelRates.find(rcid)) == fChannelRates.end() ) {
00646     fChannelRates[rcid] = rate;
00647     return true;
00648   }
00649   else {
00650     MSG("Raw",Msg::kWarning)
00651       << " duplicate rate for " << rcid.AsString("e")
00652       << " prior value: " << itr->second
00653       << ", later value: " << rate
00654       << endl;
00655     return false;
00656   }
00657 
00658 }

bool RawTpSinglesSummaryBlock::AddQieRate ( Detector::Detector_t  det,
Int_t  crateid,
UInt_t  master,
UInt_t  minder,
UInt_t  menu,
UInt_t  rate 
) const [protected]

Definition at line 621 of file RawTpSinglesSummaryBlock.cxx.

References AddChannelRate(), RawChannelId::CalcChAdd(), ElecType::kQIE, rcsMaskCrate, and rcsShiftElec.

Referenced by UnpackQieRates().

00625 {
00626   // add an QIE entry to the rates map
00627 
00628   UInt_t crateinfo = (ElecType::kQIE<<rcsShiftElec) | (crateid&rcsMaskCrate); 
00629 
00630   Int_t chadd = RawChannelId::CalcChAdd(master,minder,menu);
00631   RawChannelId rcid(det,crateinfo,chadd);
00632 
00633   return AddChannelRate(rcid,rate);
00634 }

bool RawTpSinglesSummaryBlock::AddVaRate ( Detector::Detector_t  det,
Int_t  crateid,
UInt_t  varcid,
UInt_t  vfb,
UInt_t  vachip,
UInt_t  rate 
) const [protected]

Definition at line 600 of file RawTpSinglesSummaryBlock.cxx.

References AddChannelRate(), RawChannelId::CalcChAdd(), ElecType::kVA, rcsMaskCrate, and rcsShiftElec.

Referenced by UnpackVaRates().

00604 {
00605   // add an VA entry to the rates map
00606 
00607   const UInt_t unknown = (UInt_t)(-1);
00608 
00609   UInt_t adcsel = vfb & 0x01;
00610   UInt_t vmm    = vfb >> 1; 
00611   
00612   UInt_t crateinfo = (ElecType::kVA<<rcsShiftElec) | (crateid&rcsMaskCrate); 
00613 
00614   Int_t chadd = RawChannelId::CalcChAdd(varcid,vmm,adcsel,vachip,unknown);
00615   RawChannelId rcid(det,crateinfo,chadd);
00616 
00617   return AddChannelRate(rcid,rate);
00618 }

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

Reimplemented from RawDataBlock.

Definition at line 209 of file RawTpSinglesSummaryBlock.cxx.

References fgDebugFlags, GetChannelRates(), RawChannelId::GetCrate(), GetEndTimeStamp(), RawChannelId::GetGeographicAddress(), GetHitsPerSecByCrate(), RawChannelId::GetMasterChannel(), RawChannelId::GetMinderChannel(), GetNumberOfCrates(), GetPlaneRates(), GetRun(), GetRunType(), GetSource(), GetStartTimeStamp(), GetSubRun(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVfb(), kdbg_ForceHexDump, ElecType::kQIE, ElecType::kVA, and RawChannelId::SetElecType().

00211 {
00212    if (fgDebugFlags & kdbg_ForceHexDump) option = "x";
00213 
00214    RawDataBlock::FormatToOStream(os,option);
00215    if (option[0] == 'X') return os;
00216    
00217    // additional block specific formatted output is done here
00218 
00219   Int_t src = GetSource();
00220 
00221   os << " Run " << GetRun()
00222      << " SubRun " << GetSubRun() 
00223      << " RunType " << GetRunType()
00224      << " : " 
00225      << " Source " << src << " (";
00226   switch (src) {
00227   case 0:  os << "Crate only";                  break;
00228   case 1:  os << "Crate and VARC";              break;
00229   case 2:  os << "Crate and VFB/ADCSEL";        break;
00230   case 3:  os << "Crate and VACHIP";            break;
00231   case 4:  os << "Crate and Plane";             break;
00232   case 5:  os << "Crate and MASTER";            break;
00233   case 6:  os << "Crate and MINDER";            break;
00234   case 7:  os << "Crate and MENU";              break;
00235   default: os << "Crate and ??";                break;
00236   }
00237   os << ")" << endl;
00238   os << " Start " << GetStartTimeStamp() << endl;
00239   os << " End   " << GetEndTimeStamp() << endl;
00240   for (Int_t i=0; i<GetNumberOfCrates(); i++) 
00241      os << "   crate " << setw(3) << i << ": "
00242           << setiosflags(ios::right)
00243           << setw(8) << GetHitsPerSecByCrate(i) 
00244           << setiosflags(ios::left)
00245           << " hits/sec" << endl;
00246 
00247   if (strchr(option,'q') != 0) return os;
00248 
00249   typedef std::map<RawChannelId,UInt_t> RCIdToRateMap;
00250   const RCIdToRateMap&  chnrates = GetChannelRates();  // force unpacking
00251 
00252   if ( src >= 1 && src <= 3 ) {
00253     // 1=VARC 2=VFB 3=VA chip
00254 
00255     os << "  " << chnrates.size() << " individual rates " << endl;
00256     // n.b. 2304 = 16crates * 4varcs * 12 vfbs * 3chips
00257 
00258     RCIdToRateMap::const_iterator rateItr = chnrates.begin();
00259     RCIdToRateMap::const_iterator rateEnd = chnrates.end();
00260     RawChannelId rcid_last(0xffffffff);    // garbage id
00261     rcid_last.SetElecType(ElecType::kVA);  // make it VA
00262     //cout << "fake rcid " << rcid_last.AsString("ec") << endl;
00263 
00264     while ( rateItr != rateEnd ) {
00265       RawChannelId  rcid = rateItr->first;
00266       Int_t        arate = rateItr->second;
00267     
00268       if ( rcid.GetCrate() != rcid_last.GetCrate() ) 
00269         os << endl << "  Crate: " << setw(2) << rcid.GetCrate() << " ";
00270 
00271       if ( src == 1 ) {
00272         UShort_t varcid = rcid.GetVarcId();
00273         if ( varcid == 0) os << " VarcId: ";
00274         os << "  [" << varcid << "] " 
00275              << setw(6) << arate << " ";  // series of [varc] rates
00276       }
00277       else {
00278         // (possibly) random varcs
00279         // src=2: series of vfb rates
00280         // src=3: series of vfb/chip rates
00281         if ( src == 2 ) {
00282           if ( rcid.GetVarcId() != rcid_last.GetVarcId() ) 
00283             os << endl << "    Varc: " << rcid.GetVarcId() << " ";
00284           os << "[" << setw(2) << rcid.GetVfb() << "] "
00285                << setw(5) << arate << " ";  // series of [vfb] rates
00286         }
00287         else {
00288           if ( rcid.GetVarcId() != rcid_last.GetVarcId() || 
00289                rcid.GetVfb()    != rcid_last.GetVfb() ) 
00290             os << endl << "    Varc: " << rcid.GetVarcId() 
00291                  << " Vfb: " << setw(2) << rcid.GetVfb() << "   ";
00292           os << "[" << rcid.GetVaChip() << "] "
00293                << setw(5) << arate << " ";  // series of [vachip] rates
00294         }
00295       }
00296       
00297       rateItr++;
00298       rcid_last = rcid;
00299     } // loop over channel map
00300   } // src = 1,2,3
00301   else if ( src == 4 ) {
00302     // 4=plane
00303     const std::vector<UInt_t> plnrates = GetPlaneRates(); // get reference
00304     os << "  " << plnrates.size() << " plane rates " << endl << "  ";
00305     const size_t nplnline = 5; 
00306     size_t iplnline=0;
00307     for (size_t ipln=0; ipln<plnrates.size(); ++ipln) {
00308       os << "  [" << setw(4) << ipln 
00309          << "] " << setw(6) << plnrates[ipln];        
00310       if (++iplnline==nplnline) { os << endl << "  "; iplnline=0; }
00311     }
00312     if (iplnline!=0) os << endl;
00313   } // src = 4
00314   else if ( src >= 5 && src <= 7 ) {
00315     // 5=MASTER, 6=MINDER, 7=MENU
00316       
00317     os << "  " << chnrates.size() << " individual rates " << endl;
00318     // n.b. 2304 = 16crates * 4varcs * 12 vfbs * 3chips
00319 
00320     RCIdToRateMap::const_iterator rateItr = chnrates.begin();
00321     RCIdToRateMap::const_iterator rateEnd = chnrates.end();
00322     RawChannelId rcid_last(0xffffffff);    // garbage id
00323     rcid_last.SetElecType(ElecType::kQIE);  // make it QIE
00324     //cout << "fake rcid " << rcid_last.AsString("ec") << endl;
00325 
00326     while ( rateItr != rateEnd ) {
00327       RawChannelId  rcid = rateItr->first;
00328       Int_t        arate = rateItr->second;
00329     
00330       if ( rcid.GetCrate() != rcid_last.GetCrate() ) 
00331         os << endl << "  Crate: " << setw(2) << rcid.GetCrate() << " ";
00332 
00333       if ( src == 5 ) {
00334         UShort_t master = rcid.GetGeographicAddress();
00335         if ( master != rcid_last.GetGeographicAddress() ) 
00336           os << endl << "      " << " Master: ";
00337         os << "  [" << setw(2) << master << "] " 
00338              << setw(6) << arate << " ";  // series of [master] rates
00339       }
00340       else {
00341         // (possibly) random masters
00342         // src=6: series of minder rates
00343         // src=7: series of minder/menu rates
00344         const size_t nminderline = 6;
00345         static size_t iminderline = 0;
00346         if ( src == 6 ) {
00347           if ( rcid.GetGeographicAddress() != 
00348                rcid_last.GetGeographicAddress() ) {
00349             iminderline = 0;
00350             os << endl << "    Master: " << setw(2) 
00351                << rcid.GetGeographicAddress() 
00352                << endl << "      ";
00353           }
00354           os << "[" << setw(2) << rcid.GetMasterChannel() << "] "
00355                << setw(5) << arate << " ";  // series of [minder] rates
00356         }
00357         else {
00358           if ( rcid.GetGeographicAddress() != rcid_last.GetGeographicAddress() || 
00359                rcid.GetMasterChannel()     != rcid_last.GetMasterChannel() ) {
00360             iminderline = 0;
00361             os << endl << "    Master: " << rcid.GetGeographicAddress() 
00362                << " Minder: " << setw(2) << rcid.GetMasterChannel() 
00363                << endl << "      ";
00364           }
00365           os << "[" << setw(2) << rcid.GetMinderChannel() << "] "
00366                << setw(5) << arate << " ";  // series of [menu] rates
00367         }
00368         if (++iminderline==nminderline) {
00369           os << endl << "      ";
00370           iminderline=0;
00371         }
00372       }
00373       
00374       rateItr++;
00375       rcid_last = rcid;
00376     } 
00377     os << endl;
00378 
00379   }  // extended data (src>0)
00380 
00381   return os;
00382 }

const std::map<RawChannelId,UInt_t>& RawTpSinglesSummaryBlock::GetChannelRates (  )  const [inline]

Definition at line 49 of file RawTpSinglesSummaryBlock.h.

References fChannelRates, and UnpackRates().

Referenced by FormatToOStream(), and GetRates().

00050      { UnpackRates(); return fChannelRates; } // see UnpackRates() for details

static UInt_t RawTpSinglesSummaryBlock::GetDebugFlags (  )  [inline, static]

Definition at line 63 of file RawTpSinglesSummaryBlock.h.

References fgDebugFlags.

00063 { return fgDebugFlags; }

VldTimeStamp RawTpSinglesSummaryBlock::GetEndTimeStamp (  )  const
const Int_t * RawTpSinglesSummaryBlock::GetHitsPerSecArray (  )  const

Definition at line 192 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, and zzzz_last.

00193 {
00194    // get access to the array of hits/sec
00195    if (fSize >= zzzz_last) return fRawBlock+zzzz_last;
00196    return 0;
00197 }

Int_t RawTpSinglesSummaryBlock::GetHitsPerSecByCrate ( Int_t  crate  )  const

Definition at line 200 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, and zzzz_last.

Referenced by RateSummary::Ana(), FormatToOStream(), DQHotColdElectronics::Process(), FillFarRunQuality::ProcessBlock(), and FillNearRunQuality::ProcessBlock().

00201 {
00202    // get the hits/sec by crate #
00203    if (fSize > zzzz_last+crate) 
00204       return fRawBlock[zzzz_last+crate];
00205    return -1;
00206 }

Int_t RawTpSinglesSummaryBlock::GetNumberOfCrates (  )  const

Definition at line 184 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_ncrates, and zzzz_last.

Referenced by FormatToOStream(), DQHotColdElectronics::Process(), FillFarRunQuality::ProcessBlock(), FillNearRunQuality::ProcessBlock(), UnpackPlaneRates(), UnpackQieRates(), and UnpackVaRates().

00185 {
00186    // get the number of crates with hits/sec info
00187    if (fSize >= zzzz_last) return fRawBlock[indx_ncrates];
00188    return 0;
00189 }

const std::vector<UInt_t>& RawTpSinglesSummaryBlock::GetPlaneRates (  )  const [inline]

Definition at line 52 of file RawTpSinglesSummaryBlock.h.

References fPlaneRates, and UnpackRates().

Referenced by FormatToOStream().

00053      { UnpackRates(); return fPlaneRates; } // see UnpackRates() for details

const std::map<RawChannelId,UInt_t>& RawTpSinglesSummaryBlock::GetRates (  )  const [inline]
Int_t RawTpSinglesSummaryBlock::GetRun ( void   )  const

Definition at line 131 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_run, and zzzz_last.

Referenced by FormatToOStream().

00132 {
00133    // get the run number
00134    if (fSize >= zzzz_last) return fRawBlock[indx_run];
00135    return -1;
00136 }

Short_t RawTpSinglesSummaryBlock::GetRunType (  )  const

Definition at line 148 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_runtype, and zzzz_last.

Referenced by FormatToOStream(), and FillHvFromSingles::ProcessBlock().

00149 {
00150    // get the run type
00151    if (fSize >= zzzz_last) 
00152       return fRawBlock[indx_runtype]&0xffff;
00153    return -1;
00154 }

Int_t RawTpSinglesSummaryBlock::GetSource (  )  const
VldTimeStamp RawTpSinglesSummaryBlock::GetStartTimeStamp (  )  const
Short_t RawTpSinglesSummaryBlock::GetSubRun (  )  const

Definition at line 139 of file RawTpSinglesSummaryBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_subrun, and zzzz_last.

Referenced by FormatToOStream().

00140 {
00141    // get the subrun number
00142    if (fSize >= zzzz_last) 
00143       return (fRawBlock[indx_subrun]>>16)&0xffff;
00144    return -1;
00145 }

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

Definition at line 62 of file RawTpSinglesSummaryBlock.h.

References fgDebugFlags.

00062 {fgDebugFlags=dbgflgs;}

void RawTpSinglesSummaryBlock::UnpackPlaneRates (  )  const [protected, virtual]

Definition at line 504 of file RawTpSinglesSummaryBlock.cxx.

References fPlaneRates, RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), GetNumberOfCrates(), Msg::kWarning, MAXMSG, and zzzz_last.

Referenced by UnpackRates().

00505 {
00506   // Trailing information should hold rates for planes
00507 
00508   //Int_t src = GetSource();
00509   RawBlockId rbid = GetBlockId();
00510   //Detector::Detector_t det = rbid.GetDetector();
00511 
00512   const Int_t  *p   = fRawBlock;
00513   const Int_t  *end = fRawBlock + fSize;  // 1 beyond end
00514   
00515   p += zzzz_last + GetNumberOfCrates(); //
00516 
00517   UInt_t nplanes  = *p++;
00518   fPlaneRates.resize(nplanes);
00519 
00520   UInt_t ipln = 0;
00521   while ( p < end && ipln < nplanes ) {
00522     Int_t planeRate = *p++;
00523     fPlaneRates[ipln++] = planeRate;
00524   } // p < end ... still data to be unpacked
00525 
00526   if ( p < end ) {
00527     MAXMSG("Raw",Msg::kWarning,10)
00528       << rbid << " plane unpack failed to use all data: " 
00529       << p << "<" << end << endl;
00530   }
00531   else if ( ipln < nplanes ) {
00532     MAXMSG("Raw",Msg::kWarning,10)
00533       << rbid << " plane unpack failed to find all data: " 
00534       << ipln << "<" << nplanes << endl;
00535   }
00536 
00537 }

void RawTpSinglesSummaryBlock::UnpackQieRates (  )  const [protected, virtual]

Definition at line 540 of file RawTpSinglesSummaryBlock.cxx.

References AddQieRate(), det, RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), GetNumberOfCrates(), GetSource(), and zzzz_last.

Referenced by UnpackRates().

00541 {
00542   // Trailing information should hold rates for various levels
00543   // QIE electronics (5=Master only, 6=Minder, 7=Menu)
00544 
00545   Int_t src = GetSource();
00546   RawBlockId rbid = GetBlockId();
00547   Detector::Detector_t det = rbid.GetDetector();
00548 
00549   const Int_t  *p   = fRawBlock;
00550   const Int_t  *end = fRawBlock + fSize;  // 1 beyond end
00551   
00552   p += zzzz_last + GetNumberOfCrates(); //
00553 
00554   const UInt_t unknown = (UInt_t)(-1);
00555 
00556   while ( p < end ) {
00557     Int_t crateid  = *p++;
00558     Int_t nmasters = *p++;
00559 
00560     // funkiness!
00561     Int_t imaster  = nmasters >> 16;
00562     if (imaster==0) imaster = 9;
00563     nmasters &= 0xffff;
00564 
00565     if ( src == 5 ) {
00566       for (Int_t jmaster = 0; jmaster < nmasters; jmaster++) {
00567         Int_t masterRate = *p++;
00568         AddQieRate(det,crateid,imaster,unknown,unknown,masterRate);
00569         imaster++;
00570       }  // loop over masters in crate
00571     }
00572     else {
00573       // src = 6, 7
00574       for (Int_t jmaster = 0; jmaster < nmasters; jmaster++) {
00575         Int_t xyzzy = *p++;
00576         UInt_t nmenu    = ( xyzzy       ) & 0xff;
00577         UInt_t nminder  = ( xyzzy >>  8 ) & 0xff;
00578         UInt_t masterid = ( xyzzy >> 16 ) & 0xff;
00579         for (UInt_t iminder = 0; iminder < nminder; ++iminder) {
00580           if ( src == 6 ) {
00581             Int_t minderRate = *p++;
00582             AddQieRate(det,crateid,masterid,iminder,unknown,minderRate);
00583           }
00584           else if (src == 7 ) {
00585             for (UInt_t imenu = 0; imenu < nmenu; ++imenu) {
00586               Int_t menuRate = *p++;
00587               AddQieRate(det,crateid,masterid,iminder,imenu,menuRate);
00588             }  // loop over menus
00589           }  // src 6 vs 7 
00590         }  // loop over vfb's
00591       } // loop over masters
00592 
00593     } // end of src=6,7 unpacking
00594 
00595   } // p < end ... still data to be unpacked
00596 
00597 }

void RawTpSinglesSummaryBlock::UnpackRates (  )  const [protected, virtual]

Definition at line 385 of file RawTpSinglesSummaryBlock.cxx.

References fChannelRates, fPlaneRates, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), GetSource(), Msg::kWarning, MSG, UnpackPlaneRates(), UnpackQieRates(), and UnpackVaRates().

Referenced by GetChannelRates(), and GetPlaneRates().

00386 {
00387   // Unpack the extra sub-crate rate information into 
00388   // pairs of <RawChannelId,UInt_t> ( or <UInt_t,UInt_t> for src=4->Plane)
00389   //
00390   // Meaningful parts of RawChannelId:
00391   // Source    CrateInfo  VarcId  Vfb  VaChip VaChannel
00392   //   1       yes        yes     --   --     --
00393   //   2       yes        yes     yes  --     --
00394   //   3       yes        yes     yes  yes    --
00395   // Source    CrateInfo  PlaneNum
00396   //   4       yes        yes
00397   // Source    CrateInfo  Master  Minder Menu
00398   //   5       yes        yes     --     -- 
00399   //   6       yes        yes     yes    -- 
00400   //   7       yes        yes     yes    yes
00401 
00402   Int_t src = GetSource();
00403   if      ( src == 0 ) return;  // nothing to unpack
00404   else if ( src == 4 ) {
00405     if ( !fPlaneRates.empty()   ) return;  // already unpacked
00406   }
00407   else {
00408     if ( !fChannelRates.empty() ) return;  // already unpacked
00409   }
00410 
00411   RawBlockId rbid = GetBlockId();
00412   Int_t minor = rbid.GetMinor();
00413   if ( minor < 2 ) {
00414       MSG("Raw",Msg::kWarning)
00415         << " minor version " << minor << endl 
00416         << " should have no sub-crate info,"
00417       << " but Source = " << src << " so try unpacking anyway." << endl;
00418   }
00419 
00420   switch (src) {
00421   case 1:
00422   case 2:
00423   case 3:
00424     UnpackVaRates();
00425     break;
00426   case 4:
00427     UnpackPlaneRates();
00428     break;
00429   case 5:
00430   case 6:
00431   case 7:
00432     UnpackQieRates();
00433     break;
00434   default:
00435     {
00436       MSG("Raw",Msg::kWarning)
00437         << rbid << " with source = " << src << " is unknown format." << endl;
00438       return;
00439     }
00440   }  
00441 
00442 }

void RawTpSinglesSummaryBlock::UnpackVaRates (  )  const [protected, virtual]

Definition at line 445 of file RawTpSinglesSummaryBlock.cxx.

References AddVaRate(), det, RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), GetNumberOfCrates(), GetSource(), Msg::kWarning, MAXMSG, and zzzz_last.

Referenced by UnpackRates().

00446 {
00447   // Trailing information should hold rates for various levels
00448   // VA electronics (1=VARC only, 2=VFB, 3=VA Chip)
00449 
00450   Int_t src = GetSource();
00451   RawBlockId rbid = GetBlockId();
00452   Detector::Detector_t det = rbid.GetDetector();
00453 
00454   const Int_t  *p   = fRawBlock;
00455   const Int_t  *end = fRawBlock + fSize;  // 1 beyond end
00456   
00457   p += zzzz_last + GetNumberOfCrates(); //
00458 
00459   const UInt_t unknown = (UInt_t)(-1);
00460 
00461   while ( p < end ) {
00462     Int_t crateid = *p++;
00463     Int_t nvarcs  = *p++;
00464 
00465     if ( src == 1 ) {
00466       for (Int_t varcid = 0; varcid < nvarcs; varcid++) {
00467         Int_t varcRate = *p++;
00468         AddVaRate(det,crateid,varcid,unknown,unknown,varcRate);
00469       }  // loop over varcs in crate
00470     }
00471     else {
00472       // src = 2, 3
00473       for (Int_t ivarc = 0; ivarc < nvarcs; ivarc++) {
00474         Int_t xyzzy = *p++;
00475         UInt_t nchip  = ( xyzzy       ) & 0xff;
00476         UInt_t nvfb   = ( xyzzy >>  8 ) & 0xff;
00477         UInt_t varcid = ( xyzzy >> 16 ) & 0xff;
00478         for (UInt_t ivfb = 0; ivfb < nvfb; ++ivfb) {
00479           if ( src == 2 ) {
00480             Int_t vfbRate = *p++;
00481             AddVaRate(det,crateid,varcid,ivfb,unknown,vfbRate);
00482           }
00483           else if (src == 3 ) {
00484             if (nchip != 3) {
00485               MAXMSG("Raw",Msg::kWarning,10)
00486                 << rbid << " unpack at chip level but Nchip = "
00487                 << nchip << " != 3 " << endl;
00488             }
00489             for (UInt_t ichip = 0; ichip < nchip; ++ichip) {
00490               Int_t chipRate = *p++;
00491               AddVaRate(det,crateid,varcid,ivfb,ichip,chipRate);
00492             }  // loop over chips
00493           }  // src 2 vs 3 
00494         }  // loop over vfb's
00495       } // loop over varcs
00496 
00497     } // end of src=2,3 unpacking
00498 
00499   } // p < end ... still data to be unpacked
00500 
00501 }


Member Data Documentation

std::map<RawChannelId,UInt_t> RawTpSinglesSummaryBlock::fChannelRates [mutable, protected]

Definition at line 85 of file RawTpSinglesSummaryBlock.h.

Referenced by AddChannelRate(), GetChannelRates(), and UnpackRates().

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

unpacked rates

Definition at line 91 of file RawTpSinglesSummaryBlock.h.

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

std::vector<UInt_t> RawTpSinglesSummaryBlock::fPlaneRates [mutable, protected]

unpacked rates

Definition at line 86 of file RawTpSinglesSummaryBlock.h.

Referenced by GetPlaneRates(), UnpackPlaneRates(), and UnpackRates().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1