CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ExcludedFEDListProducer.cc
Go to the documentation of this file.
15 #include <iostream>
16 #include <sstream>
17 #include <iomanip>
18 #include <ext/algorithm>
19 
20 namespace sistrip {
21 
23  runNumber_(0),
24  cabling_(0),
25  cacheId_(0)
26  {
27  token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
28  produces<DetIdCollection>();
29  }
30 
32  {
33  }
34 
35 
37  {
38  uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
39 
40  if ( cacheId_ != cacheId ) {
41 
43  es.get<SiStripFedCablingRcd>().get( c );
44  cabling_ = c.product();
45  }
46  }
47 
49  {
50  if( runNumber_ != event.run() ) {
51 
52  runNumber_ = event.run();
53 
54  DetIdCollection emptyDetIdCollection;
55  detids_.swap(emptyDetIdCollection);
56  // Reserve space in bad module list
57  detids_.reserve(100);
58 
60  event.getByToken( token_, buffers );
61 
62  // Retrieve FED ids from cabling map and iterate through
63  for (auto ifed = cabling_->fedIds().begin() ; ifed != cabling_->fedIds().end(); ifed++ ) {
64 
65  // ignore trigger FED
66  // if ( *ifed == triggerFedId_ ) { continue; }
67 
68  // Retrieve FED raw data for given FED
69  const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
70  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
71 
72  if( input.size() == 0 ) {
73  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
74  // get the cabling connections for this FED
75  auto conns = cabling_->fedConnections(*ifed);
76  // Mark FED modules as bad
77  detids_.reserve(detids_.size()+conns.size());
78  for (auto iconn = conns.begin() ; iconn != conns.end(); ++iconn ) {
79  if ( !iconn->detId() || iconn->detId() == sistrip::invalid32_ ) continue;
80  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
81  }
82  }
83  }
84  }
85 
86  std::auto_ptr< DetIdCollection > detids( new DetIdCollection(detids_) );
87 
88  // for( unsigned int it = 0; it < detids->size(); ++it ) {
89  // std::cout << "detId = " << (*detids)[it]() << std::endl;
90  // }
91 
92  event.put(detids);
93  }
94 }
static const char runNumber_[]
size_type size() const
Definition: EDCollection.h:97
T getParameter(std::string const &) const
void produce(edm::Event &event, const edm::EventSetup &es) override
static const uint32_t invalid32_
Definition: Constants.h:15
edm::EDGetTokenT< FEDRawDataCollection > token_
~ExcludedFEDListProducer()
default constructor
void push_back(T const &t)
Definition: EDCollection.h:67
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static std::string const input
Definition: EdmProvDump.cc:44
ExcludedFEDListProducer(const edm::ParameterSet &pset)
constructor
FedsConstIterRange fedIds() const
RunNumber_t run() const
Definition: Event.h:88
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void reserve(size_type n)
Definition: EDCollection.h:111
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
ConnsConstIterRange fedConnections(uint16_t fed_id) const
edm::EDCollection< DetId > DetIdCollection
void swap(EDCollection< T > &other)
Definition: EDCollection.h:74
Definition: Run.h:41