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) { subtract_(detId, firstStrip, digis, digis); }
15 void SiStripPedestalsSubtractor::subtract(const edm::DetSet<SiStripRawDigi>& input, std::vector<int16_t>& output) { subtract_(input.id, 0, input, output); }
16 
17 template <class input_t>
18 inline
20 subtract_(uint32_t id, uint16_t firstStrip, const input_t& input, std::vector<int16_t>& output) {
21  try {
22 
23  pedestals.resize(firstStrip + input.size());
24  SiStripPedestals::Range pedestalsRange = pedestalsHandle->getRange(id);
25  pedestalsHandle->allPeds(pedestals, pedestalsRange);
26 
27  typename input_t::const_iterator inDigi = input.begin();
28  std::vector<int>::const_iterator ped = pedestals.begin() + firstStrip;
29  std::vector<int16_t>::iterator outDigi = output.begin();
30 
31  while( inDigi != input.end() ) {
32 
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 
44  } catch(cms::Exception& e){
45  edm::LogError("SiStripPedestalsSubtractor")
46  << "[SiStripPedestalsSubtractor::subtract] DetId " << id << " propagating error from SiStripPedestal" << e.what();
47  output.clear();
48  }
49 
50 }
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:79
T get() const
Definition: EventSetup.h:71
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