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::SiStripPedestalsSubtractor ( bool  mode)
inlineprivate

Definition at line 21 of file SiStripPedestalsSubtractor.h.

21 : peds_cache_id(0), fedmode_(mode){};

Member Function Documentation

◆ eval() [1/2]

int16_t SiStripPedestalsSubtractor::eval ( int16_t  in)
inlineprivate

Definition at line 29 of file SiStripPedestalsSubtractor.h.

29 { return in; }

References recoMuon::in.

Referenced by subtract_().

◆ eval() [2/2]

uint16_t SiStripPedestalsSubtractor::eval ( SiStripRawDigi  in)
inlineprivate

Definition at line 30 of file SiStripPedestalsSubtractor.h.

30 { return in.adc(); }

References recoMuon::in.

◆ init()

void SiStripPedestalsSubtractor::init ( const edm::EventSetup es)

Definition at line 6 of file SiStripPedestalsSubtractor.cc.

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 }

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

◆ subtract() [1/2]

void SiStripPedestalsSubtractor::subtract ( const edm::DetSet< SiStripRawDigi > &  input,
std::vector< int16_t > &  output 
)

Definition at line 17 of file SiStripPedestalsSubtractor.cc.

17  {
18  subtract_(input.id, 0, input, output);
19 }

References input, convertSQLitetoXML_cfg::output, and subtract_().

◆ subtract() [2/2]

void SiStripPedestalsSubtractor::subtract ( uint32_t  detId,
uint16_t  firstAPV,
std::vector< int16_t > &  adcs 
)

Definition at line 14 of file SiStripPedestalsSubtractor.cc.

14  {
15  subtract_(detId, firstStrip, digis, digis);
16 }

References subtract_().

◆ subtract_()

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 22 of file SiStripPedestalsSubtractor.cc.

25  {
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 }

References SiStripPedestals::allPeds(), MillePedeFileConverter_cfg::e, eval(), fedmode_, SiStripPedestals::getRange(), input, convertSQLitetoXML_cfg::output, pedestals, and pedestalsHandle.

Referenced by subtract().

Friends And Related Function Documentation

◆ SiStripRawProcessingFactory

friend class SiStripRawProcessingFactory
friend

Definition at line 13 of file SiStripPedestalsSubtractor.h.

Member Data Documentation

◆ fedmode_

bool SiStripPedestalsSubtractor::fedmode_
private

Definition at line 25 of file SiStripPedestalsSubtractor.h.

Referenced by subtract_().

◆ pedestals

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

Definition at line 23 of file SiStripPedestalsSubtractor.h.

Referenced by subtract_().

◆ pedestalsHandle

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

Definition at line 21 of file SiStripPedestalsSubtractor.h.

Referenced by init(), and subtract_().

◆ peds_cache_id

uint32_t SiStripPedestalsSubtractor::peds_cache_id
private

Definition at line 24 of file SiStripPedestalsSubtractor.h.

Referenced by init().

SiStripPedestalsSubtractor::peds_cache_id
uint32_t peds_cache_id
Definition: SiStripPedestalsSubtractor.h:24
input
static const std::string input
Definition: EdmProvDump.cc:48
SiStripPedestals::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripPedestals.h:51
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
SiStripPedestalsSubtractor::pedestals
std::vector< int > pedestals
Definition: SiStripPedestalsSubtractor.h:23
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
SiStripPedestalsSubtractor::fedmode_
bool fedmode_
Definition: SiStripPedestalsSubtractor.h:25
SiStripPedestalsRcd
Definition: SiStripCondDataRecords.h:44
SiStripPedestalsSubtractor::pedestalsHandle
edm::ESHandle< SiStripPedestals > pedestalsHandle
Definition: SiStripPedestalsSubtractor.h:21
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripPedestalsSubtractor::subtract_
void subtract_(uint32_t detId, uint16_t firstAPV, const input_t &input, std::vector< int16_t > &output)
Definition: SiStripPedestalsSubtractor.cc:22
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::LogError
Definition: MessageLogger.h:183
recoMuon::in
Definition: RecoMuonEnumerators.h:6
get
#define get
SiStripPedestalsSubtractor::eval
int16_t eval(int16_t in)
Definition: SiStripPedestalsSubtractor.h:29
cms::Exception
Definition: Exception.h:70
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37