PlexSEIdAltL Class Reference

#include <PlexSEIdAltL.h>

List of all members.

Public Types

enum  EErrorMasks {
  kOkay = 0x0000, kBadDetector = 0x0001, kBadEnd = 0x0002, kBadPlane = 0x0004,
  kBadPlaneView = 0x0008, kUnchecked = 0x0010, kBadIsVeto = 0x0020
}
enum  EFmtFlagBits {
  fmt_Index = 0x0001, fmt_Cursor = 0x0002, fmt_Best = 0x0004, fmt_StripEnd = 0x0008,
  fmt_PixelSpot = 0x0010, fmt_Weight = 0x0020, fmt_PE = 0x0040, fmt_SigLin = 0x0080,
  fmt_SigCorr = 0x0100, fmt_Time = 0x0200
}
typedef PlexSEIdAltL::iterator PlexSEIdAltLIter
typedef
PlexSEIdAltL::const_iterator 
PlexSEIdAltLConstIter
typedef enum
PlexSEIdAltL::EErrorMasks 
ErrorMask_t
typedef enum
PlexSEIdAltL::EFmtFlagBits 
FmtFlagBits_t

Public Member Functions

 PlexSEIdAltL ()
 PlexSEIdAltL (const PlexSEIdAltL &rhs)
virtual ~PlexSEIdAltL ()
void AddStripEndId (const PlexStripEndId &seid, const PlexPixelSpotId &spot, Float_t weight=0, const PlexCalib *calib=0, Int_t adc=0, Double_t time=0)
void ClearWeights ()
void DropCurrent ()
void DropZeroWeights ()
void KeepTopWeights (UInt_t n=2, Bool_t keeporder=kFALSE)
const PlexSEIdAltLItemGetBestItem () const
PlexSEIdAltLItemGetBestItem ()
PlexStripEndId GetBestSEId () const
Float_t GetBestWeight () const
const PlexSEIdAltLItemGetCurrentItem () const
PlexSEIdAltLItemGetCurrentItem ()
PlexStripEndId GetCurrentSEId () const
Float_t GetCurrentWeight () const
UShort_t GetDemuxVetoFlag () const
Bool_t IsVetoShield (Bool_t reportError=true) const
Detector::Detector_t GetDetector (Bool_t reportError=true) const
StripEnd::StripEnd_t GetEnd (Bool_t reportError=true) const
Int_t GetPlane (Bool_t reportError=true) const
PlaneView::PlaneView_t GetPlaneView (Bool_t reportError=true) const
Int_t GetError (Bool_t reportError=true) const
Bool_t SetToOppositeEnds (PlexSEIdAltL &that)
Int_t GetSize () const
Bool_t IsValid () const
void Next () const
void Previous () const
void SetFirst () const
void SetLast () const
void SetCurrentWeight (Float_t weight)
void AddToCurrentWeight (Float_t wgtadd)
void NormalizeWeights (Float_t wgtsum=1.0)
void SetDemuxVetoFlag (UShort_t flag)
UInt_t Size () const
void Push_Back (const PlexSEIdAltLItem &item)
void Print (Option_t *option="") const

Static Public Member Functions

static void SetFmtFlag (const UInt_t fmtflg)
static UInt_t GetFmtFlag ()

Static Public Attributes

static const Short_t kBestUnset = -1

Private Member Functions

void TestConsistency (Bool_t reportError=true) const

Private Attributes

UShort_t fCurrent
Short_t fBest
UShort_t fDemuxVetoFlag
UShort_t fError

Static Private Attributes

static UInt_t fgFmtFlag = 0

Friends

std::ostream & operator<< (std::ostream &os, const PlexSEIdAltL &alt)

Detailed Description

Definition at line 26 of file PlexSEIdAltL.h.


Member Typedef Documentation

typedef PlexSEIdAltL::const_iterator PlexSEIdAltL::PlexSEIdAltLConstIter

Definition at line 41 of file PlexSEIdAltL.h.

typedef PlexSEIdAltL::iterator PlexSEIdAltL::PlexSEIdAltLIter

Definition at line 40 of file PlexSEIdAltL.h.


Member Enumeration Documentation

Enumerator:
kOkay 
kBadDetector 
kBadEnd 
kBadPlane 
kBadPlaneView 
kUnchecked 
kBadIsVeto 

Definition at line 96 of file PlexSEIdAltL.h.

00096                             {
00097       kOkay         = 0x0000,
00098       kBadDetector  = 0x0001,
00099       kBadEnd       = 0x0002,
00100       kBadPlane     = 0x0004,
00101       kBadPlaneView = 0x0008,
00102       kUnchecked    = 0x0010,
00103       kBadIsVeto    = 0x0020
00104    } ErrorMask_t;

Enumerator:
fmt_Index 
fmt_Cursor 
fmt_Best 
fmt_StripEnd 
fmt_PixelSpot 
fmt_Weight 
fmt_PE 
fmt_SigLin 
fmt_SigCorr 
fmt_Time 

Definition at line 106 of file PlexSEIdAltL.h.

00106                              {
00107      fmt_Index     = 0x0001,
00108      fmt_Cursor    = 0x0002,
00109      fmt_Best      = 0x0004,
00110      fmt_StripEnd  = 0x0008,
00111      fmt_PixelSpot = 0x0010,
00112      fmt_Weight    = 0x0020,
00113      fmt_PE        = 0x0040,
00114      fmt_SigLin    = 0x0080,
00115      fmt_SigCorr   = 0x0100,
00116      fmt_Time      = 0x0200
00117    } FmtFlagBits_t;


Constructor & Destructor Documentation

