60 printdebug_(iConfig.getUntrackedParameter<bool>(
"printDebug",
false)) {
65 thePixelColEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelColEfficiency_BPix3");
69 thePixelEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelEfficiency_BPix3");
73 thePixelChipEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelChipEfficiency_BPix3");
77 theLadderEfficiency_BPix[i++] = iConfig.
getParameter<std::vector<double> >(
"theLadderEfficiency_BPix3");
78 if ((theLadderEfficiency_BPix[0].
size() != 20) || (theLadderEfficiency_BPix[1].
size() != 32) ||
79 (theLadderEfficiency_BPix[2].
size() != 44))
80 throw cms::Exception(
"Configuration") <<
"Wrong ladder number in efficiency config!";
85 theModuleEfficiency_BPix[i++] = iConfig.
getParameter<std::vector<double> >(
"theModuleEfficiency_BPix3");
86 if ((theModuleEfficiency_BPix[0].
size() != 4) || (theModuleEfficiency_BPix[1].
size() != 4) ||
87 (theModuleEfficiency_BPix[2].
size() != 4))
88 throw cms::Exception(
"Configuration") <<
"Wrong module number in efficiency config!";
93 thePUEfficiency[i++] = iConfig.
getParameter<std::vector<double> >(
"thePUEfficiency_BPix3");
95 thePixelColEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelColEfficiency_FPix1");
96 thePixelColEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelColEfficiency_FPix2");
98 thePixelEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelEfficiency_FPix1");
99 thePixelEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelEfficiency_FPix2");
101 thePixelChipEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelChipEfficiency_FPix1");
102 thePixelChipEfficiency[i++] = iConfig.
getParameter<
double>(
"thePixelChipEfficiency_FPix2");
111 thePUEfficiency[i++] = iConfig.
getParameter<std::vector<double> >(
"thePUEfficiency_FPix_Inner");
112 thePUEfficiency[i++] = iConfig.
getParameter<std::vector<double> >(
"thePUEfficiency_FPix_Outer");
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;
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken
const std::map< unsigned int, double > & getPixelGeomFactors() const
#define DEFINE_FWK_MODULE(type)
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken
unsigned int pxbModule(const DetId &id) const
const std::map< unsigned int, std::vector< double > > & getPUFactors() const
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
double thePixelEfficiency[20]
~SiPixelDynamicInefficiencyReader() override
bool getData(T &iHolder) const
const std::vector< uint32_t > getDetIdmasks() const
const std::map< unsigned int, double > & getColGeomFactors() const
const double gettheInstLumiScaleFactor_() const
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
double thePixelChipEfficiency[20]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< double > thePUEfficiency[20]
void analyze(const edm::Event &, const edm::EventSetup &) override
Log< level::Warning, true > LogPrint
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
Log< level::Info, false > LogInfo
double thePixelColEfficiency[20]
T getParameter(std::string const &) const
const std::map< unsigned int, double > & getChipGeomFactors() const
unsigned int layer(const DetId &id) const
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.
double theOuterEfficiency_FPix[20]
std::vector< double > theModuleEfficiency_BPix[20]
tuple size
Write out results.
unsigned int pxfPanel(const DetId &id) const
constexpr Detector det() const
get the detector field from this detid
SiPixelDynamicInefficiencyReader(const edm::ParameterSet &)