#include <OnlineDB/SiStripESSources/interface/SiStripCondObjBuilderFromDb.h>
Definition at line 26 of file SiStripCondObjBuilderFromDb.h.
SiStripCondObjBuilderFromDb::SiStripCondObjBuilderFromDb | ( | ) |
Definition at line 38 of file SiStripCondObjBuilderFromDb.cc.
References LogTrace, and sistrip::mlESSources_.
00039 { 00040 LogTrace(mlESSources_) 00041 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00042 << " Constructing object..."; 00043 }
SiStripCondObjBuilderFromDb::SiStripCondObjBuilderFromDb | ( | const edm::ParameterSet & | , | |
const edm::ActivityRegistry & | ||||
) |
Definition at line 28 of file SiStripCondObjBuilderFromDb.cc.
References LogTrace, and sistrip::mlESSources_.
00030 { 00031 LogTrace(mlESSources_) 00032 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00033 << " Constructing object..."; 00034 }
SiStripCondObjBuilderFromDb::~SiStripCondObjBuilderFromDb | ( | ) | [virtual] |
Definition at line 47 of file SiStripCondObjBuilderFromDb.cc.
References LogTrace, and sistrip::mlESSources_.
00047 { 00048 LogTrace(mlESSources_) 00049 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00050 << " Destructing object..."; 00051 }
void SiStripCondObjBuilderFromDb::buildCondObj | ( | ) |
Builds pedestals using FED descriptions and cabling info retrieved from configuration database.
Definition at line 64 of file SiStripCondObjBuilderFromDb.cc.
References SiStripFedCablingBuilderFromDb::buildFecCabling(), buildStripRelatedObjects(), sistrip::CABLING_FROM_CONNS, db_, fed_cabling_, SiStripFedCablingBuilderFromDb::getFedCabling(), LogTrace, and sistrip::mlESSources_.
Referenced by newSiStripO2O::analyze(), and checkUpdate().
00064 { 00065 LogTrace(mlESSources_) 00066 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]"; 00067 00068 // Check if DB connection is made 00069 if ( db_ ) { 00070 00071 // Check if DB connection is made 00072 if ( db_->deviceFactory() || 00073 db_->databaseCache() ) { 00074 00075 // Build FEC cabling object 00076 SiStripFecCabling fec_cabling; 00077 SiStripFedCablingBuilderFromDb::buildFecCabling( &*db_, 00078 fec_cabling, 00079 sistrip::CABLING_FROM_CONNS ); 00080 00081 // Retrieve DET cabling (should be improved) 00082 fed_cabling_=new SiStripFedCabling; 00083 SiStripFedCablingBuilderFromDb::getFedCabling( fec_cabling, *fed_cabling_ ); 00084 SiStripDetCabling det_cabling( *fed_cabling_ ); 00085 00086 buildStripRelatedObjects( &*db_, det_cabling ); 00087 00088 // Call virtual method that writes FED cabling object to conditions DB 00089 //writePedestalsToCondDb( *pedestals ); 00090 00091 } else { 00092 edm::LogWarning(mlESSources_) 00093 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00094 << " NULL pointer to DeviceFactory returned by SiStripConfigDb!" 00095 << " Cannot build Pedestals object!"; 00096 } 00097 } else { 00098 edm::LogWarning(mlESSources_) 00099 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00100 << " NULL pointer to SiStripConfigDb returned by DB \"service\"!" 00101 << " Cannot build Pedestals object!"; 00102 } 00103 }
void SiStripCondObjBuilderFromDb::buildStripRelatedObjects | ( | SiStripConfigDb *const | db, | |
const SiStripDetCabling & | det_cabling | |||
) |
Definition at line 107 of file SiStripCondObjBuilderFromDb.cc.
References SiStripDetCabling::addActiveDetectorsRawIds(), addr, SiStripQuality::compact(), description, SiStripBadStrip::encode(), SiStripDetCabling::getConnections(), SiStripConfigDb::getFedDescriptions(), sistrip::invalid32_, LogTrace, sistrip::mlESSources_, noises_, pedestals_, SiStripPedestals::put(), SiStripThreshold::put(), SiStripBadStrip::put(), SiStripNoises::put(), quality_, SiStripPedestals::setData(), SiStripThreshold::setData(), SiStripNoises::setData(), strip(), sistrip::STRIPS_PER_FEDCH, and threshold_.
Referenced by buildCondObj().
00108 { 00109 00110 // Retrieve FedDescriptions from configuration database 00111 SiStripConfigDb::FedDescriptionsRange descriptions = db->getFedDescriptions(); 00112 if ( descriptions.empty() ) { 00113 edm::LogWarning(mlESSources_) 00114 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00115 << " Unable to build Pedestals object!" 00116 << " No FED descriptions found!"; 00117 return; 00118 } 00119 00120 // Retrieve list of active DetIds 00121 vector<uint32_t> det_ids; 00122 det_cabling.addActiveDetectorsRawIds(det_ids); 00123 if ( det_ids.empty() ) { 00124 edm::LogWarning(mlESSources_) 00125 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00126 << " Unable to build Pedestals object!" 00127 << " No DetIds found!"; 00128 return; 00129 } 00130 LogTrace(mlESSources_) 00131 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00132 << " Found " << det_ids.size() << " active DetIds"; 00133 00134 pedestals_=new SiStripPedestals(); 00135 noises_=new SiStripNoises(); 00136 threshold_= new SiStripThreshold(); 00137 quality_=new SiStripQuality(); 00138 00139 // Iterate through active DetIds 00140 vector<uint32_t>::const_iterator det_id = det_ids.begin(); 00141 for ( ; det_id != det_ids.end(); det_id++ ) { 00142 00143 // Ignore NULL DetIds 00144 if ( !(*det_id) ) { continue; } 00145 if ( *det_id == sistrip::invalid32_ ) { continue; } 00146 00147 //if(*det_id==369158216) 00148 //edm::LogWarning(mlESSources_) << "TEST this is my detid " << *det_id << std::endl; 00149 00150 const vector<FedChannelConnection>& conns = det_cabling.getConnections(*det_id); 00151 if (conns.size()==0){ 00152 edm::LogWarning(mlESSources_) 00153 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00154 << " Unable to build Pedestals object!" 00155 << " No FED channel connections found for detid "<< *det_id; 00156 continue; 00157 } 00158 00159 vector<FedChannelConnection>::const_iterator ipair = conns.begin(); 00160 vector< vector<FedChannelConnection>::const_iterator > listConns(ipair->nApvPairs(),conns.end()); 00161 for ( ; ipair != conns.end(); ipair++ ){ 00162 // Check if the ApvPair is connected 00163 if (ipair->fedId() && ipair->apvPairNumber()<3){ 00164 // if(*det_id==369158216 || 369124437==*det_id) 00165 // edm::LogWarning(mlESSources_) << "TEST this is the position of the listConns for detid " << *det_id << " " << ipair-conns.begin() << " " << ipair->apvPairNumber(); 00166 listConns[ipair-conns.begin()]=ipair; 00167 } else { 00168 edm::LogWarning(mlESSources_) 00169 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00170 << " DetId " << ipair->detId() 00171 << " is missing \n a) APV pair number " << ipair->apvPairNumber() 00172 << " out of " << ipair->nApvPairs() << " APV pairs\n or \n b) fedId " << ipair->fedId(); 00173 } 00174 } 00175 00176 //if(*det_id==369158216) 00177 // edm::LogWarning(mlESSources_) << "TEST this is my vector<FedChannelConnection> size " << conns.size() << " listConn.size() " << listConns.size()<< std::endl; 00178 00179 00180 // Iterate through connections for given DetId and fill peds container 00181 SiStripPedestals::InputVector inputPedestals; 00182 SiStripNoises::InputVector inputNoises; 00183 SiStripThreshold::InputVector inputThreshold; 00184 SiStripQuality::InputVector inputQuality; 00185 00186 uint16_t apvPair; 00187 vector< vector<FedChannelConnection>::const_iterator >::const_iterator ilistConns=listConns.begin(); 00188 for ( ; ilistConns != listConns.end(); ++ilistConns ) { 00189 ipair=*ilistConns; 00190 apvPair=(ilistConns-listConns.begin()); 00191 00192 if ( ipair == conns.end() ) { 00193 // Fill object with default values 00194 edm::LogWarning(mlESSources_) 00195 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00196 << " Unable to find FED connection for detid : " << *det_id << " APV pair number " << apvPair 00197 << " Writing default values"; 00198 uint16_t istrip = apvPair*sistrip::STRIPS_PER_FEDCH; 00199 inputQuality.push_back(quality_->encode(istrip,sistrip::STRIPS_PER_FEDCH)); 00200 threshold_->setData( istrip, 0., 0., inputThreshold ); 00201 for ( ;istrip < (apvPair+1)*sistrip::STRIPS_PER_FEDCH; ++istrip ){ 00202 pedestals_->setData( 0.,inputPedestals ); 00203 noises_->setData( 0., inputNoises ); 00204 //edm::LogWarning(mlESSources_) << "TEST default values for " << *det_id << " strip " << istrip << std::endl; 00205 } 00206 continue; 00207 } 00208 00209 //if(*det_id==369158216) 00210 //edm::LogWarning(mlESSources_) << "TEST this is my vector<FedChannelConnection> entry " 00211 //<< ipair-conns.begin() << " ilistConn " << ilistConns - listConns.begin()<< std::endl; 00212 00213 // Check if description exists for given FED id 00214 SiStripConfigDb::FedDescriptionsV::const_iterator description = descriptions.begin(); 00215 while ( description != descriptions.end() ) { 00216 if ( (*description)->getFedId() ==ipair->fedId() ) { break; } 00217 description++; 00218 } 00219 if ( description == descriptions.end() ) { 00220 edm::LogWarning(mlESSources_) 00221 << "SiStripCondObjBuilderFromDb::" << __func__ << "]" 00222 << " Unable to find FED description for FED id: " << ipair->fedId() << " detid : " << *det_id << " APV pair number " << apvPair 00223 << " Writing default values"; 00224 uint16_t istrip = apvPair*sistrip::STRIPS_PER_FEDCH; 00225 inputQuality.push_back(quality_->encode(istrip,sistrip::STRIPS_PER_FEDCH)); 00226 threshold_->setData( istrip, 0., 0., inputThreshold ); 00227 for ( ;istrip < (apvPair+1)*sistrip::STRIPS_PER_FEDCH; ++istrip ){ 00228 pedestals_->setData( 0.,inputPedestals ); 00229 noises_->setData( 0., inputNoises ); 00230 //edm::LogWarning(mlESSources_) << "TEST default values for " << *det_id << " strip " << istrip << std::endl; 00231 } 00232 continue; 00233 } 00234 00235 // Retrieve Fed9UStrips object from FED description 00236 const Fed9U::Fed9UStrips& strips = (*description)->getFedStrips(); 00237 00238 // Retrieve StripDescriptions for each APV 00239 for ( uint16_t iapv = 2*ipair->fedCh(); iapv < 2*ipair->fedCh()+2; iapv++ ) { 00240 00241 // Get StripDescriptions for the given APV 00242 Fed9U::Fed9UAddress addr; 00243 addr.setFedApv(iapv); 00244 vector<Fed9U::Fed9UStripDescription> strip = strips.getApvStrips(addr); 00245 00246 //if(*det_id==369158216) 00247 //edm::LogWarning(mlESSources_) << "TEST this is my apvPairNumber " << ipair->apvPairNumber()<< " out of " << ipair->nApvPairs() << std::endl; 00248 00249 vector<Fed9U::Fed9UStripDescription>::const_iterator istrip = strip.begin(); 00250 uint16_t jstrip = ipair->apvPairNumber()*sistrip::STRIPS_PER_FEDCH; 00251 for ( ; istrip != strip.end(); istrip++ ) { 00252 //if(*det_id==369158216 || 369124437==*det_id) 00253 //edm::LogWarning(mlESSources_) << "TEST this is ped " << *det_id << " strip " << jstrip << " value " << istrip->getPedestal() << std::endl; 00254 00255 pedestals_->setData( istrip->getPedestal() , inputPedestals); 00256 noises_ ->setData( istrip->getNoise() , inputNoises ); 00257 threshold_->setData( jstrip, istrip->getLowThresholdFactor(), 00258 istrip->getHighThresholdFactor(), inputThreshold ); 00259 if(istrip->getDisable()) 00260 inputQuality.push_back(quality_->encode(jstrip,1)); 00261 jstrip++; 00262 } // strip loop 00263 } // apv loop 00264 } // connection loop 00265 00266 // Insert pedestal values into Pedestals object 00267 if ( !pedestals_->put( *det_id, inputPedestals ) ) { 00268 edm::LogWarning(mlESSources_) 00269 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00270 << " Unable to insert values into SiStripPedestals object!" 00271 << " DetId already exists!"; 00272 } 00273 00274 // Insert noise values into Noises object 00275 if ( !noises_->put( *det_id, inputNoises ) ) { 00276 edm::LogWarning(mlESSources_) 00277 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00278 << " Unable to insert values into SiStripNoises object!" 00279 << " DetId already exists!"; 00280 } 00281 00282 // Insert threshold values into Threshold object 00283 if ( !threshold_->put( *det_id, inputThreshold ) ) { 00284 edm::LogWarning(mlESSources_) 00285 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00286 << " Unable to insert values into SiStripThreshold object!" 00287 << " DetId already exists!"; 00288 } 00289 00290 // Insert quality values into Quality object 00291 uint32_t detid=*det_id; 00292 if (inputQuality.size()){ 00293 quality_->compact(detid,inputQuality); 00294 if ( !quality_->put( *det_id, inputQuality ) ) { 00295 edm::LogWarning(mlESSources_) 00296 << "[SiStripCondObjBuilderFromDb::" << __func__ << "]" 00297 << " Unable to insert values into SiStripThreshold object!" 00298 << " DetId already exists!"; 00299 } 00300 } 00301 00302 00303 } // det id loop 00304 00305 }
void SiStripCondObjBuilderFromDb::checkUpdate | ( | ) | [protected] |
Definition at line 55 of file SiStripCondObjBuilderFromDb.cc.
References buildCondObj(), dbParams(), and dbParams_.
Referenced by getFedCabling(), getNoises(), getPedestals(), getQuality(), and getThreshold().
00055 { 00056 if (!(dbParams_==dbParams())){ 00057 dbParams_=dbParams(); 00058 buildCondObj(); 00059 } 00060 }
const SiStripDbParams& SiStripCondObjBuilderFromDb::dbParams | ( | ) | const [inline] |
Returns database connection parameters.
Definition at line 36 of file SiStripCondObjBuilderFromDb.h.
References db_.
Referenced by checkUpdate().
00036 {return db_->dbParams();}
SiStripFedCabling* SiStripCondObjBuilderFromDb::getFedCabling | ( | ) | [inline] |
Definition at line 44 of file SiStripCondObjBuilderFromDb.h.
References checkUpdate(), and fed_cabling_.
Referenced by newSiStripO2O::analyze(), and getValue().
00044 {checkUpdate(); return fed_cabling_;}
SiStripNoises* SiStripCondObjBuilderFromDb::getNoises | ( | ) | [inline] |
Definition at line 46 of file SiStripCondObjBuilderFromDb.h.
References checkUpdate(), and noises_.
Referenced by newSiStripO2O::analyze(), and getValue().
00046 {checkUpdate(); return noises_;}
SiStripPedestals* SiStripCondObjBuilderFromDb::getPedestals | ( | ) | [inline] |
Definition at line 45 of file SiStripCondObjBuilderFromDb.h.
References checkUpdate(), and pedestals_.
Referenced by newSiStripO2O::analyze(), and getValue().
00045 {checkUpdate(); return pedestals_;}
SiStripQuality* SiStripCondObjBuilderFromDb::getQuality | ( | ) | [inline] |
Definition at line 48 of file SiStripCondObjBuilderFromDb.h.
References checkUpdate(), and quality_.
Referenced by newSiStripO2O::analyze(), and getValue().
00048 {checkUpdate(); return quality_;}
SiStripThreshold* SiStripCondObjBuilderFromDb::getThreshold | ( | ) | [inline] |
Definition at line 47 of file SiStripCondObjBuilderFromDb.h.
References checkUpdate(), and threshold_.
Referenced by newSiStripO2O::analyze(), and getValue().
00047 {checkUpdate(); return threshold_;}
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripBadStrip *& | val | ) | [inline] |
Definition at line 55 of file SiStripCondObjBuilderFromDb.h.
References getQuality().
00055 { val = new SiStripBadStrip(* (const SiStripBadStrip*) getQuality()); }
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripQuality *& | val | ) | [inline] |
Definition at line 54 of file SiStripCondObjBuilderFromDb.h.
References getQuality().
00054 { val = getQuality(); }
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripThreshold *& | val | ) | [inline] |
Definition at line 53 of file SiStripCondObjBuilderFromDb.h.
References getThreshold().
00053 { val = getThreshold(); }
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripNoises *& | val | ) | [inline] |
Definition at line 52 of file SiStripCondObjBuilderFromDb.h.
References getNoises().
00052 { val = getNoises(); }
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripPedestals *& | val | ) | [inline] |
Definition at line 51 of file SiStripCondObjBuilderFromDb.h.
References getPedestals().
00051 { val = getPedestals(); }
void SiStripCondObjBuilderFromDb::getValue | ( | SiStripFedCabling *& | val | ) | [inline] |
Definition at line 50 of file SiStripCondObjBuilderFromDb.h.
References getFedCabling().
00050 { val = getFedCabling();}
edm::Service<SiStripConfigDb> SiStripCondObjBuilderFromDb::db_ [protected] |
Access to the configuration DB interface class.
Definition at line 64 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildCondObj(), and dbParams().
Container for DB connection parameters.
Definition at line 67 of file SiStripCondObjBuilderFromDb.h.
Referenced by checkUpdate().
Definition at line 69 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildCondObj(), and getFedCabling().
SiStripNoises* SiStripCondObjBuilderFromDb::noises_ [protected] |
Definition at line 71 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildStripRelatedObjects(), and getNoises().
SiStripPedestals* SiStripCondObjBuilderFromDb::pedestals_ [protected] |
Definition at line 70 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildStripRelatedObjects(), and getPedestals().
SiStripQuality* SiStripCondObjBuilderFromDb::quality_ [protected] |
Definition at line 73 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildStripRelatedObjects(), and getQuality().
SiStripThreshold* SiStripCondObjBuilderFromDb::threshold_ [protected] |
Definition at line 72 of file SiStripCondObjBuilderFromDb.h.
Referenced by buildStripRelatedObjects(), and getThreshold().