#include <DQM/SiStripCommissioningSources/interface/PedestalsTask.h>
Public Member Functions | |
PedestalsTask (DQMStore *, const FedChannelConnection &) | |
virtual | ~PedestalsTask () |
Private Member Functions | |
virtual void | book () |
virtual void | fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) |
virtual void | update () |
Private Attributes | |
std::vector< HistoSet > | cm_ |
std::vector< HistoSet > | peds_ |
Definition at line 10 of file PedestalsTask.h.
PedestalsTask::PedestalsTask | ( | DQMStore * | dqm, | |
const FedChannelConnection & | conn | |||
) |
Definition at line 15 of file PedestalsTask.cc.
References LogTrace, and sistrip::mlDqmSource_.
00016 : 00017 CommissioningTask( dqm, conn, "PedestalsTask" ), 00018 peds_(), 00019 cm_() 00020 { 00021 LogTrace(mlDqmSource_) 00022 << "[PedestalsTask::" << __func__ << "]" 00023 << " Constructing object..."; 00024 }
PedestalsTask::~PedestalsTask | ( | ) | [virtual] |
Definition at line 28 of file PedestalsTask.cc.
References LogTrace, and sistrip::mlDqmSource_.
00028 { 00029 LogTrace(mlDqmSource_) 00030 << "[PedestalsTask::" << __func__ << "]" 00031 << " Destructing object..."; 00032 }
void PedestalsTask::book | ( | ) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 36 of file PedestalsTask.cc.
References sistrip::APV, cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), CommissioningTask::dqm(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), sistrip::LLD_CHAN, LogTrace, sistrip::mlDqmSource_, sistrip::extrainfo::noise_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, peds_, and indexGen::title.
00036 { 00037 LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"; 00038 00039 uint16_t nbins; 00040 std::string title; 00041 std::string extra_info; 00042 peds_.resize(2); 00043 nbins = 256; 00044 00045 // Pedestals histogram 00046 extra_info = sistrip::extrainfo::pedestals_; 00047 peds_[0].isProfile_ = true; 00048 00049 title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00050 sistrip::PEDESTALS, 00051 sistrip::FED_KEY, 00052 fedKey(), 00053 sistrip::LLD_CHAN, 00054 connection().lldChannel(), 00055 extra_info ).title(); 00056 00057 peds_[0].histo( dqm()->bookProfile( title, title, 00058 nbins, -0.5, nbins*1.-0.5, 00059 1025, 0., 1025. ) ); 00060 00061 peds_[0].vNumOfEntries_.resize(nbins,0); 00062 peds_[0].vSumOfContents_.resize(nbins,0); 00063 peds_[0].vSumOfSquares_.resize(nbins,0); 00064 00065 // Noise histogram 00066 extra_info = sistrip::extrainfo::noise_; 00067 peds_[1].isProfile_ = true; 00068 00069 title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00070 sistrip::PEDESTALS, 00071 sistrip::FED_KEY, 00072 fedKey(), 00073 sistrip::LLD_CHAN, 00074 connection().lldChannel(), 00075 extra_info ).title(); 00076 00077 peds_[1].histo( dqm()->bookProfile( title, title, 00078 nbins, -0.5, nbins*1.-0.5, 00079 1025, 0., 1025. ) ); 00080 00081 peds_[1].vNumOfEntries_.resize(nbins,0); 00082 peds_[1].vSumOfContents_.resize(nbins,0); 00083 peds_[1].vSumOfSquares_.resize(nbins,0); 00084 00085 // Common mode histograms 00086 cm_.resize(2); 00087 nbins = 1024; 00088 for ( uint16_t iapv = 0; iapv < 2; iapv++ ) { 00089 00090 title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00091 sistrip::PEDESTALS, 00092 sistrip::FED_KEY, 00093 fedKey(), 00094 sistrip::APV, 00095 connection().i2cAddr(iapv), 00096 sistrip::extrainfo::commonMode_ ).title(); 00097 00098 cm_[iapv].histo( dqm()->book1D( title, title, nbins, -0.5, nbins*1.-0.5 ) ); 00099 cm_[iapv].isProfile_ = false; 00100 00101 cm_[iapv].vNumOfEntries_.resize(nbins,0); 00102 cm_[iapv].vNumOfEntries_.resize(nbins,0); 00103 00104 } 00105 00106 }
void PedestalsTask::fill | ( | const SiStripEventSummary & | summary, | |
const edm::DetSet< SiStripRawDigi > & | digis | |||
) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 110 of file PedestalsTask.cc.
References ecalMGPA::adc(), cm_, edm::DetSet< T >::data, diff, index, sistrip::mlDqmSource_, peds_, python::multivaluedict::sort(), and CommissioningTask::updateHistoSet().
00111 { 00112 00113 if ( digis.data.size() != peds_[0].vNumOfEntries_.size() ) { 00114 edm::LogWarning(mlDqmSource_) 00115 << "[PedestalsTask::" << __func__ << "]" 00116 << " Unexpected number of digis: " 00117 << digis.data.size(); 00118 return; 00119 } 00120 00121 // Check number of digis 00122 uint16_t nbins = peds_[0].vNumOfEntries_.size(); 00123 if ( digis.data.size() < nbins ) { nbins = digis.data.size(); } 00124 00125 //@@ Inefficient!!! 00126 uint16_t napvs = nbins / 128; 00127 std::vector<uint32_t> cm; cm.resize(napvs,0); 00128 00129 // Calc common mode for both APVs 00130 std::vector<uint16_t> adc; 00131 for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) { 00132 adc.clear(); adc.reserve(128); 00133 for ( uint16_t ibin = 0; ibin < 128; ibin++ ) { 00134 if ( (iapv*128)+ibin < nbins ) { 00135 adc.push_back( digis.data[(iapv*128)+ibin].adc() ); //@@ VIRGIN RAW DATA (MUX, APV READOUT) 00136 } 00137 } 00138 sort( adc.begin(), adc.end() ); 00139 uint16_t index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1; 00140 if ( !adc.empty() ) { cm[iapv] = static_cast<uint32_t>( adc[index] ); } 00141 } 00142 00143 for ( uint16_t ibin = 0; ibin < nbins; ibin++ ) { 00144 updateHistoSet( peds_[0], ibin, digis.data[ibin].adc() ); // peds and raw noise 00145 float diff = static_cast<float>( digis.data[ibin].adc() ) - static_cast<float>( cm[ibin/128] ); 00146 updateHistoSet( peds_[1], ibin, diff ); // residuals and real noise 00147 } 00148 00149 if ( cm.size() < cm_.size() ) { 00150 edm::LogWarning(mlDqmSource_) 00151 << "[PedestalsTask::" << __func__ << "]" 00152 << " Fewer CM values than expected: " << cm.size(); 00153 } 00154 00155 updateHistoSet( cm_[0], cm[0] ); 00156 updateHistoSet( cm_[1], cm[1] ); 00157 00158 }
void PedestalsTask::update | ( | ) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 162 of file PedestalsTask.cc.
References cm_, python::tagInventory::entries, error, extract(), histo, mean(), peds_, UpdateTProfile::setBinContent(), funct::sqrt(), and CommissioningTask::updateHistoSet().
00162 { 00163 00164 // Pedestals 00165 updateHistoSet( peds_[0] ); 00166 00167 // Noise (cannot use HistoSet directly, as want to plot noise as "contents", not "error") 00168 TProfile* histo = ExtractTObject<TProfile>().extract( peds_[1].histo() ); 00169 for ( uint16_t ii = 0; ii < peds_[1].vNumOfEntries_.size(); ++ii ) { 00170 00171 float mean = 0.; 00172 float spread = 0.; 00173 float entries = peds_[1].vNumOfEntries_[ii]; 00174 if ( entries > 0. ) { 00175 mean = peds_[1].vSumOfContents_[ii] / entries; 00176 spread = sqrt( peds_[1].vSumOfSquares_[ii] / entries - mean * mean ); 00177 } 00178 00179 float noise = spread; 00180 float error = 0; // sqrt(entries) / entries; 00181 00182 UpdateTProfile::setBinContent( histo, ii+1, entries, noise, error ); 00183 00184 } 00185 00186 // Common mode 00187 updateHistoSet( cm_[0] ); 00188 updateHistoSet( cm_[1] ); 00189 00190 }
std::vector<HistoSet> PedestalsTask::cm_ [private] |
std::vector<HistoSet> PedestalsTask::peds_ [private] |