PlexSEIdAltL::PlexSEIdAltL (  ) 

Definition at line 180 of file PlexSEIdAltL.cxx.

00181   : fCurrent(0), fBest(kBestUnset), fDemuxVetoFlag(0), fError(kUnchecked)
00182 {
00183    // Default constructor
00184 }

PlexSEIdAltL::PlexSEIdAltL ( const PlexSEIdAltL rhs  ) 

Definition at line 187 of file PlexSEIdAltL.cxx.

00188    : std::vector<PlexSEIdAltLItem>(),
00189      fCurrent(rhs.fCurrent), 
00190      fBest(rhs.fBest),
00191      fDemuxVetoFlag(rhs.fDemuxVetoFlag), 
00192      fError(kUnchecked)
00193 {
00194 
00195    // deep copy constructor
00196    for (unsigned int i=0; i<rhs.size(); ++i) {
00197       this->push_back(rhs[i]);
00198    }
00199 
00200 }

PlexSEIdAltL::~PlexSEIdAltL (  )  [virtual]

Definition at line 203 of file PlexSEIdAltL.cxx.

00204 {
00205    // delete all the owned sub-objects
00206 }


Member Function Documentation

void PlexSEIdAltL::AddStripEndId ( const PlexStripEndId seid,
const PlexPixelSpotId spot,
Float_t  weight = 0,
const PlexCalib calib = 0,
Int_t  adc = 0,
Double_t  time = 0 
)

Definition at line 225 of file PlexSEIdAltL.cxx.

References PlexCalib::CalibStripEnd(), fBest, fError, kBestUnset, kUnchecked, and PlexSEIdAltLItem::SetWeight().

Referenced by CheezyDisplay::AddStripEndId(), Plexus::GetSEIdAltL(), PlexusReroot::GetSEIdAltL(), AlgMCDigit::RunAlg(), and PlexValidate::TestAltL().

00229 {
00230    // add a new item to the list
00231 
00232    fError = kUnchecked;  // adding a new strip makes consistency unknown
00233    fBest  = kBestUnset;  // invalidate "best" choice
00234 
00235    if (calib) {
00236       PlexSEIdAltLItem item = calib->CalibStripEnd(seid,spot,adc,time);
00237       item.SetWeight(weight);
00238       this->push_back(item);
00239    }
00240    else {
00241       PlexSEIdAltLItem item(seid,spot,weight);
00242       this->push_back(item);
00243    }
00244 }

void PlexSEIdAltL::AddToCurrentWeight ( Float_t  wgtadd  ) 

Definition at line 722 of file PlexSEIdAltL.cxx.

References fBest, fCurrent, IsValid(), and kBestUnset.

Referenced by AlgFitTrackCam::GenerateNDSpectStrips().

00723 {
00724    // add to the weight attached to the current PlexStripEndId
00725 
00726    if (!IsValid()) return; // no list or out of range
00727    PlexSEIdAltLIter cursor = this->begin() + fCurrent;
00728    (*cursor).AddToWeight(wgtadd);
00729    fBest = kBestUnset;  // invalidate "best" choice
00730 }

void PlexSEIdAltL::ClearWeights (  ) 

Definition at line 354 of file PlexSEIdAltL.cxx.

References fBest, kBestUnset, and size.

Referenced by AlgDeMuxBeam::ReconcileShowerAndMuonRegions(), AlgMCDigit::RunAlg(), DmxMuonPlane::SetStrips(), DmxHypothesis::SetStrips(), and PlexValidate::TestAltL().

00355 {
00356    // set all the weights to zero
00357 
00358    PlexSEIdAltL& self = *this;
00359    for (unsigned int i=0; i<size(); i++) (self[i]).SetWeight(0.0);
00360 
00361    fBest  = kBestUnset;  // invalidate "best" choice
00362 }

void PlexSEIdAltL::DropCurrent (  ) 

Definition at line 247 of file PlexSEIdAltL.cxx.

References fBest, fCurrent, kBestUnset, Msg::kWarning, MSG, n, and size.

Referenced by PlexValidate::TestAltL().

00248 {
00249    // Remove current item from the list.
00250    // Do not reset current position of iterator.
00251    // An iterative removal should start from Last() and use Previous().
00252 
00253    UShort_t n = size();
00254 
00255    if (n <= 0) return;  // one cannot drop what one doesn't have
00256 
00257    fBest  = kBestUnset;  // invalidate "best" choice
00258 
00259    if (fCurrent>=n) {   
00260       MSG("Plex",Msg::kWarning)
00261          << "can not DropCurrent (fCurrent=" << fCurrent 
00262          << ") on a list of " << n << " items " << endl;
00263       return;
00264    }
00265 
00266    PlexSEIdAltLIter cursor = this->begin() + fCurrent;
00267    // delete the owned item
00268    this->erase(cursor);
00269 
00270 }

void PlexSEIdAltL::DropZeroWeights (  ) 

Definition at line 273 of file PlexSEIdAltL.cxx.

References fBest, PlexSEIdAltLItem::IsZeroWeight(), kBestUnset, and size.

Referenced by AlgMCDigit::RunAlg(), AlgDeMuxDigitList::RunAlg(), and PlexValidate::TestAltL().

00274 {
00275    // Remove pairs from the list that have weight == 0
00276 
00277    if (size() <= 0) return;  // one cannot drop what one doesn't have
00278 
00279    fBest  = kBestUnset;  // invalidate "best" choice
00280 
00281    // move all zero items to the end
00282    PlexSEIdAltLIter new_end = 
00283       remove_if(this->begin(), this->end(), 
00284                 mem_fun_ref(&PlexSEIdAltLItem::IsZeroWeight));
00285 
00286    // erase the moved items out of the array 
00287    this->erase(new_end,this->end());
00288 
00289 }

