CMS 3D CMS Logo

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

#include <OptoScanHistosUsingDb.h>

Inheritance diagram for OptoScanHistosUsingDb:
CommissioningHistosUsingDb OptoScanHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 OptoScanHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
 
void uploadConfigurations () override
 
 ~OptoScanHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
void configure (const edm::ParameterSet &, const edm::EventSetup &) override
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
 ~CommissioningHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from OptoScanHistograms
void histoAnalysis (bool debug) override
 
 OptoScanHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void printAnalyses () override
 
 ~OptoScanHistograms () override
 

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
 
void update (SiStripConfigDb::DeviceDescriptionsRange)
 

Private Attributes

bool allowSelectiveUpload_
 
bool skipGainUpdate_
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t, CommissioningAnalysis * > Analyses
 
typedef Analyses::iterator Analysis
 
typedef SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static void getContents (DQMStore *const, std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistosUsingDb
virtual void addDcuDetIds ()
 
void buildDetInfo ()
 
SiStripFedCabling *const cabling () const
 
virtual void createAnalyses (SiStripConfigDb::AnalysisDescriptionsV &)
 
SiStripConfigDb *const db () const
 
std::pair< std::string, DetInfodetInfo (const SiStripFecKey &)
 
bool deviceIsPresent (const SiStripFecKey &)
 
void uploadAnalyses ()
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata (bool getMaskedData=false)
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::unique_ptr< Factoryfactory_
 

Detailed Description

Definition at line 8 of file OptoScanHistosUsingDb.h.

Constructor & Destructor Documentation

OptoScanHistosUsingDb::OptoScanHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db 
)

Definition at line 13 of file OptoScanHistosUsingDb.cc.

References allowSelectiveUpload_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), LogTrace, sistrip::mlDqmClient_, CommissioningHistograms::pset(), and skipGainUpdate_.

