19 using namespace sistrip;
31 tkGeomToken_{tkGeomToken},
34 <<
" Constructing object...";
42 <<
" Destructing object...";
59 <<
" NULL pointer to SiStripConfigDb interface!"
60 <<
" Aborting upload...";
72 <<
" Found invalid PLL settings (coarse > 15)"
73 <<
" Aborting update to database...";
80 <<
" Uploading PLL settings to DB...";
83 <<
" Upload of PLL settings to DB finished!";
86 <<
" TEST only! No PLL settings will be uploaded to DB...";
97 <<
" Uploading FED ticker thresholds to DB...";
100 <<
" Upload of FED ticker thresholds to DB finished!";
103 <<
" TEST only! No FED ticker thresholds will be uploaded to DB...";
124 float bestDelay_ = 0.;
126 Analyses::const_iterator iter =
data().begin();
134 for (
auto ifed = ids.begin(); ifed != ids.end(); ++ifed) {
137 for (
auto iconn = conns.begin(); iconn != conns.end(); ++iconn) {
145 float tof = dist /
c;
147 float delay = bestDelay_ + tof;
150 iconn->fecCrate(), iconn->fecSlot(), iconn->fecRing(), iconn->ccuAddr(), iconn->ccuChan(), 0)
153 <<
"] Computed Delay to be added to PLL: " << bestDelay_ <<
" " << tof <<
" "
154 << delay << std::endl;
157 <<
" Tracker geometry not initialized. Impossible to compute the delays.";
170 uint16_t updated = 0;
171 std::vector<SiStripFecKey>
invalid;
172 SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
173 for (idevice = devices.begin(); idevice != devices.end(); idevice++) {
175 if ((*idevice)->getDeviceType() != PLL) {
180 pllDescription*
desc =
dynamic_cast<pllDescription*
>(*idevice);
194 float delay = desc->getDelayCoarse() * 25 + desc->getDelayFine() * 25. / 24. +
delays_[fec_key];
195 int delayCoarse = int(delay / 25);
196 int delayFine = int(round((delay - 25 * delayCoarse) * 24. / 25.));
197 if (delayFine == 24) {
202 if (delayCoarse > 15) {
203 invalid.push_back(fec_key);
209 std::stringstream
ss;
210 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
211 <<
" Updating coarse/fine PLL settings"
212 <<
" for Crate/FEC/slot/ring/CCU " << fec_path.
fecCrate() <<
"/" << fec_path.
fecSlot() <<
"/"
214 <<
static_cast<uint16_t
>(desc->getDelayCoarse()) <<
"/" << static_cast<uint16_t>(desc->getDelayFine());
215 desc->setDelayCoarse(delayCoarse);
216 desc->setDelayFine(delayFine);
218 ss <<
" to " <<
static_cast<uint16_t
>(desc->getDelayCoarse()) <<
"/"
219 << static_cast<uint16_t>(desc->getDelayFine());
224 <<
" Unexpected PLL delay settings for Crate/FEC/slot/ring/CCU " << fec_path.
fecCrate()
231 if (!invalid.empty()) {
232 std::stringstream
ss;
233 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
234 <<
" Found PLL coarse setting of 15"
235 <<
" (not allowed!) for following channels"
236 <<
" (Crate/FEC/slot/ring/CCU/LLD): ";
237 std::vector<SiStripFecKey>::iterator ikey = invalid.begin();
238 std::vector<SiStripFecKey>::iterator jkey = invalid.end();
239 for (; ikey != jkey; ++ikey) {
240 ss << ikey->fecCrate() <<
"/" << ikey->fecSlot() <<
"/" << ikey->fecRing() <<
"/" << ikey->ccuAddr() <<
"/"
241 << ikey->ccuChan() <<
", ";
248 <<
" Updated PLL settings for " << updated <<
" modules";
262 for (SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++) {
264 if (
find(ids.begin(), ids.end(), (*ifed)->getFedId()) == ids.end()) {
269 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++) {
274 Fed9U::Fed9UAddress fedChannel = Fed9U::Fed9UAddress(iconn->fedCh());
276 int fedDelayCoarse = (*ifed)->getCoarseDelay(fedChannel);
277 int fedDelayFine = (*ifed)->getFineDelay(fedChannel);
278 int fedDelay = int(fedDelayCoarse * 25. - fedDelayFine * 24. / 25.);
280 int delay = int(round(
282 iconn->fecCrate(), iconn->fecSlot(), iconn->fecRing(), iconn->ccuAddr(), iconn->ccuChan(), 0)
287 fedDelayCoarse = (fedDelay / 25) + 1;
288 fedDelayFine = fedDelayCoarse * 25 - fedDelay;
289 if (fedDelayFine == 25) {
294 std::stringstream
ss;
295 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
296 <<
" Updating the FED delay"
297 <<
" for loop FED id/ch " << (*ifed)->getFedId() <<
"/" << iconn->fedCh() <<
" from "
298 << (*ifed)->getCoarseDelay(fedChannel) <<
"/" << (*ifed)->getFineDelay(fedChannel) <<
" to ";
299 (*ifed)->setDelay(fedChannel, fedDelayCoarse, fedDelayFine);
300 ss << (*ifed)->getCoarseDelay(fedChannel) <<
"/" << (*ifed)->getFineDelay(fedChannel) << std::endl;
306 <<
" Updated FED delay for " << ids.size() <<
" FEDs!";
320 FineDelayAnalysisDescription*
tmp;
321 tmp =
new FineDelayAnalysisDescription(anal->
maximum(),
339 typedef std::vector<std::string>
Strings;
341 Strings::const_iterator istr = errors.begin();
342 Strings::const_iterator jstr = errors.end();
343 for (; istr != jstr; ++istr) {
344 tmp->addComments(*istr);
Log< level::Info, true > LogVerbatim
static const char tracker_[]
const edm::EventSetup & c
Analysis for latency run.
void uploadConfigurations() override
const uint32_t & fedKey() const
Analyses::iterator Analysis
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Analyses & data(bool getMaskedData=false)
const uint16_t & fecRing() const
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
A container class for generic run and event-related info, information required by the commissioning a...
const edm::ParameterSet & pset() const
virtual bool isValid() const
FedDescriptionsRange getFedDescriptions(std::string partition="")
Global3DPoint GlobalPoint
FedDescriptions::range FedDescriptionsRange
std::map< unsigned int, float > delays_
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
static const char mlDqmClient_[]
const uint16_t & fecSlot() const
Log< level::Error, false > LogError
void configure(const edm::ParameterSet &, const edm::EventSetup &) override
void clearDeviceDescriptions(std::string partition="")
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const uint32_t & key() const
void configure(const edm::ParameterSet &, const edm::EventSetup &) override
void configure(const edm::ParameterSet &, const edm::EventSetup &) override
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
bool getData(T &iHolder) const
const_iterator_range partitions() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
const float & error() const
FedsConstIterRange fedIds() const
DeviceDescriptions::range DeviceDescriptionsRange
An interface class to the DeviceFactory.
bool doUploadConf() const
tuple key
prepare the HTCondor submission files and eventually submit them
const uint32_t & fecKey() const
DeviceAddress deviceAddress(const deviceDescription &)
const uint16_t & fecCrate() const
~FineDelayHistosUsingDb() override
const SiStripDbParams & dbParams() const
bool update(SiStripConfigDb::DeviceDescriptionsRange)
void uploadFedDescriptions(std::string partition="")
T getParameter(std::string const &) const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
const TrackerGeometry * tracker_
std::vector< AnalysisDescription * > AnalysisDescriptionsV
const uint16_t & ccuChan() const
const float & maximum() const
FineDelayHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken, edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken)
SiStripConfigDb *const db() const
void clearFedDescriptions(std::string partition="")
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
void uploadDeviceDescriptions(std::string partition="")
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const