PlexSEIdAltLItem & PlexSEIdAltL::GetBestItem (  ) 

Definition at line 410 of file PlexSEIdAltL.cxx.

References fBest, GetSize(), PlexSEIdAltLItem::GetWeight(), kBestUnset, Msg::kWarning, MSG, and size.

00411 {
00412    // find the PlexSEIdAltLItem with the highest weight
00413 
00414    unsigned int thesize = size();
00415    if (thesize == 0) {
00416      static int msglimit = 25;  // limit the number of complaints
00417      if (msglimit) {
00418        // Empty lists generally happen because of raw channel id's
00419        // that don't map back to real strips (for instance due to
00420        // unused pixels on a tube being illuminated by crosstalk).
00421        // Complain a bit ... but then shut up.
00422        MSG("Plex",Msg::kWarning)
00423          << "can not GetBestItem() from an empty list" << endl;
00424        if (--msglimit == 0) {
00425          MSG("Plex",Msg::kWarning)
00426            << " ... last warning of this type" << endl;
00427        }
00428      }
00429      return dummyPlexSEIdAltLItem;;
00430    }
00431    else if (thesize == 1) {
00432      // simple case of only one element
00433      fBest = 0;
00434      return (*this)[0];
00435    }
00436    
00437    // if we've haven't cached the best item we need to determine it
00438    if ( fBest == kBestUnset ) {
00439 
00440      size_t cursor, vsize = GetSize();
00441      Float_t wgt, maxwgt = -FLT_MAX;
00442      for ( cursor = 0; cursor < vsize; ++cursor ) {
00443        const PlexSEIdAltLItem& item = (*this)[cursor];
00444        if ( (wgt = item.GetWeight()) > maxwgt ) {
00445          maxwgt = wgt; fBest = cursor;
00446        }
00447      }
00448 
00449    }
00450    return (*this)[fBest];
00451       
00452 }

const PlexSEIdAltLItem & PlexSEIdAltL::GetBestItem (  )  const

Definition at line 365 of file PlexSEIdAltL.cxx.

References fBest, GetSize(), PlexSEIdAltLItem::GetWeight(), kBestUnset, Msg::kWarning, MSG, and size.

Referenced by AltDeMuxDisplay::Ana(), AltDeMuxCalc::CalcBestEast(), AltDeMuxCalc::CalcBestWest(), GfxDigitList::Configure(), TridModelMaker::CreateChannelModels(), TridModelMaker::CreatePmtModels(), TridModelMaker::CreateStripModels(), DemuxFast::DemuxHits(), GfxDigitList::DigitMasked(), AlgAltDeMuxBase::FinalReTagCrossTalk(), GetBestSEId(), GetBestWeight(), CandDigitHandle::GetCharge(), GfxDigitList::GetDigitColor(), GfxDigit::GetDiscreteCoords(), GfxDigit::GetRealCoords(), GfxDigit::GetRelativeValue(), CandDigitHandle::GetTime(), CandDigit::IsEquivalent(), AlgAltDeMuxBase::IsXTalk(), CalHelpers::KeyFromTime(), GfxDigit::ModifyCoords(), AlgAltDeMuxBase::PredictedSpotQ(), Print(), PmtPixels::Refresh(), AlgAltDeMuxBase::ReTagCrossTalk(), select_digit(), GfxDigit::SetColor(), AlgTrackSRList::SpectrometerTracking(), StripSRKeyFromTube(), EVD::UpdateChargeHists(), AlgAltDeMuxBase::UpdateXTalkMap(), and AlgAltDeMuxBase::XTalkPixelMap().

00366 {
00367    // find the PlexSEIdAltLItem with the highest weight (const version)
00368 
00369    unsigned int thesize = size();
00370    if (thesize == 0) {
00371      static int msglimit = 25;  // limit the number of complaints
00372      if (msglimit) {
00373        // Empty lists generally happen because of raw channel id's
00374        // that don't map back to real strips (for instance due to
00375        // unused pixels on a tube being illuminated by crosstalk).
00376        // Complain a bit ... but then shut up.
00377        MSG("Plex",Msg::kWarning)
00378          << "can not GetBestItem() from an empty list" << endl;
00379        if (--msglimit == 0) {
00380          MSG("Plex",Msg::kWarning)
00381            << " ... last warning of this type" << endl;
00382        }
00383      }
00384      return dummyPlexSEIdAltLItem;;
00385    }
00386    else if (thesize == 1) {
00387      // simple case of only one element
00388      fBest = 0;
00389      return (*this)[0];
00390    }
00391 
00392    // if we've haven't cached the best item we need to determine it
00393    if ( fBest == kBestUnset ) {
00394 
00395      size_t cursor, vsize = GetSize();
00396      Float_t wgt, maxwgt = -FLT_MAX;
00397      for ( cursor = 0; cursor < vsize; ++cursor ) {
00398        const PlexSEIdAltLItem& item = (*this)[cursor];
00399        if ( (wgt = item.GetWeight()) > maxwgt ) {
00400          maxwgt = wgt; fBest = cursor;
00401        }
00402      }
00403 
00404    }
00405    return (*this)[fBest];
00406       
00407 }

PlexStripEndId PlexSEIdAltL::GetBestSEId (  )  const
Float_t PlexSEIdAltL::GetBestWeight (  )  const
PlexSEIdAltLItem & PlexSEIdAltL::GetCurrentItem (  ) 

Definition at line 493 of file PlexSEIdAltL.cxx.

