43 const uint32_t aNPairs,
54 maxStrip_ = sistrip::STRIPS_PER_FEDCH*(pair_+1);
85 aHandle->allNoises(
noises_,noisesRange);
89 <<
noises_.size() <<
" detId = "
96 std::vector<SiStripRawDigi> & pedsDetSetData,
97 std::vector<SiStripProcessedRawDigi> & noiseDetSetData,
98 std::vector<SiStripRawDigi> & pedSubtrDetSetData,
99 std::vector<uint32_t> & medsDetSetData,
100 const bool fillApvsForCM)
106 std::vector<std::vector<uint16_t> > apvs;
115 std::vector<uint16_t> apvVec;;
119 uint16_t ped =
static_cast<uint16_t
>(
pedestals_[st]);
125 if (digi_it == inputChannel->
end()) {
126 LogError(
messageLabel_) <<
" Error, end of inputchannel reached for detid " <<
detId_ <<
"! Processed " << lCount <<
" strips." << std::endl;
130 int lVal = digi_it->adc() - ped;
132 if (digi_it->adc()>0)
LogDebug(
messageLabel_) <<
" Negative value after pedestal subtraction ! Detid = " <<
detId_ <<
", strip " << st <<
", digi = " << digi_it->adc() <<
", ped = " << ped << std::endl;
139 apvVec.push_back( static_cast<uint16_t>(lVal) );
146 if (apvVec.size()) apvs.
push_back(apvVec);
154 if (apvs.size() !=
nPairs_*2) {
155 LogError(
messageLabel_) <<
" Error, wrong output size for median calculation for detid " <<
detId_ <<
"! Processed " << apvs.size() <<
" APVs." << std::endl;
159 for (uint32_t iapv(0); iapv<apvs.size(); iapv++){
160 std::vector<uint16_t> lVec = apvs[iapv];
162 std::vector<uint16_t>::iterator mid = lVec.begin() + (lVec.size()/2 - 1);
163 std::nth_element(lVec.begin(), mid, lVec.end());
171 medsDetSetData.push_back(*mid);
180 std::vector<SiStripRawDigi> & cmSubtrDetSetData)
183 std::vector<SiStripRawDigi>::const_iterator lDigi = pedSubtrDetSetData.begin();
194 cmSubtrDetSetData.push_back(
SiStripRawDigi(static_cast<uint16_t>(value)));
204 const std::auto_ptr<SiStripRawProcessingAlgorithms> & algorithms)
207 std::vector<int16_t> cmSubtrRawDigis;
209 cmSubtrDetSetData.end(),
210 back_inserter(cmSubtrRawDigis),
213 algorithms->suppressor->suppress(cmSubtrRawDigis, 0,
222 iApv != peds->
end(); ++iApv) {
229 iApv != noises->
end(); ++iApv) {
230 noises_.push_back(iApv->adc());
235 std::vector<uint32_t>::const_iterator iApv = (meds->second).
begin();
236 for ( ; iApv != (meds->second).
end(); ++iApv) {
242 aOs <<
"===============================" << std::endl
243 <<
" ===== FEDEmulator::print =====" << std::endl
244 <<
" === byModule = " <<
byModule_ << std::endl
245 <<
" === minStrip = " <<
minStrip_ << std::endl
246 <<
" === maxStrip = " <<
maxStrip_ << std::endl
247 <<
" === size of pedestals = " <<
pedestals_.size() << std::endl
248 <<
" === size of noises = " <<
noises_.size() << std::endl
249 <<
" === size of medians = " <<
medians_.size() << std::endl
250 <<
" === detId = " <<
detId_ << std::endl
251 <<
" === nPairs = " <<
nPairs_ << std::endl
252 <<
" === pair = " <<
pair_ << std::endl
253 <<
"===============================" << std::endl;
258 aOs <<
"=========================================" << std::endl
259 <<
" ===== FEDEmulator::printPedestals =====" << std::endl;
261 if (
i%32 == 0) aOs << std::endl;
264 aOs <<
"=========================================" << std::endl;
268 aOs <<
"=========================================" << std::endl
269 <<
" ===== FEDEmulator::printNoises =====" << std::endl;
270 for (
unsigned int i(0);
i<
noises_.size();
i++){
271 if (
i%32 == 0) aOs << std::endl;
274 aOs <<
"=========================================" << std::endl;
278 aOs <<
"=========================================" << std::endl
279 <<
" ===== FEDEmulator::printMedians =====" << std::endl;
281 if (
i%32 == 0) aOs << std::endl;
284 aOs <<
"=========================================" << std::endl;
void zeroSuppress(const std::vector< SiStripRawDigi > &cmSubtrDetSetData, edm::DetSet< SiStripDigi > &zsDetSetData, const std::auto_ptr< SiStripRawProcessingAlgorithms > &algorithms)
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 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_