CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
SiStripCondObjBuilderFromDb Class Reference

#include <SiStripCondObjBuilderFromDb.h>

Classes

class  SkipDeviceDescription
 

Public Types

typedef std::vector< pair_apvpairconn >::iterator i_apvpairconn
 
typedef std::vector< pair_detcon >::iterator i_trackercon
 
typedef std::pair< uint32_t, FedChannelConnectionpair_apvpairconn
 
typedef std::pair< uint32_t, v_apvpairconnpair_detcon
 
typedef std::vector< pair_detcontrackercon
 
typedef std::vector< pair_apvpairconnv_apvpairconn
 

Public Member Functions

void buildAnalysisRelatedObjects (SiStripConfigDb *const db, const trackercon &tc)
 
void buildCondObj ()
 
void buildFECRelatedObjects (SiStripConfigDb *const db, const trackercon &tc)
 
void buildFEDRelatedObjects (SiStripConfigDb *const db, const trackercon &tc)
 
void buildStripRelatedObjects (SiStripConfigDb *const db, const SiStripDetCabling &det_cabling)
 
TrackerTopologybuildTrackerTopology ()
 
bool checkForCompatibility (std::stringstream &input, std::stringstream &output, std::string &label)
 
const SiStripDbParamsdbParams () const
 
SiStripApvGaingetApvGain ()
 
SiStripLatencygetApvLatency ()
 
std::string getConfigString (const std::type_info &typeInfo)
 
SiStripFedCablinggetFedCabling ()
 
SiStripNoisesgetNoises ()
 
SiStripPedestalsgetPedestals ()
 
SiStripQualitygetQuality ()
 
SiStripThresholdgetThreshold ()
 
void getValue (SiStripFedCabling *&val)
 
void getValue (SiStripPedestals *&val)
 
void getValue (SiStripNoises *&val)
 
void getValue (SiStripThreshold *&val)
 
void getValue (SiStripQuality *&val)
 
void getValue (SiStripBadStrip *&val)
 
void getValue (SiStripApvGain *&val)
 
void getValue (SiStripLatency *&val)
 
