RawLIAdcSummary Class Reference

#include <RawLIAdcSummary.h>

List of all members.

Public Member Functions

 RawLIAdcSummary ()
 RawLIAdcSummary (const Int_t *&p, const RawCrateStatus *cstat, Int_t minorVersion)
virtual ~RawLIAdcSummary ()
RawChannelId GetChannel () const
Short_t GetEntries () const
Int_t GetIntMean () const
Int_t GetIntRms () const
Float_t GetMean () const
Float_t GetRms () const
virtual void Print (Option_t *option="") const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const

Protected Member Functions

void BuildRawChannelId (const RawCrateStatus *cstat, Int_t chadd)

Protected Attributes

const RawCrateStatusfCrateStatus
RawChannelId fRawChannelId
Short_t fEntries
Int_t fIntMean
Int_t fIntRms

Detailed Description

Definition at line 22 of file RawLIAdcSummary.h.


Constructor & Destructor Documentation

RawLIAdcSummary::RawLIAdcSummary (  ) 

Definition at line 27 of file RawLIAdcSummary.cxx.

00028    : fCrateStatus(0), fRawChannelId(0), fEntries(-1), fIntMean(-1), fIntRms(-1)
00029 {
00030    // Default constructor
00031 
00032    // MSG("RawData",Msg::kWarning) << "RawLIAdcSummary default ctor" << endl;
00033 }

RawLIAdcSummary::RawLIAdcSummary ( const Int_t *&  p,
const RawCrateStatus cstat,
Int_t  minorVersion 
)

Definition at line 36 of file RawLIAdcSummary.cxx.

References ElecType::AsString(), BuildRawChannelId(), fCrateStatus, fEntries, fIntMean, fIntRms, RawCrateStatus::GetElecType(), RawBlockId::GetMinor(), RawCrateStatus::GetRawBlockId(), ElecType::kQIE, ElecType::kVA, Msg::kWarning, MAXMSG, and MSG.

