CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

SiStripCondObjBuilderFromDb Class Reference

#include <SiStripCondObjBuilderFromDb.h>

List of all members.

Public Types

typedef std::vector
< pair_apvpairconn >::iterator 
i_apvpairconn
typedef std::vector
< pair_detcon >::iterator 
i_trackercon
typedef std::pair< uint32_t,
FedChannelConnection
pair_apvpairconn
typedef std::pair< uint32_t,
v_apvpairconn
pair_detcon
typedef std::vector< pair_detcontrackercon
typedef std::vector
< pair_apvpairconn
v_apvpairconn

Public Member Functions

void buildAnalysisRelatedObjects (SiStripConfigDb *const db, trackercon tc)
void buildCondObj ()
void buildFECRelatedObjects (SiStripConfigDb *const db, trackercon tc)
void buildFEDRelatedObjects (SiStripConfigDb *const db, trackercon tc)
void buildStripRelatedObjects (SiStripConfigDb *const db, const SiStripDetCabling &det_cabling)
bool checkForCompatibility (std::stringstream &input, std::stringstream &output, std::string &label)
const SiStripDbParamsdbParams () const
SiStripApvGaingetApvGain ()
SiStripLatencygetApvLatency ()
SiStripFedCablinggetFedCabling ()
SiStripNoisesgetNoises ()
SiStripPedestalsgetPedestals ()
SiStripQualitygetQuality ()
SiStripThresholdgetThreshold ()
void getValue (SiStripPedestals *&val)
void getValue (SiStripBadStrip *&val)
void getValue (SiStripThreshold *&val)
void getValue (SiStripFedCabling *&val)
void getValue (SiStripNoises *&val)
void getValue (SiStripLatency *&val)
void getValue (SiStripApvGain *&val)
void getValue (SiStripQuality *&val)
 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_, FedChannelConnection ipair, uint32_t detid, uint16_t apvnr)
void setDefaultValuesApvTiming ()
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_
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
bool m_useanalysis
bool m_usefec
bool m_usefed
SiStripNoisesnoises_
pair_apvpairconn p_apvpcon
pair_detcon p_detcon
SiStripPedestalspedestals_
SiStripQualityquality_
SiStripThresholdthreshold_
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 55 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, and sistrip::mlESSources_.

{
  LogTrace(mlESSources_) 
    << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
    << " Constructing object...";
}
SiStripCondObjBuilderFromDb::SiStripCondObjBuilderFromDb ( const edm::ParameterSet pset,
const edm::ActivityRegistry  
)