void setLastIovGain (std::shared_ptr< SiStripApvGain > gain)
 
 SiStripCondObjBuilderFromDb ()
 
 SiStripCondObjBuilderFromDb (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
virtual ~SiStripCondObjBuilderFromDb ()
 

Protected Member Functions

vector< const FedChannelConnection * > buildConnections (const SiStripDetCabling &det_cabling, uint32_t det_id)
 
void checkUpdate ()
 
vector< uint32_t > retrieveActiveDetIds (const SiStripDetCabling &det_cabling)
 
bool retrieveFedDescriptions (SiStripConfigDb *const db)
 
uint16_t retrieveNumberAPVPairs (uint32_t det_id)
 
bool retrieveTimingAnalysisDescriptions (SiStripConfigDb *const db)
 
void setDefaultValuesApvLatency (SiStripLatency &latency_, const FedChannelConnection &ipair, uint32_t detid, uint16_t apvnr)
 
void setDefaultValuesApvTiming (uint32_t detid, uint32_t apvPair)
 
void setDefaultValuesCabling (uint16_t apvPair)
 
bool setValuesApvLatency (SiStripLatency &latency_, SiStripConfigDb *const db, FedChannelConnection &ipair, uint32_t detid, uint16_t apvnr, SiStripConfigDb::DeviceDescriptionsRange apvs)
 
bool setValuesApvTiming (SiStripConfigDb *const db, FedChannelConnection &ipair)
 
bool setValuesCabling (SiStripConfigDb::FedDescriptionsRange &descriptions, FedChannelConnection &ipair, uint32_t detid)
 
void storeNoise (uint32_t det_id)
 
void storePedestals (uint32_t det_id)
 
void storeQuality (uint32_t det_id)
 
void storeThreshold (uint32_t det_id)
 
void storeTiming (uint32_t det_id)
 

Protected Attributes

edm::Service< SiStripConfigDbdb_
 
SiStripDbParams dbParams_
 
SiStripFedCablingfed_cabling_
 
SiStripApvGaingain_
 
std::shared_ptr< SiStripApvGaingain_last_
 
SiStripApvGain::InputVector inputApvGain
 
SiStripNoises::InputVector inputNoises
 
SiStripPedestals::InputVector inputPedestals
 
SiStripQuality::InputVector inputQuality
 
SiStripThreshold::InputVector inputThreshold
 
SiStripLatencylatency_
 
bool m_debug
 
uint16_t m_defaultapvlatencyvalue
 
uint16_t m_defaultapvmodevalue
 
float m_defaultnoisevalue
 
float m_defaultpedestalvalue
 
float m_defaultthresholdhighvalue
 
float m_defaultthresholdlowvalue
 
float m_defaulttickheightvalue
 
float m_gaincalibrationfactor
 
edm::VParameterSet m_skippedDevices
 
float m_tickmarkThreshold
 
bool m_useanalysis
 
bool m_usefec
 
bool m_usefed
 
SiStripNoisesnoises_
 
pair_apvpairconn p_apvpcon
 
pair_detcon p_detcon
 
SiStripPedestalspedestals_
 
SiStripQualityquality_
 
std::vector< uint32_t > skippedDetIds
 
std::vector< SkipDeviceDescriptionskippedDevices
 
SiStripThresholdthreshold_
 
TrackerTopologytTopo
 
v_apvpairconn v_apvpcon
 
trackercon v_trackercon
 

Detailed Description

Definition at line 46 of file SiStripCondObjBuilderFromDb.h.

Member Typedef Documentation

Definition at line 57 of file SiStripCondObjBuilderFromDb.h.

Definition at line 56 of file SiStripCondObjBuilderFromDb.h.

Definition at line 51 of file SiStripCondObjBuilderFromDb.h.

Definition at line 53 of file SiStripCondObjBuilderFromDb.h.

Definition at line 54 of file SiStripCondObjBuilderFromDb.h.

Definition at line 52 of file SiStripCondObjBuilderFromDb.h.

Constructor & Destructor Documentation

SiStripCondObjBuilderFromDb::SiStripCondObjBuilderFromDb ( )

Definition at line 60 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, and sistrip::mlESSources_.

61 {
63  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
64  << " Constructing object...";
65 }
#define LogTrace(id)
static const char mlESSources_[]
SiStripCondObjBuilderFromDb::SiStripCondObjBuilderFromDb ( const edm::ParameterSet pset,
const edm::ActivityRegistry  
)

Definition at line 32 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, m_skippedDevices, sistrip::mlESSources_, and skippedDevices.

33  :
35  m_tickmarkThreshold(static_cast<float>(pset.getUntrackedParameter<double>("TickmarkThreshold",50.))),
36  m_gaincalibrationfactor(static_cast<float>(pset.getUntrackedParameter<double>("GainNormalizationFactor",640.))),
37  m_defaultpedestalvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultPedestal",0.))),
38  m_defaultnoisevalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultNoise",0.))),
39  m_defaultthresholdhighvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdHigh",0.))),
40  m_defaultthresholdlowvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdLow",0.))),
41  m_defaultapvmodevalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVMode",37))),
42  m_defaultapvlatencyvalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVLatency",142))),
43  m_defaulttickheightvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultTickHeight",690.))),
44  m_useanalysis(static_cast<bool>(pset.getUntrackedParameter<bool>("UseAnalysis",false))),
45  m_usefed(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFED",false))),
46  m_usefec(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFEC",false))),
47  m_debug(static_cast<bool>(pset.getUntrackedParameter<bool>("DebugMode",false))),
49 {
51  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
52  << " Constructing object...";
53  for (const auto &pset : m_skippedDevices){
54  skippedDevices.emplace_back(pset);
55  }
56 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
#define LogTrace(id)
static const char mlESSources_[]
std::vector< SkipDeviceDescription > skippedDevices
SiStripCondObjBuilderFromDb::~SiStripCondObjBuilderFromDb ( )
virtual

Definition at line 69 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, sistrip::mlESSources_, and tTopo.

69  {
71  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
72  << " Destructing object...";
73  delete tTopo;
74 }
#define LogTrace(id)
static const char mlESSources_[]

Member Function Documentation

void SiStripCondObjBuilderFromDb::buildAnalysisRelatedObjects ( SiStripConfigDb *const  db,
const trackercon tc 
)

Definition at line 708 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, db_, Exception, gain_, SiStripDetInfoFileReader::getAllData(), sistrip::invalid32_, sistrip::mlESSources_, Utilities::operator, AlCaHLTBitMon_ParallelJobs::p, retrieveTimingAnalysisDescriptions(), setDefaultValuesApvTiming(), setValuesApvTiming(), createPayload::skip, skippedDetIds, and storeTiming().

Referenced by buildCondObj(), and dbParams().

708  {
709  trackercon tc = _tc;
710  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
711  //data container
712  gain_= new SiStripApvGain();
713 
714  //check if Timing analysis description is found, otherwise quit
717  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
718  << " NULL pointer to AnalysisDescriptions returned by SiStripConfigDb!"
719  << " Cannot build Analysis object! QUIT";
720  throw cms::Exception("Cannot build Analysis object!");
721  }
722 
723  // Get all detIds from the ideal geometry to build the payload
725  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = fr->getAllData();
726 
727  for(auto it = DetInfos.begin(); it != DetInfos.end(); ++it){
728  // check if det id is correct and if it is actually cabled in the detector
729  if( it->first==0 || it->first==sistrip::invalid32_) {
730  edm::LogError("DetIdNotGood") << "@SUB=analyze" << "Invalid detid: " << it->first
731  << " ... neglecting!" << std::endl;
732  continue;
733  }
734 
735  uint32_t detid = it->first;
736  bool update_ = true;
737  i_trackercon det_iter = std::find_if(tc.begin(), tc.end(), [detid](const pair_detcon &p){ return p.first==detid; });
738  if(det_iter==tc.end()) {
739  update_ = false; // do not update if it is not connected in cabling
740  }
741 
742  if(update_){
743  //loop connections
744  for(i_apvpairconn connections=det_iter->second.begin();connections!=det_iter->second.end();connections++){
745  uint32_t apvPair =(*connections).first;
746  FedChannelConnection ipair =(*connections).second;
747 
748  //no connection for apvPair found
749  if(apvPair>=100){
750  setDefaultValuesApvTiming(detid, apvPair-100);
751  continue;
752  }
753 
754  //fill data
755  if(!setValuesApvTiming(db, ipair)){
756  // either not found in analysis table or low tickmark height
757  setDefaultValuesApvTiming(detid, apvPair);
758  }
759  }//connections
760 
761  }else{
762  uint32_t nApvPairs = it->second.nApvs/2;
763  for (uint32_t apvPair=0; apvPair<nApvPairs; ++apvPair){
764  setDefaultValuesApvTiming(detid, apvPair);
765  }
766  }
767 
768  storeTiming(detid);
769 
770  }// end loop detids
771 
772  //print out skipped modules
773  std::stringstream ss;
774  for (const auto &skip : skippedDetIds){
775  ss << "\n" << skip;
776  }
778  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
779  << " [ApvGainSummary] Skipped " << skippedDetIds.size() << " modules: " << ss.str();
780 
781 
782 
783 }
static const uint32_t invalid32_
Definition: Constants.h:15
std::pair< uint32_t, v_apvpairconn > pair_detcon
edm::Service< SiStripConfigDb > db_
Class containning control, module, detector and connection information, at the level of a FED channel...
std::vector< pair_detcon > trackercon
bool retrieveTimingAnalysisDescriptions(SiStripConfigDb *const db)
void setDefaultValuesApvTiming(uint32_t detid, uint32_t apvPair)
static const char mlESSources_[]
std::vector< pair_detcon >::iterator i_trackercon
std::vector< pair_apvpairconn >::iterator i_apvpairconn
bool setValuesApvTiming(SiStripConfigDb *const db, FedChannelConnection &ipair)
void SiStripCondObjBuilderFromDb::buildCondObj ( )

Builds pedestals using FED descriptions and cabling info retrieved from configuration database.

Definition at line 231 of file SiStripCondObjBuilderFromDb.cc.

References buildAnalysisRelatedObjects(), SiStripFedCablingBuilderFromDb::buildFecCabling(), buildFECRelatedObjects(), buildFEDRelatedObjects(), buildStripRelatedObjects(), sistrip::CABLING_FROM_CONNS, SiStripConfigDb::databaseCache(), db_, SiStripConfigDb::deviceFactory(), fed_cabling_, SiStripFedCablingBuilderFromDb::getFedCabling(), LogTrace, m_useanalysis, m_usefec, m_usefed, sistrip::mlESSources_, tTopo, and v_trackercon.

Referenced by checkUpdate(), and dbParams().

231  {
233  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]";
234 
235  // Check if DB connection is made
236  if ( db_ ) {
237 
238  // Check if DB connection is made
239  if ( db_->deviceFactory() ||
240  db_->databaseCache() ) {
241 
242  // Build FEC cabling object
243  SiStripFecCabling fec_cabling;
244 
246  fec_cabling,
249 
251  SiStripDetCabling det_cabling( *fed_cabling_, tTopo );
252  buildStripRelatedObjects( &*db_, det_cabling );
253 
254 
258 
259 
260 
261  } else {
263  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
264  << " NULL pointer to DeviceFactory returned by SiStripConfigDb!"
265  << " Cannot build Pedestals object!";
266  }
267  } else {
269  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
270  << " NULL pointer to SiStripConfigDb returned by DB \"service\"!"
271  << " Cannot build Pedestals object!";
272  }
273 }
void buildAnalysisRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
DeviceFactory *const deviceFactory(std::string method_name="") const
edm::Service< SiStripConfigDb > db_
void buildFECRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
void buildStripRelatedObjects(SiStripConfigDb *const db, const SiStripDetCabling &det_cabling)
static void buildFecCabling(SiStripConfigDb *const, SiStripFecCabling &, const sistrip::CablingSource &)
void buildFEDRelatedObjects(SiStripConfigDb *const db, const trackercon &tc)
#define LogTrace(id)
DbClient *const databaseCache(std::string method_name="") const
static void getFedCabling(const SiStripFecCabling &in, SiStripFedCabling &out)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static const char mlESSources_[]
vector< const FedChannelConnection * > SiStripCondObjBuilderFromDb::buildConnections ( const SiStripDetCabling det_cabling,
uint32_t  det_id 
)
protected

Definition at line 328 of file SiStripCondObjBuilderFromDb.cc.

References SiStripDetCabling::getConnections(), and sistrip::mlESSources_.

Referenced by buildStripRelatedObjects().

328  {
329  vector<const FedChannelConnection *> conns = det_cabling.getConnections(det_id);
330  if (conns.size()==0){
332  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
333  << " Unable to build condition object!"
334  << " No FED channel connections found for detid "<< det_id;
335  }
336  return conns;
337 }
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
static const char mlESSources_[]
void SiStripCondObjBuilderFromDb::buildFECRelatedObjects ( SiStripConfigDb *const  db,
const trackercon tc 
)

Definition at line 787 of file SiStripCondObjBuilderFromDb.cc.

References SiStripLatency::compress(), gather_cfg::cout, end, SiStripConfigDb::getDeviceDescriptions(), latency_, SiStripLatency::printDebug(), SiStripLatency::printSummary(), and setValuesApvLatency().

Referenced by buildCondObj(), and dbParams().

787  {
788  trackercon tc = _tc;
789  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
790  //data container
791  latency_ = new SiStripLatency();
792 
793  i_trackercon detids_end=tc.end();
794 
795  // get APV DeviceDescriptions
797 
798 
799  //loop detids
800  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
801  uint32_t detid = (*detids).first;
802  uint16_t apvnr=1;
803  i_apvpairconn connections_end=((*detids).second).end();
804 
805 
806  //loop connections
807  for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
808  uint32_t apvPair =(*connections).first;
809  FedChannelConnection ipair =(*connections).second;
810 
811  //no connection for apvPair found
812  if(apvPair>=100){
813  //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);
814  std::cout << "[SiStripCondObjBuilderFromDb::" << __func__ << "] No FEDConnection for DetId " << detid << " ApvPair " << apvPair-100 << " found, skipping Latency Insertion!" << std::endl;
815  continue;
816  }
817 
818  //fill data
819  if(!setValuesApvLatency((*latency_),db, ipair, detid, apvnr, apvs)){
820  std::cout
821  << "\n "
822  << " Unable to find FEC Description"
823  << " Skipping Insertion for DetId: " << detid << std::endl;
824  //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);
825  }
826  apvnr+=2;
827  }//connections
828  // compact Latency Object
829 
830  }//detids
831  latency_->compress();
832  std::stringstream ss;
833  // latency debug output
834  latency_->printSummary(ss);
835  latency_->printDebug(ss);
836  std::cout << ss.str() << std::endl;
837 }
bool setValuesApvLatency(SiStripLatency &latency_, SiStripConfigDb *const db, FedChannelConnection &ipair, uint32_t detid, uint16_t apvnr, SiStripConfigDb::DeviceDescriptionsRange apvs)
Class containning control, module, detector and connection information, at the level of a FED channel...
DeviceDescriptions::range DeviceDescriptionsRange
std::vector< pair_detcon > trackercon
#define end
Definition: vmac.h:37
void printSummary(std::stringstream &ss) const
Prints the number of ranges as well as the value of singleLatency and singleMode. ...
void printDebug(std::stringstream &ss) const
Prints the full list of all ranges and corresponding values of latency and mode.
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
std::vector< pair_detcon >::iterator i_trackercon
std::vector< pair_apvpairconn >::iterator i_apvpairconn
void SiStripCondObjBuilderFromDb::buildFEDRelatedObjects ( SiStripConfigDb *const  db,
const trackercon tc 
)