00039    : fCrateStatus(cstat), fRawChannelId(0), fEntries(-1),
00040      fIntMean(-1), fIntRms(-1)
00041 {
00042    // this is where the everything is actually unpacked
00043 
00044    // version 0:
00045    // 1st 32-bit word: no of entries (16); Chadd (16)
00046    // 2nd 32-bit word: RMS (16); Mean (16)
00047    // Mean and RMS are both scaled by a factor of 4, so that they have a
00048    // two-binal resolution.
00049 
00050    // version 1:
00051    // 1st 32-bit word: Chadd (16); no of entries (16)
00052    // 2nd 32-bit word: Mean (16);  RMS (16)
00053    // Mean and RMS are both scaled by a factor of 4, so that they have a
00054    // two-binal resolution.
00055 
00056    // version 2:
00057    // 1st 32-bit word: Chadd (16); no of entries (16)
00058    // 2nd 32-bit word: Mean (17);  RMS (15)
00059    // Mean is scaled by a factor of 4 and RMS scaled by 2.
00060    // Mean is a 2's complement # (ie. when unpacking high order bit
00061    // of the field must be sign extended).
00062 
00063    // version 3:
00064    // Same as 2 for VA electronics, but different for QIE electronics
00065    // 2nd 32-bin word: Mean (16); RMS (16) for QIE electronics
00066    // Mean is unscaled (positive int), RMS is unscaled
00067  
00068    // version 4:
00069    // Same as v3, but QIE Means have 50 counts added.
00070    // Put change in GetMean() only.
00071 
00072    // version 5:
00073    // Same as v4, but QIE Means use 17 bits and RMS only 15
00074 
00075    const Int_t maskShort = 0xffff;
00076 
00077    switch (minorVersion) {
00078    case 0:
00079    {
00080       // note this version had upper/lower swapped from v1, v2...
00081       Int_t chadd =   p[0]         & maskShort;
00082       BuildRawChannelId(cstat,chadd);
00083 
00084       fEntries   =  ( p[0] >> 16 ) & maskShort;
00085       fIntMean   =    p[1]         & maskShort;
00086       fIntRms    =  ( p[1] >> 16 ) & maskShort;
00087 
00088       // advance pointer by amount it eats up
00089       p += 2;
00090       break;
00091    }
00092    case 1:
00093    {
00094       Int_t chadd = ( p[0] >> 16 ) & maskShort;
00095       BuildRawChannelId(cstat,chadd);
00096 
00097       fEntries   =    p[0]         & maskShort;
00098       fIntMean   =  ( p[1] >> 16 ) & maskShort;
00099       fIntRms    =    p[1]         & maskShort;
00100 
00101       // advance pointer by amount it eats up
00102       p += 2;
00103       break;
00104    }
00105    case 2:
00106    {
00107       Int_t chadd = ( p[0] >> 16) & maskShort;
00108       BuildRawChannelId(cstat,chadd);
00109 
00110       const Int_t maskMean1    = 0x0001ffff;
00111       const Int_t maskRMS1     = 0x00007fff;
00112       const Int_t mean1signbit = 0x00010000;
00113       const Int_t mean1signext = 0xffff0000;
00114       
00115       fEntries   =    p[0]         & maskShort;
00116       fIntMean   =  ( p[1] >> 15 ) & maskMean1;
00117       if (fIntMean & mean1signbit ) fIntMean |= mean1signext;
00118       fIntRms    =    p[1]         & maskRMS1;
00119       
00120       // advance pointer by amount it eats up
00121       p += 2;
00122       break;
00123    }
00124    case 3:
00125    case 4:  
00126    {
00127       Int_t chadd = ( p[0] >> 16) & maskShort;
00128       BuildRawChannelId(cstat,chadd);
00129       fEntries   =    p[0]         & maskShort;
00130 
00131       ElecType::Elec_t elec = fCrateStatus->GetElecType();
00132 
00133       switch (elec) {
00134       default:
00135       {
00136         static Int_t nmsg = 10;
00137         if (nmsg>0) {
00138           --nmsg;
00139           MSG("RawData",Msg::kWarning)
00140             << "RawLIAdcSummary::ctor with unhandled electronics type "
00141             << (int)elec << " " << ElecType::AsString(elec) << endl;
00142         }
00143         // don't break, fall through to VA
00144       }
00145       case ElecType::kVA:
00146       {
00147         const Int_t maskVAMean    = 0x0001ffff;
00148         const Int_t maskVARMS     = 0x00007fff;
00149         const Int_t meanVAsignbit = 0x00010000;
00150         const Int_t meanVAsignext = 0xffff0000;
00151       
00152         fIntMean   =  ( p[1] >> 15 ) & maskVAMean;
00153         if (fIntMean & meanVAsignbit ) fIntMean |= meanVAsignext;
00154         fIntRms    =    p[1]         & maskVARMS;
00155         break;
00156       }
00157       case ElecType::kQIE:
00158       {
00159         const Int_t maskQIEMean    = 0x0000ffff;
00160         const Int_t maskQIERMS     = 0x0000ffff;
00161       
00162         fIntMean   =  ( p[1] >> 16 ) & maskQIEMean;
00163         fIntRms    =    p[1]         & maskQIERMS;
00164         break;
00165       }
00166       } // end ElecType case
00167 
00168       // advance pointer by amount it eats up
00169       p += 2;
00170       break;
00171    }
00172    default:  // minor version #
00173    {
00174      MAXMSG("RawData",Msg::kWarning,10)
00175        << "RawLIAdcSummary::ctor with minor id "
00176        << cstat->GetRawBlockId().GetMinor()
00177        << " unknown layout" << endl;
00178      // don't break, fall through to latest
00179    }
00180    case 5:
00181    {
00182       Int_t chadd = ( p[0] >> 16) & maskShort;
00183       BuildRawChannelId(cstat,chadd);
00184       fEntries   =    p[0]         & maskShort;
00185 
00186       ElecType::Elec_t elec = fCrateStatus->GetElecType();
00187 
00188       switch (elec) {
00189       default:
00190       {
00191         static Int_t nmsg = 10;
00192         if (nmsg>0) {
00193           --nmsg;
00194           MSG("RawData",Msg::kWarning)
00195             << "RawLIAdcSummary::ctor with unhandled electronics type "
00196             << (int)elec << " " << ElecType::AsString(elec) << endl;
00197         }
00198         // don't break, fall through to VA
00199       }
00200       case ElecType::kVA:
00201       {
00202         const Int_t maskVAMean    = 0x0001ffff;
00203         const Int_t maskVARMS     = 0x00007fff;
00204         const Int_t meanVAsignbit = 0x00010000;
00205         const Int_t meanVAsignext = 0xffff0000;
00206       
00207         fIntMean   =  ( p[1] >> 15 ) & maskVAMean;
00208         if (fIntMean & meanVAsignbit ) fIntMean |= meanVAsignext;
00209         fIntRms    =    p[1]         & maskVARMS;
00210         break;
00211       }
00212       case ElecType::kQIE:
00213       {
00214         const Int_t maskQIEMean    = 0x0001ffff;
00215         const Int_t maskQIERMS     = 0x00007fff;
00216       
00217         fIntMean   =  ( p[1] >> 15 ) & maskQIEMean;
00218         fIntRms    =    p[1]         & maskQIERMS;
00219         break;
00220       }
00221       } // end ElecType case
00222 
00223       // advance pointer by amount it eats up
00224       p += 2;
00225       break;
00226    }
00227    } // end minor version number switch
00228 
00229 }

