CMS 3D CMS Logo

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