Definition at line 841 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, end, FedChannelConnection::fedId(), SiStripConfigDb::getFedDescriptions(), noises_, pedestals_, quality_, setDefaultValuesCabling(), setValuesCabling(), storeNoise(), storePedestals(), storeQuality(), storeThreshold(), and threshold_.

Referenced by buildCondObj(), and dbParams().

841  {
842  trackercon tc = _tc;
843  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
844 
845  //data containers
847  noises_ = new SiStripNoises();
849  quality_ = new SiStripQuality();
850 
851  i_trackercon detids_end=tc.end();
852 
853  //Build FED Descriptions out of db object
855 
856  //loop detids
857  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
858  uint32_t detid = (*detids).first;
859  i_apvpairconn connections_end=((*detids).second).end();
860 
861  //loop connections
862  for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
863  uint32_t apvPair =(*connections).first;
864  FedChannelConnection ipair =(*connections).second;
865 
866  //no connection for apvPair found
867  if(apvPair>=100){
868  std::cout
869  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
870  << " Unable to find FED description for FED id: " << ipair.fedId()
871  << " detid : " << detid << " APV pair number " << apvPair
872  << " Writing default values"<< std::endl;
873  setDefaultValuesCabling((apvPair-100));
874  continue;
875  }
876  // if(!setValuesCabling(db, ipair, detid)){
877  if(!setValuesCabling(descriptions, ipair, detid)){
878  std::cout
879  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
880  << " Unable to find FED description for FED id: " << ipair.fedId()
881  << " detid : " << detid << " APV pair number " << apvPair
882  << " Writing default values"<< std::endl;
883  setDefaultValuesCabling(apvPair);
884  }
885  }//connections
886  storePedestals(detid);
887  storeNoise(detid);
888  storeThreshold(detid);
889  storeQuality(detid);
890  }//detids
891 }
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
const uint16_t & fedId() const
void setDefaultValuesCabling(uint16_t apvPair)
Class containning control, module, detector and connection information, at the level of a FED channel...
std::vector< pair_detcon > trackercon
#define end
Definition: vmac.h:37
bool setValuesCabling(SiStripConfigDb::FedDescriptionsRange &descriptions, FedChannelConnection &ipair, uint32_t detid)
std::vector< pair_detcon >::iterator i_trackercon
std::vector< pair_apvpairconn >::iterator i_apvpairconn
void SiStripCondObjBuilderFromDb::buildStripRelatedObjects ( SiStripConfigDb *const  db,
const SiStripDetCabling det_cabling 
)

Definition at line 614 of file SiStripCondObjBuilderFromDb.cc.

References SiStripDetCabling::addActiveDetectorsRawIds(), buildConnections(), gather_cfg::cout, TauDecayModes::dec, sistrip::invalid32_, sistrip::invalid_, sistrip::mlESSources_, p_apvpcon, p_detcon, retrieveFedDescriptions(), retrieveNumberAPVPairs(), v_apvpcon, and v_trackercon.

Referenced by buildCondObj(), and dbParams().

615  {
616  //variables needed in this function
617  uint16_t nApvPairs;
618  vector<uint32_t>::const_iterator det_id;
619  vector<uint32_t> det_ids;
620 
622  << "\n[SiStripCondObjBuilderFromDb::" << __func__ << "] first call to this method";
623 
624  //Check if FedDescriptions exist, if not return
625  if (!retrieveFedDescriptions(db)) {std::cout<< "Found no FedDescription!" << std::endl;return;}
626  // Retrieve list of active DetIds
627  det_cabling.addActiveDetectorsRawIds(det_ids);
628  if ( det_ids.empty() ) {
629  std::cout
630  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
631  << " Unable to build Pedestals object!"
632  << " No DetIds found!" << std::endl;
633  return;
634  }
635  std::cout << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
636  << " Found " << det_ids.size() << " active DetIds";
637 
638  // Loop Active DetIds
639  det_id = det_ids.begin();
640  for ( ; det_id != det_ids.end(); det_id++ ) {
641  std::stringstream ssMessage;
642 
643  // Ignore NULL DetIds
644  if ( !(*det_id) ) { continue; }
645  if ( *det_id == sistrip::invalid32_ ) { continue; }
646 
647 
648  //build connections per DetId
649  const vector<const FedChannelConnection *>& conns=buildConnections(det_cabling, *det_id);
650 
651  vector<const FedChannelConnection *>::const_iterator ipair = conns.begin();
652  if(conns.size() ==0 ) continue;
653 
654  //retrieve number of APV pairs per detid
655  nApvPairs=retrieveNumberAPVPairs(*det_id);
656 
657 
658  //loop connections and check if APVPair is connected
659  vector< vector<const FedChannelConnection *>::const_iterator > listConns(nApvPairs,conns.end());
660 
661  for ( ; ipair != conns.end(); ++ipair ){
662  // Check if the ApvPair is connected
663  if ( !(*ipair) ) continue;
664  if ((*ipair)->fedId()!=sistrip::invalid_ && (*ipair)->apvPairNumber()<3){
665  // (*ipair)->print(ssMessage);
666  // ssMessage<< std::endl;
667  listConns[ipair-conns.begin()]=ipair;
668  } else {
669  std::cout
670  << "\n impossible to assign connection position in listConns " << std::endl;
671  // (*ipair)->print(ssMessage);
672  // ssMessage << std::endl;
673  }
674  }
675 
676  // get data
677  // vector< vector<const FedChannelConnection *>::const_iterator >::const_iterator ilistConns=listConns.begin();
678  for (uint16_t apvPair=0;apvPair<listConns.size();++apvPair){
679  ipair=listConns[apvPair];
680  if ( ipair == conns.end() ) {
681  // Fill object with default values
682  std::cout
683  << "\n "
684  << " Unable to find FED connection for detid : " << std::dec << *det_id << " APV pair number " << apvPair
685  << " Writing default values" << std::endl;
686 // (*ipair)->print(ssMessage); // this will crash!
687  //If no connection was found, add 100 to apvpair
688  apvPair+=100;
689  std::cout << " Put apvPair+100:" << apvPair << " into vector!" << std::endl;
690  // use dummy FedChannelConnection since it's not used in this case
692  p_apvpcon=std::make_pair(apvPair,dummy);
693  v_apvpcon.push_back(p_apvpcon);
694  apvPair=apvPair-100;
695  continue;
696  }
697  p_apvpcon=std::make_pair(apvPair,**ipair);
698  v_apvpcon.push_back(p_apvpcon);
699  } //conns loop
700  p_detcon=std::make_pair(*det_id,v_apvpcon);
701  v_trackercon.push_back(p_detcon);
702  v_apvpcon.clear();
703  } // det id loop
704 }
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
static const uint32_t invalid32_
Definition: Constants.h:15
bool retrieveFedDescriptions(SiStripConfigDb *const db)
Class containning control, module, detector and connection information, at the level of a FED channel...
uint16_t retrieveNumberAPVPairs(uint32_t det_id)
vector< const FedChannelConnection * > buildConnections(const SiStripDetCabling &det_cabling, uint32_t det_id)
static const uint16_t invalid_
Definition: Constants.h:16
static const char mlESSources_[]
TrackerTopology * SiStripCondObjBuilderFromDb::buildTrackerTopology ( )

