19 using namespace sistrip;
37 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
38 <<
" Constructing object...";
46 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
47 <<
" Destructing object...";
68 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
69 <<
" NULL pointer to SiStripConfigDb interface!"
70 <<
" Aborting upload...";
82 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
83 <<
" Found invalid PLL settings (coarse > 15)"
84 <<
" Aborting update to database...";
91 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
92 <<
" Uploading PLL settings to DB...";
95 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
96 <<
" Upload of PLL settings to DB finished!";
99 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
100 <<
" TEST only! No PLL settings will be uploaded to DB...";
111 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
112 <<
" Uploading FED ticker thresholds to DB...";
115 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
116 <<
" Upload of FED ticker thresholds to DB finished!";
119 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
120 <<
" TEST only! No FED ticker thresholds will be uploaded to DB...";
130 float x = 0.;
float y = 0.;
float z = 0.;
131 if(
cosmic_) { y = 385.; z=20.; }
136 float bestDelay_ = 0.;
138 Analyses::const_iterator
iter =
data().begin();
146 for (
auto ifed = ids.begin(); ifed != ids.end(); ++ifed) {
149 for (
auto iconn = conns.begin(); iconn != conns.end(); ++iconn ) {
158 float delay = bestDelay_+tof;
164 iconn->ccuChan(), 0 ).
key()] = delay;
166 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"] Computed Delay to be added to PLL: "
167 << bestDelay_ <<
" " << tof <<
" " << delay << std::endl;
170 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
171 <<
" Tracker geometry not initialized. Impossible to compute the delays.";
185 uint16_t updated = 0;
186 std::vector<SiStripFecKey>
invalid;
187 SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
188 for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
191 if ( (*idevice)->getDeviceType() != PLL ) {
continue; }
194 pllDescription* desc =
dynamic_cast<pllDescription*
>( *idevice );
195 if ( !desc ) {
continue; }
210 float delay = desc->getDelayCoarse()*25+desc->getDelayFine()*25./24. +
delays_[fec_key];
211 int delayCoarse = int(delay/25);
212 int delayFine = int(round((delay-25*delayCoarse)*24./25.));
213 if(delayFine==24) { delayFine=0; ++delayCoarse; }
215 if ( delayCoarse > 15 ) { invalid.push_back(fec_key); delayCoarse =
sistrip::invalid_; }
221 std::stringstream
ss;
222 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
223 <<
" Updating coarse/fine PLL settings"
224 <<
" for Crate/FEC/slot/ring/CCU "
231 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
232 << static_cast<uint16_t>( desc->getDelayFine() );
233 desc->setDelayCoarse(delayCoarse);
234 desc->setDelayFine(delayFine);
237 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
238 << static_cast<uint16_t>( desc->getDelayFine() );
243 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
244 <<
" Unexpected PLL delay settings for Crate/FEC/slot/ring/CCU "
255 if ( !invalid.empty() ) {
256 std::stringstream
ss;
257 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
258 <<
" Found PLL coarse setting of 15"
259 <<
" (not allowed!) for following channels"
260 <<
" (Crate/FEC/slot/ring/CCU/LLD): ";
261 std::vector<SiStripFecKey>::iterator ikey = invalid.begin();
262 std::vector<SiStripFecKey>::iterator jkey = invalid.end();
263 for ( ; ikey != jkey; ++ikey ) {
264 ss << ikey->fecCrate() <<
"/"
265 << ikey->fecSlot() <<
"/"
266 << ikey->fecRing() <<
"/"
267 << ikey->ccuAddr() <<
"/"
268 << ikey->ccuChan() <<
", ";
275 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
276 <<
" Updated PLL settings for "
277 << updated <<
" modules";
292 for ( SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
294 if (
find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) {
continue; }
297 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
301 Fed9U::Fed9UAddress fedChannel = Fed9U::Fed9UAddress(iconn->fedCh());
303 int fedDelayCoarse = (*ifed)->getCoarseDelay(fedChannel);
304 int fedDelayFine = (*ifed)->getFineDelay(fedChannel);
305 int fedDelay = int(fedDelayCoarse*25. - fedDelayFine*24./25.);
311 iconn->ccuChan(), 0 ).
key()]));
315 fedDelayCoarse = (fedDelay/25)+1;
316 fedDelayFine = fedDelayCoarse*25-fedDelay;
317 if(fedDelayFine==25) { fedDelayFine = 0; --fedDelayCoarse; }
319 std::stringstream
ss;
320 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
321 <<
" Updating the FED delay"
322 <<
" for loop FED id/ch "
323 << (*ifed)->getFedId() <<
"/" << iconn->fedCh()
325 << (*ifed)->getCoarseDelay( fedChannel) <<
"/" << (*ifed)->getFineDelay( fedChannel)
327 (*ifed)->setDelay(fedChannel, fedDelayCoarse, fedDelayFine);
328 ss << (*ifed)->getCoarseDelay(fedChannel) <<
"/" << (*ifed)->getFineDelay( fedChannel) << std::endl;
334 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
335 <<
" Updated FED delay for " << ids.size() <<
" FEDs!";
345 if ( !anal ) {
return; }
350 FineDelayAnalysisDescription*
tmp;
351 tmp =
new FineDelayAnalysisDescription( anal->
maximum(),
369 typedef std::vector<std::string>
Strings;
371 Strings::const_iterator istr = errors.begin();
372 Strings::const_iterator jstr = errors.end();
373 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
376 desc.push_back( tmp );
T getParameter(std::string const &) const
virtual void uploadConfigurations()
virtual const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
static const char tracker_[]
Analysis for latency run.
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 edm::ParameterSet & pset() const
virtual bool isValid() const
FedDescriptionsRange getFedDescriptions(std::string partition="")
Global3DPoint GlobalPoint
FedDescriptions::range FedDescriptionsRange
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
static const char mlDqmClient_[]
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
const uint16_t & fecSlot() const
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
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 float & error() const
FedsConstIterRange fedIds() const
DeviceDescriptions::range DeviceDescriptionsRange
An interface class to the DeviceFactory.
bool doUploadConf() const
virtual ~FineDelayHistosUsingDb()
const uint32_t & fecKey() const
FineDelayHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
DeviceAddress deviceAddress(const deviceDescription &)
std::map< unsigned int, float > delays_
const uint16_t & fecCrate() const
const SiStripDbParams & dbParams() const
bool update(SiStripConfigDb::DeviceDescriptionsRange)
void uploadFedDescriptions(std::string partition="")
const uint16_t & ccuAddr() const
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
std::vector< std::vector< double > > tmp
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
const TrackerGeometry * tracker_
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
std::vector< AnalysisDescription * > AnalysisDescriptionsV
const uint16_t & ccuChan() const
const float & maximum() const
SiStripConfigDb *const db() const
void clearFedDescriptions(std::string partition="")
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
void uploadDeviceDescriptions(std::string partition="")
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.