File indexing completed on 2024-09-13 22:52:26
0001 #include "catch.hpp"
0002 #include <iostream>
0003 #include <numeric> // std::accumulate
0004 #include "TCanvas.h"
0005 #include "DQM/TrackerRemapper/interface/SiStripTkMaps.h"
0006 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
0007
0008 TEST_CASE("SiStripTkMaps testing", "[SiStripTkMaps]") {
0009
0010 SECTION("Check SiStrip Tk Maps plotting") {
0011 gStyle->SetOptStat(0);
0012 SiStripTkMaps theMap("COLZA L");
0013 theMap.bookMap("testing SiStripTkMaps", "counts");
0014 const auto detInfo =
0015 SiStripDetInfoFileReader::read(edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile).fullPath());
0016 unsigned int count = 0;
0017 for (const auto& it : detInfo.getAllData()) {
0018 count++;
0019 theMap.fill(it.first, count);
0020 }
0021
0022 const auto filledIds = theMap.getTheFilledIds();
0023 TCanvas c = TCanvas("c", "c");
0024 theMap.drawMap(c, "");
0025 c.SaveAs("SiStripsTkMaps.png");
0026 std::cout << "SiStripTkMaps filled " << filledIds.size() << " DetIds" << std::endl;
0027 REQUIRE(filledIds.size() == count);
0028 }
0029
0030 SECTION("Check empty SiStripTkMaps") {
0031 SiStripTkMaps theMap("COLZA L");
0032 theMap.bookMap("testing SiStripTkMaps", "counts");
0033 TCanvas c = TCanvas("c", "c");
0034 theMap.drawMap(c, "");
0035 c.SaveAs("SiStripsEmptyTkMaps.png");
0036 REQUIRE(true);
0037 }
0038 }