60 printdebug_(iConfig.getUntrackedParameter<
bool>(
"printDebug",
false)) {
80 throw cms::Exception(
"Configuration") <<
"Wrong ladder number in efficiency config!";
88 throw cms::Exception(
"Configuration") <<
"Wrong module number in efficiency config!";
120 <<
"[SiPixelDynamicInefficiencyReader::analyze] End Reading SiPixelDynamicInefficiency" << std::endl;
122 std::map<unsigned int, double> map_pixelgeomfactor = SiPixelDynamicInefficiency_->
getPixelGeomFactors();
123 std::map<unsigned int, double> map_colgeomfactor = SiPixelDynamicInefficiency_->
getColGeomFactors();
124 std::map<unsigned int, double> map_chipgeomfactor = SiPixelDynamicInefficiency_->
getChipGeomFactors();
125 std::map<unsigned int, std::vector<double> > map_pufactor = SiPixelDynamicInefficiency_->
getPUFactors();
126 std::map<unsigned int, double>::const_iterator it_pixelgeom;
127 std::map<unsigned int, double>::const_iterator it_colgeom;
128 std::map<unsigned int, double>::const_iterator it_chipgeom;
129 std::map<unsigned int, std::vector<double> >::const_iterator it_pu;
131 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") <<
"Printing out DB content:" << std::endl;
132 for (it_pixelgeom = map_pixelgeomfactor.begin(); it_pixelgeom != map_pixelgeomfactor.end(); it_pixelgeom++) {
133 printf(
"pixelgeom detid %x\tfactor %f\n", it_pixelgeom->first, it_pixelgeom->second);
135 for (it_colgeom = map_colgeomfactor.begin(); it_colgeom != map_colgeomfactor.end(); it_colgeom++) {
136 printf(
"colgeom detid %x\tfactor %f\n", it_colgeom->first, it_colgeom->second);
138 for (it_chipgeom = map_chipgeomfactor.begin(); it_chipgeom != map_chipgeomfactor.end(); it_chipgeom++) {
139 printf(
"chipgeom detid %x\tfactor %f\n", it_chipgeom->first, it_chipgeom->second);
141 for (it_pu = map_pufactor.begin(); it_pu != map_pufactor.end(); it_pu++) {
142 printf(
"pu detid %x\t", it_pu->first);
143 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") <<
" Size of vector " << it_pu->second.size() <<
" elements:";
144 if (it_pu->second.size() > 1) {
145 for (
unsigned int i = 0;
i < it_pu->second.size();
i++) {
146 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") <<
" " << it_pu->second.at(
i);
148 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") << std::endl;
150 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") <<
" " << it_pu->second.at(0) << std::endl;
153 std::vector<uint32_t> detIdmasks = SiPixelDynamicInefficiency_->
getDetIdmasks();
154 for (
unsigned int i = 0;
i < detIdmasks.size();
i++)
155 printf(
"DetId Mask: %x\t\n", detIdmasks.at(
i));
157 edm::LogPrint(
"SiPixelDynamicInefficiencyReader") <<
"theInstLumiScaleFactor " << theInstLumiScaleFactor << std::endl;
161 <<
"\nCalculating factors/module and comparing it to config file factors...\n" 167 <<
" There are " << pDD->
detUnits().size() <<
" detectors (old)" << std::endl;
169 const size_t pu_det = map_pufactor.size();
170 double _pu_scale[pu_det];
171 double _pu_scale_conf[pu_det];
172 unsigned int match = 0, mismatch = 0, pu_match = 0, pu_mismatch = 0;
174 for (
const auto& it : pDD->
detUnits()) {
175 if (dynamic_cast<PixelGeomDetUnit const*>(it) ==
nullptr)
177 const DetId detid = it->geographicalId();
181 for (it_colgeom = map_colgeomfactor.begin(); it_colgeom != map_colgeomfactor.end(); ++it_colgeom) {
186 for (; __i < detIdmasks.size(); __i++) {
194 if (__i != detIdmasks.size())
196 scale_db *= it_colgeom->second;
200 unsigned int pu_iterator = 0;
201 for (it_pu = map_pufactor.begin(); it_pu != map_pufactor.end(); it_pu++, pu_iterator++) {
206 for (; __i < detIdmasks.size(); __i++) {
214 if (__i != detIdmasks.size())
216 double instlumi = 30 * theInstLumiScaleFactor;
217 double instlumi_pow = 1.;
218 _pu_scale[pu_iterator] = 0;
219 for (
size_t j = 0;
j < it_pu->second.size();
j++) {
220 _pu_scale[pu_iterator] += instlumi_pow * it_pu->second[
j];
221 instlumi_pow *= instlumi;
226 for (
size_t i = 0;
i < pu_det;
i++) {
227 double instlumi = 30 * theInstLumiScaleFactor;
228 double instlumi_pow = 1.;
229 _pu_scale_conf[
i] = 0;
232 instlumi_pow *= instlumi;
237 double columnEfficiency = 1;
253 unsigned int diskIndex = tTopo->
layer(detid) + 3;
254 unsigned int panelIndex = tTopo->
pxfPanel(detid);
255 unsigned int moduleIndex = tTopo->
pxfModule(detid);
257 if ((panelIndex == 1 && (moduleIndex == 1 || moduleIndex == 2)) ||
258 (panelIndex == 2 && moduleIndex == 1)) {
265 if (scale_db == columnEfficiency) {
272 for (
unsigned int i = 0;
i < pu_det;
i++) {
273 if (_pu_scale[
i] != 0 && _pu_scale_conf[
i] != 0 && _pu_scale[
i] == _pu_scale_conf[
i]) {
278 if (_pu_scale[
i] != 0 && _pu_scale_conf[
i] != 0 && _pu_scale[
i] != _pu_scale_conf[
i]) {
286 <<
match <<
" geom factors and " << pu_match <<
" pu factors matched to config file factors!\n" 290 <<
"ERROR! " << mismatch
291 <<
" geom factors mismatched to config file factors! Please change config and/or DB content!" << std::endl;
292 if (pu_mismatch != 0)
294 <<
"ERROR! " << pu_mismatch
295 <<
" pu_factors mismatched to config file pu_factors! Please change config and/or DB content!" << std::endl;
T getParameter(std::string const &) const
unsigned int pxbLayer(const DetId &id) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken
const std::map< unsigned int, double > & getPixelGeomFactors() const
#define DEFINE_FWK_MODULE(type)
unsigned int pxfModule(const DetId &id) const
const std::map< unsigned int, double > & getColGeomFactors() const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
unsigned int pxbLadder(const DetId &id) const
double thePixelEfficiency[20]
constexpr Detector det() const
get the detector field from this detid
unsigned int layer(const DetId &id) const
~SiPixelDynamicInefficiencyReader() override
const std::map< unsigned int, std::vector< double > > & getPUFactors() const
const std::vector< uint32_t > getDetIdmasks() const
double thePixelChipEfficiency[20]
const std::map< unsigned int, double > & getChipGeomFactors() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< double > thePUEfficiency[20]
bool getData(T &iHolder) const
const double gettheInstLumiScaleFactor_() const
void analyze(const edm::Event &, const edm::EventSetup &) override
Log< level::Warning, true > LogPrint
Namespace of DDCMS conversion namespace.
unsigned int pxfPanel(const DetId &id) const
Log< level::Info, false > LogInfo
double thePixelColEfficiency[20]
constexpr uint32_t rawId() const
get the raw id
double theInnerEfficiency_FPix[20]
const edm::ESGetToken< SiPixelDynamicInefficiency, SiPixelDynamicInefficiencyRcd > dynIneffToken
std::vector< double > theLadderEfficiency_BPix[20]
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
unsigned int pxbModule(const DetId &id) const
double theOuterEfficiency_FPix[20]
std::vector< double > theModuleEfficiency_BPix[20]
SiPixelDynamicInefficiencyReader(const edm::ParameterSet &)