RawLIAdcSummary::~RawLIAdcSummary (  )  [virtual]

Definition at line 232 of file RawLIAdcSummary.cxx.

00233 {
00234    // delete all owned sub-objects
00235 
00236 }


Member Function Documentation

void RawLIAdcSummary::BuildRawChannelId ( const RawCrateStatus cstat,
Int_t  chadd 
) [protected]

Definition at line 327 of file RawLIAdcSummary.cxx.

References fRawChannelId, RawCrateStatus::GetCommonMode(), RawCrateStatus::GetCrate(), RawBlockId::GetDetector(), RawCrateStatus::GetElecType(), RawCrateStatus::GetPedMode(), RawCrateStatus::GetRawBlockId(), RawCrateStatus::GetSparsMode(), and RawChannelId::SetModeBits().

Referenced by RawLIAdcSummary().

00328 {
00329    Detector::Detector_t detector = 
00330                             cstat->GetRawBlockId().GetDetector();
00331    ElecType::Elec_t etype = cstat->GetElecType();
00332    Bool_t         pedMode = cstat->GetPedMode();
00333    Bool_t       sparsMode = cstat->GetSparsMode();
00334    Bool_t      commonMode = cstat->GetCommonMode();
00335    Int_t            crate = cstat->GetCrate();
00336 
00337    fRawChannelId = RawChannelId(detector,etype,crate,chadd);
00338    fRawChannelId.SetModeBits(commonMode,sparsMode,pedMode);
00339 }

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

Definition at line 309 of file RawLIAdcSummary.cxx.

References fEntries, fIntMean, fIntRms, fRawChannelId, GetMean(), and GetRms().

Referenced by Print().

00311 {
00312    MsgFormat ffmt("%9.2f");
00313    MsgFormat ifmt("%7d");
00314    
00315    os << " "  << fRawChannelId
00316       << "  " << setw(5)  << fEntries 
00317       << "  " << ffmt(GetMean())
00318       << " (" << ifmt(fIntMean) << ")"
00319       << "  " << ffmt(GetRms())
00320       << " (" << ifmt(fIntRms) << ")"
00321       << endl;
00322 
00323    return os;
00324 }

RawChannelId RawLIAdcSummary::GetChannel (  )  const [inline]
Short_t RawLIAdcSummary::GetEntries (  )  const [inline]

Definition at line 32 of file RawLIAdcSummary.h.

References fEntries.

Referenced by PulserSummary::Add(), RawLILooker::Ana(), LISummaryAnalyser::Ana(), and LISummaryModule::GetSummaryBlocks().

00032 { return fEntries; }

Int_t RawLIAdcSummary::GetIntMean (  )  const [inline]

Definition at line 33 of file RawLIAdcSummary.h.

References fIntMean.

00033 { return fIntMean; }

Int_t RawLIAdcSummary::GetIntRms (  )  const [inline]

Definition at line 34 of file RawLIAdcSummary.h.

References fIntRms.

00034 { return fIntRms; }

Float_t RawLIAdcSummary::GetMean (  )  const

Definition at line 239 of file RawLIAdcSummary.cxx.

