CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
SiPixelDigitizerAlgorithm::PixelEfficiencies Struct Reference

Public Member Functions

void init_from_db (const edm::ESHandle< TrackerGeometry > &, const edm::ESHandle< SiPixelDynamicInefficiency > &)
 
bool matches (const DetId &, const DetId &, const std::vector< uint32_t > &)
 
 PixelEfficiencies (const edm::ParameterSet &conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks)
 

Public Attributes

std::map< uint32_t, double > ChipGeomFactors
 
std::map< uint32_t, double > ColGeomFactors
 
unsigned int FPixIndex
 
bool FromConfig
 
std::map< uint32_t, size_t > iPU
 
std::map< uint32_t, double > PixelGeomFactors
 
std::vector< double > pu_scale
 
double theInnerEfficiency_FPix [20]
 
double theInstLumiScaleFactor
 
std::vector< double > theLadderEfficiency_BPix [20]
 
std::vector< double > theModuleEfficiency_BPix [20]
 
double theOuterEfficiency_FPix [20]
 
double thePixelChipEfficiency [20]
 
double thePixelColEfficiency [20]
 
double thePixelEfficiency [20]
 
std::vector< std::vector< double > > thePUEfficiency
 

Detailed Description

Internal use only.

Definition at line 230 of file SiPixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelEfficiencies ( const edm::ParameterSet conf,
bool  AddPixelInefficiency,
int  NumberOfBarrelLayers,
int  NumberOfEndcapDisks 
)

Definition at line 366 of file SiPixelDigitizerAlgorithm.cc.

References relativeConstraints::empty, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), mps_fire::i, SiPixelDigitizerAlgorithm::NumberOfBarrelLayers, SiPixelDigitizerAlgorithm::NumberOfEndcapDisks, and findQualityFiles::size.

