122 const bool isNewFile,
const int layer,
const int fileShapeCode,
const int geoRotCode,
const int fileRotCode);
168 : geometryFileName_(iConfig.getParameter<
edm::FileInPath>(
"GeometryFileName")) {
169 viewToken_ = esConsumes<DDCompactView, IdealGeometryRecord>();
179 std::stringstream
ss;
180 ss <<
"(" << std::get<0>(coord) <<
"," << std::get<1>(coord) <<
"," << std::get<2>(coord) <<
")";
186 if (walker.
current().first.name().name() == targetName) {
203 if (walker.
current().first.name().fullname().rfind(
"hgcalwafer:", 0) == 0) {
222 if (walker.
current().first.name().fullname().rfind(
"hgcalwafer:", 0) == 0) {
226 const int copyNo = wafer.second->copyno();
236 waferInfo.
x = wafer.second->translation().x();
237 waferInfo.
y = wafer.second->translation().y();
239 std::regex_replace(waferName,
240 std::regex(
"(HGCal[EH]E)(Wafer[01])(Fine|Coarse[12])([a-z]*)([0-9]*)"),
242 std::regex_constants::format_no_copy);
243 std::stringstream
ss(waferNameData);
248 ss >> EEorHE >> typeStr >> shapeStr >> rotStr;
250 if (shapeStr.empty())
254 const int rotCode(std::stoi(rotStr));
270 if (geoThickClass == 0 && fileThickness == 120)
272 if (geoThickClass == 1 && fileThickness == 200)
274 if (geoThickClass == 2 && fileThickness == 300)
281 const bool isNewFile,
const int layer,
const int fileShapeCode,
const int geoRotCode,
const int fileRotCode) {
286 if ((geoRotCode + 1) % 2 == fileRotCode % 2)
289 if (geoRotCode % 2 == fileRotCode % 2)
303 if (!viewH.isValid()) {
312 auto eeWalker = viewH->walker();
313 const bool eeFound =
DDFindHGCal(eeWalker,
"HGCalEE");
324 auto hesilWalker = viewH->walker();
325 const bool hesilFound =
DDFindHGCal(hesilWalker,
"HGCalHEsil");
336 auto hemixWalker = viewH->walker();
337 const bool hemixFound =
DDFindHGCal(hemixWalker,
"HGCalHEmix");
348 if (!(eeFound || hesilFound || hemixFound)) {
379 int nTotalProcessed = 0;
383 int nThicknessError = 0;
388 int nUnaccounted = 0;
393 std::getline(geoTxtFile,
buf);
394 std::stringstream
ss(
buf);
395 std::vector<std::string> first_tokens;
398 first_tokens.push_back(
buf);
400 const bool isNewFile(first_tokens.size() == 1);
405 std::getline(geoTxtFile,
buf);
406 std::stringstream layerTypesSS(
buf);
407 while (layerTypesSS >>
buf)
426 while (std::getline(geoTxtFile,
buf)) {
427 std::stringstream
ss(
buf);
428 std::vector<std::string> tokens;
431 tokens.push_back(
buf);
432 if (tokens.size() != 8)
440 const std::string waferDensityStr(isNewFile ? tokens[2].substr(0, 1) :
"");
441 const int waferThickness(isNewFile ? std::stoi(tokens[2].substr(1)) : std::stoi(tokens[2]));
442 const double waferX(std::stod(tokens[3]));
443 const double waferY(std::stod(tokens[4]));
444 const int waferRotCode(std::stoi(tokens[5]));
445 const int waferU(std::stoi(tokens[6]));
446 const int waferV(std::stoi(tokens[7]));
447 const int waferShapeCode(isNewFile ? (waferDensityStr ==
"l" ?
waferShapeMapLD.at(waferShapeStr)
472 if (fabs(-waferInfo.
x - waferX) > 0.015) {
477 if (fabs(waferInfo.
y - waferY) > 0.015) {
485 <<
" != " << waferDensityStr << waferShapeCode <<
" ) name=" << waferInfo.
waferName;
491 <<
" != " << waferRotCode <<
" (" << waferShapeCode
500 if (!accounted.second) {
521 if (nMissing > 0 || nThicknessError > 0 || nPosXError > 0 || nPosYError > 0 || nShapeError > 0 || nRotError > 0 ||
543 edm::FileInPath(
"Validation/HGCalValidation/data/geomnew_corrected_360.txt"));
544 descriptions.
add(
"hgcalWaferValidation",
desc);
std::map< WaferCoord, struct WaferInfo > waferData_
Log< level::Info, true > LogVerbatim
const WaferShapeMap waferShapeMapHD
static constexpr int32_t WaferHalf2
void ProcessWaferLayer(DDCompactView::GraphWalker &walker)
static constexpr int32_t WaferFive2
bool DDFindHGCal(DDCompactView::GraphWalker &walker, std::string targetName)
const WaferShapeMap waferShapeMapDD
std::string fullPath() const
static int32_t getUnpackedU(int id)
int32_t waferU(const int32_t index)
std::map< std::string, int > WaferShapeMap
int32_t waferLayer(const int32_t index)
static constexpr int32_t WaferOut
static constexpr int32_t WaferThree
static int32_t getUnpackedV(int id)
static constexpr int32_t WaferSemi2
std::tuple< int, int, int > WaferCoord
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const WaferShapeMap waferShapeMapLD
~HGCalWaferValidation() override=default
static constexpr int32_t WaferFull
static constexpr int32_t WaferHalf
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< int > layerTypes_
bool isThicknessMatched(const int geoThickClass, const int fileThickness)
static int32_t getUnpackedType(int id)
#define DEFINE_FWK_MODULE(type)
bool isRotationMatched(const bool isNewFile, const int layer, const int fileShapeCode, const int geoRotCode, const int fileRotCode)
Log< level::Warning, true > LogPrint
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
result_type nextSibling()
static constexpr int32_t WaferChopTwoM
edm::ESGetToken< DDCompactView, IdealGeometryRecord > viewToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::map< WaferCoord, bool > waferValidated_
std::string strWaferCoord(const WaferCoord &coord)
int32_t waferV(const int32_t index)
edm::FileInPath geometryFileName_
static constexpr int32_t WaferFive
void DDFindWafers(DDCompactView::GraphWalker &walker)
static constexpr int32_t WaferSemi
HGCalWaferValidation(const edm::ParameterSet &)
value_type current() const
static constexpr int32_t WaferChopTwo