CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
APVModeFilter Class Reference

#include <Alignment/CommonAlignment/plugins/APVModeFilter.cc>

Inheritance diagram for APVModeFilter:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 APVModeFilter (const edm::ParameterSet &)
 
 ~APVModeFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

using BitMask = std::bitset< 16 >
 

Private Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
BitMask convertMode (const std::string &mode) const
 APV mode is encoded in uin16_t. More...
 
BitMask convertMode (const uint16_t &mode) const
 converts latency record content into type used for APV mode filtering More...
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const BitMask mode_
 multi mode bit mask (1000) More...
 
BitMask modeCurrentRun_
 APV mode that is filtered. More...
 

Static Private Attributes

static std::array< size_t, 2 > bits_ = {{1, 3}}
 bits of interest for the APV mode More...
 
static BitMask deco_ = BitMask(0)
 
static BitMask multi_ = BitMask(8)
 peak mode bit mask (1010) More...
 
static BitMask peak_ = BitMask(10)
 deco mode bit mask (0000) More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Plugin to filter events based on the APV mode

Implementation: The filter checks the bit configuration used for a given run and selects only events according to the configured APV mode.

General reference: https://twiki.cern.ch/twiki/bin/view/CMS/SiStripConditionObjects#SiStripLatency

Document describing the bit configuration (section 5.5): https://cds.cern.ch/record/1069892/files/cer-002725643.pdf

Summary given here: https://hypernews.cern.ch/HyperNews/CMS/get/recoTracking/1590/1/1/1.html

bit 1: 0 = 3-sample, 1 = 1-sample bit 3: 0 = deconvolution, 1 = peak

if both bits are zero: deco if both bits are one: peak if 1 is zero and bit 3 is one: multi (not used in actual data taking)

Definition at line 56 of file APVModeFilter.cc.

Member Typedef Documentation

using APVModeFilter::BitMask = std::bitset<16>
private

Definition at line 67 of file APVModeFilter.cc.

Constructor & Destructor Documentation

APVModeFilter::APVModeFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 101 of file APVModeFilter.cc.

101  :
102  mode_(convertMode(iConfig.getUntrackedParameter<std::string>("apvMode"))) {
103 }
T getUntrackedParameter(std::string const &, T const &) const
const BitMask mode_
multi mode bit mask (1000)
BitMask convertMode(const std::string &mode) const
APV mode is encoded in uin16_t.
APVModeFilter::~APVModeFilter ( )
default

Member Function Documentation

void APVModeFilter::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 118 of file APVModeFilter.cc.

References convertMode(), edm::EventSetup::get(), modeCurrentRun_, and edm::ESHandle< class >::product().

118  {
119  edm::ESHandle<SiStripLatency> siStripLatency;
120  iSetup.get<SiStripLatencyRcd>().get(siStripLatency);
121  auto product = siStripLatency.product();
122  modeCurrentRun_ = convertMode(product->singleMode());
123 }
BitMask convertMode(const std::string &mode) const
APV mode is encoded in uin16_t.
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
BitMask modeCurrentRun_
APV mode that is filtered.
APVModeFilter::BitMask APVModeFilter::convertMode ( const std::string &  mode) const
private

APV mode is encoded in uin16_t.

converts configuration parameter into type used for APV mode filtering

Definition at line 126 of file APVModeFilter.cc.

References deco_, Exception, multi_, and peak_.

Referenced by beginRun().

126  {
127  if (mode == "deco") {
128  return deco_;
129  } else if (mode == "peak") {
130  return peak_;
131  } else if (mode == "multi") {
132  return multi_;
133  } else {
134  throw cms::Exception("BadConfig")
135  << "Your choice for the APV mode ('" << mode
136  << "') is invalid.\nValid APV modes: deco, peak, multi" << std::endl;
137  }
138 }
static BitMask multi_
peak mode bit mask (1010)
static BitMask deco_
static BitMask peak_
deco mode bit mask (0000)
APVModeFilter::BitMask APVModeFilter::convertMode ( const uint16_t &  mode) const
private

converts latency record content into type used for APV mode filtering

Definition at line 141 of file APVModeFilter.cc.

References bits_, input, and query::result.

141  {
142  BitMask input(mode);
143  BitMask result;
144  for (const auto& bit: bits_) result.set(bit, input[bit]);
145  return result;
146 }
static std::array< size_t, 2 > bits_
bits of interest for the APV mode
static std::string const input
Definition: EdmProvDump.cc:43
tuple result
Definition: query.py:137
std::bitset< 16 > BitMask
void APVModeFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 150 of file APVModeFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

150  {
152  desc.setComment("Filters events with the APV mode 'apvMode' (deco/peak/multi).");
153  desc.addUntracked<std::string>("apvMode", "deco");
154  descriptions.add("apvModeFilter", desc);
155 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool APVModeFilter::filter ( edm::Event ,
const edm::EventSetup  
)
overrideprivatevirtual

Member Data Documentation

std::array< size_t, 2 > APVModeFilter::bits_ = {{1, 3}}
staticprivate

bits of interest for the APV mode

Definition at line 79 of file APVModeFilter.cc.

Referenced by convertMode().

APVModeFilter::BitMask APVModeFilter::deco_ = BitMask(0)
staticprivate

Definition at line 80 of file APVModeFilter.cc.

Referenced by convertMode().

const BitMask APVModeFilter::mode_
private

multi mode bit mask (1000)

Definition at line 84 of file APVModeFilter.cc.

Referenced by filter().

BitMask APVModeFilter::modeCurrentRun_
private

APV mode that is filtered.

Definition at line 85 of file APVModeFilter.cc.

Referenced by beginRun(), and filter().

APVModeFilter::BitMask APVModeFilter::multi_ = BitMask(8)
staticprivate

peak mode bit mask (1010)

Definition at line 82 of file APVModeFilter.cc.

Referenced by convertMode().

APVModeFilter::BitMask APVModeFilter::peak_ = BitMask(10)
staticprivate

deco mode bit mask (0000)

Definition at line 81 of file APVModeFilter.cc.

Referenced by convertMode().