References fCurrent, IsValid(), Msg::kWarning, MSG, and size.

00494 {
00495    // return by value current PlexSEIdAltLItem
00496 
00497    if (!IsValid()) {
00498      if (size() <= 0) 
00499        MSG("Plex",Msg::kWarning)
00500          << "can not GetCurrentItem() from an empty list" << endl;
00501      else
00502        MSG("Plex",Msg::kWarning)
00503          << "can not GetCurrentItem() when !IsValid()" << endl;
00504      return dummyPlexSEIdAltLItem;;
00505    }
00506 
00507    PlexSEIdAltLIter cursor = this->begin() + fCurrent;
00508    return *cursor;
00509 
00510 }

const PlexSEIdAltLItem & PlexSEIdAltL::GetCurrentItem (  )  const

Definition at line 473 of file PlexSEIdAltL.cxx.

References fCurrent, IsValid(), Msg::kWarning, MSG, and size.

Referenced by RateSummary::Ana(), AltDeMuxCalc::CalcEast(), AltDeMuxCalc::CalcWest(), AltDeMuxCalc::CurrentQ(), DemuxFast::DemuxHitE(), AlgAltDeMuxBase::DeMuxHitE(), DemuxFast::DemuxHitW(), AlgAltDeMuxBase::DeMuxHitW(), GfxDigitList::ExecuteEvent(), GfxDigitList::ExecuteEventDigit(), GetCurrentSEId(), GetCurrentWeight(), LIPatternFinderFancy::IsLightInjectionTrash(), AlgAltDeMuxBase::IsXTalk(), AlgAltDeMuxBase::MakeAltListMap(), AlgAltDeMuxBase::MakePixelMap(), DemuxFast::Reco(), EVD::SetChargeRange(), Mint::UpdateDigitRanges(), and AlgAltDeMuxBase::XTalkCharge().

00474 {
00475    // return by value current PlexSEIdAltLItem (const version)
00476 
00477    if (!IsValid()) {
00478      if (size() <= 0) 
00479        MSG("Plex",Msg::kWarning)
00480          << "can not GetCurrentItem() from an empty list" << endl;
00481      else
00482        MSG("Plex",Msg::kWarning)
00483          << "can not GetCurrentItem() when !IsValid()" << endl;
00484      return dummyPlexSEIdAltLItem;;
00485    }
00486 
00487    PlexSEIdAltLConstIter cursor = this->begin() + fCurrent;
00488    return *cursor;
00489 
00490 }

PlexStripEndId PlexSEIdAltL::GetCurrentSEId (  )  const
Float_t PlexSEIdAltL::GetCurrentWeight (  )  const

Definition at line 522 of file PlexSEIdAltL.cxx.

References GetCurrentItem(), and PlexSEIdAltLItem::GetWeight().

Referenced by CheezyDisplay::BuildPolyMarker(), DmxMuonPlane::SetStrips(), and PlexValidate::TestAltL().

00523 {
00524    // return the weight attached to the current PlexStripEndId
00525 
00526    return GetCurrentItem().GetWeight();
00527 
00528 }

UShort_t PlexSEIdAltL::GetDemuxVetoFlag (  )  const [inline]
Detector::Detector_t PlexSEIdAltL::GetDetector ( Bool_t  reportError = true  )  const

Definition at line 531 of file PlexSEIdAltL.cxx.

References fError, kBadDetector, size, and TestConsistency().

Referenced by CheezyDisplay::AddSEIdAltL().

00532 {
00533    // Return the Detector of the PlexStripEndID's in this list.
00534    // This is meaningful only in a correctly filled PlexSEIdAltL
00535 
00536    TestConsistency(reportError);
00537    
00538    if ( fError & kBadDetector || size() < 1 ) 
00539       return (Detector::Detector_t)0; // bad detector
00540 
00541    PlexSEIdAltLConstIter cursor = this->begin();
00542    return (*cursor).GetSEId().GetDetector();
00543 
00544 }

StripEnd::StripEnd_t PlexSEIdAltL::GetEnd ( Bool_t  reportError = true  )  const

Definition at line 564 of file PlexSEIdAltL.cxx.

References fError, kBadEnd, StripEnd::kUnknown, size, and TestConsistency().

Referenced by CheezyDisplay::AddSEIdAltL(), DmxDeMuxModule::Ana(), RunSummary::Ana(), RateSummary::Ana(), DmxDeMuxCosmicsModule::Ana(), FarmListModule::Ana(), AltDeMuxDisplay::Ana(), Truthifier::BestSEIdOfDigit(), AlgAltDeMuxBase::CleanIsolatedHits(), DmxHypothesis::DmxHypothesis(), DmxUtilities::FillHitPixels(), DmxUtilities::FillPlaneArray(), AlgShowerSR::FindTimingDirection(), AlgTrackSR::FindTimingDirection(), AlgFitTrackSR::FindTimingDirection(), AlgTrackSRList::FindTimingDirection(), DmxHypothesis::GetTimingOffset(), DmxMuonPlane::GetTimingOffset(), AlgAltDeMuxBase::MakeAltListMap(), AlgFitTrackCam::NDStripBegTime(), PEGainMuxBox::New(), is_east_side::operator()(), DmxMuonPlane::PrintRecon(), LIPatternFinderSimple::PrintSnarl(), DemuxFast::Reco(), OltTimeScan::Reco(), AlgFarDetShieldPlank::RunAlg(), AlgFarDetShieldPlankList::RunAlg(), AlgShieldPlank::RunAlg(), AlgFarDetStripList::RunAlg(), PlexValidate::TestAltL(), and AlgFitTrackCam::TimingFit().