Definition at line 86 of file SiStripCondObjBuilderFromDb.cc.

References TrackerTopology::PixelEndcapValues::bladeMask_, TrackerTopology::PixelEndcapValues::bladeStartBit_, TrackerTopology::PixelEndcapValues::diskMask_, TrackerTopology::PixelEndcapValues::diskStartBit_, TrackerTopology::PixelBarrelValues::ladderMask_, TrackerTopology::PixelBarrelValues::ladderStartBit_, TrackerTopology::PixelBarrelValues::layerMask_, TrackerTopology::TIBValues::layerMask_, TrackerTopology::TOBValues::layerMask_, TrackerTopology::PixelBarrelValues::layerStartBit_, TrackerTopology::TIBValues::layerStartBit_, TrackerTopology::TOBValues::layerStartBit_, TrackerTopology::TIDValues::module_fw_bwMask_, TrackerTopology::TIDValues::module_fw_bwStartBit_, TrackerTopology::PixelBarrelValues::moduleMask_, TrackerTopology::PixelEndcapValues::moduleMask_, TrackerTopology::TECValues::moduleMask_, TrackerTopology::TIBValues::moduleMask_, TrackerTopology::TIDValues::moduleMask_, TrackerTopology::TOBValues::moduleMask_, TrackerTopology::PixelBarrelValues::moduleStartBit_, TrackerTopology::PixelEndcapValues::moduleStartBit_, TrackerTopology::TECValues::moduleStartBit_, TrackerTopology::TIBValues::moduleStartBit_, TrackerTopology::TIDValues::moduleStartBit_, TrackerTopology::TOBValues::moduleStartBit_, TrackerTopology::PixelEndcapValues::panelMask_, TrackerTopology::PixelEndcapValues::panelStartBit_, TrackerTopology::TECValues::petal_fw_bwMask_, TrackerTopology::TECValues::petal_fw_bwStartBit_, TrackerTopology::TECValues::petalMask_, TrackerTopology::TECValues::petalStartBit_, TrackerTopology::TECValues::ringMask_, TrackerTopology::TIDValues::ringMask_, TrackerTopology::TECValues::ringStartBit_, TrackerTopology::TIDValues::ringStartBit_, TrackerTopology::TOBValues::rod_fw_bwMask_, TrackerTopology::TOBValues::rod_fw_bwStartBit_, TrackerTopology::TOBValues::rodMask_, TrackerTopology::TOBValues::rodStartBit_, TrackerTopology::PixelEndcapValues::sideMask_, TrackerTopology::TECValues::sideMask_, TrackerTopology::TIDValues::sideMask_, TrackerTopology::PixelEndcapValues::sideStartBit_, TrackerTopology::TECValues::sideStartBit_, TrackerTopology::TIDValues::sideStartBit_, TrackerTopology::TECValues::sterMask_, TrackerTopology::TIBValues::sterMask_, TrackerTopology::TIDValues::sterMask_, TrackerTopology::TOBValues::sterMask_, TrackerTopology::TECValues::sterStartBit_, TrackerTopology::TIBValues::sterStartBit_, TrackerTopology::TIDValues::sterStartBit_, TrackerTopology::TOBValues::sterStartBit_, TrackerTopology::TIBValues::str_fw_bwMask_, TrackerTopology::TIBValues::str_fw_bwStartBit_, TrackerTopology::TIBValues::str_int_extMask_, TrackerTopology::TIBValues::str_int_extStartBit_, TrackerTopology::TIBValues::strMask_, TrackerTopology::TIBValues::strStartBit_, TrackerTopology::TECValues::wheelMask_, TrackerTopology::TIDValues::wheelMask_, TrackerTopology::TECValues::wheelStartBit_, and TrackerTopology::TIDValues::wheelStartBit_.

86  {
93 
94  pxbVals_.layerStartBit_ = 16;
95  pxbVals_.ladderStartBit_ = 8;
96  pxbVals_.moduleStartBit_ = 2;
97  pxbVals_.layerMask_ = 0xF;
98  pxbVals_.ladderMask_ = 0xFF;
99  pxbVals_.moduleMask_ = 0x3F;
100  pxfVals_.sideStartBit_ = 23;
101  pxfVals_.diskStartBit_ = 16;
102  pxfVals_.bladeStartBit_ = 10;
103  pxfVals_.panelStartBit_ = 8;
104  pxfVals_.moduleStartBit_ = 2;
105  pxfVals_.sideMask_ = 0x3;
106  pxfVals_.diskMask_ = 0xF;
107  pxfVals_.bladeMask_ = 0x3F;
108  pxfVals_.panelMask_ = 0x3;
109  pxfVals_.moduleMask_ = 0x3F;
110  tecVals_.sideStartBit_ = 18;
111  tecVals_.wheelStartBit_ = 14;
112  tecVals_.petal_fw_bwStartBit_ = 12;
113  tecVals_.petalStartBit_ = 8;
114  tecVals_.ringStartBit_ = 5;
115  tecVals_.moduleStartBit_ = 2;
116  tecVals_.sterStartBit_ = 0;
117  tecVals_.sideMask_ = 0x3;
118  tecVals_.wheelMask_ = 0xF;
119  tecVals_.petal_fw_bwMask_ = 0x3;
120  tecVals_.petalMask_ = 0xF;
121  tecVals_.ringMask_ = 0x7;
122  tecVals_.moduleMask_ = 0x7;
123  tecVals_.sterMask_ = 0x3;
124  tibVals_.layerStartBit_ = 14;
125  tibVals_.str_fw_bwStartBit_ = 12;
126  tibVals_.str_int_extStartBit_ = 10;
127  tibVals_.strStartBit_ = 4;
128  tibVals_.moduleStartBit_ = 2;
129  tibVals_.sterStartBit_ = 0;
130  tibVals_.layerMask_ = 0x7;
131  tibVals_.str_fw_bwMask_ = 0x3;
132  tibVals_.str_int_extMask_ = 0x3;
133  tibVals_.strMask_ = 0x3F;
134  tibVals_.moduleMask_ = 0x3;
135  tibVals_.sterMask_ = 0x3;
136  tidVals_.sideStartBit_ = 13;
137  tidVals_.wheelStartBit_ = 11;
138  tidVals_.ringStartBit_ = 9;
139  tidVals_.module_fw_bwStartBit_ = 7;
140  tidVals_.moduleStartBit_ = 2;
141  tidVals_.sterStartBit_ = 0;
142  tidVals_.sideMask_ = 0x3;
143  tidVals_.wheelMask_ = 0x3;
144  tidVals_.ringMask_ = 0x3;
145  tidVals_.module_fw_bwMask_ = 0x3;
146  tidVals_.moduleMask_ = 0x1F;
147  tidVals_.sterMask_ = 0x3;
148  tobVals_.layerStartBit_ = 14;
149  tobVals_.rod_fw_bwStartBit_ = 12;
150  tobVals_.rodStartBit_ = 5;
151  tobVals_.moduleStartBit_ = 2;
152  tobVals_.sterStartBit_ = 0;
153  tobVals_.layerMask_ = 0x7;
154  tobVals_.rod_fw_bwMask_ = 0x3;
155  tobVals_.rodMask_ = 0x7F;
156  tobVals_.moduleMask_ = 0x7;
157  tobVals_.sterMask_ = 0x3;
158 
159  return new TrackerTopology(pxbVals_, pxfVals_, tecVals_, tibVals_, tidVals_, tobVals_);
160 }
unsigned int module_fw_bwStartBit_
bool SiStripCondObjBuilderFromDb::checkForCompatibility ( std::stringstream &  input,
std::stringstream &  output,
std::string &  label 
)

