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 
37  {
38  }
39 
41  {
42  uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
43 
44  if ( cacheId_ != cacheId ) {
45 
47  es.get<SiStripFedCablingRcd>().get( c );
48  cabling_ = c.product();
49  }
50  }
51 
53  {
54  }
55 
57  {
58  if( runNumber_ != event.run() ) {
59 
60  runNumber_ = event.run();
61 
62  DetIdCollection emptyDetIdCollection;
63  detids_.swap(emptyDetIdCollection);
64  // Reserve space in bad module list
65  detids_.reserve(100);
66 
68  event.getByLabel( productLabel_, buffers );
69 
70  // Retrieve FED ids from cabling map and iterate through
71  std::vector<uint16_t>::const_iterator ifed = cabling_->feds().begin();
72  for ( ; ifed != cabling_->feds().end(); ifed++ ) {
73 
74  // ignore trigger FED
75  // if ( *ifed == triggerFedId_ ) { continue; }
76 
77  // Retrieve FED raw data for given FED
78  const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
79  // The FEDData contains a vector<unsigned char>. Check the size of this vector:
80 
81  if( input.size() == 0 ) {
82  // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
83  // get the cabling connections for this FED
84  const std::vector<FedChannelConnection>& conns = cabling_->connections(*ifed);
85  // Mark FED modules as bad
86  detids_.reserve(detids_.size()+conns.size());
87  std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
88  for ( ; iconn != conns.end(); ++iconn ) {
89  if ( !iconn->detId() || iconn->detId() == sistrip::invalid32_ ) continue;
90  detids_.push_back(iconn->detId()); //@@ Possible multiple entries
91  }
92  }
93  }
94  }
95 
96  std::auto_ptr< DetIdCollection > detids( new DetIdCollection(detids_) );
97 
98  // for( unsigned int it = 0; it < detids->size(); ++it ) {
99  // std::cout << "detId = " << (*detids)[it]() << std::endl;
100  // }
101 
102  event.put(detids);
103  }
104 }
void beginRun(edm::Run &run, const edm::EventSetup &es)
static const char runNumber_[]
size_type size() const
Definition: EDCollection.h:98
const std::vector< uint16_t > & feds() const
static const uint32_t invalid32_
Definition: Constants.h:16
~ExcludedFEDListProducer()
default constructor
void push_back(T const &t)
Definition: EDCollection.h:68
void produce(edm::Event &event, const edm::EventSetup &es)
virtual void beginJob()
Definition: EDProducer.h:65
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:67
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
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:33