CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
NoiseTask Class Reference

#include <NoiseTask.h>

Inheritance diagram for NoiseTask:
CommissioningTask

Public Member Functions

 NoiseTask (DQMStore *, const FedChannelConnection &)
 
 ~NoiseTask () override
 
- Public Member Functions inherited from CommissioningTask
void bookHistograms ()
 
 CommissioningTask (DQMStore *, const FedChannelConnection &, const std::string &my_name)
 
void eventSetup (const edm::EventSetup *)
 
const uint32_t & fillCntr () const
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &, const edm::DetSet< SiStripRawDigi > &)
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &, const edm::DetSet< SiStripRawDigi > &, const std::vector< uint16_t > &)
 
void fillHistograms (const SiStripEventSummary &, const uint16_t &fed_id, const std::map< uint16_t, float > &fed_ch)
 
const std::string & myName () const
 
const uint32_t & updateFreq () const
 
void updateFreq (const uint32_t &)
 
void updateHistograms ()
 
virtual ~CommissioningTask ()
 

Private Member Functions

void book () override
 
void fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
 
void update () override
 

Private Attributes

std::vector< HistoSetcm_
 
ApvAnalysisFactorypApvFactory_
 
std::vector< HistoSetpeds_
 

Additional Inherited Members

- Public Types inherited from CommissioningTask
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from CommissioningTask
const FedChannelConnectionconnection () const
 
DQMStore *const dqm () const
 
const edm::EventSetup *const eventSetup () const
 
const uint32_t & fecKey () const
 
const uint32_t & fedKey () const
 
void updateHistoSet (HistoSet &, const uint32_t &bin, const float &value)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin, const short &value)
 
void updateHistoSet (HistoSet &, const uint32_t &bin)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin)
 
void updateHistoSet (HistoSet &, const float &value)
 
void updateHistoSet (CompactHistoSet &)
 
void updateHistoSet (HistoSet &)
 

Detailed Description

Definition at line 19 of file NoiseTask.h.

Constructor & Destructor Documentation

NoiseTask::NoiseTask ( DQMStore dqm,
const FedChannelConnection conn 
)

Definition at line 32 of file NoiseTask.cc.

References LogTrace, sistrip::mlDqmSource_, Utilities::operator, and pApvFactory_.

32  : CommissioningTask(dqm, conn, "NoiseTask") {
33  //@@ NOT GUARANTEED TO BE THREAD SAFE!
34  pApvFactory_ = edm::Service<ApvFactoryService>().operator->()->getApvFactory();
35 
36  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "]"
37  << " Constructing object...";
38 }
static const char mlDqmSource_[]
ApvAnalysisFactory * pApvFactory_
Definition: NoiseTask.h:32
#define LogTrace(id)
NoiseTask::~NoiseTask ( )
override

Definition at line 42 of file NoiseTask.cc.

References LogTrace, sistrip::mlDqmSource_, and pApvFactory_.

42  {
43  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "]"
44  << " Destructing object...";
45 
46  // Have to delete pApvFactory_ manually even though we didn't create it
47  // ourself. :(
48  if (pApvFactory_) {
49  delete pApvFactory_;
50  }
51 }
static const char mlDqmSource_[]
ApvAnalysisFactory * pApvFactory_
Definition: NoiseTask.h:32
#define LogTrace(id)

Member Function Documentation

void NoiseTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 55 of file NoiseTask.cc.

References sistrip::APV, FedChannelConnection::apvPairNumber(), cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), FedChannelConnection::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_, hgcalLayerClusters_cff::noises, pApvFactory_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, peds_, RecoTauValidation_cfi::reference, AlCaHLTBitMon_QueryRunRegistry::string, overlapproblemtsosanalyzer_cfi::title, SiStripHistoTitle::title(), CommissioningTask::HistoSet::vNumOfEntries_, CommissioningTask::HistoSet::vSumOfContents_, and CommissioningTask::HistoSet::vSumOfSquares_.