Definition at line 163 of file SiStripCondObjBuilderFromDb.cc.

References SiStripPartition::apvTimingVersion(), SiStripPartition::cabVersion(), dbParams(), SiStripPartition::fecVersion(), SiStripPartition::fedVersion(), SiStripPartition::maskVersion(), SiStripPartition::partitionName(), and SiStripDbParams::partitions().

Referenced by dbParams(), and popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded().

163  {
164  // DEPRECATED. Superseded by SiStripCondObjBuilderFromDb::getConfigString(const std::type_info& typeInfo).
165 
166  //get current config DB parameter
167 
169 
170  SiStripDbParams::SiStripPartitions::const_iterator ipart = partitionsRange.begin();
171  SiStripDbParams::SiStripPartitions::const_iterator ipartEnd = partitionsRange.end();
172  for ( ; ipart != ipartEnd; ++ipart ) {
173  SiStripPartition partition=ipart->second;
174  output << "@ "
175  << " Partition " << partition.partitionName() ;
176  if (label!="Cabling" && label !="ApvLatency")
177  output << " FedVer " << partition.fedVersion().first << "." << partition.fedVersion().second;
178  if(label=="Cabling")
179  output << " CabVer " << partition.cabVersion().first << "." << partition.cabVersion().second
180  << " MaskVer " << partition.maskVersion().first << "." << partition.maskVersion().second;
181  if(label=="ApvTiming")
182  output<< " ApvTimingVer " << partition.apvTimingVersion().first << "." << partition.apvTimingVersion().second;
183  if(label=="ApvLatency")
184  output<< " FecVersion " << partition.fecVersion().first << "." << partition.fecVersion().second;
185  }
186 
187  if (!strcmp(output.str().c_str(),input.str().c_str()))
188  return false;
189 
190  return true;
191 }
Versions maskVersion() const
std::string partitionName() const
static std::string const input
Definition: EdmProvDump.cc:44
const_iterator_range partitions() const
Versions apvTimingVersion() const
Container class for database partition parameters.
const SiStripDbParams & dbParams() const
boost::iterator_range< SiStripPartitions::const_iterator > const_iterator_range
Versions fecVersion() const
Versions cabVersion() const
Versions fedVersion() const
void SiStripCondObjBuilderFromDb::checkUpdate ( )
protected
const SiStripDbParams& SiStripCondObjBuilderFromDb::dbParams ( ) const
inline
SiStripApvGain* SiStripCondObjBuilderFromDb::getApvGain ( )
inline

Definition at line 103 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and gain_.

Referenced by getValue().

SiStripLatency* SiStripCondObjBuilderFromDb::getApvLatency ( )
inline

Definition at line 104 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and latency_.

Referenced by getValue().

std::string SiStripCondObjBuilderFromDb::getConfigString ( const std::type_info &  typeInfo)

Definition at line 194 of file SiStripCondObjBuilderFromDb.cc.

References SiStripPartition::apvTimingVersion(), SiStripPartition::cabVersion(), dbParams(), SiStripPartition::fecVersion(), SiStripPartition::fedVersion(), SiStripPartition::maskVersion(), convertSQLitetoXML_cfg::output, SiStripPartition::partitionName(), and SiStripDbParams::partitions().

Referenced by dbParams().

194  {
195  // create config line used by fast O2O
196 
197  std::stringstream output;
198 
200  SiStripDbParams::SiStripPartitions::const_iterator ipart = partitionsRange.begin();
201  SiStripDbParams::SiStripPartitions::const_iterator ipartEnd = partitionsRange.end();
202  for ( ; ipart != ipartEnd; ++ipart ) {
203  SiStripPartition partition=ipart->second;
204  output << "%%" << "Partition: " << partition.partitionName();
205 
206  // Make everything depend on cabVersion and maskVersion!
207  output << " CablingVersion: " << partition.cabVersion().first << "." << partition.cabVersion().second;
208  output << " MaskVersion: " << partition.maskVersion().first << "." << partition.maskVersion().second;
209 
210  if(typeInfo==typeid(SiStripFedCabling)){
211  // Do nothing. FedCabling only depends on cabVersion and maskVersion.
212  }
213  else if(typeInfo==typeid(SiStripLatency)){
214  // Latency is FEC related, add fecVersion.
215  output << " FecVersion: " << partition.fecVersion().first << "." << partition.fecVersion().second;
216  }else{
217  // BadStrip, Noises, Pedestals and Thresholds are FED related, add fecVersion.
218  output << " FedVersion: " << partition.fedVersion().first << "." << partition.fedVersion().second;
219  if(typeInfo==typeid(SiStripApvGain)){
220  // Not used in O2O.
221  output << " ApvTimingVersion: " << partition.apvTimingVersion().first << "." << partition.apvTimingVersion().second;
222  }
223  }
224  }
225 
226  return output.str();
227 
228 }
Versions maskVersion() const
std::string partitionName() const
const_iterator_range partitions() const
Versions apvTimingVersion() const
Container class for database partition parameters.
const SiStripDbParams & dbParams() const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
boost::iterator_range< SiStripPartitions::const_iterator > const_iterator_range
Versions fecVersion() const
Versions cabVersion() const
Versions fedVersion() const
SiStripFedCabling* SiStripCondObjBuilderFromDb::getFedCabling ( )
inline

Definition at line 98 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and fed_cabling_.

Referenced by getValue().

SiStripNoises* SiStripCondObjBuilderFromDb::getNoises ( )
inline

Definition at line 100 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and noises_.

Referenced by getValue().

SiStripPedestals* SiStripCondObjBuilderFromDb::getPedestals ( )
inline

Definition at line 99 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and pedestals_.

Referenced by getValue().

SiStripQuality* SiStripCondObjBuilderFromDb::getQuality ( )
inline

Definition at line 102 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and quality_.

Referenced by getValue().

SiStripThreshold* SiStripCondObjBuilderFromDb::getThreshold ( )
inline

Definition at line 101 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and threshold_.

Referenced by getValue().

void SiStripCondObjBuilderFromDb::getValue ( SiStripFedCabling *&  val)
inline
void SiStripCondObjBuilderFromDb::getValue ( SiStripPedestals *&  val)
inline

Definition at line 107 of file SiStripCondObjBuilderFromDb.h.

References getPedestals().

107 { val = getPedestals(); }
void SiStripCondObjBuilderFromDb::getValue ( SiStripNoises *&  val)
inline

Definition at line 108 of file SiStripCondObjBuilderFromDb.h.

References getNoises().

108 { val = getNoises(); }
void SiStripCondObjBuilderFromDb::getValue ( SiStripThreshold *&  val)
inline

Definition at line 109 of file SiStripCondObjBuilderFromDb.h.

References getThreshold().

109 { val = getThreshold(); }
void SiStripCondObjBuilderFromDb::getValue ( SiStripQuality *&  val)
inline

Definition at line 110 of file SiStripCondObjBuilderFromDb.h.

References getQuality().

110 { val = getQuality(); }
void SiStripCondObjBuilderFromDb::getValue ( SiStripBadStrip *&  val)
inline

Definition at line 111 of file SiStripCondObjBuilderFromDb.h.

References getQuality().

void SiStripCondObjBuilderFromDb::getValue ( SiStripApvGain *&  val)
inline

Definition at line 112 of file SiStripCondObjBuilderFromDb.h.

References getApvGain().

