diff --git a/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc b/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc index 3f9bf2f300d0..ab0ec22a93c9 100644 --- a/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc +++ b/RecoLocalTracker/SiPixelDigiReProducers/plugins/SiPixelDigiMorphing.cc @@ -17,11 +17,9 @@ #include #include - -typedef std::pair range; +typedef std::pair range; typedef std::vector region; - class SiPixelDigiMorphing : public edm::stream::EDProducer<> { public: explicit SiPixelDigiMorphing(const edm::ParameterSet& conf); @@ -55,8 +53,10 @@ private: void morph(uint64_t* const imap, uint64_t* omap, uint64_t* const kernel, MorphOption op) const; std::vector parseRegions(const std::vector& regionStrings, size_t size); - bool skipDetId(const TrackerTopology* tTopo, const DetId& detId, - const std::vector& theBarrelRegions, const std::vector& theEndcapRegions) const; + bool skipDetId(const TrackerTopology* tTopo, + const DetId& detId, + const std::vector& theBarrelRegions, + const std::vector& theEndcapRegions) const; }; SiPixelDigiMorphing::SiPixelDigiMorphing(edm::ParameterSet const& conf) @@ -113,7 +113,7 @@ void SiPixelDigiMorphing::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("src", edm::InputTag("siPixelDigis")); // LAYER,LADDER,MODULE (coordinates can also be specified as a range FIRST-LAST where appropriate) - desc.add>("barrelRegions", {"1,1-12,1-2","1,1-12,7-8","2,1-28,1","1,1-28,8"}); + desc.add>("barrelRegions", {"1,1-12,1-2", "1,1-12,7-8", "2,1-28,1", "1,1-28,8"}); // DISK,BLADE,SIDE,PANEL (coordinates can also be specified as a range FIRST-LAST where appropriate) desc.add>("endcapRegions", {}); desc.add("nrows", 160); @@ -148,7 +148,7 @@ void SiPixelDigiMorphing::produce(edm::Event& e, const edm::EventSetup& es) { const DetId detId(rawId); // skip DetIds for which digi morphing has not been requested - if ( skipDetId(tTopo, detId, theBarrelRegions_, theEndcapRegions_) ) { + if (skipDetId(tTopo, detId, theBarrelRegions_, theEndcapRegions_)) { outputDigis->insert(ds); continue; } @@ -240,7 +240,6 @@ void SiPixelDigiMorphing::morph(uint64_t* const imap, uint64_t* omap, uint64_t* } std::vector SiPixelDigiMorphing::parseRegions(const std::vector& regionStrings, size_t size) { - std::vector regions; for (auto const& str : regionStrings) { @@ -249,32 +248,28 @@ std::vector SiPixelDigiMorphing::parseRegions(const std::vector ranges; boost::split(ranges, str, boost::is_any_of(",")); - if (ranges.size()!=size) { + if (ranges.size() != size) { throw cms::Exception("Configuration") << "[SiPixelDigiMorphing]:" - << " invalid number of coordinates provided in " - << str - << " (" << size << " expected, " - << ranges.size() << " provided)\n"; + << " invalid number of coordinates provided in " << str << " (" << size + << " expected, " << ranges.size() << " provided)\n"; } for (auto const& r : ranges) { - std::vector limits; - boost::split(limits, r, boost::is_any_of("-")); + std::vector limits; + boost::split(limits, r, boost::is_any_of("-")); - try { - // if range specified - if (limits.size()>1) { - reg.push_back(std::make_pair(std::stoi(limits.at(0)),std::stoi(limits.at(1)))); + try { + // if range specified + if (limits.size() > 1) { + reg.push_back(std::make_pair(std::stoi(limits.at(0)), std::stoi(limits.at(1)))); // otherwise store single value as a range - } else { - reg.push_back(std::make_pair(std::stoi(limits.at(0)),std::stoi(limits.at(0)))); - } - } catch (...) { - throw cms::Exception("Configuration") << "[SiPixelDigiMorphing]:" - << " invalid coordinate value provided in " - << str - << "\n"; + } else { + reg.push_back(std::make_pair(std::stoi(limits.at(0)), std::stoi(limits.at(0)))); } + } catch (...) { + throw cms::Exception("Configuration") << "[SiPixelDigiMorphing]:" + << " invalid coordinate value provided in " << str << "\n"; + } } regions.push_back(reg); } @@ -283,8 +278,10 @@ std::vector SiPixelDigiMorphing::parseRegions(const std::vector& theBarrelRegions, const std::vector& theEndcapRegions) const { +bool SiPixelDigiMorphing::skipDetId(const TrackerTopology* tTopo, + const DetId& detId, + const std::vector& theBarrelRegions, + const std::vector& theEndcapRegions) const { // barrel if (detId.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) { // no barrel region specified @@ -298,9 +295,9 @@ bool SiPixelDigiMorphing::skipDetId(const TrackerTopology* tTopo, const DetId& d bool inRegion = false; for (auto const& reg : theBarrelRegions) { - if ((layer >= reg.at(0).first && layer <= reg.at(0).second) - && (ladder >= reg.at(1).first && ladder <= reg.at(1).second) - && (module >= reg.at(2).first && module <= reg.at(2).second)) { + if ((layer >= reg.at(0).first && layer <= reg.at(0).second) && + (ladder >= reg.at(1).first && ladder <= reg.at(1).second) && + (module >= reg.at(2).first && module <= reg.at(2).second)) { inRegion = true; break; } @@ -308,7 +305,7 @@ bool SiPixelDigiMorphing::skipDetId(const TrackerTopology* tTopo, const DetId& d return !inRegion; } - // endcap + // endcap } else { // no endcap region specified if (theEndcapRegions.empty()) { @@ -322,10 +319,10 @@ bool SiPixelDigiMorphing::skipDetId(const TrackerTopology* tTopo, const DetId& d bool inRegion = false; for (auto const& reg : theEndcapRegions) { - if ((disk >= reg.at(0).first && disk <= reg.at(0).second) - && (blade >= reg.at(1).first && blade <= reg.at(1).second) - && (side >= reg.at(2).first && side <= reg.at(2).second) - && (panel >= reg.at(3).first && panel <= reg.at(3).second)) { + if ((disk >= reg.at(0).first && disk <= reg.at(0).second) && + (blade >= reg.at(1).first && blade <= reg.at(1).second) && + (side >= reg.at(2).first && side <= reg.at(2).second) && + (panel >= reg.at(3).first && panel <= reg.at(3).second)) { inRegion = true; break; }