CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiStripPedestalsSubtractor Class Reference

#include <SiStripPedestalsSubtractor.h>

Public Member Functions

void init (const edm::EventSetup &)
 
void subtract (const edm::DetSet< SiStripRawDigi > &input, std::vector< int16_t > &output)
 
void subtract (uint32_t detId, uint16_t firstAPV, std::vector< int16_t > &adcs)
 

Private Member Functions

int16_t eval (int16_t in)
 
uint16_t eval (SiStripRawDigi in)
 
 SiStripPedestalsSubtractor (bool mode)
 
template<class input_t >
void subtract_ (uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)
 

Private Attributes

bool fedmode_
 
std::vector< int > pedestals
 
edm::ESHandle< SiStripPedestalspedestalsHandle
 
uint32_t peds_cache_id
 

Friends

class SiStripRawProcessingFactory
 

Detailed Description

Definition at line 12 of file SiStripPedestalsSubtractor.h.

Constructor & Destructor Documentation

SiStripPedestalsSubtractor::SiStripPedestalsSubtractor ( bool  mode)
inlineprivate

Member Function Documentation

int16_t SiStripPedestalsSubtractor::eval ( int16_t  in)
inlineprivate

Definition at line 31 of file SiStripPedestalsSubtractor.h.

References recoMuon::in.

Referenced by subtract_().

31 { return in; }
uint16_t SiStripPedestalsSubtractor::eval ( SiStripRawDigi  in)
inlineprivate

Definition at line 32 of file SiStripPedestalsSubtractor.h.

References SiStripRawDigi::adc().

32 { return in.adc(); }
const uint16_t & adc() const
void SiStripPedestalsSubtractor::init ( const edm::EventSetup es)

Definition at line 6 of file SiStripPedestalsSubtractor.cc.

References edm::EventSetup::get(), pedestalsHandle, and peds_cache_id.

6  {
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 }
edm::ESHandle< SiStripPedestals > pedestalsHandle
T get() const
Definition: EventSetup.h:71
void SiStripPedestalsSubtractor::subtract ( const edm::DetSet< SiStripRawDigi > &  input,
std::vector< int16_t > &  output 
)

Definition at line 15 of file SiStripPedestalsSubtractor.cc.

References edm::DetSet< T >::id, and subtract_().

15 { subtract_(input.id, 0, input, output); }
det_id_type id
Definition: DetSet.h:79
void subtract_(uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)
void SiStripPedestalsSubtractor::subtract ( uint32_t  detId,
uint16_t  firstAPV,
std::vector< int16_t > &  adcs 
)

Definition at line 14 of file SiStripPedestalsSubtractor.cc.

References subtract_().

14 { subtract_(detId, firstStrip, digis, digis); }
void subtract_(uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)
template<class input_t >
void SiStripPedestalsSubtractor::subtract_ ( uint32_t  detId,
uint16_t  firstAPV,
const input_t &  input,
std::vector< int16_t > &  output 
)
inlineprivate

Definition at line 20 of file SiStripPedestalsSubtractor.cc.

References SiStripPedestals::allPeds(), MillePedeFileConverter_cfg::e, eval(), fedmode_, SiStripPedestals::getRange(), pedestals, pedestalsHandle, and cms::Exception::what().

Referenced by subtract().

20  {
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
char const * what() const override
Definition: Exception.cc:103
std::pair< ContainerIterator, ContainerIterator > Range
static std::string const input
Definition: EdmProvDump.cc:48
void allPeds(std::vector< int > &pefs, const Range &range) const
const Range getRange(const uint32_t &detID) const

Friends And Related Function Documentation

friend class SiStripRawProcessingFactory
friend

Definition at line 14 of file SiStripPedestalsSubtractor.h.

Member Data Documentation

bool SiStripPedestalsSubtractor::fedmode_
private

Definition at line 28 of file SiStripPedestalsSubtractor.h.

Referenced by subtract_().

std::vector<int> SiStripPedestalsSubtractor::pedestals
private

Definition at line 26 of file SiStripPedestalsSubtractor.h.

Referenced by subtract_().

edm::ESHandle<SiStripPedestals> SiStripPedestalsSubtractor::pedestalsHandle
private

Definition at line 24 of file SiStripPedestalsSubtractor.h.

Referenced by init(), SiStripPedestalsSubtractor(), and subtract_().

uint32_t SiStripPedestalsSubtractor::peds_cache_id
private

Definition at line 27 of file SiStripPedestalsSubtractor.h.

Referenced by init().