112 { val = getApvGain(); }
void SiStripCondObjBuilderFromDb::getValue ( SiStripLatency *&  val)
inline

Definition at line 113 of file SiStripCondObjBuilderFromDb.h.

References getApvLatency().

113 { val = getApvLatency(); }
vector< uint32_t > SiStripCondObjBuilderFromDb::retrieveActiveDetIds ( const SiStripDetCabling det_cabling)
protected

Definition at line 309 of file SiStripCondObjBuilderFromDb.cc.

References SiStripDetCabling::addActiveDetectorsRawIds(), LogTrace, and sistrip::mlESSources_.

309  {
310  vector<uint32_t> det_ids;
311  det_cabling.addActiveDetectorsRawIds(det_ids);
312  if ( det_ids.empty() ) {
314  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
315  << " Unable to build Pedestals object!"
316  << " No DetIds found!";
317  return det_ids;
318  }
320  << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
321  << " Found " << det_ids.size() << " active DetIds";
322  return det_ids;
323 }
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
#define LogTrace(id)
static const char mlESSources_[]
bool SiStripCondObjBuilderFromDb::retrieveFedDescriptions ( SiStripConfigDb *const  db)
protected

Definition at line 278 of file SiStripCondObjBuilderFromDb.cc.

References SiStripConfigDb::getFedDescriptions(), and sistrip::mlESSources_.

Referenced by buildStripRelatedObjects().

278  {
280  if ( descriptions.empty() ) {
282  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
283  << " No FED descriptions found!";
284 
285  return false;
286  }
287  return true;
288 }
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
static const char mlESSources_[]
uint16_t SiStripCondObjBuilderFromDb::retrieveNumberAPVPairs ( uint32_t  det_id)
protected

Definition at line 342 of file SiStripCondObjBuilderFromDb.cc.

References SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), and Utilities::operator.

Referenced by buildStripRelatedObjects().

342  {
343  uint16_t nApvPairs;
345  nApvPairs=fr->getNumberOfApvsAndStripLength(det_id).first/2;
346  return nApvPairs;
347 }
bool SiStripCondObjBuilderFromDb::retrieveTimingAnalysisDescriptions ( SiStripConfigDb *const  db)
protected

Definition at line 293 of file SiStripCondObjBuilderFromDb.cc.

References SiStripConfigDb::getAnalysisDescriptions(), and sistrip::mlESSources_.

Referenced by buildAnalysisRelatedObjects().

293  {
295  db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
296  if ( anal_descriptions.empty() ) {
298  << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
299  << " Unable to build SiStripApvGain object!"
300  << " No timing-scan analysis descriptions found!";
301  return false;
302  }
303  return true;
304 }
AnalysisDescriptionsRange getAnalysisDescriptions(AnalysisType, std::string partition="")
AnalysisDescriptions::range AnalysisDescriptionsRange
static const char mlESSources_[]
void SiStripCondObjBuilderFromDb::setDefaultValuesApvLatency ( SiStripLatency latency_,
const FedChannelConnection ipair,
uint32_t  detid,
uint16_t  apvnr 
)
protected

Definition at line 389 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, m_defaultapvlatencyvalue, m_defaultapvmodevalue, and SiStripLatency::put().

