20 using namespace sistrip;
38 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
39 <<
" Constructing object...";
47 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
48 <<
" Destructing object...";
69 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
70 <<
" NULL pointer to SiStripConfigDb interface!"
71 <<
" Aborting upload...";
83 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
84 <<
" Found invalid PLL settings (coarse > 15)"
85 <<
" Aborting update to database...";
92 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
93 <<
" Uploading PLL settings to DB...";
96 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
97 <<
" Upload of PLL settings to DB finished!";
100 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
101 <<
" TEST only! No PLL settings will be uploaded to DB...";
112 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
113 <<
" Uploading FED ticker thresholds to DB...";
116 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
117 <<
" Upload of FED ticker thresholds to DB finished!";
120 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
121 <<
" TEST only! No FED ticker thresholds will be uploaded to DB...";
131 float x = 0.;
float y = 0.;
float z = 0.;
132 if(
cosmic_) { y = 385.; z=20.; }
137 float bestDelay_ = 0.;
139 Analyses::const_iterator iter =
data().begin();
147 for (std::vector<uint16_t>::const_iterator ifed = ids.begin(); ifed != ids.end(); ++ifed) {
150 for ( std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
159 float delay = bestDelay_+tof;
165 iconn->ccuChan(), 0 ).
key()] = delay;
167 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"] Computed Delay to be added to PLL: "
168 << bestDelay_ <<
" " << tof <<
" " << delay << std::endl;
171 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
172 <<
" Tracker geometry not initialized. Impossible to compute the delays.";
186 uint16_t updated = 0;
187 std::vector<SiStripFecKey>
invalid;
188 SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
189 for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
192 if ( (*idevice)->getDeviceType() != PLL ) {
continue; }
195 pllDescription* desc =
dynamic_cast<pllDescription*
>( *idevice );
196 if ( !desc ) {
continue; }
211 float delay = desc->getDelayCoarse()*25+desc->getDelayFine()*25./24. +
delays_[fec_key];
212 int delayCoarse = int(delay/25);
213 int delayFine = int(round((delay-25*delayCoarse)*24./25.));
214 if(delayFine==24) { delayFine=0; ++delayCoarse; }
216 if ( delayCoarse > 15 ) { invalid.push_back(fec_key); delayCoarse =
sistrip::invalid_; }
222 std::stringstream ss;
223 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
224 <<
" Updating coarse/fine PLL settings"
225 <<
" for Crate/FEC/slot/ring/CCU "
232 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
233 << static_cast<uint16_t>( desc->getDelayFine() );
234 desc->setDelayCoarse(delayCoarse);
235 desc->setDelayFine(delayFine);
238 <<
static_cast<uint16_t
>( desc->getDelayCoarse() ) <<
"/"
239 << static_cast<uint16_t>( desc->getDelayFine() );
244 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
245 <<
" Unexpected PLL delay settings for Crate/FEC/slot/ring/CCU "
256 if ( !invalid.empty() ) {
257 std::stringstream ss;
258 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
259 <<
" Found PLL coarse setting of 15"
260 <<
" (not allowed!) for following channels"
261 <<
" (Crate/FEC/slot/ring/CCU/LLD): ";
262 std::vector<SiStripFecKey>::iterator ikey = invalid.begin();
263 std::vector<SiStripFecKey>::iterator jkey = invalid.end();
264 for ( ; ikey != jkey; ++ikey ) {
265 ss << ikey->fecCrate() <<
"/"
266 << ikey->fecSlot() <<
"/"
267 << ikey->fecRing() <<
"/"
268 << ikey->ccuAddr() <<
"/"
269 << ikey->ccuChan() <<
", ";
276 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
277 <<
" Updated PLL settings for "
278 << updated <<
" modules";
293 for ( SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
295 if (
find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) {
continue; }
296 const std::vector<FedChannelConnection>& conns =
cabling()->
connections((*ifed)->getFedId());
298 for ( std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
302 Fed9U::Fed9UAddress fedChannel = Fed9U::Fed9UAddress(iconn->fedCh());
304 int fedDelayCoarse = (*ifed)->getCoarseDelay(fedChannel);
305 int fedDelayFine = (*ifed)->getFineDelay(fedChannel);
306 int fedDelay = int(fedDelayCoarse*25. - fedDelayFine*24./25.);
312 iconn->ccuChan(), 0 ).
key()]));
316 fedDelayCoarse = (fedDelay/25)+1;
317 fedDelayFine = fedDelayCoarse*25-fedDelay;
318 if(fedDelayFine==25) { fedDelayFine = 0; --fedDelayCoarse; }
320 std::stringstream ss;
321 ss <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
322 <<
" Updating the FED delay"
323 <<
" for loop FED id/ch "
324 << (*ifed)->getFedId() <<
"/" << iconn->fedCh()
326 << (*ifed)->getCoarseDelay( fedChannel) <<
"/" << (*ifed)->getFineDelay( fedChannel)
328 (*ifed)->setDelay(fedChannel, fedDelayCoarse, fedDelayFine);
329 ss << (*ifed)->getCoarseDelay(fedChannel) <<
"/" << (*ifed)->getFineDelay( fedChannel) << std::endl;
335 <<
"[FineDelayHistosUsingDb::" << __func__ <<
"]"
336 <<
" Updated FED delay for " << ids.size() <<
" FEDs!";
346 if ( !anal ) {
return; }
351 FineDelayAnalysisDescription*
tmp;
352 tmp =
new FineDelayAnalysisDescription( anal->
maximum(),
370 typedef std::vector<std::string>
Strings;
372 Strings::const_iterator istr = errors.begin();
373 Strings::const_iterator jstr = errors.end();
374 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
377 desc.push_back( tmp );
T getParameter(std::string const &) const
virtual void uploadConfigurations()
static const char tracker_[]
Analysis for latency run.
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 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
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_
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
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.
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const