#include <DQM/SiStripCommissioningSources/interface/NoiseTask.h>
Public Member Functions | |
NoiseTask (DQMStore *, const FedChannelConnection &) | |
virtual | ~NoiseTask () |
Private Member Functions | |
virtual void | book () |
virtual void | fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) |
virtual void | update () |
Private Attributes | |
std::vector< HistoSet > | cm_ |
ApvAnalysisFactory * | pApvFactory_ |
std::vector< HistoSet > | peds_ |
Definition at line 19 of file NoiseTask.h.
NoiseTask::NoiseTask | ( | DQMStore * | dqm, | |
const FedChannelConnection & | conn | |||
) |
Definition at line 37 of file NoiseTask.cc.
References LogTrace, sistrip::mlDqmSource_, and pApvFactory_.
00039 : CommissioningTask( dqm, conn, "NoiseTask") 00040 { 00041 //@@ NOT GUARANTEED TO BE THREAD SAFE! 00042 pApvFactory_ = edm::Service<ApvFactoryService>().operator->()->getApvFactory(); 00043 00044 LogTrace( mlDqmSource_) 00045 << "[NoiseTask::" << __func__ << "]" 00046 << " Constructing object..."; 00047 }
NoiseTask::~NoiseTask | ( | ) | [virtual] |
Definition at line 51 of file NoiseTask.cc.
References LogTrace, sistrip::mlDqmSource_, and pApvFactory_.
00052 { 00053 LogTrace(mlDqmSource_) 00054 << "[NoiseTask::" << __func__ << "]" 00055 << " Destructing object..."; 00056 00057 // Have to delete pApvFactory_ manually even though we didn't create it 00058 // ourself. :( 00059 if( pApvFactory_) { delete pApvFactory_; } 00060 }
void NoiseTask::book | ( | ) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 64 of file NoiseTask.cc.
References sistrip::APV, FedChannelConnection::apvPairNumber(), cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), FedChannelConnection::detId(), detId, CommissioningTask::dqm(), CommissioningTask::eventSetup(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), edm::EventSetup::get(), ApvAnalysisFactory::getApvAnalysis(), CommissioningTask::HistoSet::histo(), ApvAnalysisFactory::instantiateApvs(), CommissioningTask::HistoSet::isProfile_, sistrip::LLD_CHAN, LogTrace, sistrip::mlDqmSource_, sistrip::NOISE, sistrip::extrainfo::noise_, pApvFactory_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, peds_, indexGen::title, CommissioningTask::HistoSet::vNumOfEntries_, CommissioningTask::HistoSet::vSumOfContents_, and CommissioningTask::HistoSet::vSumOfSquares_.
00065 { 00066 LogTrace( mlDqmSource_) << "[NoiseTask::" << __func__ << "]"; 00067 00068 // CACHING 00069 static std::auto_ptr<SiStripPedestals> pDBPedestals; 00070 static std::auto_ptr<SiStripNoises> pDBNoises; 00071 00072 const uint16_t nBINS = 256; 00073 00074 { 00075 // Pedestals 00076 std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00077 sistrip::NOISE, 00078 sistrip::FED_KEY, 00079 fedKey(), 00080 sistrip::LLD_CHAN, 00081 connection().lldChannel(), 00082 sistrip::extrainfo::pedestals_).title(); 00083 00084 HistoSet oHSet; 00085 oHSet.isProfile_ = true; 00086 00087 oHSet.vNumOfEntries_.resize( nBINS, 0); 00088 oHSet.vSumOfContents_.resize( nBINS, 0); 00089 oHSet.vSumOfSquares_.resize( nBINS, 0); 00090 00091 oHSet.histo( dqm()->bookProfile( title, title, 00092 nBINS, -0.5, nBINS * 1. - 0.5, 00093 1025, 0., 1025.) ); 00094 00095 peds_.push_back( oHSet); 00096 } 00097 00098 { 00099 // Corrected Noise 00100 std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00101 sistrip::NOISE, 00102 sistrip::FED_KEY, 00103 fedKey(), 00104 sistrip::LLD_CHAN, 00105 connection().lldChannel(), 00106 sistrip::extrainfo::noise_).title(); 00107 00108 HistoSet oHSet; 00109 oHSet.isProfile_ = true; 00110 00111 oHSet.vNumOfEntries_.resize( nBINS, 0); 00112 oHSet.vSumOfContents_.resize( nBINS, 0); 00113 oHSet.vSumOfSquares_.resize( nBINS, 0); 00114 00115 oHSet.histo( dqm()->bookProfile( title, title, 00116 nBINS, -0.5, nBINS * 1. - 0.5, 00117 1025, 0., 1025.) ); 00118 00119 peds_.push_back( oHSet); 00120 } 00121 00122 const uint16_t nCM_BINS = 1024; 00123 for( uint16_t nApv = 0; 2 > nApv; ++nApv) 00124 { 00125 std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 00126 sistrip::PEDESTALS, 00127 sistrip::FED_KEY, 00128 fedKey(), 00129 sistrip::APV, 00130 connection().i2cAddr( nApv), 00131 sistrip::extrainfo::commonMode_).title(); 00132 00133 HistoSet oHSet; 00134 00135 oHSet.isProfile_ = false; 00136 00137 oHSet.vNumOfEntries_.resize( nCM_BINS, 0); 00138 00139 oHSet.histo( dqm()->book1D( title, title, 00140 nCM_BINS, 00141 nCM_BINS/2 * -1. - 0.5, 00142 nCM_BINS/2 * 1. - 0.5 ) ); 00143 00144 cm_.push_back( oHSet); 00145 } 00146 00147 // Initialize Apv 00148 pApvFactory_->instantiateApvs( connection().detId(), connection().nApvs() ); 00149 00150 // --[ RETRIEVE PEDESTALS FROM DB ]-- 00151 // Operation should be performed only once 00152 if( !pDBPedestals.get()) { 00153 LogTrace( mlDqmSource_) 00154 << "[NoiseTask::" << __func__ << "] " 00155 << "Retrieving Pedestals from DB"; 00156 00157 // Directly retrieve Pedestals from EventSetup 00158 edm::ESHandle<SiStripPedestals> pedestals; 00159 eventSetup()->get<SiStripPedestalsRcd>().get( pedestals); 00160 00161 // Cache Pedestals 00162 pDBPedestals.reset( new SiStripPedestals( *pedestals) ); 00163 00164 LogTrace( mlDqmSource_) 00165 << "[NoiseTask::" << __func__ << "] " 00166 << "Done Retrieving Pedestals from DB"; 00167 } // End retrieve Pedestals from DB 00168 00169 // --[ RETRIEVE NOISES FROM DB ]-- 00170 // Operation should be performed only once 00171 if( !pDBNoises.get()) { 00172 LogTrace( mlDqmSource_) 00173 << "[NoiseTask::" << __func__ << "] " 00174 << "Retrieving Noises from DB"; 00175 00176 // Directly retrieve Noises from EventSetup 00177 edm::ESHandle<SiStripNoises> noises; 00178 eventSetup()->get<SiStripNoisesRcd>().get( noises); 00179 00180 // Cache Pedestals 00181 pDBNoises.reset( new SiStripNoises( *noises) ); 00182 00183 LogTrace( mlDqmSource_) 00184 << "[NoiseTask::" << __func__ << "] " 00185 << "Done Retrieving Noises from DB"; 00186 } // End retrieve Noises from DB 00187 00188 00189 // Get ApvAnalysis associated with given DetId 00190 ApvAnalysisFactory::ApvAnalysisVector 00191 apvAnalysisVector( pApvFactory_->getApvAnalysis( connection().detId())); 00192 00193 SiStripPedestals::Range pedestalsRange( 00194 pDBPedestals->getRange( connection().detId() ) ); 00195 SiStripNoises::Range noisesRange( 00196 pDBNoises->getRange( connection().detId() ) ); 00197 00198 // Cache Apv Pair # 00199 const uint16_t nAPV_PAIR = connection().apvPairNumber(); 00200 00201 for( uint16_t nLclApv = 0; 2 > nLclApv; ++nLclApv) { 00202 // Retrieve pedestals and noises associated with given DetId/Apv 00203 ApvAnalysis::PedestalType pedestals; 00204 ApvAnalysis::PedestalType noises; 00205 for( uint16_t nStrip = nAPV_PAIR * 256 + nLclApv * 128, 00206 nMaxStrip = nStrip + 128; 00207 nMaxStrip > nStrip; 00208 ++nStrip) 00209 { 00210 pedestals.push_back( pDBPedestals->getPed( nStrip, pedestalsRange)); 00211 noises.push_back( pDBNoises->getNoise( nStrip, noisesRange)); 00212 } 00213 00214 try { 00215 // Checked access 00216 ApvAnalysisFactory::ApvAnalysisVector::reference rApvAnalysis = 00217 apvAnalysisVector.at( nAPV_PAIR * 2 + nLclApv); 00218 00219 rApvAnalysis->pedestalCalculator().setPedestals( pedestals); 00220 rApvAnalysis->pedestalCalculator().setNoise( noises); 00221 00222 /* 00223 std::stringstream out; 00224 LogTrace( mlDqmSource_) 00225 << "[NoiseTask::" << __func__ << "] " 00226 << "DetId|Apv# -> " 00227 << connection().detId() << '|' << ( nAPV_PAIR * 2 + nLclApv) 00228 << " Pedestals: " 00229 << ( out << pedestals 00230 << " Noises: " << noises, out.str()); 00231 */ 00232 } catch( std::out_of_range) { 00233 // Hmm, didn't find appropriate Apv :((( -> VERY, VERY BAD 00234 LogTrace( mlDqmSource_) 00235 << "[NoiseTask::" << __func__ << "] " 00236 << "Could not set Pedestals/Noises for DetId|Apv# -> " 00237 << connection().detId() << '|' << ( nAPV_PAIR * 2 + nLclApv) 00238 << ". !!! POSSIBLE BUG !!!"; 00239 } // End Try block 00240 } // End Local Apvs loop 00241 }
void NoiseTask::fill | ( | const SiStripEventSummary & | rSummary, | |
const edm::DetSet< SiStripRawDigi > & | rDigis | |||
) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 245 of file NoiseTask.cc.
References CommissioningTask::connection(), detId, pApvFactory_, and ApvAnalysisFactory::updatePair().
00247 { 00248 pApvFactory_->updatePair( connection().detId(), 00249 connection().apvPairNumber(), 00250 rDigis); 00251 }
void NoiseTask::update | ( | ) | [private, virtual] |
Reimplemented from CommissioningTask.
Definition at line 255 of file NoiseTask.cc.
References FedChannelConnection::apvPairNumber(), cm_, CommissioningTask::connection(), FedChannelConnection::detId(), detId, extract(), ApvAnalysisFactory::getCommonMode(), ApvAnalysisFactory::getNoise(), ApvAnalysisFactory::getPedestal(), histo, LogTrace, sistrip::mlDqmSource_, out, pApvFactory_, peds_, UpdateTProfile::setBinContent(), and CommissioningTask::updateHistoSet().
00256 { 00257 static UpdateTProfile updateTProfile; 00258 00259 TProfile *pedsProf = ExtractTObject<TProfile>().extract( peds_[0].histo() ); 00260 TProfile *noiseProf = ExtractTObject<TProfile>().extract( peds_[1].histo() ); 00261 00262 for( uint16_t nLclApv = 2 * connection().apvPairNumber(), 00263 nMaxLclApv = nLclApv + 2, 00264 nApv = 0; 00265 nMaxLclApv > nLclApv; 00266 ++nLclApv, ++nApv) 00267 { 00268 ApvAnalysis::PedestalType lclPedestals; 00269 ApvAnalysis::PedestalType lclNoises; 00270 ApvAnalysis::PedestalType lclCommonMode( 00271 pApvFactory_->getCommonMode( connection().detId(), nLclApv) ); 00272 00273 pApvFactory_->getPedestal ( connection().detId(), nLclApv, lclPedestals); 00274 pApvFactory_->getNoise ( connection().detId(), nLclApv, lclNoises ); 00275 00276 const uint16_t nSTART_BIN = 128 * ( nLclApv % 2); 00277 00278 for( uint16_t nBin = 0, 00279 nAbsBin = nSTART_BIN + nBin + 1; 00280 128 > nBin; 00281 ++nBin, ++nAbsBin) 00282 { 00283 updateTProfile.setBinContent( pedsProf, nAbsBin, 5, 00284 lclPedestals[nBin], lclNoises[nBin]); 00285 updateTProfile.setBinContent( noiseProf, nAbsBin, 5, 00286 lclNoises[nBin], 0); 00287 } // End loop over BINs 00288 00289 // Samvel: Assume Once CM value is calculated per chip. 00290 // In principle Chip can be divided into a several ranges. Then CM 00291 // will be calculated per range. !!! UPDATE CODE THEN !!! 00292 for( ApvAnalysis::PedestalType::const_iterator cmIterator 00293 = lclCommonMode.begin(); 00294 cmIterator != lclCommonMode.end(); 00295 ++cmIterator) 00296 { 00297 //uint32_t nCM = static_cast<uint32_t>( *cmIterator); 00298 //if( nCM >= 1024) nCM = 1023; 00299 //updateHistoSet( cm_[nApv], nCM); 00300 float nCM = static_cast<float>( *cmIterator ); 00301 updateHistoSet( cm_[nApv], nCM ); 00302 } 00303 00304 std::stringstream out; 00305 LogTrace( mlDqmSource_) 00306 << "[NoiseTask::" << __func__ << "] " 00307 << "DET ID [" << connection().detId() 00308 << "] has Common Mode size " << lclCommonMode.size() << " : " 00309 << ( out << lclCommonMode, out.str()); 00310 } // End loop over Local Apvs 00311 00312 updateHistoSet( cm_[0]); 00313 updateHistoSet( cm_[1]); 00314 }
std::vector<HistoSet> NoiseTask::cm_ [private] |
ApvAnalysisFactory* NoiseTask::pApvFactory_ [private] |
Definition at line 34 of file NoiseTask.h.
Referenced by book(), fill(), NoiseTask(), update(), and ~NoiseTask().
std::vector<HistoSet> NoiseTask::peds_ [private] |