CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 246 of file SiPixelDigitizerAlgorithm.h.

Constructor & Destructor Documentation

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

Definition at line 359 of file SiPixelDigitizerAlgorithm.cc.

References Exception, edm::ParameterSet::exists(), FPixIndex, FromConfig, edm::ParameterSet::getParameter(), i, j, SiPixelDigitizerAlgorithm::NumberOfBarrelLayers, SiPixelDigitizerAlgorithm::NumberOfEndcapDisks, pu_scale, findQualityFiles::size, theInnerEfficiency_FPix, theInstLumiScaleFactor, theLadderEfficiency_BPix, theModuleEfficiency_BPix, theOuterEfficiency_FPix, thePixelChipEfficiency, thePixelColEfficiency, thePixelEfficiency, and thePUEfficiency.

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

Member Function Documentation

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

Definition at line 491 of file SiPixelDigitizerAlgorithm.cc.

References cond::rpcobgas::detid, Exception, i, matches, and DetId::rawId().

Referenced by SiPixelDigitizerAlgorithm::init_DynIneffDB().

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

Definition at line 534 of file SiPixelDigitizerAlgorithm.cc.

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

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