55  {
56  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "]";
57 
58  // CACHING
59  static std::unique_ptr<SiStripPedestals> pDBPedestals;
60  static std::unique_ptr<SiStripNoises> pDBNoises;
61 
62  const uint16_t nBINS = 256;
63 
64  {
65  // Pedestals
69  fedKey(),
71  connection().lldChannel(),
73  .title();
74 
75  HistoSet oHSet;
76  oHSet.isProfile_ = true;
77 
78  oHSet.vNumOfEntries_.resize(nBINS, 0);
79  oHSet.vSumOfContents_.resize(nBINS, 0);
80  oHSet.vSumOfSquares_.resize(nBINS, 0);
81 
82  oHSet.histo(dqm()->bookProfile(title, title, nBINS, -0.5, nBINS * 1. - 0.5, 1025, 0., 1025.));
83 
84  peds_.push_back(oHSet);
85  }
86 
87  {
88  // Corrected Noise
92  fedKey(),
94  connection().lldChannel(),
96  .title();
97 
98  HistoSet oHSet;
99  oHSet.isProfile_ = true;
100 
101  oHSet.vNumOfEntries_.resize(nBINS, 0);
102  oHSet.vSumOfContents_.resize(nBINS, 0);
103  oHSet.vSumOfSquares_.resize(nBINS, 0);
104 
105  oHSet.histo(dqm()->bookProfile(title, title, nBINS, -0.5, nBINS * 1. - 0.5, 1025, 0., 1025.));
106 
107  peds_.push_back(oHSet);
108  }
109 
110  const uint16_t nCM_BINS = 1024;
111  for (uint16_t nApv = 0; 2 > nApv; ++nApv) {
115  fedKey(),
116  sistrip::APV,
117  connection().i2cAddr(nApv),
119  .title();
120 
121  HistoSet oHSet;
122 
123  oHSet.isProfile_ = false;
124 
125  oHSet.vNumOfEntries_.resize(nCM_BINS, 0);
126 
127  oHSet.histo(dqm()->book1D(title, title, nCM_BINS, nCM_BINS / 2 * -1. - 0.5, nCM_BINS / 2 * 1. - 0.5));
128 
129  cm_.push_back(oHSet);
130  }
131 
132  // Initialize Apv
133  pApvFactory_->instantiateApvs(connection().detId(), connection().nApvs());
134 
135  // --[ RETRIEVE PEDESTALS FROM DB ]--
136  // Operation should be performed only once
137  if (!pDBPedestals.get()) {
138  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
139  << "Retrieving Pedestals from DB";
140 
141  // Directly retrieve Pedestals from EventSetup
143  eventSetup()->get<SiStripPedestalsRcd>().get(pedestals);
144 
145  // Cache Pedestals
146  pDBPedestals.reset(new SiStripPedestals(*pedestals));
147 
148  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
149  << "Done Retrieving Pedestals from DB";
150  } // End retrieve Pedestals from DB
151 
152  // --[ RETRIEVE NOISES FROM DB ]--
153  // Operation should be performed only once
154  if (!pDBNoises.get()) {
155  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
156  << "Retrieving Noises from DB";
157 
158  // Directly retrieve Noises from EventSetup
160  eventSetup()->get<SiStripNoisesRcd>().get(noises);
161 
162  // Cache Pedestals
163  pDBNoises.reset(new SiStripNoises(*noises));
164 
165  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
166  << "Done Retrieving Noises from DB";
167  } // End retrieve Noises from DB
168 
169  // Get ApvAnalysis associated with given DetId
171 
172  SiStripPedestals::Range pedestalsRange(pDBPedestals->getRange(connection().detId()));
173  SiStripNoises::Range noisesRange(pDBNoises->getRange(connection().detId()));
174 
175  // Cache Apv Pair #
176  const uint16_t nAPV_PAIR = connection().apvPairNumber();
177 
178  for (uint16_t nLclApv = 0; 2 > nLclApv; ++nLclApv) {
179  // Retrieve pedestals and noises associated with given DetId/Apv
180  ApvAnalysis::PedestalType pedestals;
182  for (uint16_t nStrip = nAPV_PAIR * 256 + nLclApv * 128, nMaxStrip = nStrip + 128; nMaxStrip > nStrip; ++nStrip) {
183  pedestals.push_back(pDBPedestals->getPed(nStrip, pedestalsRange));
184  noises.push_back(pDBNoises->getNoise(nStrip, noisesRange));
185  }
186 
187  try {
188  // Checked access
189  ApvAnalysisFactory::ApvAnalysisVector::reference rApvAnalysis = apvAnalysisVector.at(nAPV_PAIR * 2 + nLclApv);
190 
191  rApvAnalysis->pedestalCalculator().setPedestals(pedestals);
192  rApvAnalysis->pedestalCalculator().setNoise(noises);
193 
194  /*
195  std::stringstream out;
196  LogTrace( mlDqmSource_)
197  << "[NoiseTask::" << __func__ << "] "
198  << "DetId|Apv# -> "
199  << connection().detId() << '|' << ( nAPV_PAIR * 2 + nLclApv)
200  << " Pedestals: "
201  << ( out << pedestals
202  << " Noises: " << noises, out.str());
203  */
204  } catch (std::out_of_range const &) {
205  // Hmm, didn't find appropriate Apv :((( -> VERY, VERY BAD
206  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
207  << "Could not set Pedestals/Noises for DetId|Apv# -> " << connection().detId() << '|'
208  << (nAPV_PAIR * 2 + nLclApv) << ". !!! POSSIBLE BUG !!!";
209  } // End Try block
210  } // End Local Apvs loop
211 }
static const char noise_[]
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
Utility class that holds histogram title.
const std::string & title() const
static const char mlDqmSource_[]
uint16_t apvPairNumber() const
ApvAnalysisFactory * pApvFactory_
Definition: NoiseTask.h:32
std::pair< ContainerIterator, ContainerIterator > Range
const uint32_t & detId() const
DQMStore *const dqm() const
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
std::vector< HistoSet > cm_
Definition: NoiseTask.h:30
static const char commonMode_[]
#define LogTrace(id)
std::vector< ApvAnalysis * > ApvAnalysisVector
std::vector< HistoSet > peds_
Definition: NoiseTask.h:29
static const char pedestals_[]
ApvAnalysisVector getApvAnalysis(const uint32_t nDET_ID)
T get() const
Definition: EventSetup.h:73
const edm::EventSetup *const eventSetup() const
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
void NoiseTask::fill ( const SiStripEventSummary rSummary,
const edm::DetSet< SiStripRawDigi > &  rDigis 
)
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 215 of file NoiseTask.cc.

