10 using namespace sistrip;
26 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
27 <<
" Constructing object...";
32 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
33 <<
" Skipping update of FEC parameters.";
36 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
37 <<
" Skipping update of FED parameters.";
44 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
45 <<
" Destructing object...";
52 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]";
56 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
57 <<
" NULL pointer to SiStripConfigDb interface!"
58 <<
" Aborting upload...";
71 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
72 <<
" Found invalid PLL settings (coarse > 15)"
73 <<
" Aborting update to database...";
80 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
81 <<
" Uploading PLL settings to DB...";
84 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
85 <<
" Upload of PLL settings to DB finished!";
88 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
89 <<
" TEST only! No PLL settings will be uploaded to DB...";
94 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
95 <<
" No upload of PLL settings to DB, as defined by .cfg file!";
107 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
108 <<
" Uploading FED ticker thresholds to DB...";
111 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
112 <<
" Upload of FED ticker thresholds to DB finished!";
115 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
116 <<
" TEST only! No FED ticker thresholds will be uploaded to DB...";
121 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
122 <<
" No Upload of FED ticker thresholds to DB, as defined by .cfg file!";
132 uint16_t updated = 0;
133 std::vector<SiStripFecKey>
invalid;
134 SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
136 for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
139 if ( (*idevice)->getDeviceType() != PLL ) {
continue; }
142 pllDescription* desc =
dynamic_cast<pllDescription*
>( *idevice );
143 if ( !desc ) {
continue; }
166 Analyses::const_iterator
iter =
data().find( fec_key.
key() );
167 if ( iter !=
data().end() ) {
172 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
173 <<
" NULL pointer to analysis object!";
178 int32_t delay =
static_cast<int32_t
>( rint( anal->
delay() )*24./25 );
180 coarse =
static_cast<uint16_t
>( desc->getDelayCoarse() + (delay/24) )
181 + (
static_cast<uint16_t
>( desc->getDelayFine() ) + (delay%24) ) / 24;
183 if ( ( static_cast<uint16_t>( desc->getDelayFine() ) + delay ) % 24 < 0 ) {
187 fine = (
static_cast<uint16_t
>( desc->getDelayFine() ) + delay ) % 24;
190 if ( coarse > 15 ) { invalid.push_back(fec_key); }
195 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
196 <<
" Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD: "
216 std::stringstream
ss;
218 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
219 <<
" Updating coarse/fine PLL settings"
220 <<
" for crate/FEC/ring/CCU/module "
227 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
228 << static_cast<uint16_t>( desc->getDelayFine() );
230 desc->setDelayCoarse(coarse);
231 desc->setDelayFine(fine);
235 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
236 << static_cast<uint16_t>( desc->getDelayFine() );
242 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
243 <<
" Invalid PLL delay settings course/fine = "
244 << coarse <<
"/" << fine
245 <<
" for crate/FEC/ring/CCU/module "
256 if ( !invalid.empty() ) {
257 std::stringstream
ss;
258 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
259 <<
" Found PLL coarse setting of >15"
260 <<
" (not allowed!) for "
263 ss <<
" (Example is crate/FEC/ring/CCU/module/LLD: "
264 << invalid.front().fecCrate() <<
"/"
265 << invalid.front().fecSlot() <<
"/"
266 << invalid.front().fecRing() <<
"/"
267 << invalid.front().ccuAddr() <<
"/"
268 << invalid.front().ccuChan() <<
"/"
269 << invalid.front().channel();
275 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
276 <<
" Updated PLL settings for "
277 << updated <<
" modules";
290 uint16_t updated = 0;
291 for (
auto ifed = feds.begin(); ifed != feds.end(); ++ifed ) {
294 if (
find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) {
continue; }
317 Analyses::const_iterator
iter =
data().find( fec_key.key() );
318 if ( iter !=
data().end() ) {
323 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
324 <<
" NULL pointer to analysis object!";
329 Fed9U::Fed9UAddress addr( ichan );
330 uint16_t old_threshold =
static_cast<uint16_t
>( (*ifed)->getFrameThreshold( addr ) );
335 uint16_t new_threshold =
static_cast<uint16_t
>( (*ifed)->getFrameThreshold( addr ) );
338 std::stringstream
ss;
339 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]";
341 ss <<
" Updating the frame-finding threshold"
342 <<
" from " << old_threshold
343 <<
" to " << new_threshold
344 <<
" using tick mark base/peak/height "
345 << anal->
base() <<
"/"
346 << anal->
peak() <<
"/"
349 ss <<
" Cannot update the frame-finding threshold"
350 <<
" from " << old_threshold
351 <<
" to a new value using invalid analysis ";
353 ss <<
" for crate/FEC/ring/CCU/module/LLD "
354 << fec_key.fecCrate() <<
"/"
355 << fec_key.fecSlot() <<
"/"
356 << fec_key.fecRing() <<
"/"
357 << fec_key.ccuAddr() <<
"/"
361 << fed_key.
fedId() <<
"/"
368 std::stringstream
ss;
369 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
370 <<
" Unable to find analysis object and update ticker thresholds"
371 <<
" for key/crate/FEC/ring/CCU/module/LLD "
372 << std::hex << std::setw(8) << std::setfill(
'0') << fec_key.key() << std::dec
373 << fec_key.fecCrate() <<
"/"
374 << fec_key.fecSlot() <<
"/"
375 << fec_key.fecRing() <<
"/"
376 << fec_key.ccuAddr() <<
"/"
377 << fec_key.ccuChan() <<
"/"
379 <<
" and FED key/id/ch "
380 << std::hex << std::setw(8) << std::setfill(
'0') << fed_key.
key() << std::dec
381 << fed_key.
fedId() <<
"/"
390 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
391 <<
" Updated ticker thresholds for " << updated
392 <<
" channels on " << ids.size() <<
" FEDs!";
402 if ( !anal ) {
return; }
407 for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
421 TimingAnalysisDescription*
tmp;
422 tmp =
new TimingAnalysisDescription( anal->
time(),
448 typedef std::vector<std::string>
Strings;
450 Strings::const_iterator istr = errors.begin();
451 Strings::const_iterator jstr = errors.end();
452 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
455 desc.push_back( tmp );
const uint16_t & fecSlot() const
T getParameter(std::string const &) const
const uint16_t & fecCrate() const
const uint32_t & fedKey() const
Analyses::iterator Analysis
const uint16_t & fecRing() const
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
A container class for generic run and event-related info, information required by the commissioning a...
const uint16_t & fedCh() const
const edm::ParameterSet & pset() const
bool deviceIsPresent(const SiStripFecKey &)
FedDescriptionsRange getFedDescriptions(std::string partition="")
const float & refTime() const
FedDescriptions::range FedDescriptionsRange
static const float tickMarkHeightThreshold_
static const char mlDqmClient_[]
ApvTimingHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
const uint16_t & fecSlot() const
const float & optimumSamplingPoint() const
uint16_t lldChannel() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const uint16_t & i2cAddr() const
const uint16_t & fedId() const
bool update(SiStripConfigDb::DeviceDescriptionsRange)
const float & base() const
const uint32_t & key() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
const_iterator_range partitions() const
const uint16_t & fecRing() const
Class containning control, module, detector and connection information, at the level of a FED channel...
virtual void uploadConfigurations()
FedsConstIterRange fedIds() const
DeviceDescriptions::range DeviceDescriptionsRange
static const uint16_t CHANS_PER_LLD
An interface class to the DeviceFactory.
const uint16_t & ccuChan() const
bool doUploadConf() const
const uint32_t & fecKey() const
DeviceAddress deviceAddress(const deviceDescription &)
uint16_t fedChannel() const
const float & peak() const
const uint16_t & ccuAddr() const
const float & time() const
const float & delay() const
void print(std::stringstream &, uint32_t not_used=0)
const uint16_t & fecCrate() const
uint16_t frameFindingThreshold() const
virtual ~ApvTimingHistosUsingDb()
const uint16_t & feUnit() const
const SiStripDbParams & dbParams() const
const uint16_t & channel() const
void uploadFedDescriptions(std::string partition="")
const uint16_t & ccuAddr() const
static const uint16_t invalid_
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
std::vector< std::vector< double > > tmp
static const uint16_t FEDCH_PER_FED
std::vector< AnalysisDescription * > AnalysisDescriptionsV
const uint16_t & feChan() const
const uint16_t & ccuChan() const
const uint16_t & fedId() const
SiStripConfigDb *const db() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
void uploadDeviceDescriptions(std::string partition="")
Analysis for timing run using APV tick marks.
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const
const float & height() const