Definition at line 33 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, and sistrip::mlESSources_.

                                                                                    :
  m_gaincalibrationfactor(static_cast<float>(pset.getUntrackedParameter<double>("GainNormalizationFactor",690.))), 
  m_defaultpedestalvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultPedestal",0.))), 
  m_defaultnoisevalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultNoise",0.))), 
  m_defaultthresholdhighvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdHigh",0.))), 
  m_defaultthresholdlowvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultThresholdLow",0.))), 
  m_defaultapvmodevalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVMode",37))),
  m_defaultapvlatencyvalue(static_cast<uint16_t>(pset.getUntrackedParameter<uint32_t>("DefaultAPVLatency",142))),
  m_defaulttickheightvalue(static_cast<float>(pset.getUntrackedParameter<double>("DefaultTickHeight",690.))),
  m_useanalysis(static_cast<bool>(pset.getUntrackedParameter<bool>("UseAnalysis",false))),
  m_usefed(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFED",false))),
  m_usefec(static_cast<bool>(pset.getUntrackedParameter<bool>("UseFEC",false))),
  m_debug(static_cast<bool>(pset.getUntrackedParameter<bool>("DebugMode",false)))
{
  LogTrace(mlESSources_) 
    << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
    << " Constructing object...";
}
SiStripCondObjBuilderFromDb::~SiStripCondObjBuilderFromDb ( ) [virtual]

Definition at line 64 of file SiStripCondObjBuilderFromDb.cc.

References LogTrace, and sistrip::mlESSources_.

                                                          {
  LogTrace(mlESSources_)
    << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
    << " Destructing object...";
}

Member Function Documentation

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

Definition at line 554 of file SiStripCondObjBuilderFromDb.cc.

References gather_cfg::cout, db_, cond::rpcobgas::detid, end, gain_, m_defaulttickheightvalue, m_gaincalibrationfactor, sistrip::mlESSources_, retrieveTimingAnalysisDescriptions(), setDefaultValuesApvTiming(), setValuesApvTiming(), and storeTiming().

Referenced by buildCondObj().

                                                                                                      {
  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
  //data container
  gain_= new SiStripApvGain();

  //check if Timing analysis description is found, otherwise quit
  if(!retrieveTimingAnalysisDescriptions(&*db_)){
    edm::LogWarning(mlESSources_)
      << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " NULL pointer to AnalysisDescriptions returned by SiStripConfigDb!"
      << " Cannot build Analysis object! QUIT";
    // some values have to be set, otherwise PopCon will crash
    setDefaultValuesApvTiming();
    storeTiming(4711);
    return;
  }

  i_trackercon detids_end=tc.end();

  //loop detids
  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
    uint32_t detid = (*detids).first;
    i_apvpairconn connections_end=((*detids).second).end();
    
    //loop connections
    for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
      uint32_t apvPair =(*connections).first;
      FedChannelConnection ipair =(*connections).second;

          
      //no connection for apvPair found
      if(apvPair>=100){
        setDefaultValuesApvTiming();  
        continue;
      }
      
      //fill data
      if(!setValuesApvTiming(db, ipair)){
        std::cout
          << "\n "
          << " Unable to find Timing Analysis Description"
          << " Writing default values for DetId: " << detid
          << " Value: " << m_defaulttickheightvalue/m_gaincalibrationfactor << std::endl;
        setDefaultValuesApvTiming();
      }
    }//connections
    storeTiming(detid);
  }//detids

}
void SiStripCondObjBuilderFromDb::buildCondObj ( )

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

Definition at line 115 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by checkUpdate().

                                               {
  LogTrace(mlESSources_) 
    << "[SiStripCondObjBuilderFromDb::" << __func__ << "]";

  // Check if DB connection is made 
  if ( db_ ) { 
    
    // Check if DB connection is made 
    if ( db_->deviceFactory() || 
         db_->databaseCache() ) { 
      
      // Build FEC cabling object
      SiStripFecCabling fec_cabling;
      
      SiStripFedCablingBuilderFromDb::buildFecCabling( &*db_, 
                                                       fec_cabling, 
                                                       sistrip::CABLING_FROM_CONNS );
      fed_cabling_=new SiStripFedCabling;

      SiStripFedCablingBuilderFromDb::getFedCabling( fec_cabling, *fed_cabling_ );
      SiStripDetCabling det_cabling( *fed_cabling_ );
      buildStripRelatedObjects( &*db_, det_cabling );
     
     
      if(m_useanalysis)buildAnalysisRelatedObjects(&*db_, v_trackercon);
      if(m_usefed) buildFEDRelatedObjects(&*db_, v_trackercon);
      if(m_usefec) buildFECRelatedObjects(&*db_, v_trackercon);
         
   
      
    } else {
      edm::LogWarning(mlESSources_)
        << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
        << " NULL pointer to DeviceFactory returned by SiStripConfigDb!"
        << " Cannot build Pedestals object!";
    }
  } else {
    edm::LogWarning(mlESSources_)
      << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " NULL pointer to SiStripConfigDb returned by DB \"service\"!"
      << " Cannot build Pedestals object!";
  }
}
vector< const FedChannelConnection * > SiStripCondObjBuilderFromDb::buildConnections ( const SiStripDetCabling det_cabling,
uint32_t  det_id 
) [protected]

Definition at line 212 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildStripRelatedObjects().

                                                                                                                                        {
  vector<const FedChannelConnection *> conns = det_cabling.getConnections(det_id);
  if (conns.size()==0){
    edm::LogWarning(mlESSources_)
        << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
        << " Unable to build condition object!"
        << " No FED channel connections found for detid "<< det_id;
  }
  return conns;
}
void SiStripCondObjBuilderFromDb::buildFECRelatedObjects ( SiStripConfigDb *const  db,
trackercon  tc 
)