00565 {
00566    // Return the end (kEast,kWest) of the PlexStripEndID's in this list.
00567    // This is meaningful only in a correctly cabled detector
00568    // if there are mis-cablings then it could return nonsense.
00569 
00570    TestConsistency(reportError);
00571 
00572    if ( fError & kBadEnd || size() < 1 ) 
00573       return StripEnd::kUnknown;  // bad end
00574 
00575    PlexSEIdAltLConstIter cursor = this->begin();
00576    return (*cursor).GetSEId().GetEnd();
00577 
00578 }

Int_t PlexSEIdAltL::GetError ( Bool_t  reportError = true  )  const [inline]

Definition at line 70 of file PlexSEIdAltL.h.

References fError, and TestConsistency().

Referenced by Plexus::ValidateConsistency().

00071       { TestConsistency(reportError); return fError; }

static UInt_t PlexSEIdAltL::GetFmtFlag (  )  [inline, static]

Definition at line 122 of file PlexSEIdAltL.h.

References fgFmtFlag.

Referenced by operator<<(), and TestConsistency().

00122 { return fgFmtFlag; }

Int_t PlexSEIdAltL::GetPlane ( Bool_t  reportError = true  )  const

Definition at line 581 of file PlexSEIdAltL.cxx.

References fError, kBadPlane, size, and TestConsistency().

Referenced by DigitText::AddCandDigitText(), LIRawNt::Ana(), DmxDeMuxModule::Ana(), RunSummary::Ana(), UberDST::Ana(), ChopModule::Ana(), NoiseFilterModule::Ana(), PreFilter::Ana(), FarmListModule::Ana(), AltDeMuxDisplay::Ana(), PEGainModule::analyseMeanSigmaFile(), PmtMap::BuildMap(), AlgAltDeMuxBase::DistanceToNearestInPlane(), ChopEvaluation::Evaluate(), NtpMaker::FillDataQualityInfo(), NtpSRModule::FillNtpDataQuality(), DmxUtilities::FillPlaneArray(), DmxDeMuxCosmicsModule::FindDigitsChiSq(), Blinder::GetInfo(), LILookup::GetPinDiodePlanes(), CalHelpers::GetPlane(), AlgAltDeMuxBase::IsXTalk(), KeyFrmDigitPlane(), KeyFromDigitPlane(), KeyFromPlane(), KeyFromPlane1(), AlgAltDeMuxBase::MakeAltListMap(), AlgAltDeMuxBase::MakePixelMap(), PEGainMuxBox::New(), is_in_plane_range_and_above_thr::operator()(), min_plane::operator()(), is_in_plane_and_above_thr::operator()(), LIPatternFinderSimple::PrintSnarl(), DemuxFast::Reco(), OltNewModule::Reco(), OltTimeScan::Reco(), OltTimePlot::Reco(), UberModule::Reco(), UberModuleLite::Reco(), LISummarySorter::ReconstructStripEnd(), AlgFarDetShieldPlank::RunAlg(), AlgFarDetShieldPlankList::RunAlg(), AlgShieldPlank::RunAlg(), AlgFilterDigitListAB::RunAlg(), AlgFilterDigitListSR::RunAlg(), AlgShieldPlankList::RunAlg(), AlgStripSRList::RunAlgMixed(), AlgStripSRList::RunAlgNear(), DmxMuonPlane::SetStrips(), AlgAltDeMuxBase::StripCrossTalkSingles(), AlgAltDeMuxBase::TagCrossTalk(), PlexValidate::TestAltL(), and Detector::Update().

00582 {
00583    // Return the plane # of the PlexStripEndId's in this list.
00584    // This is meaningful only in a correctly cabled detector
00585    // if there are mis-cablings then it could return nonsense.
00586 
00587    TestConsistency(reportError);
00588 
00589    if ( fError & kBadPlane || size() < 1 )
00590       return -1;  // bad plane
00591 
00592    PlexSEIdAltLConstIter cursor = this->begin();
00593    return (*cursor).GetSEId().GetPlane();
00594 
00595 }

PlaneView::PlaneView_t PlexSEIdAltL::GetPlaneView ( Bool_t  reportError = true  )  const

Definition at line 599 of file PlexSEIdAltL.cxx.

References fError, kBadPlaneView, PlaneView::kUnknown, size, and TestConsistency().

Referenced by CheezyDisplay::AddSEIdAltL(), PreFilter::Ana(), AltDeMuxDisplay::Ana(), GfxDigit::Configure(), AlgAltDeMuxBase::DeMuxHits(), AlgAltDeMuxBase::DeMuxSingleHitE(), AlgAltDeMuxBase::DeMuxSingleHitW(), DmxDeMuxCosmicsModule::FindDigitsChiSq(), AlgTrackSRList::FindTimingDirection(), AlgAltDeMuxBase::MakeAltListMap(), LISummarySorter::ReconstructStripEnd(), select_digit(), EVD::SetChargeRange(), HistPage::Update(), EVD::UpdateChargeHists(), and Mint::UpdateDigitRanges().

00600 {
00601    // Return the PlaneView of the PlexStripEndID's in this list.
00602    // This is meaningful only in a correctly cabled detector
00603    // if there are mis-cablings then it could return nonsense.
00604 
00605    TestConsistency(reportError);
00606 
00607    if ( fError & kBadPlaneView || size() < 1 )
00608       return PlaneView::kUnknown;  // bad view
00609 
00610    PlexSEIdAltLConstIter cursor = this->begin();
00611    return (*cursor).GetSEId().GetPlaneView();
00612 
00613 }

