CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ApvTimingHistosUsingDb Class Reference

#include <ApvTimingHistosUsingDb.h>

Inheritance diagram for ApvTimingHistosUsingDb:
CommissioningHistosUsingDb ApvTimingHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 ApvTimingHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
 
virtual void uploadConfigurations ()
 
virtual ~ApvTimingHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
virtual ~CommissioningHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
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 printAnalyses ()
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0)
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from ApvTimingHistograms
 ApvTimingHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void histoAnalysis (bool debug)
 
virtual ~ApvTimingHistograms ()
 

Private Member Functions

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

Private Attributes

bool skipFecUpdate_
 
bool skipFedUpdate_
 

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,
Histos
HistosMap
 
- 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 ()
 
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::auto_ptr< Factoryfactory_
 

Detailed Description

Definition at line 9 of file ApvTimingHistosUsingDb.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file ApvTimingHistosUsingDb.cc.

References edm::ParameterSet::getParameter(), LogTrace, sistrip::mlDqmClient_, CommissioningHistograms::pset(), skipFecUpdate_, and skipFedUpdate_.

18  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("ApvTimingParameters"),
19  bei,
23  ApvTimingHistograms( pset.getParameter<edm::ParameterSet>("ApvTimingParameters"),
24  bei )
25 {
27  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
28  << " Constructing object...";
29  skipFecUpdate_ = this->pset().getParameter<bool>("SkipFecUpdate");
30  skipFedUpdate_ = this->pset().getParameter<bool>("SkipFedUpdate");
31  if (skipFecUpdate_)
33  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
34  << " Skipping update of FEC parameters.";
35  if (skipFedUpdate_)
37  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
38  << " Skipping update of FED parameters.";
39 }
T getParameter(std::string const &) const
const edm::ParameterSet & pset() const
static const char mlDqmClient_[]
#define LogTrace(id)
ApvTimingHistograms(const edm::ParameterSet &pset, DQMStore *)
ApvTimingHistosUsingDb::~ApvTimingHistosUsingDb ( )
virtual

Definition at line 43 of file ApvTimingHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

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

Member Function Documentation

void ApvTimingHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
privatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 400 of file ApvTimingHistosUsingDb.cc.

References ApvTimingAnalysis::base(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), ApvTimingAnalysis::delay(), benchmark_cfg::errors, CommissioningAnalysis::fecKey(), CommissioningAnalysis::fedKey(), ApvTimingAnalysis::frameFindingThreshold(), CommissioningAnalysis::getErrorCodes(), ApvTimingAnalysis::height(), SiStripFecKey::i2cAddr(), ApvTimingAnalysis::isValid(), ApvTimingAnalysis::optimumSamplingPoint(), SiStripDbParams::partitions(), ApvTimingAnalysis::peak(), ApvTimingAnalysis::refTime(), ApvTimingAnalysis::tickMarkHeightThreshold_, ApvTimingAnalysis::time(), and tmp.

401  {
402 
403  ApvTimingAnalysis* anal = dynamic_cast<ApvTimingAnalysis*>( analysis->second );
404  if ( !anal ) { return; }
405 
406  SiStripFecKey fec_key( anal->fecKey() );
407  SiStripFedKey fed_key( anal->fedKey() );
408 
409  for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
410 
411 // std::stringstream ss;
412 // if ( anal->isValid() ) { ss << " TEST VALID "; }
413 // else { ss << " TEST INVALID "; }
414 // ss << std::hex << anal->fecKey() << std::dec << " "
415 // << anal->base() << " "
416 // << anal->peak() << " "
417 // << anal->height() << " "
418 // << ( anal->base() + anal->height() * ApvTimingAnalysis::frameFindingThreshold_ ) << " "
419 // << anal->frameFindingThreshold();
420 // edm::LogError("TEST") << ss.str();
421 
422  // Create description
423  TimingAnalysisDescription* tmp;
424  tmp = new TimingAnalysisDescription( anal->time(),
425  anal->refTime(),
426  anal->delay(),
427  anal->height(),
428  anal->base(),
429  anal->peak(),
430  anal->frameFindingThreshold(),
431  anal->optimumSamplingPoint(),
433  true, //@@ APV timing analysis (not FED timing)
434  fec_key.fecCrate(),
435  fec_key.fecSlot(),
436  fec_key.fecRing(),
437  fec_key.ccuAddr(),
438  fec_key.ccuChan(),
439  SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ),
440  db()->dbParams().partitions().begin()->second.partitionName(),
441  db()->dbParams().partitions().begin()->second.runNumber(),
442  anal->isValid(),
443  "",
444  fed_key.fedId(),
445  fed_key.feUnit(),
446  fed_key.feChan(),
447  fed_key.fedApv() );
448 
449  // Add comments
450  typedef std::vector<std::string> Strings;
451  Strings errors = anal->getErrorCodes();
452  Strings::const_iterator istr = errors.begin();
453  Strings::const_iterator jstr = errors.end();
454  for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
455 
456  // Store description
457  desc.push_back( tmp );
458 
459  }
460 
461 }
const uint32_t & fedKey() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:57
std::vector< std::string > Strings
Definition: MsgTools.h:18
const float & refTime() const
static const float tickMarkHeightThreshold_
const float & optimumSamplingPoint() const
const uint16_t & i2cAddr() const
const float & base() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
const_iterator_range partitions() const
const uint32_t & fecKey() const
const float & peak() const
const float & time() const
const float & delay() const
uint16_t frameFindingThreshold() const
const SiStripDbParams & dbParams() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
SiStripConfigDb *const db() const
Analysis for timing run using APV tick marks.
const VString & getErrorCodes() const
const float & height() const
bool ApvTimingHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange  devices)
private