Definition at line 607 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildCondObj().

                                                                                                 {
  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;
  //data container
  latency_ = new SiStripLatency();

  i_trackercon detids_end=tc.end();
 
  // get APV DeviceDescriptions
  SiStripConfigDb::DeviceDescriptionsRange apvs= db->getDeviceDescriptions( APV25 );;


  //loop detids
  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
    uint32_t detid = (*detids).first;
    uint16_t apvnr=1;
    i_apvpairconn connections_end=((*detids).second).end();
    

    //loop connections
    for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
      uint32_t apvPair =(*connections).first;
      FedChannelConnection ipair =(*connections).second;
      
      //no connection for apvPair found
      if(apvPair>=100){
        //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);  
        std::cout << "[SiStripCondObjBuilderFromDb::" << __func__ << "] No FEDConnection for DetId " << detid << " ApvPair " << apvPair-100 << " found, skipping Latency Insertion!" << std::endl;
        continue;
      }
      
      //fill data
           if(!setValuesApvLatency((*latency_),db, ipair, detid, apvnr, apvs)){
        std::cout
          << "\n "
          << " Unable to find FEC Description"
          << " Skipping Insertion for DetId: " << detid << std::endl;
          //setDefaultValuesApvLatency((*latency_),ipair, detid, apvnr);
       }
       apvnr+=2;
    }//connections
     // compact Latency Object
  
  }//detids
  latency_->compress();
  std::stringstream ss;
  // latency debug output
  latency_->printSummary(ss);
  latency_->printDebug(ss);
  std::cout << ss.str() << std::endl;
}
void SiStripCondObjBuilderFromDb::buildFEDRelatedObjects ( SiStripConfigDb *const  db,
trackercon  tc 
)

Definition at line 660 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildCondObj().

                                                                                                 {
  std::cout << "Entering [SiStripCondObjBuilderFromDb::"<<__func__ <<"]"<<std::endl;

  //data containers
  pedestals_= new SiStripPedestals();  
  noises_ = new SiStripNoises();  
  threshold_= new SiStripThreshold();  
  quality_ = new SiStripQuality();  
 
  i_trackercon detids_end=tc.end();

  //Build FED Descriptions out of db object
  SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions();

  //loop detids
  for(i_trackercon detids=tc.begin();detids!=detids_end;detids++){
    uint32_t detid = (*detids).first;
    i_apvpairconn connections_end=((*detids).second).end();
  
    //loop connections
    for(i_apvpairconn connections=((*detids).second).begin();connections!=connections_end;connections++){
      uint32_t apvPair =(*connections).first;
      FedChannelConnection ipair =(*connections).second;
            
      //no connection for apvPair found
      if(apvPair>=100){
        std::cout
          << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
          << " Unable to find FED description for FED id: " << ipair.fedId()
          << " detid : " << detid << " APV pair number " << apvPair
          << " Writing default values"<< std::endl; 
        setDefaultValuesCabling((apvPair-100)); 
        continue;
      }
      //  if(!setValuesCabling(db, ipair, detid)){
      if(!setValuesCabling(descriptions, ipair, detid)){
        std::cout
          << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
          << " Unable to find FED description for FED id: " << ipair.fedId()
          << " detid : " << detid << " APV pair number " << apvPair
          << " Writing default values"<< std::endl; 
        setDefaultValuesCabling(apvPair); 
      }
    }//connections
    storePedestals(detid);
    storeNoise(detid);
    storeThreshold(detid);
    storeQuality(detid);
  }//detids
}
void SiStripCondObjBuilderFromDb::buildStripRelatedObjects ( SiStripConfigDb *const  db,
const SiStripDetCabling det_cabling 
)

