CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SlidingPeakFinder Class Reference

#include <SlidingPeakFinder.h>

Public Member Functions

template<typename Test >
bool apply (const uint8_t *x, const uint8_t *begin, const uint8_t *end, const Test &test, bool verbose=false, int firststrip=0)
 
template<typename V , typename Test >
bool apply (const V &ampls, const Test &test, bool verbose=false, int firststrip=0)
 
 SlidingPeakFinder (unsigned int size)
 

Private Attributes

unsigned int half_
 
unsigned int size_
 

Detailed Description

Definition at line 11 of file SlidingPeakFinder.h.

Constructor & Destructor Documentation

◆ SlidingPeakFinder()

SlidingPeakFinder::SlidingPeakFinder ( unsigned int  size)
inline

Definition at line 13 of file SlidingPeakFinder.h.

13 : size_(size), half_((size + 1) / 2) {}
size
Write out results.

Member Function Documentation

◆ apply() [1/2]

template<typename Test >
bool SlidingPeakFinder::apply ( const uint8_t *  x,
const uint8_t *  begin,
const uint8_t *  end,
const Test &  test,
bool  verbose = false,
int  firststrip = 0 
)
inline

Definition at line 16 of file SlidingPeakFinder.h.

References SplitLinear::begin, mps_fire::end, half_, WZElectronSkims53X_cff::max, SiStripPI::min, runTheMatrix::ret, size_, builder_last_value_cfg::test, and x.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and apply().

21  {
22  const uint8_t *ileft = (x != begin) ? std::min_element(x - 1, x + half_) : begin - 1;
23  const uint8_t *iright = ((x + size_) < end) ? std::min_element(x + half_, std::min(x + size_ + 1, end)) : end;
24  uint8_t left = (ileft < begin ? 0 : *ileft);
25  uint8_t right = (iright >= end ? 0 : *iright);
26  uint8_t center = *std::max_element(x, std::min(x + size_, end));
27  uint8_t maxmin = std::max(left, right);
28  if (maxmin < center) {
29  bool ret = test(center, maxmin);
30  if (ret) {
31  ret = test(ileft, iright, begin, end);
32  }
33  return ret;
34  } else {
35  return false;
36  }
37  }
ret
prodAgent to be discontinued

◆ apply() [2/2]

template<typename V , typename Test >
bool SlidingPeakFinder::apply ( const V &  ampls,
const Test &  test,
bool  verbose = false,
int  firststrip = 0 
)
inline

Definition at line 40 of file SlidingPeakFinder.h.

References apply(), SplitLinear::begin, mps_fire::end, half_, verbose, and x.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

40  {
41  const uint8_t *begin = &*ampls.begin();
42  const uint8_t *end = &*ampls.end();
43  for (const uint8_t *x = begin; x < end - (half_ - 1); ++x) {
44  if (apply(x, begin, end, test, verbose, firststrip)) {
45  return true;
46  }
47  }
48  return false;
49  }
bool verbose
bool apply(const uint8_t *x, const uint8_t *begin, const uint8_t *end, const Test &test, bool verbose=false, int firststrip=0)

Member Data Documentation

◆ half_

unsigned int SlidingPeakFinder::half_
private

Definition at line 52 of file SlidingPeakFinder.h.

Referenced by apply().

◆ size_

unsigned int SlidingPeakFinder::size_
private

Definition at line 52 of file SlidingPeakFinder.h.

Referenced by apply().