References CommissioningTask::connection(), pApvFactory_, and ApvAnalysisFactory::updatePair().

215  {
216  pApvFactory_->updatePair(connection().detId(), connection().apvPairNumber(), rDigis);
217 }
ApvAnalysisFactory * pApvFactory_
Definition: NoiseTask.h:32
void updatePair(uint32_t det_id, size_t apvPair, const edm::DetSet< SiStripRawDigi > &in)
const FedChannelConnection & connection() const
void NoiseTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 221 of file NoiseTask.cc.

References FedChannelConnection::apvPairNumber(), cm_, CommissioningTask::connection(), FedChannelConnection::detId(), extract(), ApvAnalysisFactory::getCommonMode(), ApvAnalysisFactory::getNoise(), ApvAnalysisFactory::getPedestal(), timingPdfMaker::histo, LogTrace, sistrip::mlDqmSource_, PFElectronDQMAnalyzer_cfi::nBin, MillePedeFileConverter_cfg::out, pApvFactory_, peds_, UpdateTProfile::setBinContent(), and CommissioningTask::updateHistoSet().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

221  {
222  static UpdateTProfile updateTProfile;
223 
224  TProfile *pedsProf = ExtractTObject<TProfile>().extract(peds_[0].histo());
225  TProfile *noiseProf = ExtractTObject<TProfile>().extract(peds_[1].histo());
226 
227  for (uint16_t nLclApv = 2 * connection().apvPairNumber(), nMaxLclApv = nLclApv + 2, nApv = 0; nMaxLclApv > nLclApv;
228  ++nLclApv, ++nApv) {
229  ApvAnalysis::PedestalType lclPedestals;
230  ApvAnalysis::PedestalType lclNoises;
231  ApvAnalysis::PedestalType lclCommonMode(pApvFactory_->getCommonMode(connection().detId(), nLclApv));
232 
233  pApvFactory_->getPedestal(connection().detId(), nLclApv, lclPedestals);
234  pApvFactory_->getNoise(connection().detId(), nLclApv, lclNoises);
235 
236  const uint16_t nSTART_BIN = 128 * (nLclApv % 2);
237 
238  for (uint16_t nBin = 0, nAbsBin = nSTART_BIN + nBin + 1; 128 > nBin; ++nBin, ++nAbsBin) {
239  updateTProfile.setBinContent(pedsProf, nAbsBin, 5, lclPedestals[nBin], lclNoises[nBin]);
240  updateTProfile.setBinContent(noiseProf, nAbsBin, 5, lclNoises[nBin], 0);
241  } // End loop over BINs
242 
243  // Samvel: Assume Once CM value is calculated per chip.
244  // In principle Chip can be divided into a several ranges. Then CM
245  // will be calculated per range. !!! UPDATE CODE THEN !!!
246  for (ApvAnalysis::PedestalType::const_iterator cmIterator = lclCommonMode.begin();
247  cmIterator != lclCommonMode.end();
248  ++cmIterator) {
249  //uint32_t nCM = static_cast<uint32_t>( *cmIterator);
250  //if( nCM >= 1024) nCM = 1023;
251  //updateHistoSet( cm_[nApv], nCM);
252  float nCM = static_cast<float>(*cmIterator);
253  updateHistoSet(cm_[nApv], nCM);
254  }
255 
256  std::stringstream out;
257  LogTrace(mlDqmSource_) << "[NoiseTask::" << __func__ << "] "
258  << "DET ID [" << connection().detId() << "] has Common Mode size " << lclCommonMode.size()
259  << " : " << (out << lclCommonMode, out.str());
260  } // End loop over Local Apvs
261 
262  updateHistoSet(cm_[0]);
263  updateHistoSet(cm_[1]);
264 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
void getNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
static const char mlDqmSource_[]
uint16_t apvPairNumber() const
ApvAnalysisFactory * pApvFactory_
Definition: NoiseTask.h:32
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
const uint32_t & detId() const
std::vector< HistoSet > cm_
Definition: NoiseTask.h:30
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
#define LogTrace(id)
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
std::vector< HistoSet > peds_
Definition: NoiseTask.h:29
int extract(std::vector< int > *output, const std::string &dati)
const FedChannelConnection & connection() const

Member Data Documentation

std::vector<HistoSet> NoiseTask::cm_
private

Definition at line 30 of file NoiseTask.h.

Referenced by book(), and update().

ApvAnalysisFactory* NoiseTask::pApvFactory_
private

Definition at line 32 of file NoiseTask.h.

Referenced by book(), fill(), NoiseTask(), update(), and ~NoiseTask().

std::vector<HistoSet> NoiseTask::peds_
private

Definition at line 29 of file NoiseTask.h.

Referenced by book(), and update().