11 using namespace sistrip;
27 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
28 <<
" Constructing object...";
33 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
34 <<
" Skipping update of FEC parameters.";
37 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
38 <<
" Skipping update of FED parameters.";
45 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
46 <<
" Destructing object...";
53 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]";
57 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
58 <<
" NULL pointer to SiStripConfigDb interface!"
59 <<
" Aborting upload...";
72 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
73 <<
" Found invalid PLL settings (coarse > 15)"
74 <<
" Aborting update to database...";
81 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
82 <<
" Uploading PLL settings to DB...";
85 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
86 <<
" Upload of PLL settings to DB finished!";
89 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
90 <<
" TEST only! No PLL settings will be uploaded to DB...";
95 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
96 <<
" No upload of PLL settings to DB, as defined by .cfg file!";
108 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
109 <<
" Uploading FED ticker thresholds to DB...";
112 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
113 <<
" Upload of FED ticker thresholds to DB finished!";
116 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
117 <<
" TEST only! No FED ticker thresholds will be uploaded to DB...";
122 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
123 <<
" No Upload of FED ticker thresholds to DB, as defined by .cfg file!";
133 uint16_t updated = 0;
134 std::vector<SiStripFecKey>
invalid;
135 SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
137 for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
140 if ( (*idevice)->getDeviceType() != PLL ) {
continue; }
143 pllDescription* desc =
dynamic_cast<pllDescription*
>( *idevice );
144 if ( !desc ) {
continue; }
167 Analyses::const_iterator iter =
data().find( fec_key.
key() );
168 if ( iter !=
data().end() ) {
173 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
174 <<
" NULL pointer to analysis object!";
179 int32_t delay =
static_cast<int32_t
>( rint( anal->
delay() )*24./25 );
181 coarse =
static_cast<uint16_t
>( desc->getDelayCoarse() + (delay/24) )
182 + (
static_cast<uint16_t
>( desc->getDelayFine() ) + (delay%24) ) / 24;
184 if ( ( static_cast<uint16_t>( desc->getDelayFine() ) + delay ) % 24 < 0 ) {
188 fine = (
static_cast<uint16_t
>( desc->getDelayFine() ) + delay ) % 24;
191 if ( coarse > 15 ) { invalid.push_back(fec_key); }
196 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
197 <<
" Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD: "
217 std::stringstream ss;
219 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
220 <<
" Updating coarse/fine PLL settings"
221 <<
" for crate/FEC/ring/CCU/module "
228 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
229 << static_cast<uint16_t>( desc->getDelayFine() );
231 desc->setDelayCoarse(coarse);
232 desc->setDelayFine(fine);
236 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
237 << static_cast<uint16_t>( desc->getDelayFine() );
243 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
244 <<
" Invalid PLL delay settings course/fine = "
245 << coarse <<
"/" << fine
246 <<
" for crate/FEC/ring/CCU/module "
257 if ( !invalid.empty() ) {
258 std::stringstream ss;
259 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
260 <<
" Found PLL coarse setting of >15"
261 <<
" (not allowed!) for "
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();
276 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
277 <<
" Updated PLL settings for "
278 << updated <<
" modules";
291 uint16_t updated = 0;
292 SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
293 for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
296 if (
find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) {
continue; }
319 Analyses::const_iterator iter =
data().find( fec_key.key() );
320 if ( iter !=
data().end() ) {
325 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
326 <<
" NULL pointer to analysis object!";
331 Fed9U::Fed9UAddress addr( ichan );
332 uint16_t old_threshold =
static_cast<uint16_t
>( (*ifed)->getFrameThreshold( addr ) );
337 uint16_t new_threshold =
static_cast<uint16_t
>( (*ifed)->getFrameThreshold( addr ) );
340 std::stringstream ss;
341 ss <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]";
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() <<
"/"
351 ss <<
" Cannot update the frame-finding threshold"
352 <<
" from " << old_threshold
353 <<
" to a new value using invalid analysis ";
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() <<
"/"
363 << fed_key.
fedId() <<
"/"
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() <<
"/"
381 <<
" and FED key/id/ch "
382 << std::hex << std::setw(8) << std::setfill(
'0') << fed_key.
key() << std::dec
383 << fed_key.
fedId() <<
"/"
392 <<
"[ApvTimingHistosUsingDb::" << __func__ <<
"]"
393 <<
" Updated ticker thresholds for " << updated
394 <<
" channels on " << ids.size() <<
" FEDs!";
404 if ( !anal ) {
return; }
409 for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
423 TimingAnalysisDescription*
tmp;
424 tmp =
new TimingAnalysisDescription( anal->
time(),
450 typedef std::vector<std::string>
Strings;
452 Strings::const_iterator istr = errors.begin();
453 Strings::const_iterator jstr = errors.end();
454 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
457 desc.push_back( tmp );
const uint16_t & fecSlot() const
T getParameter(std::string const &) const
const uint16_t & fecCrate() const
const std::vector< uint16_t > & feds() const
const uint32_t & fedKey() const
Analyses::iterator Analysis
const uint16_t & fecRing() 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_[]
const FedChannelConnection & connection(uint16_t fed_id, uint16_t fed_ch) const
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()
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