test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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(const uint32_t& id, const uint16_t& firstStrip, std::vector<int16_t>& digis) {subtract_(id, 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_(const uint32_t& id, const 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 = ( *ped > 895 )
34  ? eval(*inDigi) - *ped + 1024
35  : eval(*inDigi) - *ped;
36 
37  if(fedmode_ && *outDigi < 0) //FED bottoms out at 0
38  *outDigi=0;
39 
40  ++inDigi;
41  ++ped;
42  ++outDigi;
43  }
44 
45 
46  } catch(cms::Exception& e){
47  edm::LogError("SiStripPedestalsSubtractor")
48  << "[SiStripPedestalsSubtractor::subtract] DetId " << id << " propagating error from SiStripPedestal" << e.what();
49  output.clear();
50  }
51 
52 }
virtual char const * what() const
Definition: Exception.cc:141
void subtract(const edm::DetSet< SiStripRawDigi > &, std::vector< int16_t > &)
edm::ESHandle< SiStripPedestals > pedestalsHandle
std::pair< ContainerIterator, ContainerIterator > Range
static std::string const input
Definition: EdmProvDump.cc:44
void init(const edm::EventSetup &)
const int16_t & eval(const int16_t &in)
const T & get() const
Definition: EventSetup.h:55
void subtract_(const uint32_t &, const uint16_t &, const input_t &, std::vector< int16_t > &)
det_id_type id
Definition: DetSet.h:77