References fCrateStatus, fIntMean, RawCrateStatus::GetElecType(), RawBlockId::GetMinor(), RawCrateStatus::GetRawBlockId(), ElecType::kQIE, Msg::kWarning, and MAXMSG.

Referenced by PulserSummary::Add(), RawLILooker::Ana(), LISummaryAnalyser::Ana(), FormatToOStream(), and LISummaryModule::GetSummaryBlocks().

00240 {
00241    // return unscaled mean
00242    
00243    switch (fCrateStatus->GetRawBlockId().GetMinor()) {
00244    case 0:
00245    case 1:
00246       return fIntMean * 0.25;  // scale factor of 4
00247       break;
00248    case 2:
00249       return fIntMean * 0.25;  // scale factor of 4
00250       break;
00251    case 3:
00252       return fIntMean * 
00253         ( (fCrateStatus->GetElecType() == ElecType::kQIE) ? 1.0 : 0.25 );
00254       break;
00255    default:
00256      {
00257       MAXMSG("RawData",Msg::kWarning,100)
00258          << "RawLIAdcSummary::GetMean() with minor id "
00259          << fCrateStatus->GetRawBlockId().GetMinor()
00260          << " assumes default scale factor" << endl;
00261      }
00262       // don't break, fall through to latest
00263    case 4:
00264    case 5:
00265       return fIntMean * 
00266         ( (fCrateStatus->GetElecType() == ElecType::kQIE) ? 1.0 : 0.25 )
00267         + ((fCrateStatus->GetElecType() == ElecType::kQIE) ? -50 : 0 );
00268       break;
00269    }
00270 }

Float_t RawLIAdcSummary::GetRms (  )  const

Definition at line 273 of file RawLIAdcSummary.cxx.

References fCrateStatus, fIntRms, RawCrateStatus::GetElecType(), RawBlockId::GetMinor(), RawCrateStatus::GetRawBlockId(), ElecType::kQIE, Msg::kWarning, and MAXMSG.

Referenced by PulserSummary::Add(), RawLILooker::Ana(), LISummaryAnalyser::Ana(), FormatToOStream(), and LISummaryModule::GetSummaryBlocks().

00274 {
00275    // return unscaled RMS
00276    
00277    switch (fCrateStatus->GetRawBlockId().GetMinor()) {
00278    case 0:
00279    case 1:
00280       return fIntRms * 0.25;  // scale factor of 4
00281       break;
00282    case 2:
00283       return fIntRms * 0.5;   // scale factor of 2
00284       break;
00285    default:
00286      {
00287       MAXMSG("RawData",Msg::kWarning,100)
00288          << "RawLIAdcSummary::GetRms() with minor id "
00289          << fCrateStatus->GetRawBlockId().GetMinor()
00290          << " assumes default scale factor" << endl;
00291      }
00292       // don't break, fall through to latest
00293    case 3:
00294    case 4:  
00295    case 5:  
00296       return fIntRms * 
00297         ( (fCrateStatus->GetElecType() == ElecType::kQIE) ? 1.0 : 0.5 );
00298       break;
00299    }
00300 }

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

Definition at line 303 of file RawLIAdcSummary.cxx.

References FormatToOStream().

Referenced by RawLIAdcSummaryBlock::FillRawAdcSums().

00304 {
00305    FormatToOStream(cout,option);
00306 }


Member Data Documentation

Definition at line 46 of file RawLIAdcSummary.h.

Referenced by GetMean(), GetRms(), and RawLIAdcSummary().

Short_t RawLIAdcSummary::fEntries [protected]

Definition at line 49 of file RawLIAdcSummary.h.

Referenced by FormatToOStream(), GetEntries(), and RawLIAdcSummary().

Int_t RawLIAdcSummary::fIntMean [protected]

Definition at line 50 of file RawLIAdcSummary.h.

Referenced by FormatToOStream(), GetIntMean(), GetMean(), and RawLIAdcSummary().

Int_t RawLIAdcSummary::fIntRms [protected]

Definition at line 51 of file RawLIAdcSummary.h.

Referenced by FormatToOStream(), GetIntRms(), GetRms(), and RawLIAdcSummary().

Definition at line 48 of file RawLIAdcSummary.h.

Referenced by BuildRawChannelId(), FormatToOStream(), and GetChannel().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1