Definition at line 463 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildCondObj().

                                                                                                 {
  //variables needed in this function
  uint16_t nApvPairs;
  vector<uint32_t>::const_iterator det_id;
  vector<uint32_t> det_ids;
 
  edm::LogInfo(mlESSources_)
    << "\n[SiStripCondObjBuilderFromDb::" << __func__ << "] first call to this method";

  //Check if FedDescriptions exist, if not return
  if (!retrieveFedDescriptions(db)) {std::cout<< "Found no FedDescription!" << std::endl;return;}
  // Retrieve list of active DetIds
  det_cabling.addActiveDetectorsRawIds(det_ids);
  if ( det_ids.empty() ) {
    std::cout
      << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " Unable to build Pedestals object!"
      << " No DetIds found!" << std::endl;
    return;
  }  
  std::cout << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
            << " Found " << det_ids.size() << " active DetIds";

  // Loop Active DetIds
  det_id = det_ids.begin();
  for ( ; det_id != det_ids.end(); det_id++ ) {
    std::stringstream ssMessage;
              
    // Ignore NULL DetIds
    if ( !(*det_id) ) { continue; }
    if ( *det_id == sistrip::invalid32_ ) { continue; }
       
       
    //build connections per DetId
    const vector<const FedChannelConnection *>& conns=buildConnections(det_cabling, *det_id);
       
    vector<const FedChannelConnection *>::const_iterator ipair = conns.begin();
    if(conns.size() ==0 ) continue;
       
    //retrieve number of APV pairs per detid
    nApvPairs=retrieveNumberAPVPairs(*det_id);
       

    //loop connections and check if APVPair is connected
    vector< vector<const FedChannelConnection *>::const_iterator > listConns(nApvPairs,conns.end());
              
    for ( ; ipair != conns.end(); ++ipair ){
      // Check if the ApvPair is connected
      if ((*ipair)->fedId()!=sistrip::invalid_ && (*ipair)->apvPairNumber()<3){
        // (*ipair)->print(ssMessage);
        // ssMessage<< std::endl;
        listConns[ipair-conns.begin()]=ipair;
      } else {
        std::cout
          << "\n impossible to assign connection position in listConns " << std::endl;
        // (*ipair)->print(ssMessage);
        // ssMessage << std::endl;
      }
    }
    
    // get data
    // vector< vector<const FedChannelConnection *>::const_iterator >::const_iterator ilistConns=listConns.begin();
    for (uint16_t apvPair=0;apvPair<listConns.size();++apvPair){
      ipair=listConns[apvPair];
          if ( ipair == conns.end() ) {
        // Fill object with default values
        std::cout
          << "\n "
          << " Unable to find FED connection for detid : " << std::dec << *det_id << " APV pair number " << apvPair
          << " Writing default values" << std::endl;
        (*ipair)->print(ssMessage);
        //If no connection was found, add 100 to apvpair
        apvPair+=100;
        std::cout << " Put apvPair+100:" << apvPair << " into vector!" << std::endl;
        p_apvpcon=std::make_pair(apvPair,**ipair);
        v_apvpcon.push_back(p_apvpcon);
        apvPair=apvPair-100;
        continue;
      }
      p_apvpcon=std::make_pair(apvPair,**ipair);
      v_apvpcon.push_back(p_apvpcon);
    } //conns loop 
    p_detcon=std::make_pair(*det_id,v_apvpcon);
    v_trackercon.push_back(p_detcon);
    v_apvpcon.clear();
  } // det id loop
}
bool SiStripCondObjBuilderFromDb::checkForCompatibility ( std::stringstream &  input,
std::stringstream &  output,
std::string &  label 
)

Definition at line 83 of file SiStripCondObjBuilderFromDb.cc.

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

                                                                                                                      {


  //get current config DB parameter
      
  SiStripDbParams::const_iterator_range partitionsRange = dbParams().partitions(); 

  SiStripDbParams::SiStripPartitions::const_iterator ipart = partitionsRange.begin();
  SiStripDbParams::SiStripPartitions::const_iterator ipartEnd = partitionsRange.end();
  for ( ; ipart != ipartEnd; ++ipart ) { 
    SiStripPartition partition=ipart->second;
    output  << "@ "
            << " Partition " << partition.partitionName() ;
    if (label!="Cabling" && label !="ApvLatency")
        output << " FedVer "    << partition.fedVersion().first << "." << partition.fedVersion().second;       
    if(label=="Cabling")
      output << " CabVer "    << partition.cabVersion().first << "." << partition.cabVersion().second
             << " MaskVer "   << partition.maskVersion().first << "." << partition.maskVersion().second;
    if(label=="ApvTiming")
      output<< " ApvTimingVer " << partition.apvTimingVersion().first << "." << partition.apvTimingVersion().second;
    if(label=="ApvLatency")
      output<< " FecVersion " << partition.fecVersion().first << "." << partition.fecVersion().second;
  }
  
  if (!strcmp(output.str().c_str(),input.str().c_str()))
    return false;

  return true;
}
void SiStripCondObjBuilderFromDb::checkUpdate ( ) [protected]
const SiStripDbParams& SiStripCondObjBuilderFromDb::dbParams ( ) const [inline]