16  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("OptoScanParameters"),
17  bei,
21  OptoScanHistograms( pset.getParameter<edm::ParameterSet>("OptoScanParameters"),
22  bei )
23 {
25  << "[OptoScanHistosUsingDb::" << __func__ << "]"
26  << " Constructing object...";
27  skipGainUpdate_ = this->pset().getParameter<bool>("SkipGainUpdate");
28  if (skipGainUpdate_)
30  << "[OptoScanHistosUsingDb::" << __func__ << "]"
31  << " Skipping db update of gain parameters.";
32 
33  allowSelectiveUpload_ = this->pset().existsAs<bool>("doSelectiveUpload")?this->pset().getParameter<bool>("doSelectiveUpload"):false;
36  << "[OptoScanHistosUsingDb::" << __func__ << "]"
37  << " Enabling selective upload of gain parameters";
38 
39 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
const edm::ParameterSet & pset() const
OptoScanHistograms(const edm::ParameterSet &pset, DQMStore *)
static const char mlDqmClient_[]
#define LogTrace(id)
DQMStore *const bei() const
OptoScanHistosUsingDb::~OptoScanHistosUsingDb ( )
override

Definition at line 43 of file OptoScanHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

43  {
45  << "[OptoScanHistosUsingDb::" << __func__ << "]"
46  << " Destructing object...";
47 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

void OptoScanHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
overrideprivatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 170 of file OptoScanHistosUsingDb.cc.

References OptoScanAnalysis::baseSlope(), OptoScanAnalysis::bias(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), CommissioningAnalysis::fecKey(), CommissioningAnalysis::fedKey(), OptoScanAnalysis::gain(), CommissioningAnalysis::getErrorCodes(), SiStripFecKey::i2cAddr(), OptoScanAnalysis::isValid(), OptoScanAnalysis::liftOff(), OptoScanAnalysis::linkNoise(), OptoScanAnalysis::measGain(), SiStripDbParams::partitions(), OptoScanAnalysis::threshold(), OptoScanAnalysis::tickHeight(), tmp, and OptoScanAnalysis::zeroLight().

171  {
172 
173  OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>( analysis->second );
174  if ( !anal ) { return; }
175 
176  SiStripFecKey fec_key( anal->fecKey() );
177  SiStripFedKey fed_key( anal->fedKey() );
178 
179  for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
180 
181  // Create description
182  OptoScanAnalysisDescription* tmp;
183  tmp = new OptoScanAnalysisDescription( anal->baseSlope()[0],
184  anal->baseSlope()[1],
185  anal->baseSlope()[2],
186  anal->baseSlope()[3],
187  anal->gain(),
188  anal->bias()[0],
189  anal->bias()[1],
190  anal->bias()[2],
191  anal->bias()[3],
192  anal->measGain()[0],
193  anal->measGain()[1],
194  anal->measGain()[2],
195  anal->measGain()[3],
196  anal->zeroLight()[0],
197  anal->zeroLight()[1],
198  anal->zeroLight()[2],
199  anal->zeroLight()[3],
200  anal->linkNoise()[0],
201  anal->linkNoise()[1],
202  anal->linkNoise()[2],
203  anal->linkNoise()[3],
204  anal->liftOff()[0],
205  anal->liftOff()[1],
206  anal->liftOff()[2],
207  anal->liftOff()[3],
208  anal->threshold()[0],
209  anal->threshold()[1],
210  anal->threshold()[2],
211  anal->threshold()[3],
212  anal->tickHeight()[0],
213  anal->tickHeight()[1],
214  anal->tickHeight()[2],
215  anal->tickHeight()[3],
216  fec_key.fecCrate(),
217  fec_key.fecSlot(),
218  fec_key.fecRing(),
219  fec_key.ccuAddr(),
220  fec_key.ccuChan(),
221  SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ),
222  db()->dbParams().partitions().begin()->second.partitionName(),
223  db()->dbParams().partitions().begin()->second.runNumber(),
224  anal->isValid(),
225  "",
226  fed_key.fedId(),
227  fed_key.feUnit(),
228  fed_key.feChan(),
229  fed_key.fedApv() );
230 
231  // Add comments
232  typedef std::vector<std::string> Strings;
233  Strings errors = anal->getErrorCodes();
234  Strings::const_iterator istr = errors.begin();
235  Strings::const_iterator jstr = errors.end();
236  for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
237 
238  // Store description
239  desc.push_back( tmp );
240 
241  }
242 
243 }
Histogram-based analysis for opto bias/gain scan.
const uint16_t & gain() const
const uint32_t & fedKey() const
const VFloat & baseSlope() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
const VFloat & liftOff() const
std::vector< std::string > Strings
Definition: MsgTools.h:18
const VFloat & linkNoise() const
const uint16_t & i2cAddr() const
const VFloat & measGain() const
const VFloat & tickHeight() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const_iterator_range partitions() const
const VFloat & zeroLight() const
const uint32_t & fecKey() const
const VInt & bias() const
const SiStripDbParams & dbParams() const
const VFloat & threshold() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Definition: errors.py:1
SiStripConfigDb *const db() const
const VString & getErrorCodes() const
bool isValid() const override
void OptoScanHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange  devices)
private

Definition at line 84 of file OptoScanHistosUsingDb.cc.

