File indexing completed on 2024-05-04 04:04:31
0001 #include "Geometry/HGCalMapping/interface/HGCalMappingTools.h"
0002 #include "FWCore/ParameterSet/interface/FileInPath.h"
0003 #include <iostream>
0004 #include <algorithm>
0005 #include <iterator>
0006
0007 int main(int argc, char *argv[]) {
0008 if (argc < 2) {
0009 std::cout << "Need a mapping file as argument!" << std::endl;
0010 return -1;
0011 }
0012
0013
0014 hgcal::mappingtools::HGCalEntityList map;
0015 edm::FileInPath fip(argv[1]);
0016 std::string url(fip.fullPath());
0017 map.buildFrom(url);
0018
0019
0020 auto cols = map.getColumnNames();
0021 auto entities = map.getEntries();
0022 std::cout << "Read " << entities.size() << " entities from " << url << std::endl << "Columns available are {";
0023 std::copy(cols.begin(), cols.end(), std::ostream_iterator<std::string>(std::cout, ","));
0024 std::cout << "}" << std::endl;
0025
0026
0027 for (auto r : entities) {
0028 for (auto c : cols)
0029 std::cout << map.getAttr(c, r) << " ";
0030 std::cout << std::endl;
0031 }
0032
0033 return 0;
0034 }