Returns database connection parameters.

Definition at line 66 of file SiStripCondObjBuilderFromDb.h.

References db_.

Referenced by checkForCompatibility(), and checkUpdate().

{return db_->dbParams();} 
SiStripApvGain* SiStripCondObjBuilderFromDb::getApvGain ( ) [inline]

Definition at line 85 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and gain_.

Referenced by getValue().

{ checkUpdate(); return gain_; }  
SiStripLatency* SiStripCondObjBuilderFromDb::getApvLatency ( ) [inline]

Definition at line 86 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and latency_.

Referenced by getValue().

{ checkUpdate(); return latency_; }
SiStripFedCabling* SiStripCondObjBuilderFromDb::getFedCabling ( ) [inline]

Definition at line 80 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and fed_cabling_.

Referenced by buildCondObj(), and getValue().

SiStripNoises* SiStripCondObjBuilderFromDb::getNoises ( ) [inline]

Definition at line 82 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and noises_.

Referenced by getValue().

{checkUpdate(); return noises_;}  
SiStripPedestals* SiStripCondObjBuilderFromDb::getPedestals ( ) [inline]

Definition at line 81 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and pedestals_.

Referenced by getValue().

{checkUpdate(); return pedestals_;}  
SiStripQuality* SiStripCondObjBuilderFromDb::getQuality ( ) [inline]

Definition at line 84 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and quality_.

Referenced by getValue().

{checkUpdate(); return quality_;}  
SiStripThreshold* SiStripCondObjBuilderFromDb::getThreshold ( ) [inline]

Definition at line 83 of file SiStripCondObjBuilderFromDb.h.

References checkUpdate(), and threshold_.

Referenced by getValue().

{checkUpdate(); return threshold_;}  
void SiStripCondObjBuilderFromDb::getValue ( SiStripPedestals *&  val) [inline]

Definition at line 89 of file SiStripCondObjBuilderFromDb.h.

References getPedestals().

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

Definition at line 90 of file SiStripCondObjBuilderFromDb.h.

References getNoises().

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

Definition at line 91 of file SiStripCondObjBuilderFromDb.h.

References getThreshold().

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

Definition at line 92 of file SiStripCondObjBuilderFromDb.h.

References getQuality().

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

Definition at line 93 of file SiStripCondObjBuilderFromDb.h.

References getQuality().

{ val = new SiStripBadStrip(* (const SiStripBadStrip*) getQuality());   }  
void SiStripCondObjBuilderFromDb::getValue ( SiStripApvGain *&  val) [inline]

Definition at line 94 of file SiStripCondObjBuilderFromDb.h.

References getApvGain().

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

Definition at line 95 of file SiStripCondObjBuilderFromDb.h.

References getApvLatency().

{ val = getApvLatency(); }  
void SiStripCondObjBuilderFromDb::getValue ( SiStripFedCabling *&  val) [inline]

Definition at line 88 of file SiStripCondObjBuilderFromDb.h.

References getFedCabling().

{ val = getFedCabling();}
vector< uint32_t > SiStripCondObjBuilderFromDb::retrieveActiveDetIds ( const SiStripDetCabling det_cabling) [protected]

Definition at line 193 of file SiStripCondObjBuilderFromDb.cc.

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

                                                                                                      {
  vector<uint32_t> det_ids;
  det_cabling.addActiveDetectorsRawIds(det_ids);
  if ( det_ids.empty() ) {
    edm::LogWarning(mlESSources_)
      << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " Unable to build Pedestals object!"
      << " No DetIds found!";
    return det_ids;
  }  
  LogTrace(mlESSources_)
    << "\n\nSiStripCondObjBuilderFromDb::" << __func__ << "]"
    << " Found " << det_ids.size() << " active DetIds";
  return det_ids;
}
bool SiStripCondObjBuilderFromDb::retrieveFedDescriptions ( SiStripConfigDb *const  db) [protected]