References allowSelectiveUpload_, OptoScanAnalysis::bias(), SiStripFecKey::ccuAddr(), SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripFecKey::ccuChan(), SiStripConfigDb::DeviceAddress::ccuChan_, SiStripKey::channel(), sistrip::CHANS_PER_LLD, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, OptoScanAnalysis::gain(), muonCSCDigis_cfi::gain, SiStripKey::key(), LogTrace, sistrip::mlDqmClient_, and skipGainUpdate_.

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(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and uploadConfigurations().

84  {
85 
86  // Iterate through devices and update device descriptions
87  uint16_t updated = 0;
88  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
89  for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
90 
91  if ( (*idevice)->getDeviceType() != LASERDRIVER ) { continue; }
92 
93  // Cast to retrieve appropriate description object
94  laserdriverDescription* desc = dynamic_cast<laserdriverDescription*>( *idevice );
95  if ( !desc ) { continue; }
96 
97  // Retrieve device addresses from device description
98  const SiStripConfigDb::DeviceAddress& addr = db()->deviceAddress(*desc);
99 
100  // Iterate through LLD channels
101  for ( uint16_t ichan = 0; ichan < sistrip::CHANS_PER_LLD; ichan++ ) {
102 
103  // Construct key from device description
104  SiStripFecKey fec_key( addr.fecCrate_,
105  addr.fecSlot_,
106  addr.fecRing_,
107  addr.ccuAddr_,
108  addr.ccuChan_,
109  ichan+1 );
110 
111  // Iterate through all channels and extract LLD settings
112  Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() );
113  if ( iter != data(allowSelectiveUpload_).end() ) {
114 
115  OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>( iter->second );
116  if ( !anal ) {
118  << "[OptoScanHistosUsingDb::" << __func__ << "]"
119  << " NULL pointer to analysis object!";
120  continue;
121  }
122 
123  uint16_t gain = anal->gain();
124  std::stringstream ss;
125  ss << "[OptoScanHistosUsingDb::" << __func__ << "]"
126  << " Updating LLD gain/bias settings for crate/crate/FEC/ring/CCU/module/LLD "
127  << fec_key.fecCrate() << "/"
128  << fec_key.fecSlot() << "/"
129  << fec_key.fecRing() << "/"
130  << fec_key.ccuAddr() << "/"
131  << fec_key.ccuChan() << "/"
132  << fec_key.channel()
133  << " from "
134  << static_cast<uint16_t>( desc->getGain(ichan) ) << "/"
135  << static_cast<uint16_t>( desc->getBias(ichan) );
136  if (!skipGainUpdate_) desc->setGain( ichan, gain );
137  desc->setBias( ichan, anal->bias()[gain] );
138  updated++;
139  ss << " to "
140  << static_cast<uint16_t>(desc->getGain(ichan)) << "/"
141  << static_cast<uint16_t>(desc->getBias(ichan));
142  LogTrace(mlDqmClient_) << ss.str();
143 
144  } else {
145  if ( deviceIsPresent(fec_key) ) {
147  << "[OptoScanHistosUsingDb::" << __func__ << "]"
148  << " Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD "
149  << fec_key.fecCrate() << "/"
150  << fec_key.fecSlot() << "/"
151  << fec_key.fecRing() << "/"
152  << fec_key.ccuAddr() << "/"
153  << fec_key.ccuChan() << "/"
154  << fec_key.channel();
155  }
156  }
157  }
158  }
159 
161  << "[OptoScanHistosUsingDb::" << __func__ << "]"
162  << " Updated LLD bias/gain settings for "
163  << updated << " modules";
164 
165 
166 }
Histogram-based analysis for opto bias/gain scan.
const uint16_t & gain() const
Analyses & data(bool getMaskedData=false)
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static const uint16_t CHANS_PER_LLD
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
const VInt & bias() const
SiStripConfigDb *const db() const
void OptoScanHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 51 of file OptoScanHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), LogTrace, sistrip::mlDqmClient_, update(), and SiStripConfigDb::uploadDeviceDescriptions().

51  {
53  << "[OptoScanHistosUsingDb::" << __func__ << "]";
54 
55  if ( !db() ) {
57  << "[OptoScanHistosUsingDb::" << __func__ << "]"
58  << " NULL pointer to SiStripConfigDb interface!"
59  << " Aborting upload...";
60  return;
61  }
62 
63  // Update LLD descriptions with new bias/gain settings
65  update( devices );
66  if ( doUploadConf() ) {
68  << "[OptoScanHistosUsingDb::" << __func__ << "]"
69  << " Uploading LLD settings to DB...";
72  << "[OptoScanHistosUsingDb::" << __func__ << "]"
73  << " Upload of LLD settings to DB finished!";
74  } else {
76  << "[OptoScanHistosUsingDb::" << __func__ << "]"
77  << " TEST only! No LLD settings will be uploaded to DB...";
78  }
79 
80 }
static const char mlDqmClient_[]
void update(SiStripConfigDb::DeviceDescriptionsRange)
DeviceDescriptions::range DeviceDescriptionsRange
#define LogTrace(id)
SiStripConfigDb *const db() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
void uploadDeviceDescriptions(std::string partition="")

Member Data Documentation

bool OptoScanHistosUsingDb::allowSelectiveUpload_
private

Definition at line 29 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().

bool OptoScanHistosUsingDb::skipGainUpdate_
private

Definition at line 27 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().