Int_t PlexSEIdAltL::GetSize (  )  const [inline]
Bool_t PlexSEIdAltL::IsValid (  )  const
Bool_t PlexSEIdAltL::IsVetoShield ( Bool_t  reportError = true  )  const

Definition at line 547 of file PlexSEIdAltL.cxx.

References fError, kBadIsVeto, size, and TestConsistency().

Referenced by FCPCFilterModule::Ana(), RunSummary::Ana(), NoiseFilterModule::Ana(), PreFilter::Ana(), RateSummary::Ana(), FarmListModule::Ana(), AltDeMuxDisplay::Ana(), GfxDigitList::Configure(), GfxDigit::Configure(), NtpMaker::FillDataQualityInfo(), NtpSRModule::FillNtpDataQuality(), NtpSRModule::FillNtpShieldStrip(), DmxUtilities::FillPlaneArray(), GfxDigit::GetRealCoords(), AlgFilterDigitListAB::IsVetoShield(), AlgAltDeMuxBase::MakeAltListMap(), AlgAltDeMuxBase::MakePixelMap(), GfxDigit::ModifyCoords(), DemuxFast::Reco(), RejectHelper::reject_veto(), AlgChop::RunAlg(), AlgFilterDigitListSR::RunAlg(), AlgShieldPlankList::RunAlg(), select_digit(), GfxDigit::SetColor(), and AlgAltDeMuxBase::StripCrossTalkSingles().

00548 {
00549    // Return the whether this alt-list reflect veto shield strips
00550    // This is meaningful only in a correctly filled PlexSEIdAltL
00551 
00552    TestConsistency(reportError);
00553    
00554    // if inconsistent ... don't take it as part of veto shield
00555    // "nothing" isn't part of a veto shield
00556    if ( fError & kBadIsVeto || size() < 1 ) return false;
00557 
00558    PlexSEIdAltLConstIter cursor = this->begin();
00559    return (*cursor).GetSEId().IsVetoShield();
00560 
00561 }

void PlexSEIdAltL::KeepTopWeights ( UInt_t  n = 2,
Bool_t  keeporder = kFALSE 
)

Definition at line 292 of file PlexSEIdAltL.cxx.

References clear(), fBest, kBestUnset, size, and TMath::Sort().

Referenced by AlgDeMuxDigitList::RunAlg(), and PlexValidate::TestAltL().

00293 {
00294    // Remove all but "n" pairs from the list (top "n" sorted by weight)
00295    // Final relative order of elements in the list is unchanged
00296    // if keeporder=kTRUE otherwise list ordered by decending weights.
00297    // If "n" would separate values of the same weight then
00298    // more than "n" are kept.
00299 
00300    unsigned int i, cnt = size();
00301 
00302    if (cnt <= 0) return;  // one cannot drop what one doesn't have
00303 
00304    fBest  = kBestUnset;  // invalidate "best" choice
00305 
00306    if (n >= cnt) {
00307       if (keeporder) return; // keep everything, no change in order
00308       else n = cnt;          // perform sort but don't go beyond end
00309    }
00310 
00311    PlexSEIdAltL& self = *this;
00312 
00313    if (n <= 0) { // special case for new size=0
00314       this->clear();
00315       return;
00316    }
00317 
00318    // make a copy of the weights
00319    // sort it
00320    // select the nth down the list for lowest weight value to keep
00321    Float_t *sortedwgt = new Float_t[cnt];
00322 #if ROOT_VERSION_CODE < ROOT_VERSION(5,21,5)
00323    Int_t   *sortedindx = new Int_t[cnt];
00324 #else
00325    UInt_t  *sortedindx = new UInt_t[cnt];
00326 #endif
00327    for (i=0; i<cnt; i++) sortedwgt[i] = self[i].GetWeight();
00328    Bool_t down=kTRUE;
00329    TMath::Sort(cnt,sortedwgt,sortedindx,down);
00330    // n-1 because C arrays start with 0
00331    Int_t   icut = sortedindx[n-1];
00332    Float_t  cut = sortedwgt[icut]; 
00333 
00334    // count final size
00335    // may not be ==n because of two entries with same weight
00336    vector<PlexSEIdAltLItem> tempVector;
00337    for (i=0; i<cnt; i++) {
00338       unsigned int indxold = i;
00339       if (!keeporder) indxold = sortedindx[i];
00340       if (self[indxold].GetWeight() >= cut) {
00341          tempVector.push_back(self[indxold]);
00342       }
00343    }
00344 
00345    // replace current vector with newly created temporary
00346    this->swap(tempVector);
00347 
00348    delete [] sortedwgt;
00349    delete [] sortedindx;
00350 
00351 }

void PlexSEIdAltL::Next (  )  const [inline]
void PlexSEIdAltL::NormalizeWeights ( Float_t  wgtsum = 1.0  ) 

Definition at line 733 of file PlexSEIdAltL.cxx.

References n, and size.

Referenced by AlgDeMuxDigitList::RunAlg(), and PlexValidate::TestAltL().

00734 {
00735    // normalize the weights so sum adds up to "wgtsum"
00736    // if all values are exactly zero, then this sets them
00737    // to wgtsum/fSize
00738 
00739    unsigned int n=size();
00740 
00741    if (n < 1) return;
00742 
00743    Float_t sum = 0.0;
00744 
00745    PlexSEIdAltLIter iter, the_end=this->end();
00746 
00747    iter = this->begin();
00748    while (iter != the_end) { sum += (*iter).GetWeight(); iter++; }
00749 
00750    iter = this->begin();
00751    if ( sum != 0.0 ) {
00752       Float_t scale = wgtsum/sum;
00753       while (iter != the_end) {
00754          Float_t wgt = (*iter).GetWeight() * scale;
00755          (*iter).SetWeight(wgt);
00756          iter++;
00757       }
00758    } else {
00759       // all weight values were zero
00760       Float_t equalwgt = wgtsum/(float)n;
00761       while (iter != the_end) { (*iter).SetWeight(equalwgt); iter++; }
00762    }
00763 
00764 }