Definition at line 162 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildStripRelatedObjects().

                                                                                  {
  SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions();
  if ( descriptions.empty() ) {
    edm::LogWarning(mlESSources_)
      << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " No FED descriptions found!";
    
    return false;
  }
  return true;
}
uint16_t SiStripCondObjBuilderFromDb::retrieveNumberAPVPairs ( uint32_t  det_id) [protected]

Definition at line 226 of file SiStripCondObjBuilderFromDb.cc.

References SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), and cmsCodeRules::cppFunctionSkipper::operator.

Referenced by buildStripRelatedObjects().

                                                                           {
  uint16_t nApvPairs;
  SiStripDetInfoFileReader * fr=edm::Service<SiStripDetInfoFileReader>().operator->();
  nApvPairs=fr->getNumberOfApvsAndStripLength(det_id).first/2;
  return nApvPairs;
}
bool SiStripCondObjBuilderFromDb::retrieveTimingAnalysisDescriptions ( SiStripConfigDb *const  db) [protected]

Definition at line 177 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildAnalysisRelatedObjects().

                                                                                              {
  SiStripConfigDb::AnalysisDescriptionsRange anal_descriptions = 
    db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
  if ( anal_descriptions.empty() ) {
    edm::LogWarning(mlESSources_)
      << "SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " Unable to build SiStripApvGain object!"
      << " No timing-scan analysis descriptions found!";
    return false;
  }
  return true;
}
void SiStripCondObjBuilderFromDb::setDefaultValuesApvLatency ( SiStripLatency latency_,
FedChannelConnection  ipair,
uint32_t  detid,
uint16_t  apvnr 
) [protected]

Definition at line 256 of file SiStripCondObjBuilderFromDb.cc.

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

                                                                                                                                                 {
  std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Set Default Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
  if(!latency_.put( detid, apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
    {
      std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
    }
     if(!latency_.put( detid, ++apvnr, m_defaultapvmodevalue, m_defaultapvlatencyvalue))
       {
         std::cout << "[SiStripCondObjBuilderFromDb::"<<__func__<<"]: Unable to fill Latency for Detid: " << detid << " ApvNr: " << apvnr << std::endl;
       }

}
void SiStripCondObjBuilderFromDb::setDefaultValuesApvTiming ( ) [protected]
void SiStripCondObjBuilderFromDb::setDefaultValuesCabling ( uint16_t  apvPair) [protected]
bool SiStripCondObjBuilderFromDb::setValuesApvLatency ( SiStripLatency latency_,
SiStripConfigDb *const  db,
FedChannelConnection ipair,
uint32_t  detid,
uint16_t  apvnr,
SiStripConfigDb::DeviceDescriptionsRange  apvs 
) [protected]

Definition at line 303 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFECRelatedObjects().

                                                                                                                                                                                                                     {
SiStripDetInfoFileReader * fr=edm::Service<SiStripDetInfoFileReader>().operator->();
 fr->getNumberOfApvsAndStripLength(detid).first/2;
 
 SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
 SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
 if(iapv==japv) return false;
 for ( ; iapv != japv; ++iapv ) {
   apvDescription* apv = dynamic_cast<apvDescription*>( *iapv );
   if ( !apv ) { continue; }
   if((apv->getCrateId()) != (ipair.fecCrate())) continue;
   if((apv->getFecSlot()) != (ipair.fecSlot())) continue;
   if((apv->getRingSlot()) != (ipair.fecRing())) continue;
   if((apv->getCcuAddress()) != (ipair.ccuAddr())) continue;
   if((apv->getChannel()) != (ipair.ccuChan())) continue;
     // Insert latency values into latency object
   if((apv->getAddress()) == (ipair.i2cAddr(0))) {
     if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
       std::cout << "UNABLE APVLatency Put: Detid "<< dec<<detid 
                 << " APVNr.: " << apvnr 
                 << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency()) 
                 << " APV Mode: " << dec<< static_cast<uint16_t>(apv->getApvMode())
                 << std::endl;
       return false;
     }else{++apvnr;}
   }
   if((apv->getAddress()) == (ipair.i2cAddr(1))) {
     if(!latency_.put( detid, apvnr, static_cast<uint16_t>(apv->getLatency()), static_cast<uint16_t>(apv->getApvMode()))){
       std::cout << "UNABLE APVLatency Put: Detid "<<dec<< detid
                 << " APVNr.: " << apvnr
                 << " Latency Value: " << dec <<static_cast<uint16_t>(apv->getLatency())
                 << " APV Mode: " << dec <<static_cast<uint16_t>(apv->getApvMode())
                 << std::endl;
       continue;
       return false;
     }else{++apvnr;}
   }
  }
 return true;
}
bool SiStripCondObjBuilderFromDb::setValuesApvTiming ( SiStripConfigDb *const  db,
FedChannelConnection ipair 
) [protected]

