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.
16 #include <iostream>
17 #include <sstream>
18 #include <iomanip>
19 #include <ext/algorithm>
20 
21 namespace sistrip {
22 
24  runNumber_(0),
25  productLabel_(pset.getParameter<edm::InputTag>("ProductLabel")),
26  cabling_(0),
27  cacheId_(0)
28  {
29  produces<DetIdCollection>();
30  }
31 
33  {
34  }
35 
36 
38  {
39  uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
40 
41  if ( cacheId_ != cacheId ) {
42 
44  es.get<SiStripFedCablingRcd>().get( c );
45  cabling_ = c.product();
46  }
47  }
48 
50  {
51  if( runNumber_ != event.run() ) {
52 
53  runNumber_ = event.run();
54 
55  DetIdCollection emptyDetIdCollection;
56  detids_.swap(emptyDetIdCollection);
57  // Reserve space in bad module list
58  detids_.reserve(100);
59 
61  event.getByLabel( productLabel_, buffers );
62 
63  // Retrieve FED ids from cabling map and iterate through
64  std::vector<uint16_t>::const_iterator ifed = cabling_->feds().begin();
65  for ( ; ifed != cabling_->feds().end(); ifed++ ) {
66 
67  // ignore trigger FED
68  // if ( *ifed == triggerFedId_ ) { continue; }
69 
70  // Retrieve FED raw data for given FED
71  const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
72  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
73 
74  if( input.size() == 0 ) {
75  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
76  // get the cabling connections for this FED
77  const std::vector<FedChannelConnection>& conns = cabling_->connections(*ifed);
78  // Mark FED modules as bad
79  detids_.reserve(detids_.size()+conns.size());
80  std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
81  for ( ; iconn != conns.end(); ++iconn ) {
82  if ( !iconn->detId() || iconn->detId() == sistrip::invalid32_ ) continue;
83  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
84  }
85  }
86  }
87  }
88 
89  std::auto_ptr< DetIdCollection > detids( new DetIdCollection(detids_) );
90 
91  // for( unsigned int it = 0; it < detids->size(); ++it ) {
92  // std::cout << "detId = " << (*detids)[it]() << std::endl;
93  // }
94 
95  event.put(detids);
96  }
97 }
static const char runNumber_[]
size_type size() const
Definition: EDCollection.h:98
const std::vector< uint16_t > & feds() const
void produce(edm::Event &event, const edm::EventSetup &es) override
static const uint32_t invalid32_
Definition: Constants.h:16
~ExcludedFEDListProducer()
default constructor
void push_back(T const &t)
Definition: EDCollection.h:68
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
ExcludedFEDListProducer(const edm::ParameterSet &pset)
constructor
RunNumber_t run() const
Definition: Event.h:76
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:112
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
edm::EDCollection< DetId > DetIdCollection
void swap(EDCollection< T > &other)
Definition: EDCollection.h:75
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const
Definition: Run.h:36