366  {
367  // pixel inefficiency
368  // Don't use Hard coded values, read inefficiencies in from DB/python config or don't use any
369  int NumberOfTotLayers = NumberOfBarrelLayers + NumberOfEndcapDisks;
372  FromConfig =
373  conf.exists("thePixelColEfficiency_BPix1") && conf.exists("thePixelColEfficiency_BPix2") && conf.exists("thePixelColEfficiency_BPix3") &&
374  conf.exists("thePixelColEfficiency_FPix1") && conf.exists("thePixelColEfficiency_FPix2") &&
375  conf.exists("thePixelEfficiency_BPix1") && conf.exists("thePixelEfficiency_BPix2") && conf.exists("thePixelEfficiency_BPix3") &&
376  conf.exists("thePixelEfficiency_FPix1") && conf.exists("thePixelEfficiency_FPix2") &&
377  conf.exists("thePixelChipEfficiency_BPix1") && conf.exists("thePixelChipEfficiency_BPix2") && conf.exists("thePixelChipEfficiency_BPix3") &&
378  conf.exists("thePixelChipEfficiency_FPix1") && conf.exists("thePixelChipEfficiency_FPix2");
379  if (NumberOfBarrelLayers==3) FromConfig = FromConfig && conf.exists("theLadderEfficiency_BPix1") && conf.exists("theLadderEfficiency_BPix2") && conf.exists("theLadderEfficiency_BPix3") &&
380  conf.exists("theModuleEfficiency_BPix1") && conf.exists("theModuleEfficiency_BPix2") && conf.exists("theModuleEfficiency_BPix3") &&
381  conf.exists("thePUEfficiency_BPix1") && conf.exists("thePUEfficiency_BPix2") && conf.exists("thePUEfficiency_BPix3") &&
382  conf.exists("theInnerEfficiency_FPix1") && conf.exists("theInnerEfficiency_FPix2") &&
383  conf.exists("theOuterEfficiency_FPix1") && conf.exists("theOuterEfficiency_FPix2") &&
384  conf.exists("thePUEfficiency_FPix_Inner") && conf.exists("thePUEfficiency_FPix_Outer") &&
385  conf.exists("theInstLumiScaleFactor");
386  if (NumberOfBarrelLayers>=4) FromConfig = FromConfig && conf.exists("thePixelColEfficiency_BPix4") &&
387  conf.exists("thePixelEfficiency_BPix4") && conf.exists("thePixelChipEfficiency_BPix4");
388  if (NumberOfEndcapDisks>=3) FromConfig = FromConfig && conf.exists("thePixelColEfficiency_FPix4") &&
389  conf.exists("thePixelEfficiency_FPix3") && conf.exists("thePixelChipEfficiency_FPix3");
390  if (FromConfig) {
391  LogInfo ("PixelDigitizer ") <<"The PixelDigitizer inefficiency configuration is read from the config file.\n";
392  theInstLumiScaleFactor = conf.getParameter<double>("theInstLumiScaleFactor");
393  int i=0;
394  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix1");
395  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix2");
396  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix3");
397  if (NumberOfBarrelLayers>=4){thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix4");}
398  //
399  i=0;
400  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix1");
401  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix2");
402  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix3");
403  if (NumberOfBarrelLayers>=4){thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix4");}
404  //
405  i=0;
406  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix1");
407  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix2");
408  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix3");
409  if (NumberOfBarrelLayers>=4){thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix4");}
410  //
411  if (NumberOfBarrelLayers==3){
412  i=0;
413  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix1");
414  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix2");
415  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix3");
416  if ( ((theLadderEfficiency_BPix[0].size()!=20) || (theLadderEfficiency_BPix[1].size()!=32) ||
417  (theLadderEfficiency_BPix[2].size()!=44)) && (NumberOfBarrelLayers==3) )
418  throw cms::Exception("Configuration") << "Wrong ladder number in efficiency config!";
419  //
420  i=0;
421  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix1");
422  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix2");
423  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix3");
424  if ( ((theModuleEfficiency_BPix[0].size()!=4) || (theModuleEfficiency_BPix[1].size()!=4) ||
425  (theModuleEfficiency_BPix[2].size()!=4)) && (NumberOfBarrelLayers==3) )
426  throw cms::Exception("Configuration") << "Wrong module number in efficiency config!";
427  //
428  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix1"));
429  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix2"));
430  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix3"));
431  if ( ((thePUEfficiency[0].empty()) || (thePUEfficiency[1].empty()) ||
432  (thePUEfficiency[2].empty())) && (NumberOfBarrelLayers==3) )
433  throw cms::Exception("Configuration") << "At least one PU efficiency (BPix) number is needed in efficiency config!";
434  }
435  // The next is needed for Phase2 Tracker studies
436  if (NumberOfBarrelLayers>=5){
437  if (NumberOfTotLayers>20){throw cms::Exception("Configuration") <<"SiPixelDigitizer was given more layers than it can handle";}
438  // For Phase2 tracker layers just set the outermost BPix inefficiency to 99.9% THESE VALUES ARE HARDCODED ALSO ELSEWHERE IN THIS FILE
439  for (int j=5 ; j<=NumberOfBarrelLayers ; j++){
440  thePixelColEfficiency[j-1]=0.999;
441  thePixelEfficiency[j-1]=0.999;
442  thePixelChipEfficiency[j-1]=0.999;
443  }
444  }
445  //
446  i=FPixIndex;
447  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix1");
448  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix2");
449  if (NumberOfEndcapDisks>=3){thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix3");}
450  i=FPixIndex;
451  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix1");
452  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix2");
453  if (NumberOfEndcapDisks>=3){thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix3");}
454  i=FPixIndex;
455  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix1");
456  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix2");
457  if (NumberOfEndcapDisks>=3){thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix3");}
458  // The next is needed for Phase2 Tracker studies
459  if (NumberOfEndcapDisks>=4){
460  if (NumberOfTotLayers>20){throw cms::Exception("Configuration") <<"SiPixelDigitizer was given more layers than it can handle";}
461  // For Phase2 tracker layers just set the extra FPix disk inefficiency to 99.9% THESE VALUES ARE HARDCODED ALSO ELSEWHERE IN THIS FILE
462  for (int j=4+FPixIndex ; j<=NumberOfEndcapDisks+NumberOfBarrelLayers ; j++){
463  thePixelColEfficiency[j-1]=0.999;
464  thePixelEfficiency[j-1]=0.999;
465  thePixelChipEfficiency[j-1]=0.999;
466  }
467  }
468  //FPix Dynamic Inefficiency
469  if (NumberOfBarrelLayers==3){
470  i=FPixIndex;
471  theInnerEfficiency_FPix[i++] = conf.getParameter<double>("theInnerEfficiency_FPix1");
472  theInnerEfficiency_FPix[i++] = conf.getParameter<double>("theInnerEfficiency_FPix2");
473  i=FPixIndex;
474  theOuterEfficiency_FPix[i++] = conf.getParameter<double>("theOuterEfficiency_FPix1");
475  theOuterEfficiency_FPix[i++] = conf.getParameter<double>("theOuterEfficiency_FPix2");
476  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_FPix_Inner"));
477  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_FPix_Outer"));
478  if ( ((thePUEfficiency[3].empty()) || (thePUEfficiency[4].empty())) && (NumberOfEndcapDisks==2) )
479  throw cms::Exception("Configuration") << "At least one (FPix) PU efficiency number is needed in efficiency config!";
480  pu_scale.resize(thePUEfficiency.size());
481  }
482  }
483  else LogInfo ("PixelDigitizer ") <<"The PixelDigitizer inefficiency configuration is read from the database.\n";
484  }
485  // the first "NumberOfBarrelLayers" settings [0],[1], ... , [NumberOfBarrelLayers-1] are for the barrel pixels
486  // the next "NumberOfEndcapDisks" settings [NumberOfBarrelLayers],[NumberOfBarrelLayers+1], ... [NumberOfEndcapDisks+NumberOfBarrelLayers-1]
487 }
size
Write out results.
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< std::vector< double > > thePUEfficiency

Member Function Documentation

void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db ( const edm::ESHandle< TrackerGeometry > &  geom,
const edm::ESHandle< SiPixelDynamicInefficiency > &  SiPixelDynamicInefficiency 
)

Definition at line 498 of file SiPixelDigitizerAlgorithm.cc.

References TrackerGeometry::detUnits(), Exception, SiPixelDynamicInefficiency::getChipGeomFactors(), SiPixelDynamicInefficiency::getColGeomFactors(), SiPixelDynamicInefficiency::getDetIdmasks(), SiPixelDynamicInefficiency::getPixelGeomFactors(), SiPixelDynamicInefficiency::getPUFactors(), SiPixelDynamicInefficiency::gettheInstLumiScaleFactor(), mps_fire::i, patRefSel_triggerMatching_cfi::matches, and DetId::rawId().

Referenced by SiPixelDigitizerAlgorithm::init_DynIneffDB().

498  {
499 
500  theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor();
501  const std::map<uint32_t, double>& PixelGeomFactorsDB = SiPixelDynamicInefficiency->getPixelGeomFactors();
502  const std::map<uint32_t, double>& ColGeomFactorsDB = SiPixelDynamicInefficiency->getColGeomFactors();
503  const std::map<uint32_t, double>& ChipGeomFactorsDB = SiPixelDynamicInefficiency->getChipGeomFactors();
504  const std::map<uint32_t, std::vector<double> >& PUFactors = SiPixelDynamicInefficiency->getPUFactors();
505  std::vector<uint32_t > DetIdmasks = SiPixelDynamicInefficiency->getDetIdmasks();
506 
507  // Loop on all modules, calculate geometrical scale factors and store in map for easy access
508  for( const auto& it_module : geom->detUnits()) {
509  if( dynamic_cast<PixelGeomDetUnit const*>(it_module)==nullptr) continue;
510  const DetId detid = it_module->geographicalId();
511  uint32_t rawid = detid.rawId();
512  PixelGeomFactors[rawid] = 1;
513  ColGeomFactors[rawid] = 1;
514  ChipGeomFactors[rawid] = 1;
515  for (auto db_factor : PixelGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) PixelGeomFactors[rawid] *= db_factor.second;
516  for (auto db_factor : ColGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ColGeomFactors[rawid] *= db_factor.second;
517  for (auto db_factor : ChipGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ChipGeomFactors[rawid] *= db_factor.second;
518  }
519 
520  // piluep scale factors are calculated once per event
521  // therefore vector index is stored in a map for each module that matches to a db_id
522  size_t i=0;
523  for (auto factor : PUFactors) {
524  const DetId db_id = DetId(factor.first);
525  for( const auto& it_module : geom->detUnits()) {
526  if( dynamic_cast<PixelGeomDetUnit const*>(it_module)==nullptr) continue;
527  const DetId detid = it_module->geographicalId();
528  if (!matches(detid, db_id, DetIdmasks)) continue;
529  if (iPU.count(detid.rawId())) {
530  throw cms::Exception("Database")<<"Multiple db_ids match to same module in SiPixelDynamicInefficiency DB Object";
531  } else {
532  iPU[detid.rawId()] = i;
533  }
534  }
535  thePUEfficiency.push_back(factor.second);
536  ++i;
537  }
538  pu_scale.resize(thePUEfficiency.size());
539 }
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::vector< std::vector< double > > thePUEfficiency
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
const std::vector< uint32_t > getDetIdmasks() const
Definition: DetId.h:18
bool matches(const DetId &, const DetId &, const std::vector< uint32_t > &)
const std::map< unsigned int, std::vector< double > > & getPUFactors() const
const std::map< unsigned int, double > & getColGeomFactors() const
const std::map< unsigned int, double > & getPixelGeomFactors() const
const std::map< unsigned int, double > & getChipGeomFactors() const
bool SiPixelDigitizerAlgorithm::PixelEfficiencies::matches ( const DetId detid,
const DetId db_id,
const std::vector< uint32_t > &  DetIdmasks 
)

Definition at line 541 of file SiPixelDigitizerAlgorithm.cc.

References DetId::det(), mps_fire::i, DetId::rawId(), and DetId::subdetId().

541  {
542  if (detid.subdetId() != db_id.subdetId()) return false;
543  for (size_t i=0; i<DetIdmasks.size(); ++i) {
544  DetId maskid = DetId(DetIdmasks.at(i));
545  if (maskid.subdetId() != db_id.subdetId()) continue;
546  if ((detid.rawId()&maskid.rawId()) != (db_id.rawId()&maskid.rawId()) &&
547  (db_id.rawId()&maskid.rawId()) != DetId(db_id.det(), db_id.subdetId()).rawId()) return false;
548  }
549  return true;
550 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
Definition: DetId.h:18
Detector det() const
get the detector field from this detid
Definition: DetId.h:36

Member Data Documentation

std::map<uint32_t, double> SiPixelDigitizerAlgorithm::PixelEfficiencies::ChipGeomFactors
std::map<uint32_t, double> SiPixelDigitizerAlgorithm::PixelEfficiencies::ColGeomFactors
unsigned int SiPixelDigitizerAlgorithm::PixelEfficiencies::FPixIndex
bool SiPixelDigitizerAlgorithm::PixelEfficiencies::FromConfig
std::map<uint32_t, size_t > SiPixelDigitizerAlgorithm::PixelEfficiencies::iPU
std::map<uint32_t, double> SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelGeomFactors
std::vector<double> SiPixelDigitizerAlgorithm::PixelEfficiencies::pu_scale
double SiPixelDigitizerAlgorithm::PixelEfficiencies::theInnerEfficiency_FPix[20]
double SiPixelDigitizerAlgorithm::PixelEfficiencies::theInstLumiScaleFactor
std::vector<double> SiPixelDigitizerAlgorithm::PixelEfficiencies::theLadderEfficiency_BPix[20]
std::vector<double> SiPixelDigitizerAlgorithm::PixelEfficiencies::theModuleEfficiency_BPix[20]
double SiPixelDigitizerAlgorithm::PixelEfficiencies::theOuterEfficiency_FPix[20]
double SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelChipEfficiency[20]
double SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelColEfficiency[20]
double SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelEfficiency[20]
std::vector<std::vector<double> > SiPixelDigitizerAlgorithm::PixelEfficiencies::thePUEfficiency