Definition at line 273 of file SiStripCondObjBuilderFromDb.cc.

References SiStripFedKey::fedCh(), FedChannelConnection::fedCh(), FedChannelConnection::fedId(), SiStripConfigDb::getAnalysisDescriptions(), inputApvGain, m_defaulttickheightvalue, m_gaincalibrationfactor, and tmp.

Referenced by buildAnalysisRelatedObjects().

                                                                                                          {
  SiStripConfigDb::AnalysisDescriptionsRange anal_descriptions = db->getAnalysisDescriptions( CommissioningAnalysisDescription::T_ANALYSIS_TIMING );
   SiStripConfigDb::AnalysisDescriptionsV::const_iterator iii = anal_descriptions.begin();
  SiStripConfigDb::AnalysisDescriptionsV::const_iterator jjj = anal_descriptions.end();
 
  while ( iii != jjj ) {
    CommissioningAnalysisDescription* tmp = *iii;
    uint16_t fed_id = tmp->getFedId();
    uint16_t fed_ch = SiStripFedKey::fedCh( tmp->getFeUnit(), tmp->getFeChan() );
    if ( fed_id == ipair.fedId() && fed_ch == ipair.fedCh() ) { break; }
    iii++;
  }
  
  TimingAnalysisDescription *anal=0;
  if ( iii != jjj ) { anal = dynamic_cast<TimingAnalysisDescription*>(*iii); }
  if ( anal ) {
    float tick_height = (anal->getHeight() / m_gaincalibrationfactor);
    inputApvGain.push_back( tick_height ); // APV0
    inputApvGain.push_back( tick_height); // APV1
  } else {
    inputApvGain.push_back(m_defaulttickheightvalue/m_gaincalibrationfactor); // APV0
    inputApvGain.push_back(m_defaulttickheightvalue/m_gaincalibrationfactor); // APV1
    return false;
  }

  return true;
}
bool SiStripCondObjBuilderFromDb::setValuesCabling ( SiStripConfigDb::FedDescriptionsRange descriptions,
FedChannelConnection ipair,
uint32_t  detid 
) [protected]

Definition at line 347 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFEDRelatedObjects().

                                                                                                                                                {
  //SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions();
  SiStripConfigDb::FedDescriptionsV::const_iterator description = descriptions.begin();
  while ( description != descriptions.end() ) {
    if ( (*description)->getFedId() ==ipair.fedId() ) { break; }
    description++;
  }
  if ( description == descriptions.end() ) {return false;}
  // Retrieve Fed9UStrips object from FED description
  const Fed9U::Fed9UStrips& strips = (*description)->getFedStrips();
      
      
  // Retrieve StripDescriptions for each APV
  uint16_t jstrip = ipair.apvPairNumber()*sistrip::STRIPS_PER_FEDCH;
  for ( uint16_t iapv = 2*ipair.fedCh(); iapv < 2*ipair.fedCh()+2; iapv++ ) {
        
    // Get StripDescriptions for the given APV
    Fed9U::Fed9UAddress addr;
    addr.setFedApv(iapv);
    vector<Fed9U::Fed9UStripDescription> strip = strips.getApvStrips(addr);
        
    vector<Fed9U::Fed9UStripDescription>::const_iterator istrip = strip.begin();

    for ( ; istrip != strip.end(); istrip++ ) {
      pedestals_->setData( istrip->getPedestal() , inputPedestals);
      noises_   ->setData( istrip->getNoise()    , inputNoises );
      threshold_->setData( jstrip, istrip->getLowThresholdFactor(),
                           istrip->getHighThresholdFactor(), inputThreshold );
      if(istrip->getDisable()){
        std::cout << "Found disabled strip! Detid: " << detid << " APVNr: " << iapv << " Strips: " << jstrip << std::endl;

        inputQuality.push_back(quality_->encode(jstrip,1));
      }
      jstrip++;
    }
  }
  return true;
}
void SiStripCondObjBuilderFromDb::storeNoise ( uint32_t  det_id) [protected]