Definition at line 130 of file ApvTimingHistosUsingDb.cc.

References SiStripFecKey::ccuAddr(), SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripFecKey::ccuChan(), SiStripConfigDb::DeviceAddress::ccuChan_, SiStripKey::channel(), sistrip::CHANS_PER_LLD, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), ApvTimingAnalysis::delay(), SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, align::invalid, sistrip::invalid_, edm::isDebugEnabled(), SiStripKey::key(), LogTrace, and sistrip::mlDqmClient_.

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and uploadConfigurations().

130  {
131 
132  // Iterate through devices and update device descriptions
133  uint16_t updated = 0;
134  std::vector<SiStripFecKey> invalid;
135  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
136 
137  for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
138 
139  // Check device type
140  if ( (*idevice)->getDeviceType() != PLL ) { continue; }
141 
142  // Cast to retrieve appropriate description object
143  pllDescription* desc = dynamic_cast<pllDescription*>( *idevice );
144  if ( !desc ) { continue; }
145 
146  // Retrieve device addresses from device description
147  const SiStripConfigDb::DeviceAddress& addr = db()->deviceAddress(*desc);
148  SiStripFecKey fec_path;
149 
150  // PLL delay settings
151  uint32_t coarse = sistrip::invalid_;
152  uint32_t fine = sistrip::invalid_;
153 
154  // Iterate through LLD channels
155  for ( uint16_t ichan = 0; ichan < sistrip::CHANS_PER_LLD; ichan++ ) {
156 
157  // Construct key from device description
158  SiStripFecKey fec_key( addr.fecCrate_,
159  addr.fecSlot_,
160  addr.fecRing_,
161  addr.ccuAddr_,
162  addr.ccuChan_,
163  ichan+1 );
164  fec_path = fec_key;
165 
166  // Locate appropriate analysis object
167  Analyses::const_iterator iter = data().find( fec_key.key() );
168  if ( iter != data().end() ) {
169 
170  ApvTimingAnalysis* anal = dynamic_cast<ApvTimingAnalysis*>( iter->second );
171  if ( !anal ) {
173  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
174  << " NULL pointer to analysis object!";
175  continue;
176  }
177 
178  // Calculate coarse and fine delays
179  int32_t delay = static_cast<int32_t>( rint( anal->delay() )*24./25 );
180  // first set course delay
181  coarse = static_cast<uint16_t>( desc->getDelayCoarse() + (delay/24) )
182  + ( static_cast<uint16_t>( desc->getDelayFine() ) + (delay%24) ) / 24;
183  delay = delay % 24; // only bother with fine delay now
184  if ( ( static_cast<uint16_t>( desc->getDelayFine() ) + delay ) % 24 < 0 ) {
185  coarse -= 1;
186  delay += 24;
187  }
188  fine = ( static_cast<uint16_t>( desc->getDelayFine() ) + delay ) % 24;
189 
190  // Record PPLs maximum coarse setting
191  if ( coarse > 15 ) { invalid.push_back(fec_key); }
192 
193  } else {
194  if ( deviceIsPresent(fec_key) ) {
196  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
197  << " Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD: "
198  << fec_key.fecCrate() << "/"
199  << fec_key.fecSlot() << "/"
200  << fec_key.fecRing() << "/"
201  << fec_key.ccuAddr() << "/"
202  << fec_key.ccuChan() << "/"
203  << fec_key.channel();
204  }
205  }
206 
207  // Exit LLD channel loop if coarse and fine delays are known
208  if ( coarse != sistrip::invalid_ &&
209  fine != sistrip::invalid_ ) { break; }
210 
211  } // lld channel loop
212 
213  // Update PLL settings
214  if ( coarse != sistrip::invalid_ &&
215  fine != sistrip::invalid_ ) {
216 
217  std::stringstream ss;
218  if ( edm::isDebugEnabled() ) {
219  ss << "[ApvTimingHistosUsingDb::" << __func__ << "]"
220  << " Updating coarse/fine PLL settings"
221  << " for crate/FEC/ring/CCU/module "
222  << fec_path.fecCrate() << "/"
223  << fec_path.fecSlot() << "/"
224  << fec_path.fecRing() << "/"
225  << fec_path.ccuAddr() << "/"
226  << fec_path.ccuChan()
227  << " from "
228  << static_cast<uint16_t>( desc->getDelayCoarse() ) << "/"
229  << static_cast<uint16_t>( desc->getDelayFine() );
230  }
231  desc->setDelayCoarse(coarse);
232  desc->setDelayFine(fine);
233  updated++;
234  if ( edm::isDebugEnabled() ) {
235  ss << " to "
236  << static_cast<uint16_t>( desc->getDelayCoarse() ) << "/"
237  << static_cast<uint16_t>( desc->getDelayFine() );
238  LogTrace(mlDqmClient_) << ss.str();
239  }
240 
241  } else {
243  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
244  << " Invalid PLL delay settings course/fine = "
245  << coarse << "/" << fine
246  << " for crate/FEC/ring/CCU/module "
247  << fec_path.fecCrate() << "/"
248  << fec_path.fecSlot() << "/"
249  << fec_path.fecRing() << "/"
250  << fec_path.ccuAddr() << "/"
251  << fec_path.ccuChan();
252  }
253 
254  }
255 
256  // Check if invalid settings were found
257  if ( !invalid.empty() ) {
258  std::stringstream ss;
259  ss << "[ApvTimingHistosUsingDb::" << __func__ << "]"
260  << " Found PLL coarse setting of >15"
261  << " (not allowed!) for "
262  << invalid.size()
263  << " channels";
264  ss << " (Example is crate/FEC/ring/CCU/module/LLD: "
265  << invalid.front().fecCrate() << "/"
266  << invalid.front().fecSlot() << "/"
267  << invalid.front().fecRing() << "/"
268  << invalid.front().ccuAddr() << "/"
269  << invalid.front().ccuChan() << "/"
270  << invalid.front().channel();
271  edm::LogWarning(mlDqmClient_) << ss.str();
272  return false;
273  }
274 
276  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
277  << " Updated PLL settings for "
278  << updated << " modules";
279  return true;
280 
281 }
bool isDebugEnabled()
const uint16_t & fecRing() const
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
const uint16_t & fecSlot() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
static const uint16_t CHANS_PER_LLD
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
const float & delay() const
const uint16_t & fecCrate() const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:17
const uint16_t & ccuChan() const
SiStripConfigDb *const db() const
Analysis for timing run using APV tick marks.
void ApvTimingHistosUsingDb::update ( SiStripConfigDb::FedDescriptionsRange  feds)
private

