CMS 3D CMS Logo

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

#include <filter/HcalCalibTypeFilter/src/HcalCalibTypeFilter.cc>

Inheritance diagram for HcalCalibTypeFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalCalibTypeFilter (const edm::ParameterSet &)
 
 ~HcalCalibTypeFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< int > CalibTypes_
 
std::vector< int > eventsByType
 
bool Summary_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_data_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 45 of file HcalCalibTypeFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file HcalCalibTypeFilter.cc.

References CalibTypes_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, Summary_, and tok_data_.

69 {
70  //now do what ever initialization is needed
71 
72  tok_data_ = consumes<FEDRawDataCollection>(edm::InputTag(iConfig.getParameter<std::string>("InputLabel") ));
73  Summary_ = iConfig.getUntrackedParameter<bool>("FilterSummary",false) ;
74  CalibTypes_ = iConfig.getParameter< std::vector<int> >("CalibTypes") ;
75 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > CalibTypes_
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
HcalCalibTypeFilter::~HcalCalibTypeFilter ( )
override

Definition at line 78 of file HcalCalibTypeFilter.cc.

79 {
80 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 
84 }

Member Function Documentation

void HcalCalibTypeFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 135 of file HcalCalibTypeFilter.cc.

References eventsByType.

136 {
137  eventsByType.clear() ;
138  eventsByType.resize(8,0) ;
139 }
std::vector< int > eventsByType
void HcalCalibTypeFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 143 of file HcalCalibTypeFilter.cc.

References DEFINE_FWK_MODULE, eventsByType, hc_HBHEHPD, hc_HFPMT, hc_HOHPD, hc_Null, hc_Pedestal, hc_RADDAM, and Summary_.

143  {
144  if ( Summary_ )
145  edm::LogWarning("HcalCalibTypeFilter") << "Summary of filter decisions: "
146  << eventsByType.at(hc_Null) << "(No Calib), "
147  << eventsByType.at(hc_Pedestal) << "(Pedestal), "
148  << eventsByType.at(hc_RADDAM) << "(RADDAM), "
149  << eventsByType.at(hc_HBHEHPD) << "(HBHE/HPD), "
150  << eventsByType.at(hc_HOHPD) << "(HO/HPD), "
151  << eventsByType.at(hc_HFPMT) << "(HF/PMT)" ;
152 }
std::vector< int > eventsByType
bool HcalCalibTypeFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 93 of file HcalCalibTypeFilter.cc.

References CalibTypes_, FEDRawData::data(), eventsByType, funct::false, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), LogDebug, edmScanValgrind::maxCount, FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, matplotRender::rawdata, FEDRawData::size(), and tok_data_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

94 {
95  using namespace edm;
96 
98  iEvent.getByToken(tok_data_,rawdata);
99 
100  if(!rawdata.isValid()){
101  return false;
102  }
103 
104 
105  // checking FEDs for calibration information
106  int calibType = -1 ; int numEmptyFEDs = 0 ;
107  std::vector<int> calibTypeCounter(8,0) ;
108  for (int i=FEDNumbering::MINHCALFEDID;
110  const FEDRawData& fedData = rawdata->FEDData(i) ;
111  if ( fedData.size() < 24 ) numEmptyFEDs++ ;
112  if ( fedData.size() < 24 ) continue ;
113  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ;
114  calibTypeCounter.at(value)++ ; // increment the counter for this calib type
115  }
116 
117  int maxCount = 0 ;
118  int numberOfFEDIds = FEDNumbering::MAXHCALFEDID - FEDNumbering::MINHCALFEDID + 1 ;
119  for (unsigned int i=0; i<calibTypeCounter.size(); i++) {
120  if ( calibTypeCounter.at(i) > maxCount ) { calibType = i ; maxCount = calibTypeCounter.at(i) ; }
121  if ( maxCount == numberOfFEDIds ) break ;
122  }
123  if ( maxCount != (numberOfFEDIds-numEmptyFEDs) )
124  edm::LogWarning("HcalCalibTypeFilter") << "Conflicting calibration types found. Assigning type "
125  << calibType ;
126  LogDebug("HcalCalibTypeFilter") << "Calibration type is: " << calibType ;
127  eventsByType.at(calibType)++ ;
128  for (unsigned int i=0; i<CalibTypes_.size(); i++)
129  if ( calibType == CalibTypes_.at(i) ) return true ;
130  return false ;
131 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< int > CalibTypes_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: value.py:1
bool isValid() const
Definition: HandleBase.h:74
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
std::vector< int > eventsByType

Member Data Documentation

std::vector<int> HcalCalibTypeFilter::CalibTypes_
private

Definition at line 59 of file HcalCalibTypeFilter.cc.

Referenced by filter(), and HcalCalibTypeFilter().

std::vector<int> HcalCalibTypeFilter::eventsByType
private

Definition at line 60 of file HcalCalibTypeFilter.cc.

Referenced by beginJob(), endJob(), and filter().

bool HcalCalibTypeFilter::Summary_
private

Definition at line 58 of file HcalCalibTypeFilter.cc.

Referenced by endJob(), and HcalCalibTypeFilter().

edm::EDGetTokenT<FEDRawDataCollection> HcalCalibTypeFilter::tok_data_
private

Definition at line 57 of file HcalCalibTypeFilter.cc.

Referenced by filter(), and HcalCalibTypeFilter().