389  {
390  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Set Default Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
391  if(!latency_.put( detid, apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
392  {
393  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
394  }
395  if(!latency_.put( detid, ++apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
396  {
397  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
398  }
399 
400 }
bool put(const uint32_t detId, const uint16_t apv, const uint16_t latency, const uint16_t mode)
void SiStripCondObjBuilderFromDb::setDefaultValuesApvTiming ( uint32_t  detid,
uint32_t  apvPair 
)
protected

Definition at line 365 of file SiStripCondObjBuilderFromDb.cc.

References gain_last_, inputApvGain, m_defaulttickheightvalue, m_gaincalibrationfactor, and sistrip::mlESSources_.

Referenced by buildAnalysisRelatedObjects().

365  {
367 
368  if (gain_last_){
369  auto range = gain_last_->getRange(detid);
370  if (apvPair*2 < range.second - range.first){
371  height = gain_last_->getApvGain(apvPair*2, range);
372  edm::LogWarning(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
373  << " [ApvGain] Read gain value from last IOV for DetId: " << detid << " ApvPair: " << apvPair << ", value=" << height;
374  }else{
375  edm::LogWarning(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
376  << " [ApvGain] Unable to read gain value from last IOV for DetId: " << detid << " ApvPair: " << apvPair << ", use dummy value=" << height;
377  }
378  } else {
379  edm::LogWarning(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
380  << " [ApvGain] NULL pointer for last stored gain object in DB!!! " << "Will use dummy value=" << height << " for DetId: " << detid << " ApvPair: " << apvPair;
381  }
382 
383  inputApvGain.push_back(height); // APV0
384  inputApvGain.push_back(height); // APV1
385 }
std::shared_ptr< SiStripApvGain > gain_last_
SiStripApvGain::InputVector inputApvGain
static const char mlESSources_[]
void SiStripCondObjBuilderFromDb::setDefaultValuesCabling ( uint16_t  apvPair)
protected

Definition at line 352 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, SiStripBadStrip::encode(), inputNoises, inputPedestals, inputQuality, inputThreshold, m_defaultnoisevalue, m_defaultpedestalvalue, m_defaultthresholdhighvalue, m_defaultthresholdlowvalue, noises_, pedestals_, quality_, SiStripPedestals::setData(), SiStripNoises::setData(), SiStripThreshold::setData(), sistrip::STRIPS_PER_FEDCH, and threshold_.

Referenced by buildFEDRelatedObjects().

352  {
353  uint16_t istrip = apvPair*sistrip::STRIPS_PER_FEDCH;
354  std::cout << "Found disabled FedConnection! APVPair: " << apvPair << " Strips: " << sistrip::STRIPS_PER_FEDCH << std::endl;
355  inputQuality.push_back(quality_->encode(istrip,sistrip::STRIPS_PER_FEDCH));
356  for ( ;istrip < (apvPair+1)*sistrip::STRIPS_PER_FEDCH; ++istrip ){
360  }
361 }
SiStripPedestals::InputVector inputPedestals
SiStripQuality::InputVector inputQuality
SiStripThreshold::InputVector inputThreshold
SiStripNoises::InputVector inputNoises
static const uint16_t STRIPS_PER_FEDCH
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
void setData(float ped, InputVector &vped)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void setData(float noise_, InputVector &vped)
void SiStripCondObjBuilderFromDb::setLastIovGain ( std::shared_ptr< SiStripApvGain gain)
inline
bool SiStripCondObjBuilderFromDb::setValuesApvLatency ( SiStripLatency latency_,
SiStripConfigDb *const  db,
FedChannelConnection ipair,
uint32_t  detid,
uint16_t  apvnr,
SiStripConfigDb::DeviceDescriptionsRange  apvs 
)
protected

Definition at line 454 of file SiStripCondObjBuilderFromDb.cc.

References FedChannelConnection::ccuAddr(), FedChannelConnection::ccuChan(), gather_cfg::cout, TauDecayModes::dec, FedChannelConnection::fecCrate(), FedChannelConnection::fecRing(), FedChannelConnection::fecSlot(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), FedChannelConnection::i2cAddr(), Utilities::operator, and SiStripLatency::put().

Referenced by buildFECRelatedObjects().

454  {
456  fr->getNumberOfApvsAndStripLength(detid);
457 
458  SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
459  SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
460  if(iapv==japv) return false;
461  for ( ; iapv != japv; ++iapv ) {
462  apvDescription* apv = dynamic_cast<apvDescription*>( *iapv );
463  if ( !apv ) { continue; }
464  if((apv->getCrateId()) != (ipair.fecCrate())) continue;
465  if((apv->getFecSlot()) != (ipair.fecSlot())) continue;
466  if((apv->getRingSlot()) != (ipair.fecRing())) continue;
467  if((apv->getCcuAddress()) != (ipair.ccuAddr())) continue;
468  if((apv->getChannel()) != (ipair.ccuChan())) continue;
469  // Insert latency values into latency object
470  if((apv->getAddress()) == (ipair.i2cAddr(0))) {
471  if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
472  std::cout << "UNABLE APVLatency Put: Detid "<< dec<<detid
473  << " APVNr.: " << apvnr
474  << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency())
475  << " APV Mode: " << dec<< static_cast<uint16_t>(apv->getApvMode())
476  << std::endl;
477  return false;
478  }else{++apvnr;}
479  }
480  if((apv->getAddress()) == (ipair.i2cAddr(1))) {
481  if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
482  std::cout << "UNABLE APVLatency Put: Detid "<<dec<< detid
483  << " APVNr.: " << apvnr
484  << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency())
485  << " APV Mode: " << dec <<static_cast<uint16_t>(apv->getApvMode())
486  << std::endl;
487  continue;
488  return false;
489  }else{++apvnr;}
490  }
491  }
492  return true;
493 }
const uint16_t & fecSlot() const
const uint16_t & fecCrate() const
bool put(const uint32_t detId, const uint16_t apv, const uint16_t latency, const uint16_t mode)
const uint16_t & fecRing() const
const uint16_t & ccuChan() const
const uint16_t & ccuAddr() const
const uint16_t & i2cAddr(const uint16_t &apv0_or_1) const
bool SiStripCondObjBuilderFromDb::setValuesApvTiming ( SiStripConfigDb *const  db,
FedChannelConnection ipair 
)
protected

Definition at line 406 of file SiStripCondObjBuilderFromDb.cc.

References FedChannelConnection::apvPairNumber(), FedChannelConnection::detId(), SiStripFedKey::fedCh(), FedChannelConnection::fedCh(), FedChannelConnection::fedId(), spr::find(), SiStripConfigDb::getAnalysisDescriptions(), inputApvGain, m_gaincalibrationfactor, m_tickmarkThreshold, sistrip::mlESSources_, skippedDetIds, skippedDevices, and tmp.

Referenced by buildAnalysisRelatedObjects().

406  {
407  SiStripConfigDb::AnalysisDescriptionsRange anal_descriptions = db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
408  SiStripConfigDb::AnalysisDescriptionsV::const_iterator iii = anal_descriptions.begin();
409  SiStripConfigDb::AnalysisDescriptionsV::const_iterator jjj = anal_descriptions.end();
410 
411  while ( iii != jjj ) {
412  CommissioningAnalysisDescription* tmp = *iii;
413  uint16_t fed_id = tmp->getFedId();
414  uint16_t fed_ch = SiStripFedKey::fedCh( tmp->getFeUnit(), tmp->getFeChan() );
415  if ( fed_id == ipair.fedId() && fed_ch == ipair.fedCh() ) { break; }
416  iii++;
417  }
418 
419  TimingAnalysisDescription *anal=0;
420  if ( iii != jjj ) { anal = dynamic_cast<TimingAnalysisDescription*>(*iii); }
421  if ( !anal ) {
422  edm::LogWarning(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
423  << " [ApvGain] Unable to find Timing Analysis Description from DB for DetId: " << ipair.detId() << " ApvPair:" << ipair.apvPairNumber();
424  return false;
425  }
426 
427  for (const auto &desc : skippedDevices){
428  if (desc.isConsistent(ipair)){
429  edm::LogInfo(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
430  << " [ApvGain] Skip module with DetId:" << ipair.detId() << " ApvPair:" << ipair.apvPairNumber()
431  << " according to \n" << desc.dump();
432  if (std::find(skippedDetIds.begin(), skippedDetIds.end(), ipair.detId()) == skippedDetIds.end()){
433  skippedDetIds.push_back(ipair.detId());
434  }
435  return false;
436  }
437  }
438 
439  if ( anal->getHeight() > m_tickmarkThreshold ) {
440  float tick_height = (anal->getHeight() / m_gaincalibrationfactor);
441  inputApvGain.push_back( tick_height ); // APV0
442  inputApvGain.push_back( tick_height ); // APV1
443  } else {
444  edm::LogWarning(mlESSources_) << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
445  << " [ApvGain] Low tickmark height for DetId:" << ipair.detId() << " ApvPair:" << ipair.apvPairNumber() << ", height=" << anal->getHeight();
446  return false;
447  }
448 
449  return true;
450 }
const uint16_t & fedCh() const
uint16_t apvPairNumber() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const uint16_t & fedId() const
const uint32_t & detId() const
AnalysisDescriptionsRange getAnalysisDescriptions(AnalysisType, std::string partition="")
AnalysisDescriptions::range AnalysisDescriptionsRange
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
SiStripApvGain::InputVector inputApvGain
static uint16_t fedCh(const uint16_t &fe_unit, const uint16_t &fe_chan)
static const char mlESSources_[]
std::vector< SkipDeviceDescription > skippedDevices
bool SiStripCondObjBuilderFromDb::setValuesCabling ( SiStripConfigDb::FedDescriptionsRange descriptions,
FedChannelConnection ipair,
uint32_t  detid 
)
protected

Definition at line 498 of file SiStripCondObjBuilderFromDb.cc.

References FedChannelConnection::apvPairNumber(), gather_cfg::cout, heppy_report::description, SiStripBadStrip::encode(), FedChannelConnection::fedCh(), FedChannelConnection::fedId(), inputNoises, inputPedestals, inputQuality, inputThreshold, noises_, pedestals_, quality_, SiStripPedestals::setData(), SiStripNoises::setData(), SiStripThreshold::setData(), digi_MixPreMix_cfi::strip, RecoTauPiZeroBuilderPlugins_cfi::strips, sistrip::STRIPS_PER_FEDCH, and threshold_.

Referenced by buildFEDRelatedObjects().

498  {
499  //SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions();
500  SiStripConfigDb::FedDescriptionsV::const_iterator description = descriptions.begin();
501  while ( description != descriptions.end() ) {
502  if ( (*description)->getFedId() ==ipair.fedId() ) { break; }
503  description++;
504  }
505  if ( description == descriptions.end() ) {return false;}
506  // Retrieve Fed9UStrips object from FED description
507  const Fed9U::Fed9UStrips& strips = (*description)->getFedStrips();
508 
509 
510  // Retrieve StripDescriptions for each APV
511  uint16_t jstrip = ipair.apvPairNumber()*sistrip::STRIPS_PER_FEDCH;
512  for ( uint16_t iapv = 2*ipair.fedCh(); iapv < 2*ipair.fedCh()+2; iapv++ ) {
513 
514  // Get StripDescriptions for the given APV
515  Fed9U::Fed9UAddress addr;
516  addr.setFedApv(iapv);
517  vector<Fed9U::Fed9UStripDescription> strip = strips.getApvStrips(addr);
518 
519  vector<Fed9U::Fed9UStripDescription>::const_iterator istrip = strip.begin();
520 
521  for ( ; istrip != strip.end(); istrip++ ) {
522  pedestals_->setData( istrip->getPedestal() , inputPedestals);
523  noises_ ->setData( istrip->getNoise() , inputNoises );
524  threshold_->setData( jstrip, istrip->getLowThresholdFactor(),
525  istrip->getHighThresholdFactor(), inputThreshold );
526  if(istrip->getDisable()){
527  std::cout << "Found disabled strip! Detid: " << detid << " APVNr: " << iapv << " Strips: " << jstrip << std::endl;
528 
529  inputQuality.push_back(quality_->encode(jstrip,1));
530  }
531  jstrip++;
532  }
533  }
534  return true;
535 }
SiStripPedestals::InputVector inputPedestals
const uint16_t & fedCh() const
SiStripQuality::InputVector inputQuality
uint16_t apvPairNumber() const
SiStripThreshold::InputVector inputThreshold
const uint16_t & fedId() const
SiStripNoises::InputVector inputNoises
static const uint16_t STRIPS_PER_FEDCH
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
void setData(float ped, InputVector &vped)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void setData(float noise_, InputVector &vped)
void SiStripCondObjBuilderFromDb::storeNoise ( uint32_t  det_id)
protected

Definition at line 556 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, inputNoises, noises_, and SiStripNoises::put().

Referenced by buildFEDRelatedObjects().

556  {
557  // Insert noise values into Noises object
558 
559  if ( !noises_->put(det_id, inputNoises ) ) {
560  std::cout
561  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
562  << " Unable to insert values into SiStripNoises object!"
563  << " DetId already exists!" << std::endl;
564  }
565  inputNoises.clear();
566 
567  }
SiStripNoises::InputVector inputNoises
bool put(const uint32_t &detID, const InputVector &input)
void SiStripCondObjBuilderFromDb::storePedestals ( uint32_t  det_id)
protected

Definition at line 541 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, inputPedestals, pedestals_, and SiStripPedestals::put().

Referenced by buildFEDRelatedObjects().

541  {
542  if ( !pedestals_->put(det_id, inputPedestals ) ) {
543  std::cout
544  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
545  << " Unable to insert values into SiStripPedestals object!"
546  << " DetId already exists!" << std::endl;
547  }
548  inputPedestals.clear();
549 
550  }
SiStripPedestals::InputVector inputPedestals
bool put(const uint32_t &detID, InputVector &input)
void SiStripCondObjBuilderFromDb::storeQuality ( uint32_t  det_id)
protected

Definition at line 584 of file SiStripCondObjBuilderFromDb.cc.

References SiStripQuality::compact(), gather_cfg::cout, inputQuality, SiStripBadStrip::put(), and quality_.

Referenced by buildFEDRelatedObjects().

584  {
585  // Insert quality values into Quality object
586  if (inputQuality.size()){
587  quality_->compact(det_id,inputQuality);
588  if ( !quality_->put(det_id, inputQuality ) ) {
589  std::cout
590  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
591  << " Unable to insert values into SiStripQuality object!"
592  << " DetId already exists!" << std::endl;
593  }
594  }
595  inputQuality.clear();
596 }
SiStripQuality::InputVector inputQuality
void compact(unsigned int &, std::vector< unsigned int > &)
bool put(const uint32_t &detID, const InputVector &vect)
void SiStripCondObjBuilderFromDb::storeThreshold ( uint32_t  det_id)
protected

Definition at line 571 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, inputThreshold, SiStripThreshold::put(), and threshold_.

Referenced by buildFEDRelatedObjects().

571  {
572  // Insert threshold values into Threshold object
573  if ( !threshold_->put(det_id, inputThreshold ) ) {
574  std::cout
575  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
576  << " Unable to insert values into SiStripThreshold object!"
577  << " DetId already exists!" << std::endl;
578  }
579  inputThreshold.clear();
580 }
bool put(const uint32_t &detID, const InputVector &vect)
SiStripThreshold::InputVector inputThreshold
void SiStripCondObjBuilderFromDb::storeTiming ( uint32_t  det_id)
protected

Definition at line 600 of file SiStripCondObjBuilderFromDb.cc.

References gain_, inputApvGain, sistrip::mlESSources_, and SiStripApvGain::put().

Referenced by buildAnalysisRelatedObjects().

600  {
601  // Insert tick height values into Gain object
602  SiStripApvGain::Range range( inputApvGain.begin(), inputApvGain.end() );
603  if ( !gain_->put( det_id, range ) ) {
605  << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
606  << " [ApvGain] Unable to insert values into SiStripApvGain object!"
607  << " DetId already exists!";
608  }
609  inputApvGain.clear();
610 }
bool put(const uint32_t &detID, Range input)
std::pair< ContainerIterator, ContainerIterator > Range
SiStripApvGain::InputVector inputApvGain
static const char mlESSources_[]

Member Data Documentation

edm::Service<SiStripConfigDb> SiStripCondObjBuilderFromDb::db_
protected

Access to the configuration DB interface class.

Definition at line 123 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildAnalysisRelatedObjects(), buildCondObj(), and dbParams().

SiStripDbParams SiStripCondObjBuilderFromDb::dbParams_
protected

Container for DB connection parameters.

Definition at line 126 of file SiStripCondObjBuilderFromDb.h.

Referenced by checkUpdate().

SiStripFedCabling* SiStripCondObjBuilderFromDb::fed_cabling_
protected

Definition at line 127 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj(), and getFedCabling().

SiStripApvGain* SiStripCondObjBuilderFromDb::gain_
protected
std::shared_ptr<SiStripApvGain> SiStripCondObjBuilderFromDb::gain_last_
protected

Definition at line 135 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvTiming(), and setLastIovGain().

SiStripApvGain::InputVector SiStripCondObjBuilderFromDb::inputApvGain
protected
SiStripNoises::InputVector SiStripCondObjBuilderFromDb::inputNoises
protected
SiStripPedestals::InputVector SiStripCondObjBuilderFromDb::inputPedestals
protected
SiStripQuality::InputVector SiStripCondObjBuilderFromDb::inputQuality
protected
SiStripThreshold::InputVector SiStripCondObjBuilderFromDb::inputThreshold
protected
SiStripLatency* SiStripCondObjBuilderFromDb::latency_
protected

Definition at line 133 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildFECRelatedObjects(), and getApvLatency().

bool SiStripCondObjBuilderFromDb::m_debug
protected

Definition at line 175 of file SiStripCondObjBuilderFromDb.h.

uint16_t SiStripCondObjBuilderFromDb::m_defaultapvlatencyvalue
protected

Definition at line 170 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvLatency().

uint16_t SiStripCondObjBuilderFromDb::m_defaultapvmodevalue
protected

Definition at line 169 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvLatency().

float SiStripCondObjBuilderFromDb::m_defaultnoisevalue
protected

Definition at line 166 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

float SiStripCondObjBuilderFromDb::m_defaultpedestalvalue
protected

Definition at line 165 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

float SiStripCondObjBuilderFromDb::m_defaultthresholdhighvalue
protected

Definition at line 167 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

float SiStripCondObjBuilderFromDb::m_defaultthresholdlowvalue
protected

Definition at line 168 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

float SiStripCondObjBuilderFromDb::m_defaulttickheightvalue
protected

Definition at line 171 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvTiming().

float SiStripCondObjBuilderFromDb::m_gaincalibrationfactor
protected

Definition at line 164 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvTiming(), and setValuesApvTiming().

edm::VParameterSet SiStripCondObjBuilderFromDb::m_skippedDevices
protected

Definition at line 162 of file SiStripCondObjBuilderFromDb.h.

Referenced by SiStripCondObjBuilderFromDb().

float SiStripCondObjBuilderFromDb::m_tickmarkThreshold
protected

Definition at line 163 of file SiStripCondObjBuilderFromDb.h.

Referenced by setValuesApvTiming().

bool SiStripCondObjBuilderFromDb::m_useanalysis
protected

Definition at line 172 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

bool SiStripCondObjBuilderFromDb::m_usefec
protected

Definition at line 174 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

bool SiStripCondObjBuilderFromDb::m_usefed
protected

Definition at line 173 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

SiStripNoises* SiStripCondObjBuilderFromDb::noises_
protected
pair_apvpairconn SiStripCondObjBuilderFromDb::p_apvpcon
protected

Definition at line 187 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

pair_detcon SiStripCondObjBuilderFromDb::p_detcon
protected

Definition at line 189 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

SiStripPedestals* SiStripCondObjBuilderFromDb::pedestals_
protected
SiStripQuality* SiStripCondObjBuilderFromDb::quality_
protected
std::vector<uint32_t> SiStripCondObjBuilderFromDb::skippedDetIds
protected
std::vector<SkipDeviceDescription> SiStripCondObjBuilderFromDb::skippedDevices
protected
SiStripThreshold* SiStripCondObjBuilderFromDb::threshold_
protected
TrackerTopology* SiStripCondObjBuilderFromDb::tTopo
protected

Definition at line 178 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj(), and ~SiStripCondObjBuilderFromDb().

v_apvpairconn SiStripCondObjBuilderFromDb::v_apvpcon
protected

Definition at line 188 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

trackercon SiStripCondObjBuilderFromDb::v_trackercon
protected

Definition at line 190 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj(), and buildStripRelatedObjects().