13 using namespace sistrip;
39 opto_.resize( gains );
40 for ( uint16_t igain = 0; igain <
opto_.size(); igain++ ) {
41 opto_[igain].resize(3);
44 for ( uint16_t igain = 0; igain <
opto_.size(); igain++ ) {
45 for ( uint16_t ihisto = 0; ihisto < 3; ihisto++ ) {
48 std::stringstream extra_info;
50 if ( ihisto == 0 || ihisto == 1 ) {
63 extra_info.str() ).
title();
66 opto_[igain][ihisto].histo(
dqm()->bookProfile( title, title,
67 nbins, 0.5, nbins*1.+0.5,
68 1024, -0.5, 1023.5 ) );
70 opto_[igain][ihisto].vNumOfEntries_.resize(nbins,0);
71 opto_[igain][ihisto].vSumOfContents_.resize(nbins,0);
72 opto_[igain][ihisto].vSumOfSquares_.resize(nbins,0);
87 if ( digis.
data.empty() ) {
89 <<
"[OptoScanTask::" << __func__ <<
"]"
90 <<
" Unexpected number of digis! "
95 uint16_t gain = summary.
lldGain();
96 uint16_t bias = summary.
lldBias();
98 if ( gain >=
opto_.size() ) {
100 for ( uint16_t igain = 0; igain <
opto_.size(); igain++ ) {
104 <<
"[OptoScanTask::" << __func__ <<
"]"
105 <<
" Unexpected gain value! " << gain;
108 if ( bias > 50 ) {
return; }
111 std::vector<float> baseline;
112 std::pair<float,float> digital_range;
117 locateTicks( digis, digital_range, baseline, baseline_rms );
119 uint16_t
bin = bias - 1;
145 for ( uint16_t igain = 0; igain <
opto_.size(); igain++ ) {
146 for ( uint16_t ihisto = 0; ihisto <
opto_[igain].size(); ihisto++ ) {
157 std::pair<float,float> & range,
158 std::vector<float> & baseline,
159 float & baseline_rms ) {
162 std::vector<uint16_t>
adc;
163 adc.reserve( digis.
data.size() );
164 for ( uint16_t iadc = 0; iadc < digis.
data.size(); iadc++ ) {
168 adc.push_back( digis.
data[iadc].adc() );
171 sort( adc.begin(), adc.end() );
177 if ( adc.size() > 70 ) {
180 range.second = adc.back();
183 std::vector<uint16_t> truncated;
184 std::vector<uint16_t>::const_iterator ii = adc.begin();
186 std::vector<uint16_t>::const_iterator
jj = adc.end() - 4 * ( ( adc.size() / 70 ) + 1 );
187 truncated.resize( jj - ii );
189 if ( truncated.empty() ) {
return; }
193 std::vector<uint16_t>::const_iterator iii = truncated.begin();
194 std::vector<uint16_t>::const_iterator jjj = truncated.end();
195 for ( ; iii != jjj; ++iii ) { b_mean += *iii; }
196 b_mean /= ( 1. * truncated.size() );
197 range.first = b_mean;
201 std::vector<uint16_t>::const_iterator iiii = truncated.begin();
202 std::vector<uint16_t>::const_iterator jjjj = truncated.end();
203 for ( ; iiii != jjjj; ++iiii ) { b_rms += fabs( *iiii - b_mean ); }
205 baseline_rms =
sqrt ( b_rms / ( 1. * truncated.size() ) );
209 <<
"[OptoScanTask::" << __func__ <<
"]"
210 <<
" Insufficient ADC values: " << adc.size();
int adc(sample_type sample)
get the ADC sample (12 bits)
Utility class that holds histogram title.
std::vector< std::vector< HistoSet > > opto_
static const char mlDqmSource_[]
virtual void fill(const SiStripEventSummary &summary, const edm::DetSet< SiStripRawDigi > &digis)
static const uint16_t valid_
const uint32_t & lldGain() const
const uint32_t & lldBias() const
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Class containning control, module, detector and connection information, at the level of a FED channel...
OptoScanTask(DQMStore *dqm, const FedChannelConnection &conn)
DQMStore *const dqm() const
static const uint16_t invalid_
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
tuple size
Write out results.
void locateTicks(const edm::DetSet< SiStripRawDigi > &scope_mode_data, std::pair< float, float > &digital_range, std::vector< float > &baseline, float &baseline_rms)