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 362 of file SiPixelDigitizerAlgorithm.cc.

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

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

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

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

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

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