CMS 3D CMS Logo

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

#include <LaserAlignmentEventFilter.h>

Inheritance diagram for LaserAlignmentEventFilter:
edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 LaserAlignmentEventFilter (const edm::ParameterSet &)
 
 ~LaserAlignmentEventFilter ()
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::global::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 ()
 

Private Member Functions

virtual bool filter (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 

Private Attributes

const uint16_t channel_count_thresh
 
const edm::EDGetTokenT
< FEDRawDataCollection
FED_collection_token
 
const std::vector< uint16_t > las_fed_ids
 
const std::vector< uint32_t > las_signal_ids
 
const uint16_t single_channel_thresh
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 8 of file LaserAlignmentEventFilter.h.

Constructor & Destructor Documentation

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

constructors and destructor

Definition at line 29 of file LaserAlignmentEventFilter.cc.

29  :
30  FED_collection_token( consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("FedInputTag")) ),
31  las_fed_ids( copy_and_sort_vector<uint16_t>(iConfig.getParameter<std::vector<int>>("FED_IDs")) ),
32  las_signal_ids( copy_and_sort_vector<uint32_t>(iConfig.getParameter<std::vector<int>>("SIGNAL_IDs")) ),
33  single_channel_thresh(iConfig.getParameter<unsigned>("SINGLE_CHANNEL_THRESH") ),
34  channel_count_thresh( iConfig.getParameter<unsigned>("CHANNEL_COUNT_THRESH") )
35 {
36 }
T getParameter(std::string const &) const
const std::vector< uint16_t > las_fed_ids
const edm::EDGetTokenT< FEDRawDataCollection > FED_collection_token
const std::vector< uint32_t > las_signal_ids
LaserAlignmentEventFilter::~LaserAlignmentEventFilter ( )

Definition at line 41 of file LaserAlignmentEventFilter.cc.

41  {
42 }

Member Function Documentation

bool LaserAlignmentEventFilter::filter ( edm::StreamID  sid,
edm::Event iEvent,
edm::EventSetup const &  iSetup 
) const
overrideprivatevirtual

Checks for Laser Signals in specific modules For Accessing FED Data see also EventFilter/SiStripRawToDigi/src/SiStripRawToDigiUnpacker.cc and related files

Implements edm::global::EDFilterBase.

Definition at line 46 of file LaserAlignmentEventFilter.cc.

References channel_count_thresh, FEDRawData::data(), FED_collection_token, edm::EventSetup::get(), edm::Event::getByToken(), input, las_fed_ids, las_signal_ids, LogDebug, single_channel_thresh, and FEDRawData::size().

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().

47 {
48  //unsigned int det_ctr = 0; // count how many modules are tested for signal
49  unsigned int sig_ctr = 0; // count how many modules have signal
50  //unsigned long buffer_sum = 0; // sum of buffer sizes
51 
52  // retrieve FED raw data (by label, which is "source" by default)
54  iEvent.getByToken( FED_collection_token, buffers );
55 
56  // read the cabling map from the EventSetup
58  iSetup.get<SiStripFedCablingRcd>().get( cabling );
59 
60  std::vector<uint16_t>::const_iterator ifed = las_fed_ids.begin();
61  for ( ; ifed != las_fed_ids.end(); ifed++ ) {
62  // Retrieve FED raw data for given FED
63  const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
64  LogDebug("LaserAlignmentEventFilter") << "Examining FED " << *ifed;
65 
66  // check on FEDRawData pointer
67  if (not input.data())
68  continue;
69 
70  // check on FEDRawData size
71  if (not input.size())
72  continue;
73 
74  // construct FEDBuffer
75  sistrip::FEDBuffer buffer(input.data(), input.size());
76  if (not buffer.doChecks()) {
77  edm::LogWarning("LaserAlignmentEventFilter") << "FED Buffer check fails for FED ID " << *ifed << ".";
78  continue;
79  }
80 
81  // get the cabling connections for this FED
82  auto const & conns = cabling->fedConnections(*ifed);
83 
84  // Iterate through FED channels, extract payload and create Digis
85  std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
86  for ( ; iconn != conns.end(); iconn++ ) {
87  if (std::binary_search(las_signal_ids.begin(), las_signal_ids.end(), iconn->detId())) {
88  LogDebug("LaserAlignmentEventFilter")
89  << " Found LAS signal module in FED "
90  << *ifed
91  << " DetId: "
92  << iconn->detId() << "\n"
93  << "buffer.channel(iconn->fedCh()).size(): " << buffer.channel(iconn->fedCh()).length();
94  //++det_ctr;
95  if (buffer.channel(iconn->fedCh()).length() > single_channel_thresh)
96  ++sig_ctr;
97  //buffer_sum += buffer.channel(iconn->fedCh()).length();
98  if (sig_ctr > channel_count_thresh){
99  LogDebug("LaserAlignmentEventFilter") << "Event identified as LAS";
100  return true;
101  }
102  }
103  } // channel loop
104  } // FED loop
105 
106 // LogDebug("LaserAlignmentEventFilter") << det_ctr << " channels were tested for signal\n"
107 // <<sig_ctr << " channels have signal\n"
108 // << "Sum of buffer sizes: " << buffer_sum;
109 
110 
111  return false;
112 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const std::vector< uint16_t > las_fed_ids
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static std::string const input
Definition: EdmProvDump.cc:43
const edm::EDGetTokenT< FEDRawDataCollection > FED_collection_token
const std::vector< uint32_t > las_signal_ids
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28

Member Data Documentation

const uint16_t LaserAlignmentEventFilter::channel_count_thresh
private

Definition at line 25 of file LaserAlignmentEventFilter.h.

Referenced by filter().

const edm::EDGetTokenT<FEDRawDataCollection> LaserAlignmentEventFilter::FED_collection_token
private

Definition at line 18 of file LaserAlignmentEventFilter.h.

Referenced by filter().

const std::vector<uint16_t> LaserAlignmentEventFilter::las_fed_ids
private

Definition at line 21 of file LaserAlignmentEventFilter.h.

Referenced by filter().

const std::vector<uint32_t> LaserAlignmentEventFilter::las_signal_ids
private

Definition at line 22 of file LaserAlignmentEventFilter.h.

Referenced by filter().

const uint16_t LaserAlignmentEventFilter::single_channel_thresh
private

Definition at line 24 of file LaserAlignmentEventFilter.h.

Referenced by filter().