void PlexSEIdAltL::Previous (  )  const [inline]

Definition at line 79 of file PlexSEIdAltL.h.

References fCurrent.

Referenced by PlexValidate::TestAltL().

00079 { fCurrent--; }

void PlexSEIdAltL::Print ( Option_t *  option = ""  )  const

Definition at line 653 of file PlexSEIdAltL.cxx.

References StripEnd::AsString(), PlaneCoverage::AsString(), bfld::AsString(), Detector::AsString(), fCurrent, GetBestItem(), GetCurrentSEId(), PlexPlaneId::GetDetector(), PlexStripEndId::GetEnd(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), PlexSEIdAltLItem::GetSEId(), PlexStripEndId::GetStrip(), PlexStripEndId::GetSubPart(), PlexSEIdAltLItem::GetWeight(), n, and size.

Referenced by CheezyDisplay::AddSEIdAltL(), PlexValidate::TestAltL(), TestConsistency(), and Plexus::ValidateConsistency().

00654 {
00655    // Print out the list
00656 
00657    unsigned int n = size();
00658 
00659    if (n <= 0) {
00660       printf("Empty PlexSEIdAltL\n");
00661       return;
00662    }
00663 
00664    const PlexSEIdAltLItem& best = GetBestItem();
00665 
00666    const PlexSEIdAltL& self = *this;
00667    unsigned int i;
00668    char cursormarker, bestmarker;
00669    PlexStripEndId seid;
00670 //   Float_t        weight;
00671 
00672    switch (option[0]) {
00673    case 'c':
00674    case 'C':
00675       // compact notation assumes that there isn't a mixup
00676       // and all items share a common detector/plane/subpart/end
00677       seid = GetCurrentSEId(); // any will do
00678       printf("[%1.1s|%4d %1.1s%1.1s|%1.1s%1.1s]",
00679              Detector::AsString(seid.GetDetector()),
00680              seid.GetPlane(),
00681              PlaneView::AsString(seid.GetPlaneView()),
00682              PlaneCoverage::AsString(seid.GetPlaneCoverage()),
00683              StripEnd::AsString(seid.GetSubPart()),
00684              StripEnd::AsString(seid.GetEnd()));
00685       for (i=0; i<n; i++) {
00686          const PlexSEIdAltLItem& item = self[i];
00687          bestmarker   = (item == best)     ? '!' : ' ';
00688          cursormarker = (i    == fCurrent) ? '@' : ' ';
00689          seid   = item.GetSEId();
00690          printf(" %c%c%3d",bestmarker,cursormarker,seid.GetStrip());
00691 
00692       }
00693       if (option[0] == 'C') {
00694          printf("\n          wgt ");
00695          for (i=0; i<n; i++) {
00696             const PlexSEIdAltLItem& item = self[i];
00697             printf(" %5.3f",item.GetWeight());
00698          }
00699       }
00700       printf("\n");
00701 
00702       break;
00703    default:
00704 
00705      cout << *this;
00706 
00707    }
00708 }

void PlexSEIdAltL::Push_Back ( const PlexSEIdAltLItem item  )  [inline]

Definition at line 92 of file PlexSEIdAltL.h.

00092 { this->push_back(item); }

void PlexSEIdAltL::SetCurrentWeight ( Float_t  weight  ) 

Definition at line 711 of file PlexSEIdAltL.cxx.

References fBest, fCurrent, IsValid(), and kBestUnset.

Referenced by AlgAltDeMuxBase::DeMuxBigGroup(), DemuxFast::DemuxHitE(), AlgAltDeMuxBase::DeMuxHitE(), DemuxFast::DemuxHitW(), AlgAltDeMuxBase::DeMuxHitW(), DmxMuonPlane::DmxMuonPlane(), AlgDeMuxBeam::ReconcileShowerAndMuonRegions(), DmxMuonPlane::SetStrips(), and DmxHypothesis::SetStrips().

00712 {
00713    // set the weight attached to the current PlexStripEndId
00714 
00715    if (!IsValid()) return; // no list or out of range
00716    PlexSEIdAltLIter cursor = this->begin() + fCurrent;
00717    (*cursor).SetWeight(weight);
00718    fBest = kBestUnset;  // invalidate "best" choice
00719 }

void PlexSEIdAltL::SetDemuxVetoFlag ( UShort_t  flag  )  [inline]
void PlexSEIdAltL::SetFirst (  )  const [inline]
static void PlexSEIdAltL::SetFmtFlag ( const UInt_t  fmtflg  )  [inline, static]

Definition at line 121 of file PlexSEIdAltL.h.

References fgFmtFlag.

Referenced by TestConsistency().

00121 { fgFmtFlag = fmtflg; }

void PlexSEIdAltL::SetLast (  )  const [inline]

Definition at line 81 of file PlexSEIdAltL.h.

References fCurrent, and GetSize().

Referenced by PlexValidate::TestAltL().

00081 { fCurrent = GetSize()-1; }

Bool_t PlexSEIdAltL::SetToOppositeEnds ( PlexSEIdAltL that  ) 

Definition at line 616 of file PlexSEIdAltL.cxx.

References fCurrent, GetCurrentSEId(), PlexStripEndId::IsOppositeStripEnd(), IsValid(), Next(), and SetFirst().

