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 }
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
SiStripPedestals::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripPedestals.h:51
edm::DetSet
Definition: DetSet.h:23
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
SiStripPedestalsSubtractor::pedestals
std::vector< int > pedestals
Definition: SiStripPedestalsSubtractor.h:28
SiStripPedestalsSubtractor::fedmode_
bool fedmode_
Definition: SiStripPedestalsSubtractor.h:29
SiStripPedestalsSubtractor::pedestalsToken_
edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalsToken_
Definition: SiStripPedestalsSubtractor.h:25
SiStripPedestalsSubtractor::pedestalsHandle
const SiStripPedestals * pedestalsHandle
Definition: SiStripPedestalsSubtractor.h:27
SiStripPedestalsSubtractor::pedestalsWatcher_
edm::ESWatcher< SiStripPedestalsRcd > pedestalsWatcher_
Definition: SiStripPedestalsSubtractor.h:26
SiStripPedestalsSubtractor::subtract_
void subtract_(uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)
Definition: SiStripPedestalsSubtractor.cc:19
SiStripPedestals::allPeds
void allPeds(std::vector< int > &pefs, const Range &range) const
Definition: SiStripPedestals.cc:143
SiStripPedestals::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiStripPedestals.cc:28
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripPedestalsSubtractor::subtract
void subtract(const edm::DetSet< SiStripRawDigi > &input, std::vector< int16_t > &output)
Definition: SiStripPedestalsSubtractor.cc:14
SiStripPedestalsSubtractor::eval
int16_t eval(int16_t in)
Definition: SiStripPedestalsSubtractor.h:33
Exception.h
cms::Exception
Definition: Exception.h:70
SiStripPedestalsSubtractor.h
SiStripPedestalsSubtractor::init
void init(const edm::EventSetup &)
Definition: SiStripPedestalsSubtractor.cc:5
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37