Definition at line 405 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFEDRelatedObjects().

                                                           {
  // Insert noise values into Noises object

    if ( !noises_->put(det_id, inputNoises ) ) {
      std::cout
        << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
        << " Unable to insert values into SiStripNoises object!"
        << " DetId already exists!" << std::endl;
    }
    inputNoises.clear();

 }
void SiStripCondObjBuilderFromDb::storePedestals ( uint32_t  det_id) [protected]

Definition at line 390 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFEDRelatedObjects().

                                                               {
  if ( !pedestals_->put(det_id, inputPedestals ) ) {
    std::cout
      << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
      << " Unable to insert values into SiStripPedestals object!"
      << " DetId already exists!" << std::endl;
  }
  inputPedestals.clear();

  }
void SiStripCondObjBuilderFromDb::storeQuality ( uint32_t  det_id) [protected]

Definition at line 433 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFEDRelatedObjects().

                                                             {
  // Insert quality values into Quality object
    if (inputQuality.size()){
      quality_->compact(det_id,inputQuality);
      if ( !quality_->put(det_id, inputQuality ) ) {
        std::cout
          << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
          << " Unable to insert values into SiStripQuality object!"
          << " DetId already exists!" << std::endl;
      }
    }
    inputQuality.clear();
}
void SiStripCondObjBuilderFromDb::storeThreshold ( uint32_t  det_id) [protected]

Definition at line 420 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildFEDRelatedObjects().

                                                               {
  // Insert threshold values into Threshold object
    if ( !threshold_->put(det_id, inputThreshold ) ) {
      std::cout
        << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
        << " Unable to insert values into SiStripThreshold object!"
        << " DetId already exists!" << std::endl;
    }
    inputThreshold.clear();
}
void SiStripCondObjBuilderFromDb::storeTiming ( uint32_t  det_id) [protected]

Definition at line 449 of file SiStripCondObjBuilderFromDb.cc.

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

Referenced by buildAnalysisRelatedObjects().

                                                            {
  // Insert tick height values into Gain object
      SiStripApvGain::Range range( inputApvGain.begin(), inputApvGain.end() );
      if ( !gain_->put( det_id, range ) ) {
        edm::LogWarning(mlESSources_)
          << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"
          << " Unable to insert values into SiStripApvGain object!"
          << " DetId already exists!";
      }
      inputApvGain.clear();
}

Member Data Documentation

Access to the configuration DB interface class.

Definition at line 104 of file SiStripCondObjBuilderFromDb.h.

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

Container for DB connection parameters.

Definition at line 107 of file SiStripCondObjBuilderFromDb.h.

Referenced by checkUpdate().

Definition at line 108 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj(), and getFedCabling().

Definition at line 114 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildFECRelatedObjects(), and getApvLatency().

Definition at line 151 of file SiStripCondObjBuilderFromDb.h.

Definition at line 146 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvLatency().

Definition at line 145 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesApvLatency().

Definition at line 142 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

Definition at line 141 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

Definition at line 143 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

Definition at line 144 of file SiStripCondObjBuilderFromDb.h.

Referenced by setDefaultValuesCabling().

Definition at line 148 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

Definition at line 150 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

Definition at line 149 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj().

Definition at line 162 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

Definition at line 164 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

Definition at line 163 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildStripRelatedObjects().

Definition at line 165 of file SiStripCondObjBuilderFromDb.h.

Referenced by buildCondObj(), and buildStripRelatedObjects().