00617 {
00618    // Given two PlexSEIdAltL's set both "current" iterators
00619    // to entries that are at opposite ends of the same strip
00620    // and return true.  If no legal combination exists then
00621    // return false leaving current positions unchanged.
00622 
00623    UInt_t where_this =      fCurrent;
00624    UInt_t where_that = that.fCurrent;
00625 
00626    this->SetFirst();
00627    while (this->IsValid()) {
00628       PlexStripEndId seid_this = this->GetCurrentSEId();
00629       that.SetFirst();
00630       while (that.IsValid()) {
00631          PlexStripEndId seid_that = that.GetCurrentSEId();
00632          if (seid_this.IsOppositeStripEnd(seid_that)) return true;
00633          that.Next();
00634       }
00635       this->Next();
00636    }
00637    // fell through means no legal match
00638    fCurrent      = where_this;
00639    that.fCurrent = where_that;
00640    return false;
00641 
00642 }

UInt_t PlexSEIdAltL::Size ( void   )  const [inline]

Definition at line 91 of file PlexSEIdAltL.h.

References size.

00091 { return this->size(); }

void PlexSEIdAltL::TestConsistency ( Bool_t  reportError = true  )  const [private]

Definition at line 768 of file PlexSEIdAltL.cxx.

References fError, fmt_Index, fmt_PixelSpot, fmt_StripEnd, PlexPlaneId::GetDetector(), PlexStripEndId::GetEnd(), GetFmtFlag(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneView(), PlexPlaneId::IsVetoShield(), kBadDetector, kBadEnd, kBadIsVeto, kBadPlane, kBadPlaneView, kOkay, kUnchecked, Msg::kWarning, MSG, n, Print(), SetFmtFlag(), and size.

Referenced by GetDetector(), GetEnd(), GetError(), GetPlane(), GetPlaneView(), and IsVetoShield().

00769 {
00770    // Set the fError flag if the list is inconsistent
00771    // in terms of GetDetector, GetEnd, GetPlane, GetPlaneView
00772 
00773    // skip if already checked (adding values clears this flag)
00774    if ( kUnchecked != fError ) return;
00775 
00776    // clear all errors
00777    fError = 0;
00778 
00779    unsigned int n = size();
00780 
00781    // a single entry is consistent with itself
00782    if ( 1 == n ) return;
00783 
00784    // an empty list is consistent with nothing
00785    // and asking for these value will be problematic
00786    if ( 0 == n ) {
00787       fError = kBadDetector | kBadEnd | kBadPlane | kBadPlaneView;
00788       return;
00789    }
00790 
00791    PlexSEIdAltLConstIter iter = this->begin();
00792    PlexSEIdAltLConstIter the_end = this->end();
00793 
00794    PlexStripEndId first_seid = (*iter).GetSEId();
00795    Detector::Detector_t     firstdet = first_seid.GetDetector();
00796    StripEnd::StripEnd_t     firstend = first_seid.GetEnd();
00797    Int_t                    firstpln = first_seid.GetPlane();
00798    PlaneView::PlaneView_t   firstpvw = first_seid.GetPlaneView();
00799    Bool_t                   firstisv = first_seid.IsVetoShield();
00800 
00801    iter++;  // no need to recheck the first against itself
00802    while (iter != the_end) {
00803       PlexStripEndId alt_seid = (*iter).GetSEId();
00804       Detector::Detector_t     altdet = alt_seid.GetDetector();
00805       StripEnd::StripEnd_t     altend = alt_seid.GetEnd();
00806       Int_t                    altpln = alt_seid.GetPlane();
00807       PlaneView::PlaneView_t   altpvw = alt_seid.GetPlaneView();
00808       Bool_t                   altisv = alt_seid.IsVetoShield();
00809       if ( altdet != firstdet ) fError |= kBadDetector;
00810       if ( altend != firstend ) fError |= kBadEnd;
00811       // veto shield connections span modules (and thus "planes"
00812       // and "planeviews")
00813       if ( ! altisv ) {
00814         if ( altpln != firstpln ) fError |= kBadPlane;
00815         if ( altpvw != firstpvw ) fError |= kBadPlaneView;
00816       }
00817       if ( altisv != firstisv ) fError |= kBadIsVeto;
00818       iter++;
00819    }
00820    
00821    if ( fError != kOkay && reportError ) {
00822       MSG("Plex",Msg::kWarning)
00823          << "PlexSEIdAltL::TestConsistency - list is inconsistent " 
00824          << "(0x" << hex << setfill('0') << setw(2) << fError
00825          << setfill(' ') << dec << ")" << endl;
00826 
00827       UInt_t old_fmt = GetFmtFlag();
00828       SetFmtFlag(fmt_Index|fmt_StripEnd|fmt_PixelSpot);
00829       this->Print();
00830       SetFmtFlag(old_fmt);
00831    }
00832 
00833 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const PlexSEIdAltL alt 
) [friend]

Member Data Documentation

Short_t PlexSEIdAltL::fBest [mutable, private]
UShort_t PlexSEIdAltL::fCurrent [mutable, private]
UShort_t PlexSEIdAltL::fDemuxVetoFlag [private]

Definition at line 132 of file PlexSEIdAltL.h.

Referenced by GetDemuxVetoFlag(), and SetDemuxVetoFlag().

UShort_t PlexSEIdAltL::fError [mutable, private]
UInt_t PlexSEIdAltL::fgFmtFlag = 0 [static, private]

Definition at line 136 of file PlexSEIdAltL.h.

Referenced by GetFmtFlag(), and SetFmtFlag().

const Short_t PlexSEIdAltL::kBestUnset = -1 [static]

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1