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

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

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

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

Definition at line 535 of file SiPixelDigitizerAlgorithm.cc.

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

535  {
536  if (detid.subdetId() != db_id.subdetId()) return false;
537  for (size_t i=0; i<DetIdmasks.size(); ++i) {
538  DetId maskid = DetId(DetIdmasks.at(i));
539  if (maskid.subdetId() != db_id.subdetId()) continue;
540  if ((detid.rawId()&maskid.rawId()) != (db_id.rawId()&maskid.rawId()) &&
541  (db_id.rawId()&maskid.rawId()) != DetId(db_id.det(), db_id.subdetId()).rawId()) return false;
542  }
543  return true;
544 }
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