CMS 3D CMS Logo

SiStripPedestalsSubtractor.cc
Go to the documentation of this file.
4 
6  if (pedestalsWatcher_.check(es)) {
8  }
9 }
10 
11 void SiStripPedestalsSubtractor::subtract(uint32_t detId, uint16_t firstStrip, std::vector<int16_t>& digis) {
12  subtract_(detId, firstStrip, digis, digis);
13 }
15  subtract_(input.id, 0, input, output);
16 }
17 
18 template <class input_t>
19 inline void SiStripPedestalsSubtractor::subtract_(uint32_t id,
20  uint16_t firstStrip,
21  const input_t& input,
22  std::vector<int16_t>& output) {
23  try {
24  pedestals.resize(firstStrip + input.size());
25  SiStripPedestals::Range pedestalsRange = pedestalsHandle->getRange(id);
26  pedestalsHandle->allPeds(pedestals, pedestalsRange);
27 
28  typename input_t::const_iterator inDigi = input.begin();
29  std::vector<int>::const_iterator ped = pedestals.begin() + firstStrip;
30  std::vector<int16_t>::iterator outDigi = output.begin();
31 
32  while (inDigi != input.end()) {
33  *outDigi = eval(*inDigi) - *ped + ((*ped > 895) ? 1024 : 0);
34 
35  if (fedmode_ && *outDigi < 0) //FED bottoms out at 0
36  *outDigi = 0;
37 
38  ++inDigi;
39  ++ped;
40  ++outDigi;
41  }
42 
43  } catch (cms::Exception& e) {
44  edm::LogError("SiStripPedestalsSubtractor") << "[SiStripPedestalsSubtractor::subtract] DetId " << id
45  << " propagating error from SiStripPedestal" << e.what();
46  output.clear();
47  }
48 }
const Range getRange(const uint32_t &detID) const
void subtract(const edm::DetSet< SiStripRawDigi > &input, std::vector< int16_t > &output)
void allPeds(std::vector< int > &pefs, const Range &range) const
std::pair< ContainerIterator, ContainerIterator > Range
Log< level::Error, false > LogError
const SiStripPedestals * pedestalsHandle
static std::string const input
Definition: EdmProvDump.cc:50
ap_fixed< 16, 8 > input_t
edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalsToken_
void init(const edm::EventSetup &)
edm::ESWatcher< SiStripPedestalsRcd > pedestalsWatcher_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void subtract_(uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)