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>();
186 std::stringstream
ss;
187 ss <<
"(" << std::get<0>(coord) <<
"," << std::get<1>(coord) <<
"," << std::get<2>(coord) <<
")";
193 if (walker.
current().first.name().name() == targetName) {
210 if (walker.
current().first.name().fullname().rfind(
"hgcalwafer:", 0) == 0) {
229 if (walker.
current().first.name().fullname().rfind(
"hgcalwafer:", 0) == 0) {
233 const int copyNo = wafer.second->copyno();
243 waferInfo.
x = wafer.second->translation().x();
244 waferInfo.
y = wafer.second->translation().y();
246 std::regex_replace(waferName,
247 std::regex(
"(HGCal[EH]E)(Wafer[01])(Fine|Coarse[12])([a-z]*)([0-9]*)"),
249 std::regex_constants::format_no_copy);
250 std::stringstream
ss(waferNameData);
255 ss >> EEorHE >> typeStr >> shapeStr >> rotStr;
257 if (shapeStr.empty())
261 const int rotCode(std::stoi(rotStr));
277 if (geoThickClass == 0 && fileThickness == 120)
279 if (geoThickClass == 1 && fileThickness == 200)
281 if (geoThickClass == 2 && fileThickness == 300)
288 const bool isNewFile,
const int layer,
const int fileShapeCode,
const int geoRotCode,
const int fileRotCode) {
293 if ((geoRotCode + 1) % 2 == fileRotCode % 2)
296 if (geoRotCode % 2 == fileRotCode % 2)
310 if (!viewH.isValid()) {
319 auto eeWalker = viewH->walker();
320 const bool eeFound =
DDFindHGCal(eeWalker,
"HGCalEE");
331 auto hesilWalker = viewH->walker();
332 const bool hesilFound =
DDFindHGCal(hesilWalker,
"HGCalHEsil");
343 auto hemixWalker = viewH->walker();
344 const bool hemixFound =
DDFindHGCal(hemixWalker,
"HGCalHEmix");
355 if (!(eeFound || hesilFound || hemixFound)) {
386 int nTotalProcessed = 0;
390 int nThicknessError = 0;
395 int nUnaccounted = 0;
400 std::getline(geoTxtFile,
buf);
401 std::stringstream
ss(
buf);
402 std::vector<std::string> first_tokens;
405 first_tokens.push_back(
buf);
407 const bool isNewFile(first_tokens.size() == 1);
412 std::getline(geoTxtFile,
buf);
413 std::stringstream layerTypesSS(
buf);
414 while (layerTypesSS >>
buf)
433 while (std::getline(geoTxtFile,
buf)) {
434 std::stringstream
ss(
buf);
435 std::vector<std::string> tokens;
438 tokens.push_back(
buf);
439 if (tokens.size() != 8)
447 const std::string waferDensityStr(isNewFile ? tokens[2].substr(0, 1) :
"");
448 const int waferThickness(isNewFile ? std::stoi(tokens[2].substr(1)) : std::stoi(tokens[2]));
449 const double waferX(std::stod(tokens[3]));
450 const double waferY(std::stod(tokens[4]));
451 const int waferRotCode(std::stoi(tokens[5]));
452 const int waferU(std::stoi(tokens[6]));
453 const int waferV(std::stoi(tokens[7]));
454 const int waferShapeCode(isNewFile ? (waferDensityStr ==
"l" ?
waferShapeMapLD.at(waferShapeStr)
479 if (fabs(-waferInfo.
x - waferX) > 0.015) {
484 if (fabs(waferInfo.
y - waferY) > 0.015) {
492 <<
" != " << waferDensityStr << waferShapeCode <<
" ) name=" << waferInfo.
waferName;
498 <<
" != " << waferRotCode <<
" (" << waferShapeCode
507 if (!accounted.second) {
528 if (nMissing > 0 || nThicknessError > 0 || nPosXError > 0 || nPosYError > 0 || nShapeError > 0 || nRotError > 0 ||
550 edm::FileInPath(
"Validation/HGCalValidation/data/geomnew_corrected_360.txt"));
551 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)
#define DEFINE_FWK_MODULE(type)
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 > layer
const WaferShapeMap waferShapeMapLD
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)
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_
~HGCalWaferValidation() override
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