CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripCondObjBuilderFromDb.cc
Go to the documentation of this file.
1 // Last commit: $Id: SiStripCondObjBuilderFromDb.cc,v 1.27 2013/05/30 21:52:09 gartung Exp $
2 // Latest tag: $Name: CMSSW_6_2_0 $
3 
20 
21 #include <cstdlib>
22 #include <iostream>
23 #include <sstream>
24 #include <iomanip>
25 #include "Fed9UUtils.hh"
26 
27 using namespace std;
28 using namespace sistrip;
29 
30 
31 // -----------------------------------------------------------------------------
34  const edm::ActivityRegistry&):
35  m_gaincalibrationfactor(static_cast<float>(pset.getUntrackedParameter<double>("GainNormalizationFactor",690.))),
36  m_defaultpedestalvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultPedestal",0.))),
37  m_defaultnoisevalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultNoise",0.))),
38  m_defaultthresholdhighvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdHigh",0.))),
39  m_defaultthresholdlowvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdLow",0.))),
40  m_defaultapvmodevalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVMode",37))),
41  m_defaultapvlatencyvalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVLatency",142))),
42  m_defaulttickheightvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultTickHeight",690.))),
43  m_useanalysis(static_cast<bool>(pset.getUntrackedParameter<bool>("UseAnalysis",false))),
44  m_usefed(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFED",false))),
45  m_usefec(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFEC",false))),
46  m_debug(static_cast<bool>(pset.getUntrackedParameter<bool>("DebugMode",false)))
47 {
49  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
50  << " Constructing object...";
51 }
52 
53 // -----------------------------------------------------------------------------
56 {
58  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
59  << " Constructing object...";
60 }
61 
62 // -----------------------------------------------------------------------------
66  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
67  << " Destructing object...";
68 }
69 
70 // -----------------------------------------------------------------------------
71 
74  if (!(dbParams_==dbParams())){
76  buildCondObj();
77  }
78 }
79 
80 
81 // -----------------------------------------------------------------------------
84 
85 
86  //get current config DB parameter
87 
89 
90  SiStripDbParams::SiStripPartitions::const_iterator ipart = partitionsRange.begin();
91  SiStripDbParams::SiStripPartitions::const_iterator ipartEnd = partitionsRange.end();
92  for ( ; ipart != ipartEnd; ++ipart ) {
93  SiStripPartition partition=ipart->second;
94  output << "@ "
95  << " Partition " << partition.partitionName() ;
96  if (label!="Cabling" && label !="ApvLatency")
97  output << " FedVer " << partition.fedVersion().first << "." << partition.fedVersion().second;
98  if(label=="Cabling")
99  output << " CabVer " << partition.cabVersion().first << "." << partition.cabVersion().second
100  << " MaskVer " << partition.maskVersion().first << "." << partition.maskVersion().second;
101  if(label=="ApvTiming")
102  output<< " ApvTimingVer " << partition.apvTimingVersion().first << "." << partition.apvTimingVersion().second;
103  if(label=="ApvLatency")
104  output<< " FecVersion " << partition.fecVersion().first << "." << partition.fecVersion().second;
105  }
106 
107  if (!strcmp(output.str().c_str(),input.str().c_str()))
108  return false;
109 
110  return true;
111 }
112 
113 // -----------------------------------------------------------------------------
117  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]";
118 
119  // Check if DB connection is made
120  if ( db_ ) {
121 
122  // Check if DB connection is made
123  if ( db_->deviceFactory() ||
124  db_->databaseCache() ) {
125 
126  // Build FEC cabling object
127  SiStripFecCabling fec_cabling;
128 
130  fec_cabling,
133 
135  SiStripDetCabling det_cabling( *fed_cabling_ );
136  buildStripRelatedObjects( &*db_, det_cabling );
137 
138 
142 
143 
144 
145  } else {
147  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
148  << " NULL pointer to DeviceFactory returned by SiStripConfigDb!"
149  << " Cannot build Pedestals object!";
150  }
151  } else {
153  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
154  << " NULL pointer to SiStripConfigDb returned by DB \"service\"!"
155  << " Cannot build Pedestals object!";
156  }
157 }
158 
159 // -----------------------------------------------------------------------------
161 //Retrieve FedDescriptions from configuration database
164  if ( descriptions.empty() ) {
166  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
167  << " No FED descriptions found!";
168 
169  return false;
170  }
171  return true;
172 }
173 
174 // -----------------------------------------------------------------------------
176  // Retrieve gain from configuration database
178  SiStripConfigDb::AnalysisDescriptionsRange anal_descriptions =
179  db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
180  if ( anal_descriptions.empty() ) {
182  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
183  << " Unable to build SiStripApvGain object!"
184  << " No timing-scan analysis descriptions found!";
185  return false;
186  }
187  return true;
188 }
189 
190 // -----------------------------------------------------------------------------
192  // Retrieve list of active DetIds
194  vector<uint32_t> det_ids;
195  det_cabling.addActiveDetectorsRawIds(det_ids);
196  if ( det_ids.empty() ) {
198  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
199  << " Unable to build Pedestals object!"
200  << " No DetIds found!";
201  return det_ids;
202  }
204  << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
205  << " Found " << det_ids.size() << " active DetIds";
206  return det_ids;
207 }
208 
209 // -----------------------------------------------------------------------------
211  //build connections per DetId
212 vector<const FedChannelConnection *> SiStripCondObjBuilderFromDb::buildConnections(const SiStripDetCabling& det_cabling, uint32_t det_id ){
213  vector<const FedChannelConnection *> conns = det_cabling.getConnections(det_id);
214  if (conns.size()==0){
216  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
217  << " Unable to build condition object!"
218  << " No FED channel connections found for detid "<< det_id;
219  }
220  return conns;
221 }
222 
223 // -----------------------------------------------------------------------------
225 //retrieve number of APV pairs per detid
227  uint16_t nApvPairs;
229  nApvPairs=fr->getNumberOfApvsAndStripLength(det_id).first/2;
230  return nApvPairs;
231 }
232 
233 // -----------------------------------------------------------------------------
235 //set default values for Cabling Objects Peds, Noise, thresh, Quality
237  uint16_t istrip = apvPair*sistrip::STRIPS_PER_FEDCH;
238  std::cout << "Found disabled FedConnection! APVPair: " << apvPair << " Strips: " << sistrip::STRIPS_PER_FEDCH << std::endl;
239  inputQuality.push_back(quality_->encode(istrip,sistrip::STRIPS_PER_FEDCH));
240  for ( ;istrip < (apvPair+1)*sistrip::STRIPS_PER_FEDCH; ++istrip ){
244  }
245 }
246 
247 // -----------------------------------------------------------------------------
252 }
253 
254 // -----------------------------------------------------------------------------
257  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Set Default Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
258  if(!latency_.put( detid, apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
259  {
260  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
261  }
262  if(!latency_.put( detid, ++apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
263  {
264  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
265  }
266 
267 }
268 
269 
270 
271 // -----------------------------------------------------------------------------
274  SiStripConfigDb::AnalysisDescriptionsRange anal_descriptions = db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
275  SiStripConfigDb::AnalysisDescriptionsV::const_iterator iii = anal_descriptions.begin();
276  SiStripConfigDb::AnalysisDescriptionsV::const_iterator jjj = anal_descriptions.end();
277 
278  while ( iii != jjj ) {
279  CommissioningAnalysisDescription* tmp = *iii;
280  uint16_t fed_id = tmp->getFedId();
281  uint16_t fed_ch = SiStripFedKey::fedCh( tmp->getFeUnit(), tmp->getFeChan() );
282  if ( fed_id == ipair.fedId() && fed_ch == ipair.fedCh() ) { break; }
283  iii++;
284  }
285 
286  TimingAnalysisDescription *anal=0;
287  if ( iii != jjj ) { anal = dynamic_cast<TimingAnalysisDescription*>(*iii); }
288  if ( anal ) {
289  float tick_height = (anal->getHeight() / m_gaincalibrationfactor);
290  inputApvGain.push_back( tick_height ); // APV0
291  inputApvGain.push_back( tick_height); // APV1
292  } else {
295  return false;
296  }
297 
298  return true;
299 }
300 
301 // -----------------------------------------------------------------------------
306 
307  SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
308  SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
309  if(iapv==japv) return false;
310  for ( ; iapv != japv; ++iapv ) {
311  apvDescription* apv = dynamic_cast<apvDescription*>( *iapv );
312  if ( !apv ) { continue; }
313  if((apv->getCrateId()) != (ipair.fecCrate())) continue;
314  if((apv->getFecSlot()) != (ipair.fecSlot())) continue;
315  if((apv->getRingSlot()) != (ipair.fecRing())) continue;
316  if((apv->getCcuAddress()) != (ipair.ccuAddr())) continue;
317  if((apv->getChannel()) != (ipair.ccuChan())) continue;
318  // Insert latency values into latency object
319  if((apv->getAddress()) == (ipair.i2cAddr(0))) {
320  if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
321  std::cout << "UNABLE APVLatency Put: Detid "<< dec<<detid
322  << " APVNr.: " << apvnr
323  << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency())
324  << " APV Mode: " << dec<< static_cast<uint16_t>(apv->getApvMode())
325  << std::endl;
326  return false;
327  }else{++apvnr;}
328  }
329  if((apv->getAddress()) == (ipair.i2cAddr(1))) {
330  if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
331  std::cout << "UNABLE APVLatency Put: Detid "<<dec<< detid
332  << " APVNr.: " << apvnr
333  << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency())
334  << " APV Mode: " << dec <<static_cast<uint16_t>(apv->getApvMode())
335  << std::endl;
336  continue;
337  return false;
338  }else{++apvnr;}
339  }
340  }
341  return true;
342 }
343 
344 // -----------------------------------------------------------------------------
346 //bool SiStripCondObjBuilderFromDb::setValuesCabling(SiStripConfigDb* const db, FedChannelConnection &ipair, uint32_t detid){
348  //SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions();
349  SiStripConfigDb::FedDescriptionsV::const_iterator description = descriptions.begin();
350  while ( description != descriptions.end() ) {
351  if ( (*description)->getFedId() ==ipair.fedId() ) { break; }
352  description++;
353  }
354  if ( description == descriptions.end() ) {return false;}
355  // Retrieve Fed9UStrips object from FED description
356  const Fed9U::Fed9UStrips& strips = (*description)->getFedStrips();
357 
358 
359  // Retrieve StripDescriptions for each APV
360  uint16_t jstrip = ipair.apvPairNumber()*sistrip::STRIPS_PER_FEDCH;
361  for ( uint16_t iapv = 2*ipair.fedCh(); iapv < 2*ipair.fedCh()+2; iapv++ ) {
362 
363  // Get StripDescriptions for the given APV
364  Fed9U::Fed9UAddress addr;
365  addr.setFedApv(iapv);
366  vector<Fed9U::Fed9UStripDescription> strip = strips.getApvStrips(addr);
367 
368  vector<Fed9U::Fed9UStripDescription>::const_iterator istrip = strip.begin();
369 
370  for ( ; istrip != strip.end(); istrip++ ) {
371  pedestals_->setData( istrip->getPedestal() , inputPedestals);
372  noises_ ->setData( istrip->getNoise() , inputNoises );
373  threshold_->setData( jstrip, istrip->getLowThresholdFactor(),
374  istrip->getHighThresholdFactor(), inputThreshold );
375  if(istrip->getDisable()){
376  std::cout << "Found disabled strip! Detid: " << detid << " APVNr: " << iapv << " Strips: " << jstrip << std::endl;
377 
378  inputQuality.push_back(quality_->encode(jstrip,1));
379  }
380  jstrip++;
381  }
382  }
383  return true;
384 }
385 
386 
387 // -----------------------------------------------------------------------------
389 //store objects
391  if ( !pedestals_->put(det_id, inputPedestals ) ) {
392  std::cout
393  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
394  << " Unable to insert values into SiStripPedestals object!"
395  << " DetId already exists!" << std::endl;
396  }
397  inputPedestals.clear();
398 
399  }
400 
401 
402 
403 // -----------------------------------------------------------------------------
406  // Insert noise values into Noises object
407 
408  if ( !noises_->put(det_id, inputNoises ) ) {
409  std::cout
410  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
411  << " Unable to insert values into SiStripNoises object!"
412  << " DetId already exists!" << std::endl;
413  }
414  inputNoises.clear();
415 
416  }
417 
418 // -----------------------------------------------------------------------------
421  // Insert threshold values into Threshold object
422  if ( !threshold_->put(det_id, inputThreshold ) ) {
423  std::cout
424  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
425  << " Unable to insert values into SiStripThreshold object!"
426  << " DetId already exists!" << std::endl;
427  }
428  inputThreshold.clear();
429 }
430 
431 // -----------------------------------------------------------------------------
434  // Insert quality values into Quality object
435  if (inputQuality.size()){
436  quality_->compact(det_id,inputQuality);
437  if ( !quality_->put(det_id, inputQuality ) ) {
438  std::cout
439  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
440  << " Unable to insert values into SiStripQuality object!"
441  << " DetId already exists!" << std::endl;
442  }
443  }
444  inputQuality.clear();
445 }
446 
447 // -----------------------------------------------------------------------------
450  // Insert tick height values into Gain object
451  SiStripApvGain::Range range( inputApvGain.begin(), inputApvGain.end() );
452  if ( !gain_->put( det_id, range ) ) {
454  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
455  << " Unable to insert values into SiStripApvGain object!"
456  << " DetId already exists!";
457  }
458  inputApvGain.clear();
459 }
460 
461 // -----------------------------------------------------------------------------
464  const SiStripDetCabling& det_cabling){
465  //variables needed in this function
466  uint16_t nApvPairs;
467  vector<uint32_t>::const_iterator det_id;
468  vector<uint32_t> det_ids;
469 
471  << "\n[SiStripCondObjBuilderFromDb::" << __func__ << "] first call to this method";
472 
473  //Check if FedDescriptions exist, if not return
474  if (!retrieveFedDescriptions(db)) {std::cout<< "Found no FedDescription!" << std::endl;return;}
475  // Retrieve list of active DetIds
476  det_cabling.addActiveDetectorsRawIds(det_ids);
477  if ( det_ids.empty() ) {
478  std::cout
479  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
480  << " Unable to build Pedestals object!"
481  << " No DetIds found!" << std::endl;
482  return;
483  }
484  std::cout << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
485  << " Found " << det_ids.size() << " active DetIds";
486 
487  // Loop Active DetIds
488  det_id = det_ids.begin();
489  for ( ; det_id != det_ids.end(); det_id++ ) {
490  std::stringstream ssMessage;
491 
492  // Ignore NULL DetIds
493  if ( !(*det_id) ) { continue; }
494  if ( *det_id == sistrip::invalid32_ ) { continue; }
495 
496 
497  //build connections per DetId
498  const vector<const FedChannelConnection *>& conns=buildConnections(det_cabling, *det_id);
499 
500  vector<const FedChannelConnection *>::const_iterator ipair = conns.begin();
501  if(conns.size() ==0 ) continue;
502 
503  //retrieve number of APV pairs per detid
504  nApvPairs=retrieveNumberAPVPairs(*det_id);
505 
506 
507  //loop connections and check if APVPair is connected
508  vector< vector<const FedChannelConnection *>::const_iterator > listConns(nApvPairs,conns.end());
509 
510  for ( ; ipair != conns.end(); ++ipair ){
511  // Check if the ApvPair is connected
512  if ((*ipair)->fedId()!=sistrip::invalid_ && (*ipair)->apvPairNumber()<3){
513  // (*ipair)->print(ssMessage);
514  // ssMessage<< std::endl;
515  listConns[ipair-conns.begin()]=ipair;
516  } else {
517  std::cout
518  << "\n impossible to assign connection position in listConns " << std::endl;
519  // (*ipair)->print(ssMessage);
520  // ssMessage << std::endl;
521  }
522  }
523 
524  // get data
525  // vector< vector<const FedChannelConnection *>::const_iterator >::const_iterator ilistConns=listConns.begin();
526  for (uint16_t apvPair=0;apvPair<listConns.size();++apvPair){
527  ipair=listConns[apvPair];
528  if ( ipair == conns.end() ) {
529  // Fill object with default values
530  std::cout
531  << "\n "
532  << " Unable to find FED connection for detid : " << std::dec << *det_id << " APV pair number " << apvPair
533  << " Writing default values" << std::endl;
534  (*ipair)->print(ssMessage);
535  //If no connection was found, add 100 to apvpair
536  apvPair+=100;
537  std::cout << " Put apvPair+100:" << apvPair << " into vector!" << std::endl;
538  p_apvpcon=std::make_pair(apvPair,**ipair);
539  v_apvpcon.push_back(p_apvpcon);
540  apvPair=apvPair-100;
541  continue;
542  }
543  p_apvpcon=std::make_pair(apvPair,**ipair);
544  v_apvpcon.push_back(p_apvpcon);
545  } //conns loop
546  p_detcon=std::make_pair(*det_id,v_apvpcon);
547  v_trackercon.push_back(p_detcon);
548  v_apvpcon.clear();
549  } // det id loop
550 }
551 
552 // -----------------------------------------------------------------------------
555  trackercon tc = _tc;
556  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
557  //data container
558  gain_= new SiStripApvGain();
559 
560  //check if Timing analysis description is found, otherwise quit
563  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
564  << " NULL pointer to AnalysisDescriptions returned by SiStripConfigDb!"
565  << " Cannot build Analysis object! QUIT";
566  // some values have to be set, otherwise PopCon will crash
568  storeTiming(4711);
569  return;
570  }
571 
572  i_trackercon detids_end=tc.end();
573 
574  //loop detids
575  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
576  uint32_t detid = (*detids).first;
577  i_apvpairconn connections_end=((*detids).second).end();
578 
579  //loop connections
580  for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
581  uint32_t apvPair =(*connections).first;
582  FedChannelConnection ipair =(*connections).second;
583 
584 
585  //no connection for apvPair found
586  if(apvPair>=100){
588  continue;
589  }
590 
591  //fill data
592  if(!setValuesApvTiming(db, ipair)){
593  std::cout
594  << "\n "
595  << " Unable to find Timing Analysis Description"
596  << " Writing default values for DetId: " << detid
597  << " Value: " << m_defaulttickheightvalue/m_gaincalibrationfactor << std::endl;
599  }
600  }//connections
601  storeTiming(detid);
602  }//detids
603 
604 }
605 
606 // -----------------------------------------------------------------------------
609  trackercon tc = _tc;
610  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
611  //data container
612  latency_ = new SiStripLatency();
613 
614  i_trackercon detids_end=tc.end();
615 
616  // get APV DeviceDescriptions
618 
619 
620  //loop detids
621  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
622  uint32_t detid = (*detids).first;
623  uint16_t apvnr=1;
624  i_apvpairconn connections_end=((*detids).second).end();
625 
626 
627  //loop connections
628  for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
629  uint32_t apvPair =(*connections).first;
630  FedChannelConnection ipair =(*connections).second;
631 
632  //no connection for apvPair found
633  if(apvPair>=100){
634  //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);
635  std::cout << "[SiStripCondObjBuilderFromDb::" << __func__ << "] No FEDConnection for DetId " << detid << " ApvPair " << apvPair-100 << " found, skipping Latency Insertion!" << std::endl;
636  continue;
637  }
638 
639  //fill data
640  if(!setValuesApvLatency((*latency_),db, ipair, detid, apvnr, apvs)){
641  std::cout
642  << "\n "
643  << " Unable to find FEC Description"
644  << " Skipping Insertion for DetId: " << detid << std::endl;
645  //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);
646  }
647  apvnr+=2;
648  }//connections
649  // compact Latency Object
650 
651  }//detids
652  latency_->compress();
653  std::stringstream ss;
654  // latency debug output
655  latency_->printSummary(ss);
656  latency_->printDebug(ss);
657  std::cout << ss.str() << std::endl;
658 }
659 
660 // -----------------------------------------------------------------------------
663  trackercon tc = _tc;
664  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
665 
666  //data containers
668  noises_ = new SiStripNoises();
670  quality_ = new SiStripQuality();
671 
672  i_trackercon detids_end=tc.end();
673 
674  //Build FED Descriptions out of db object
676 
677  //loop detids
678  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
679  uint32_t detid = (*detids).first;
680  i_apvpairconn connections_end=((*detids).second).end();
681 
682  //loop connections
683  for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
684  uint32_t apvPair =(*connections).first;
685  FedChannelConnection ipair =(*connections).second;
686 
687  //no connection for apvPair found
688  if(apvPair>=100){
689  std::cout
690  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
691  << " Unable to find FED description for FED id: " << ipair.fedId()
692  << " detid : " << detid << " APV pair number " << apvPair
693  << " Writing default values"<< std::endl;
694  setDefaultValuesCabling((apvPair-100));
695  continue;
696  }
697  // if(!setValuesCabling(db, ipair, detid)){
698  if(!setValuesCabling(descriptions, ipair, detid)){
699  std::cout
700  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
701  << " Unable to find FED description for FED id: " << ipair.fedId()
702  << " detid : " << detid << " APV pair number " << apvPair
703  << " Writing default values"<< std::endl;
704  setDefaultValuesCabling(apvPair);
705  }
706  }//connections
707  storePedestals(detid);
708  storeNoise(detid);
709  storeThreshold(detid);
710  storeQuality(detid);
711  }//detids
712 }
713 
714 
const uint16_t & fecSlot() const
bool put(const uint32_t &detID, const InputVector &vect)
vector< uint32_t > retrieveActiveDetIds(const SiStripDetCabling &det_cabling)
SiStripPedestals::InputVector inputPedestals
const uint16_t & fecCrate() const
bool put(const uint32_t detId, const uint16_t apv, const uint16_t latency, const uint16_t mode)
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
Versions maskVersion() const
const uint16_t & fedCh() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void buildAnalysisRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
DeviceFactory *const deviceFactory(std::string method_name="") const
static const uint32_t invalid32_
Definition: Constants.h:16
SiStripQuality::InputVector inputQuality
FedDescriptionsRange getFedDescriptions(std::string partition="")
std::string partitionName() const
uint16_t apvPairNumber() const
tuple db
Definition: EcalCondDB.py:151
FedDescriptions::range FedDescriptionsRange
SiStripThreshold::InputVector inputThreshold
const uint16_t & fedId() const
void setDefaultValuesCabling(uint16_t apvPair)
edm::Service< SiStripConfigDb > db_
bool put(const uint32_t &detID, Range input)
void buildFECRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const_iterator_range partitions() const
bool setValuesApvLatency(SiStripLatency &latency_, SiStripConfigDb *const db, FedChannelConnection &ipair, uint32_t detid, uint16_t apvnr, SiStripConfigDb::DeviceDescriptionsRange apvs)
bool retrieveFedDescriptions(SiStripConfigDb *const db)
Versions apvTimingVersion() const
void buildStripRelatedObjects(SiStripConfigDb *const db, const SiStripDetCabling &det_cabling)
bool checkForCompatibility(std::stringstream &input, std::stringstream &output, std::string &label)
const uint16_t & fecRing() const
static void buildFecCabling(SiStripConfigDb *const, SiStripFecCabling &, const sistrip::CablingSource &)
Class containning control, module, detector and connection information, at the level of a FED channel...
DeviceDescriptions::range DeviceDescriptionsRange
void compact(unsigned int &, std::vector< unsigned int > &)
An interface class to the DeviceFactory.
const uint16_t & ccuChan() const
void buildFEDRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
std::pair< ContainerIterator, ContainerIterator > Range
uint16_t retrieveNumberAPVPairs(uint32_t det_id)
std::vector< pair_detcon > trackercon
Container class for database partition parameters.
#define end
Definition: vmac.h:38
AnalysisDescriptionsRange getAnalysisDescriptions(AnalysisType, std::string partition="")
const uint16_t & ccuAddr() const
vector< const FedChannelConnection * > buildConnections(const SiStripDetCabling &det_cabling, uint32_t det_id)
SiStripNoises::InputVector inputNoises
#define LogTrace(id)
void printSummary(std::stringstream &ss) const
Prints the number of ranges as well as the value of singleLatency and singleMode. ...
bool put(const uint32_t &detID, const InputVector &input)
DbClient *const databaseCache(std::string method_name="") const
const SiStripDbParams & dbParams() const
tuple description
Definition: idDealer.py:66
bool setValuesCabling(SiStripConfigDb::FedDescriptionsRange &descriptions, FedChannelConnection &ipair, uint32_t detid)
static void getFedCabling(const SiStripFecCabling &in, SiStripFedCabling &out)
static const uint16_t STRIPS_PER_FEDCH
bool put(const uint32_t &detID, InputVector &input)
bool retrieveTimingAnalysisDescriptions(SiStripConfigDb *const db)
AnalysisDescriptions::range AnalysisDescriptionsRange
static const uint16_t invalid_
Definition: Constants.h:17
void setDefaultValuesApvLatency(SiStripLatency &latency_, const FedChannelConnection &ipair, uint32_t detid, uint16_t apvnr)
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
boost::iterator_range< SiStripPartitions::const_iterator > const_iterator_range
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
SiStripApvGain::InputVector inputApvGain
void printDebug(std::stringstream &ss) const
Prints the full list of all ranges and corresponding values of latency and mode.
void setData(float ped, InputVector &vped)
tuple cout
Definition: gather_cfg.py:121
static uint16_t fedCh(const uint16_t &fe_unit, const uint16_t &fe_chan)
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
static const char mlESSources_[]
const uint16_t & i2cAddr(const uint16_t &apv0_or_1) const
bool put(const uint32_t &detID, const InputVector &vect)
std::vector< pair_detcon >::iterator i_trackercon
Versions fecVersion() const
Versions cabVersion() const
std::vector< pair_apvpairconn >::iterator i_apvpairconn
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
Versions fedVersion() const
void setData(float noise_, InputVector &vped)
bool setValuesApvTiming(SiStripConfigDb *const db, FedChannelConnection &ipair)