Definition at line 285 of file ApvTimingHistosUsingDb.cc.

References ApvTimingAnalysis::base(), CommissioningHistosUsingDb::cabling(), FedChannelConnection::ccuAddr(), FedChannelConnection::ccuChan(), SiStripFedCabling::connection(), CommissioningHistograms::data(), CommissioningHistosUsingDb::deviceIsPresent(), FedChannelConnection::fecCrate(), SiStripFedKey::feChan(), FedChannelConnection::fecRing(), FedChannelConnection::fecSlot(), FedChannelConnection::fedCh(), sistrip::FEDCH_PER_FED, SiStripFedKey::fedChannel(), SiStripFedKey::fedId(), FedChannelConnection::fedId(), SiStripFedCabling::feds(), SiStripFedKey::feUnit(), spr::find(), ApvTimingAnalysis::frameFindingThreshold(), ApvTimingAnalysis::height(), sistrip::invalid_, ApvTimingAnalysis::isValid(), SiStripKey::key(), FedChannelConnection::lldChannel(), sistrip::mlDqmClient_, ApvTimingAnalysis::peak(), and ApvTimingAnalysis::print().

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

285  {
286 
287  // Retrieve FED ids from cabling
288  std::vector<uint16_t> ids = cabling()->feds();
289 
290  // Iterate through feds and update fed descriptions
291  uint16_t updated = 0;
292  SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
293  for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
294 
295  // If FED id not found in list (from cabling), then continue
296  if ( find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) { continue; }
297 
298  for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) {
299 
300  // Build FED and FEC keys
301  const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan );
302  if ( conn.fecCrate() == sistrip::invalid_ ||
303  conn.fecSlot() == sistrip::invalid_ ||
304  conn.fecRing() == sistrip::invalid_ ||
305  conn.ccuAddr() == sistrip::invalid_ ||
306  conn.ccuChan() == sistrip::invalid_ ||
307  conn.lldChannel() == sistrip::invalid_ ) { continue; }
308  SiStripFedKey fed_key( conn.fedId(),
309  SiStripFedKey::feUnit( conn.fedCh() ),
310  SiStripFedKey::feChan( conn.fedCh() ) );
311  SiStripFecKey fec_key( conn.fecCrate(),
312  conn.fecSlot(),
313  conn.fecRing(),
314  conn.ccuAddr(),
315  conn.ccuChan(),
316  conn.lldChannel() );
317 
318  // Locate appropriate analysis object
319  Analyses::const_iterator iter = data().find( fec_key.key() );
320  if ( iter != data().end() ) {
321 
322  ApvTimingAnalysis* anal = dynamic_cast<ApvTimingAnalysis*>( iter->second );
323  if ( !anal ) {
325  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
326  << " NULL pointer to analysis object!";
327  continue;
328  }
329 
330  // Update frame finding threshold
331  Fed9U::Fed9UAddress addr( ichan );
332  uint16_t old_threshold = static_cast<uint16_t>( (*ifed)->getFrameThreshold( addr ) );
333  if ( anal->isValid() ) {
334  (*ifed)->setFrameThreshold( addr, anal->frameFindingThreshold() );
335  updated++;
336  }
337  uint16_t new_threshold = static_cast<uint16_t>( (*ifed)->getFrameThreshold( addr ) );
338 
339  // Debug
340  std::stringstream ss;
341  ss << "[ApvTimingHistosUsingDb::" << __func__ << "]";
342  if ( anal->isValid() ) {
343  ss << " Updating the frame-finding threshold"
344  << " from " << old_threshold
345  << " to " << new_threshold
346  << " using tick mark base/peak/height "
347  << anal->base() << "/"
348  << anal->peak() << "/"
349  << anal->height();
350  } else {
351  ss << " Cannot update the frame-finding threshold"
352  << " from " << old_threshold
353  << " to a new value using invalid analysis ";
354  }
355  ss << " for crate/FEC/ring/CCU/module/LLD "
356  << fec_key.fecCrate() << "/"
357  << fec_key.fecSlot() << "/"
358  << fec_key.fecRing() << "/"
359  << fec_key.ccuAddr() << "/"
360  << fec_key.ccuChan()
361  << fec_key.channel()
362  << " and FED id/ch "
363  << fed_key.fedId() << "/"
364  << fed_key.fedChannel();
365  anal->print(ss);
366  //LogTrace(mlDqmClient_) << ss.str();
367 
368  } else {
369  if ( deviceIsPresent(fec_key) ) {
370  std::stringstream ss;
371  ss << "[ApvTimingHistosUsingDb::" << __func__ << "]"
372  << " Unable to find analysis object and update ticker thresholds"
373  << " for key/crate/FEC/ring/CCU/module/LLD "
374  << std::hex << std::setw(8) << std::setfill('0') << fec_key.key() << std::dec
375  << fec_key.fecCrate() << "/"
376  << fec_key.fecSlot() << "/"
377  << fec_key.fecRing() << "/"
378  << fec_key.ccuAddr() << "/"
379  << fec_key.ccuChan() << "/"
380  << fec_key.channel()
381  << " and FED key/id/ch "
382  << std::hex << std::setw(8) << std::setfill('0') << fed_key.key() << std::dec
383  << fed_key.fedId() << "/"
384  << fed_key.fedChannel();
385  edm::LogWarning(mlDqmClient_) << ss.str();
386  }
387  }
388  }
389  }
390 
392  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
393  << " Updated ticker thresholds for " << updated
394  << " channels on " << ids.size() << " FEDs!";
395 
396 }
const uint16_t & fecSlot() const
const uint16_t & fecCrate() const
const std::vector< uint16_t > & feds() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:57
const uint16_t & fedCh() const
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
const FedChannelConnection & connection(uint16_t fed_id, uint16_t fed_ch) const
uint16_t lldChannel() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const uint16_t & fedId() const
const float & base() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
const uint16_t & fecRing() const
Class containning control, module, detector and connection information, at the level of a FED channel...
const uint16_t & ccuChan() const
const float & peak() const
const uint16_t & ccuAddr() const
void print(std::stringstream &, uint32_t not_used=0)
uint16_t frameFindingThreshold() const
const uint16_t & feUnit() const
static const uint16_t invalid_
Definition: Constants.h:17
static const uint16_t FEDCH_PER_FED
const uint16_t & feChan() const
Analysis for timing run using APV tick marks.
SiStripFedCabling *const cabling() const
const float & height() const
void ApvTimingHistosUsingDb::uploadConfigurations ( )
virtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 51 of file ApvTimingHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedDescriptions(), LogTrace, sistrip::mlDqmClient_, skipFecUpdate_, skipFedUpdate_, update(), alcaDQMUpload::upload(), SiStripConfigDb::uploadDeviceDescriptions(), and SiStripConfigDb::uploadFedDescriptions().

