5 #include "boost/bind.hpp"
45 const uint32_t aNPairs,
56 maxStrip_ = sistrip::STRIPS_PER_FEDCH*(pair_+1);
87 aHandle->allNoises(
noises_,noisesRange);
91 <<
noises_.size() <<
" detId = "
98 std::vector<SiStripRawDigi> & pedsDetSetData,
99 std::vector<SiStripProcessedRawDigi> & noiseDetSetData,
100 std::vector<SiStripRawDigi> & pedSubtrDetSetData,
101 std::vector<uint32_t> & medsDetSetData,
102 const bool fillApvsForCM)
108 std::vector<std::vector<uint16_t> > apvs;
117 std::vector<uint16_t> apvVec;;
121 uint16_t ped =
static_cast<uint16_t
>(
pedestals_[st]);
127 if (digi_it == inputChannel->
end()) {
128 LogError(
messageLabel_) <<
" Error, end of inputchannel reached for detid " <<
detId_ <<
"! Processed " << lCount <<
" strips." << std::endl;
132 int lVal = digi_it->adc() - ped;
134 if (digi_it->adc()>0)
LogDebug(
messageLabel_) <<
" Negative value after pedestal subtraction ! Detid = " <<
detId_ <<
", strip " << st <<
", digi = " << digi_it->adc() <<
", ped = " << ped << std::endl;
141 apvVec.push_back( static_cast<uint16_t>(lVal) );
148 if (apvVec.size()) apvs.
push_back(apvVec);
156 if (apvs.size() !=
nPairs_*2) {
157 LogError(
messageLabel_) <<
" Error, wrong output size for median calculation for detid " <<
detId_ <<
"! Processed " << apvs.size() <<
" APVs." << std::endl;
161 for (uint32_t iapv(0); iapv<apvs.size(); iapv++){
162 std::vector<uint16_t> lVec = apvs[iapv];
164 std::vector<uint16_t>::iterator mid = lVec.begin() + (lVec.size()/2 - 1);
165 std::nth_element(lVec.begin(), mid, lVec.end());
173 medsDetSetData.push_back(*mid);
182 std::vector<SiStripRawDigi> & cmSubtrDetSetData)
185 std::vector<SiStripRawDigi>::const_iterator lDigi = pedSubtrDetSetData.begin();
196 cmSubtrDetSetData.push_back(
SiStripRawDigi(static_cast<uint16_t>(value)));
206 const std::unique_ptr<SiStripRawProcessingAlgorithms> & algorithms)
209 std::vector<int16_t> cmSubtrRawDigis;
211 cmSubtrDetSetData.end(),
212 back_inserter(cmSubtrRawDigis),
215 algorithms->suppressor->suppress(cmSubtrRawDigis, 0,
224 iApv != peds->
end(); ++iApv) {
231 iApv != noises->
end(); ++iApv) {
232 noises_.push_back(iApv->adc());
237 std::vector<uint32_t>::const_iterator iApv = (meds->second).
begin();
238 for ( ; iApv != (meds->second).
end(); ++iApv) {
244 aOs <<
"===============================" << std::endl
245 <<
" ===== FEDEmulator::print =====" << std::endl
246 <<
" === byModule = " <<
byModule_ << std::endl
247 <<
" === minStrip = " <<
minStrip_ << std::endl
248 <<
" === maxStrip = " <<
maxStrip_ << std::endl
249 <<
" === size of pedestals = " <<
pedestals_.size() << std::endl
250 <<
" === size of noises = " <<
noises_.size() << std::endl
251 <<
" === size of medians = " <<
medians_.size() << std::endl
252 <<
" === detId = " <<
detId_ << std::endl
253 <<
" === nPairs = " <<
nPairs_ << std::endl
254 <<
" === pair = " <<
pair_ << std::endl
255 <<
"===============================" << std::endl;
260 aOs <<
"=========================================" << std::endl
261 <<
" ===== FEDEmulator::printPedestals =====" << std::endl;
263 if (
i%32 == 0) aOs << std::endl;
266 aOs <<
"=========================================" << std::endl;
270 aOs <<
"=========================================" << std::endl
271 <<
" ===== FEDEmulator::printNoises =====" << std::endl;
272 for (
unsigned int i(0);
i<
noises_.size();
i++){
273 if (
i%32 == 0) aOs << std::endl;
276 aOs <<
"=========================================" << std::endl;
280 aOs <<
"=========================================" << std::endl
281 <<
" ===== FEDEmulator::printMedians =====" << std::endl;
283 if (
i%32 == 0) aOs << std::endl;
286 aOs <<
"=========================================" << std::endl;
virtual char const * what() const
const uint16_t & adc() const
void push_back(const T &t)
void subtractPedestals(const edm::DetSetVector< SiStripRawDigi >::const_iterator &inputChannel, std::vector< SiStripRawDigi > &pedsDetSetData, std::vector< SiStripProcessedRawDigi > &noiseDetSetData, std::vector< SiStripRawDigi > &pedSubtrDetSetData, std::vector< uint32_t > &medsDetSetData, const bool fillApvsForCM)
void printPeds(std::ostream &aOs)
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
void fillPeds(const edm::DetSetVector< SiStripRawDigi >::const_iterator &peds)
std::pair< ContainerIterator, ContainerIterator > Range
void retrieveNoises(const edm::ESHandle< SiStripNoises > &aHandle)
std::vector< float > noises_
void fillMedians(const std::map< uint32_t, std::vector< uint32_t > >::const_iterator &meds)
void initialiseModule(const uint32_t aDetId, const uint32_t aNPairs, const uint32_t aPair)
std::vector< int > pedestals_
void subtractCM(const std::vector< SiStripRawDigi > &pedSubtrDetSetData, std::vector< SiStripRawDigi > &cmSubtrDetSetData)
iterator end()
Return the off-the-end iterator.
static const uint16_t STRIPS_PER_FEDCH
void initialise(const bool byModule)
void zeroSuppress(const std::vector< SiStripRawDigi > &cmSubtrDetSetData, edm::DetSet< SiStripDigi > &zsDetSetData, const std::unique_ptr< SiStripRawProcessingAlgorithms > &algorithms)
void printNoises(std::ostream &aOs)
void print(std::ostream &aOs)
void printMeds(std::ostream &aOs)
std::vector< uint32_t > medians_
static const uint16_t STRIPS_PER_APV
iterator begin()
Return an iterator to the first DetSet.
void retrievePedestals(const edm::ESHandle< SiStripPedestals > &aHandle)
std::pair< ContainerIterator, ContainerIterator > Range
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
void fillNoises(const edm::DetSetVector< SiStripProcessedRawDigi >::const_iterator &noise)
static const char * messageLabel_