Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-29 02:25:52

0001 #include <array>
0002 #include <iostream>
0003 #include <sstream>
0004 #include <map>
0005 
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "FWCore/Framework/interface/MakerMacros.h"
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0013 
0014 #include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
0015 #include "Geometry/HGCalCommonData/interface/HGCalTileIndex.h"
0016 #include "Geometry/HGCalCommonData/interface/HGCalWaferIndex.h"
0017 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0018 
0019 class HGCalParameterTester : public edm::one::EDAnalyzer<> {
0020 public:
0021   explicit HGCalParameterTester(const edm::ParameterSet&);
0022   ~HGCalParameterTester() override = default;
0023   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0024 
0025   void beginJob() override {}
0026   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0027   void endJob() override {}
0028 
0029 private:
0030   template <typename T>
0031   void myPrint(std::string const& s, std::vector<T> const& obj, int n) const;
0032   template <typename T>
0033   void myPrint(std::string const& s, std::vector<std::pair<T, T> > const& obj, int n) const;
0034   void myPrint(std::string const& s, std::vector<double> const& obj1, std::vector<double> const& obj2, int n) const;
0035   void myPrint(std::string const& s, HGCalParameters::wafer_map const& obj, int n) const;
0036   void printTrform(HGCalParameters const*) const;
0037   void printWaferType(HGCalParameters const* phgp) const;
0038 
0039   const std::string name_;
0040   edm::ESGetToken<HGCalParameters, IdealGeometryRecord> token_;
0041   const int mode_;
0042 };
0043 
0044 HGCalParameterTester::HGCalParameterTester(const edm::ParameterSet& ic)
0045     : name_(ic.getParameter<std::string>("Name")),
0046       token_(esConsumes<HGCalParameters, IdealGeometryRecord>(edm::ESInputTag{"", name_})),
0047       mode_(ic.getParameter<int>("Mode")) {}
0048 
0049 void HGCalParameterTester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0050   edm::ParameterSetDescription desc;
0051   desc.add<std::string>("Name", "HGCalEESensitive");
0052   desc.add<int>("Mode", 1);
0053   descriptions.add("hgcParameterTesterEE", desc);
0054 }
0055 
0056 void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0057   edm::LogVerbatim("HGCalGeomr") << "HGCalParameter::Here I am";
0058   auto start = std::chrono::high_resolution_clock::now();
0059 
0060   const auto& hgp = iSetup.getData(token_);
0061   const auto* phgp = &hgp;
0062 
0063   edm::LogVerbatim("HGCalGeom") << phgp->name_;
0064   if (mode_ == 0) {
0065     // Wafers of 6-inch format
0066     edm::LogVerbatim("HGCalGeom") << "DetectorType: " << phgp->detectorType_;
0067     edm::LogVerbatim("HGCalGeom") << "WaferR_: " << phgp->waferR_;
0068     edm::LogVerbatim("HGCalGeom") << "nCells_: " << phgp->nCells_;
0069     edm::LogVerbatim("HGCalGeom") << "nSectors_: " << phgp->nSectors_;
0070     edm::LogVerbatim("HGCalGeom") << "FirstLayer: " << phgp->firstLayer_;
0071     edm::LogVerbatim("HGCalGeom") << "FirstMixedLayer: " << phgp->firstMixedLayer_;
0072     edm::LogVerbatim("HGCalGeom") << "mode_: " << phgp->mode_;
0073 
0074     myPrint("CellSize", phgp->cellSize_, 10);
0075     myPrint("slopeMin", phgp->slopeMin_, 10);
0076     myPrint("slopeTop", phgp->slopeTop_, 10);
0077     myPrint("zFrontTop", phgp->zFrontTop_, 10);
0078     myPrint("rMaxFront", phgp->rMaxFront_, 10);
0079     myPrint("zRanges", phgp->zRanges_, 10);
0080     myPrint("moduleBlS", phgp->moduleBlS_, 10);
0081     myPrint("moduleTlS", phgp->moduleTlS_, 10);
0082     myPrint("moduleHS", phgp->moduleHS_, 10);
0083     myPrint("moduleDzS", phgp->moduleDzS_, 10);
0084     myPrint("moduleAlphaS", phgp->moduleAlphaS_, 10);
0085     myPrint("moduleCellS", phgp->moduleCellS_, 10);
0086     myPrint("moduleBlR", phgp->moduleBlR_, 10);
0087     myPrint("moduleTlR", phgp->moduleTlR_, 10);
0088     myPrint("moduleHR", phgp->moduleHR_, 10);
0089     myPrint("moduleDzR", phgp->moduleDzR_, 10);
0090     myPrint("moduleAlphaR", phgp->moduleAlphaR_, 10);
0091     myPrint("moduleCellR", phgp->moduleCellR_, 10);
0092     myPrint("trformTranX", phgp->trformTranX_, 10);
0093     myPrint("trformTranY", phgp->trformTranY_, 10);
0094     myPrint("trformTranZ", phgp->trformTranZ_, 10);
0095     myPrint("trformRotXX", phgp->trformRotXX_, 10);
0096     myPrint("trformRotYX", phgp->trformRotYX_, 10);
0097     myPrint("trformRotZX", phgp->trformRotZX_, 10);
0098     myPrint("trformRotXY", phgp->trformRotXY_, 10);
0099     myPrint("trformRotYY", phgp->trformRotYY_, 10);
0100     myPrint("trformRotZY", phgp->trformRotZY_, 10);
0101     myPrint("trformRotXZ", phgp->trformRotXZ_, 10);
0102     myPrint("trformRotYZ", phgp->trformRotYZ_, 10);
0103     myPrint("trformRotZZ", phgp->trformRotZZ_, 10);
0104     myPrint("zLayerHex", phgp->zLayerHex_, 10);
0105     myPrint("rMinLayHex", phgp->rMinLayHex_, 10);
0106     myPrint("rMaxLayHex", phgp->rMaxLayHex_, 10);
0107     myPrint("waferPos", phgp->waferPosX_, phgp->waferPosY_, 4);
0108     myPrint("cellFine", phgp->cellFineX_, phgp->cellFineY_, 4);
0109     myPrint("cellFineHalf", phgp->cellFineHalf_, 10);
0110     myPrint("cellCoarse", phgp->cellCoarseX_, phgp->cellCoarseY_, 4);
0111     myPrint("cellCoarseHalf", phgp->cellCoarseHalf_, 10);
0112     myPrint("boundR", phgp->boundR_, 10);
0113     myPrint("moduleLayS", phgp->moduleLayS_, 10);
0114     myPrint("moduleLayR", phgp->moduleLayR_, 10);
0115     myPrint("layer", phgp->layer_, 18);
0116     myPrint("layerIndex", phgp->layerIndex_, 18);
0117     myPrint("layerGroup", phgp->layerGroup_, 18);
0118     myPrint("cellFactor", phgp->cellFactor_, 10);
0119     myPrint("depth", phgp->depth_, 18);
0120     myPrint("depthIndex", phgp->depthIndex_, 18);
0121     myPrint("depthLayerF", phgp->depthLayerF_, 18);
0122     myPrint("waferCopy", phgp->waferCopy_, 10);
0123     myPrint("waferTypeL", phgp->waferTypeL_, 25);
0124     myPrint("waferTypeT", phgp->waferTypeT_, 25);
0125     myPrint("layerGroupM", phgp->layerGroupM_, 18);
0126     myPrint("layerGroupO", phgp->layerGroupO_, 18);
0127     printTrform(phgp);
0128     myPrint("levelTop", phgp->levelT_, 10);
0129     printWaferType(phgp);
0130 
0131   } else if (mode_ == 1) {
0132     // Wafers of 8-inch format
0133     edm::LogVerbatim("HGCalGeom") << "DetectorType: " << phgp->detectorType_;
0134     edm::LogVerbatim("HGCalGeom") << "UseSimWt: " << phgp->useSimWt_;
0135     edm::LogVerbatim("HGCalGeom") << "Wafer Parameters: " << phgp->waferSize_ << ":" << phgp->waferR_ << ":"
0136                                   << phgp->waferThick_ << ":" << phgp->sensorSeparation_ << ":" << phgp->mouseBite_;
0137     myPrint("waferThickness", phgp->waferThickness_, 10);
0138     edm::LogVerbatim("HGCalGeom") << "nCells_: " << phgp->nCellsFine_ << ":" << phgp->nCellsCoarse_;
0139     edm::LogVerbatim("HGCalGeom") << "nSectors_: " << phgp->nSectors_;
0140     edm::LogVerbatim("HGCalGeom") << "FirstLayer: " << phgp->firstLayer_;
0141     edm::LogVerbatim("HGCalGeom") << "FirstMixedLayer: " << phgp->firstMixedLayer_;
0142     edm::LogVerbatim("HGCalGeom") << "LayerOffset: " << phgp->layerOffset_;
0143     edm::LogVerbatim("HGCalGeom") << "mode_: " << phgp->mode_;
0144     edm::LogVerbatim("HGCalGeom") << "cassettes_: " << phgp->cassettes_;
0145 
0146     myPrint("waferUVMaxLayer", phgp->waferUVMaxLayer_, 20);
0147     myPrint("CellThickness", phgp->cellThickness_, 10);
0148     myPrint("radius100to200", phgp->radius100to200_, 10);
0149     myPrint("radius200to300", phgp->radius200to300_, 10);
0150     edm::LogVerbatim("HGCalGeom") << "choiceType " << phgp->choiceType_ << "   nCornerCut " << phgp->nCornerCut_
0151                                   << "  fracAreaMin " << phgp->fracAreaMin_ << "  zMinForRad " << phgp->zMinForRad_;
0152 
0153     myPrint("CellSize", phgp->cellSize_, 10);
0154     myPrint("radiusMixBoundary", phgp->radiusMixBoundary_, 10);
0155     myPrint("LayerCenter", phgp->layerCenter_, 20);
0156     edm::LogVerbatim("HGCalGeom") << "Layer Rotation " << phgp->layerRotation_ << "   with " << phgp->layerRotV_.size()
0157                                   << "  parameters";
0158     for (unsigned int k = 0; k < phgp->layerRotV_.size(); ++k)
0159       edm::LogVerbatim("HGCalGeom") << "Element[" << k << "] " << phgp->layerRotV_[k].first << ":"
0160                                     << phgp->layerRotV_[k].second;
0161     myPrint("slopeMin", phgp->slopeMin_, 10);
0162     myPrint("zFrontMin", phgp->zFrontMin_, 10);
0163     myPrint("rMinFront", phgp->rMinFront_, 10);
0164     myPrint("slopeTop", phgp->slopeTop_, 10);
0165     myPrint("zFrontTop", phgp->zFrontTop_, 10);
0166     myPrint("rMaxFront", phgp->rMaxFront_, 10);
0167     myPrint("zRanges", phgp->zRanges_, 10);
0168     myPrint("moduleBlS", phgp->moduleBlS_, 10);
0169     myPrint("moduleTlS", phgp->moduleTlS_, 10);
0170     myPrint("moduleHS", phgp->moduleHS_, 10);
0171     myPrint("moduleDzS", phgp->moduleDzS_, 10);
0172     myPrint("moduleAlphaS", phgp->moduleAlphaS_, 10);
0173     myPrint("moduleCellS", phgp->moduleCellS_, 10);
0174     myPrint("moduleBlR", phgp->moduleBlR_, 10);
0175     myPrint("moduleTlR", phgp->moduleTlR_, 10);
0176     myPrint("moduleHR", phgp->moduleHR_, 10);
0177     myPrint("moduleDzR", phgp->moduleDzR_, 10);
0178     myPrint("moduleAlphaR", phgp->moduleAlphaR_, 10);
0179     myPrint("moduleCellR", phgp->moduleCellR_, 10);
0180     myPrint("trformTranX", phgp->trformTranX_, 8);
0181     myPrint("trformTranY", phgp->trformTranY_, 8);
0182     myPrint("trformTranZ", phgp->trformTranZ_, 8);
0183     myPrint("trformRotXX", phgp->trformRotXX_, 10);
0184     myPrint("trformRotYX", phgp->trformRotYX_, 10);
0185     myPrint("trformRotZX", phgp->trformRotZX_, 10);
0186     myPrint("trformRotXY", phgp->trformRotXY_, 10);
0187     myPrint("trformRotYY", phgp->trformRotYY_, 10);
0188     myPrint("trformRotZY", phgp->trformRotZY_, 10);
0189     myPrint("trformRotXZ", phgp->trformRotXZ_, 10);
0190     myPrint("trformRotYZ", phgp->trformRotYZ_, 10);
0191     myPrint("trformRotZZ", phgp->trformRotZZ_, 10);
0192     myPrint("xLayerHex", phgp->xLayerHex_, 8);
0193     myPrint("yLayerHex", phgp->yLayerHex_, 8);
0194     myPrint("zLayerHex", phgp->zLayerHex_, 8);
0195     myPrint("rMinLayHex", phgp->rMinLayHex_, 8);
0196     myPrint("rMaxLayHex", phgp->rMaxLayHex_, 8);
0197     myPrint("waferPos", phgp->waferPosX_, phgp->waferPosY_, 4);
0198     myPrint("cellFineIndex", phgp->cellFineIndex_, 8);
0199     myPrint("cellFine", phgp->cellFineX_, phgp->cellFineY_, 4);
0200     myPrint("cellCoarseIndex", phgp->cellCoarseIndex_, 8);
0201     myPrint("cellCoarse", phgp->cellCoarseX_, phgp->cellCoarseY_, 4);
0202     myPrint("layer", phgp->layer_, 18);
0203     myPrint("layerIndex", phgp->layerIndex_, 18);
0204     myPrint("depth", phgp->depth_, 18);
0205     myPrint("depthIndex", phgp->depthIndex_, 18);
0206     myPrint("depthLayerF", phgp->depthLayerF_, 18);
0207     myPrint("waferCopy", phgp->waferCopy_, 10);
0208     myPrint("waferTypeL", phgp->waferTypeL_, 25);
0209     printTrform(phgp);
0210     myPrint("levelTop", phgp->levelT_, 10);
0211     printWaferType(phgp);
0212     myPrint("cassetteShift", phgp->cassetteShift_, 8);
0213 
0214     edm::LogVerbatim("HGCalGeom") << "MaskMode: " << phgp->waferMaskMode_;
0215     if (phgp->waferMaskMode_ > 1) {
0216       edm::LogVerbatim("HGCalGeom") << "WaferInfo with " << phgp->waferInfoMap_.size() << " elements";
0217       unsigned int kk(0);
0218       std::unordered_map<int32_t, HGCalParameters::waferInfo>::const_iterator itr = phgp->waferInfoMap_.begin();
0219       for (; itr != phgp->waferInfoMap_.end(); ++itr, ++kk)
0220         edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "["
0221                                       << HGCalWaferIndex::waferLayer(itr->first) << ", "
0222                                       << HGCalWaferIndex::waferU(itr->first) << ", "
0223                                       << HGCalWaferIndex::waferV(itr->first) << "] (" << (itr->second).type << ", "
0224                                       << (itr->second).part << ", " << (itr->second).orient << ")";
0225     }
0226   } else {
0227     // Tpaezoid (scintillator) type
0228     edm::LogVerbatim("HGCalGeom") << "DetectorType: " << phgp->detectorType_;
0229     edm::LogVerbatim("HGCalGeom") << "UseSimWt: " << phgp->useSimWt_;
0230     edm::LogVerbatim("HGCalGeom") << "nCells_: " << phgp->nCellsFine_ << ":" << phgp->nCellsCoarse_;
0231     edm::LogVerbatim("HGCalGeom") << "MinTileZize: " << phgp->minTileSize_;
0232     edm::LogVerbatim("HGCalGeom") << "FirstLayer: " << phgp->firstLayer_;
0233     edm::LogVerbatim("HGCalGeom") << "FirstMixedLayer: " << phgp->firstMixedLayer_;
0234     edm::LogVerbatim("HGCalGeom") << "LayerOffset: " << phgp->layerOffset_;
0235     edm::LogVerbatim("HGCalGeom") << "mode_: " << phgp->mode_;
0236     edm::LogVerbatim("HGCalGeom") << "waferUVMax: " << phgp->waferUVMax_;
0237     edm::LogVerbatim("HGCalGeom") << "nSectors_: " << phgp->nSectors_;
0238     edm::LogVerbatim("HGCalGeom") << "nCells_: " << phgp->nCellsFine_ << ":" << phgp->nCellsCoarse_;
0239 
0240     myPrint("CellSize", phgp->cellSize_, 10);
0241     myPrint("radiusMixBoundary", phgp->radiusMixBoundary_, 10);
0242     myPrint("nPhiBinBH", phgp->nPhiBinBH_, 18);
0243     myPrint("layerFrontBH", phgp->layerFrontBH_, 10);
0244     myPrint("LayerCenter", phgp->layerCenter_, 20);
0245     myPrint("rMinLayerBH", phgp->rMinLayerBH_, 10);
0246     myPrint("slopeMin", phgp->slopeMin_, 10);
0247     myPrint("zFrontMin", phgp->zFrontMin_, 10);
0248     myPrint("rMinFront", phgp->rMinFront_, 10);
0249     myPrint("radiusLayer[0]", phgp->radiusLayer_[0], 10);
0250     myPrint("radiusLayer[1]", phgp->radiusLayer_[1], 10);
0251     myPrint("iradMinBH", phgp->iradMinBH_, 20);
0252     myPrint("iradMaxBH", phgp->iradMaxBH_, 20);
0253     myPrint("slopeTop", phgp->slopeTop_, 10);
0254     myPrint("zFrontTop", phgp->zFrontTop_, 10);
0255     myPrint("rMaxFront", phgp->rMaxFront_, 10);
0256     myPrint("zRanges", phgp->zRanges_, 10);
0257     myPrint("firstModule", phgp->firstModule_, 10);
0258     myPrint("lastModule", phgp->lastModule_, 10);
0259     myPrint("moduleBlS", phgp->moduleBlS_, 10);
0260     myPrint("moduleTlS", phgp->moduleTlS_, 10);
0261     myPrint("moduleHS", phgp->moduleHS_, 10);
0262     myPrint("moduleDzS", phgp->moduleDzS_, 10);
0263     myPrint("moduleAlphaS", phgp->moduleAlphaS_, 10);
0264     myPrint("moduleCellS", phgp->moduleCellS_, 10);
0265     myPrint("moduleBlR", phgp->moduleBlR_, 10);
0266     myPrint("moduleTlR", phgp->moduleTlR_, 10);
0267     myPrint("moduleHR", phgp->moduleHR_, 10);
0268     myPrint("moduleDzR", phgp->moduleDzR_, 10);
0269     myPrint("moduleAlphaR", phgp->moduleAlphaR_, 10);
0270     myPrint("moduleCellR", phgp->moduleCellR_, 9);
0271     myPrint("trformTranX", phgp->trformTranY_, 9);
0272     myPrint("trformTranY", phgp->trformTranY_, 9);
0273     myPrint("trformTranZ", phgp->trformTranZ_, 9);
0274     myPrint("trformRotXX", phgp->trformRotXX_, 10);
0275     myPrint("trformRotYX", phgp->trformRotYX_, 10);
0276     myPrint("trformRotZX", phgp->trformRotZX_, 10);
0277     myPrint("trformRotXY", phgp->trformRotXY_, 10);
0278     myPrint("trformRotYY", phgp->trformRotYY_, 10);
0279     myPrint("trformRotZY", phgp->trformRotZY_, 10);
0280     myPrint("trformRotXZ", phgp->trformRotXZ_, 10);
0281     myPrint("trformRotYZ", phgp->trformRotYZ_, 10);
0282     myPrint("trformRotZZ", phgp->trformRotZZ_, 10);
0283     myPrint("xLayerHex", phgp->xLayerHex_, 10);
0284     myPrint("yLayerHex", phgp->yLayerHex_, 10);
0285     myPrint("zLayerHex", phgp->zLayerHex_, 10);
0286     myPrint("rMinLayHex", phgp->rMinLayHex_, 9);
0287     myPrint("rMaxLayHex", phgp->rMaxLayHex_, 9);
0288     myPrint("layer", phgp->layer_, 18);
0289     myPrint("layerIndex", phgp->layerIndex_, 18);
0290     myPrint("depth", phgp->depth_, 18);
0291     myPrint("depthIndex", phgp->depthIndex_, 18);
0292     myPrint("depthLayerF", phgp->depthLayerF_, 18);
0293     printTrform(phgp);
0294     myPrint("levelTop", phgp->levelT_, 10);
0295     printWaferType(phgp);
0296 
0297     edm::LogVerbatim("HGCalGeom") << "MaskMode: " << phgp->waferMaskMode_;
0298     if (phgp->waferMaskMode_ > 1) {
0299       myPrint("tileRingR", phgp->tileRingR_, 4);
0300       myPrint("tileRingRange", phgp->tileRingRange_, 8);
0301       edm::LogVerbatim("HGCalGeom") << "TileInfo with " << phgp->tileInfoMap_.size() << " elements";
0302       unsigned int kk(0);
0303       std::unordered_map<int32_t, HGCalParameters::tileInfo>::const_iterator itr = phgp->tileInfoMap_.begin();
0304       for (; itr != phgp->tileInfoMap_.end(); ++itr, ++kk)
0305         edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "[" << HGCalTileIndex::tileLayer(itr->first)
0306                                       << ", " << HGCalTileIndex::tileRing(itr->first) << ", "
0307                                       << HGCalTileIndex::tilePhi(itr->first) << "] (" << (itr->second).type << ", "
0308                                       << (itr->second).sipm << std::hex << ", " << (itr->second).hex[0] << ", "
0309                                       << (itr->second).hex[1] << ", " << (itr->second).hex[2] << ", "
0310                                       << (itr->second).hex[3] << ")" << std::dec;
0311     }
0312   }
0313 
0314   auto finish = std::chrono::high_resolution_clock::now();
0315   std::chrono::duration<double> elapsed = finish - start;
0316   edm::LogVerbatim("HGCalGeom") << "Elapsed time: " << elapsed.count() << " s";
0317 }
0318 
0319 template <typename T>
0320 void HGCalParameterTester::myPrint(std::string const& s, std::vector<T> const& obj, int n) const {
0321   int k(0), kk(0);
0322   edm::LogVerbatim("HGCalGeom") << s << " with " << obj.size() << " elements with n " << n << ": 1000";
0323   std::ostringstream st1[1000];
0324   for (auto const& it : obj) {
0325     st1[kk] << it << ", ";
0326     ++k;
0327     if (k == n) {
0328       edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0329       ++kk;
0330       k = 0;
0331     }
0332   }
0333   if (k > 0)
0334     edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0335 }
0336 
0337 template <typename T>
0338 void HGCalParameterTester::myPrint(std::string const& s, std::vector<std::pair<T, T> > const& obj, int n) const {
0339   int k(0), kk(0);
0340   edm::LogVerbatim("HGCalGeom") << s << " with " << obj.size() << " elements with n " << n << ":200";
0341   std::ostringstream st1[200];
0342   for (auto const& it : obj) {
0343     st1[kk] << "(" << it.first << ", " << it.second << ") ";
0344     ++k;
0345     if (k == n) {
0346       edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0347       ++kk;
0348       k = 0;
0349     }
0350   }
0351   if (k > 0)
0352     edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0353 }
0354 
0355 void HGCalParameterTester::myPrint(std::string const& s,
0356                                    std::vector<double> const& obj1,
0357                                    std::vector<double> const& obj2,
0358                                    int n) const {
0359   int k(0), kk(0);
0360   std::ostringstream st1[250];
0361   edm::LogVerbatim("HGCalGeom") << s << " with " << obj1.size() << " elements with n " << n << ": 250";
0362   for (unsigned int k1 = 0; k1 < obj1.size(); ++k1) {
0363     st1[kk] << "(" << obj1[k1] << ", " << obj2[k1] << ") ";
0364     ++k;
0365     if (k == n) {
0366       edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0367       ++kk;
0368       k = 0;
0369     }
0370   }
0371   if (k > 0)
0372     edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0373 }
0374 
0375 void HGCalParameterTester::myPrint(std::string const& s, HGCalParameters::wafer_map const& obj, int n) const {
0376   int k(0), kk(0);
0377   std::ostringstream st1[100];
0378   edm::LogVerbatim("HGCalGeom") << s << " with " << obj.size() << " elements with n " << n << ": 100";
0379   for (auto const& it : obj) {
0380     st1[kk] << it.first << ":" << it.second << ", ";
0381     ++k;
0382     if (k == n) {
0383       edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0384       ++kk;
0385       k = 0;
0386     }
0387   }
0388   if (k > 0)
0389     edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0390 }
0391 
0392 void HGCalParameterTester::printTrform(HGCalParameters const* phgp) const {
0393   int k(0), kk(0);
0394   std::ostringstream st1[20];
0395   edm::LogVerbatim("HGCalGeom") << "TrformIndex with " << phgp->trformIndex_.size() << " elements with n 7:20";
0396   for (unsigned int i = 0; i < phgp->trformIndex_.size(); ++i) {
0397     std::array<int, 4> id = phgp->getID(i);
0398     st1[kk] << id[0] << ":" << id[1] << ":" << id[2] << ":" << id[3] << ", ";
0399     ++k;
0400     if (k == 7) {
0401       edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0402       ++kk;
0403       k = 0;
0404     }
0405   }
0406   if (k > 0)
0407     edm::LogVerbatim("HGCalGeom") << st1[kk].str();
0408 }
0409 
0410 void HGCalParameterTester::printWaferType(HGCalParameters const* phgp) const {
0411   int k(0);
0412   edm::LogVerbatim("HGCalGeom") << "waferTypes with " << phgp->waferTypes_.size() << " elements";
0413   std::map<std::pair<int, int>, int> kounts;
0414   std::map<std::pair<int, int>, int>::iterator itr;
0415   for (auto const& it : phgp->waferTypes_) {
0416     std::ostringstream st1;
0417     st1 << " [" << k << "] " << HGCalWaferIndex::waferLayer(it.first);
0418     if (HGCalWaferIndex::waferFormat(it.first)) {
0419       st1 << ":" << HGCalWaferIndex::waferU(it.first) << ":" << HGCalWaferIndex::waferV(it.first);
0420     } else {
0421       st1 << ":" << HGCalWaferIndex::waferCopy(it.first);
0422     }
0423     edm::LogVerbatim("HGCalGeom") << st1.str() << " ==> (" << (it.second).first << ":" << (it.second).second << ")";
0424     itr = kounts.find(it.second);
0425     if (itr == kounts.end())
0426       kounts[it.second] = 1;
0427     else
0428       ++(itr->second);
0429     ++k;
0430   }
0431   if (!kounts.empty()) {
0432     edm::LogVerbatim("HGCalGeom") << "Summary of waferTypes ==========================";
0433     for (itr = kounts.begin(); itr != kounts.end(); ++itr)
0434       edm::LogVerbatim("HGCalGeom") << "Type (" << (itr->first).first << ":" << (itr->first).second << ") Kount "
0435                                     << itr->second;
0436   }
0437 }
0438 
0439 DEFINE_FWK_MODULE(HGCalParameterTester);