51  {
53  << "[ApvTimingHistosUsingDb::" << __func__ << "]";
54 
55  if ( !db() ) {
57  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
58  << " NULL pointer to SiStripConfigDb interface!"
59  << " Aborting upload...";
60  return;
61  }
62 
63  if ( !skipFecUpdate_ ) {
64 
65  // Retrieve and update PLL device descriptions
67  bool upload = update( devices );
68 
69  // Check if new PLL settings are valid
70  if ( !upload ) {
72  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
73  << " Found invalid PLL settings (coarse > 15)"
74  << " Aborting update to database...";
75  return;
76  }
77 
78  // Upload PLL device descriptions
79  if ( doUploadConf() ) {
81  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
82  << " Uploading PLL settings to DB...";
85  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
86  << " Upload of PLL settings to DB finished!";
87  } else {
89  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
90  << " TEST only! No PLL settings will be uploaded to DB...";
91  }
92 
93  } else {
95  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
96  << " No upload of PLL settings to DB, as defined by .cfg file!";
97  }
98 
99  if ( !skipFedUpdate_ ) {
100 
101  // Update FED descriptions with new ticker thresholds
103  update( feds );
104 
105  // Update FED descriptions with new ticker thresholds
106  if ( doUploadConf() ) {
108  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
109  << " Uploading FED ticker thresholds to DB...";
112  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
113  << " Upload of FED ticker thresholds to DB finished!";
114  } else {
116  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
117  << " TEST only! No FED ticker thresholds will be uploaded to DB...";
118  }
119 
120  } else {
122  << "[ApvTimingHistosUsingDb::" << __func__ << "]"
123  << " No Upload of FED ticker thresholds to DB, as defined by .cfg file!";
124  }
125 
126 }
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
bool update(SiStripConfigDb::DeviceDescriptionsRange)
DeviceDescriptions::range DeviceDescriptionsRange
#define LogTrace(id)
void uploadFedDescriptions(std::string partition="")
SiStripConfigDb *const db() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
void uploadDeviceDescriptions(std::string partition="")

Member Data Documentation

bool ApvTimingHistosUsingDb::skipFecUpdate_
private

Definition at line 30 of file ApvTimingHistosUsingDb.h.

Referenced by ApvTimingHistosUsingDb(), and uploadConfigurations().

bool ApvTimingHistosUsingDb::skipFedUpdate_
private

Definition at line 32 of file ApvTimingHistosUsingDb.h.

Referenced by ApvTimingHistosUsingDb(), and uploadConfigurations().