Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-01 23:53:47

0001 // -*- C++ -*-
0002 //
0003 // Package:    CondTools/SiStrip
0004 // Class:      SiStripNoiseVisualizer
0005 //
0006 /**\class SiStripNoiseVisualizer SiStripNoiseVisualizer.cc
0007  CondTools/SiStrip/plugins/SiStripNoiseVisualizer.cc
0008 
0009  Description:
0010     Creates a ROOT file with per-module profiles of Noise and Pedestals vs strip
0011  number
0012 
0013 */
0014 //
0015 // Original Author:  Marco Musich
0016 //         Created:  Thu, 05 Apr 2018 15:32:25 GMT
0017 //
0018 //
0019 
0020 // system include files
0021 #include <map>
0022 #include <memory>
0023 #include <string>
0024 #include <unordered_map>
0025 #include <vector>
0026 
0027 // user include files
0028 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0029 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0030 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
0031 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0032 #include "CommonTools/UtilAlgos/interface/DetIdSelector.h"
0033 #include "CondFormats/DataRecord/interface/SiStripApvGainRcd.h"
0034 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0035 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0036 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
0037 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0038 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0039 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0040 #include "DataFormats/Common/interface/DetSetNew.h"
0041 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0042 #include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h" /* for STRIPS_PER_APV*/
0043 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0044 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0045 #include "FWCore/Framework/interface/Event.h"
0046 #include "FWCore/Framework/interface/EventSetup.h"
0047 #include "FWCore/Framework/interface/Frameworkfwd.h"
0048 #include "FWCore/Framework/interface/MakerMacros.h"
0049 #include "FWCore/Framework/interface/Run.h"
0050 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0051 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0052 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0053 #include "FWCore/ServiceRegistry/interface/Service.h"
0054 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0055 #define LOGERROR(x) edm::LogError(x)
0056 #define LOGWARNING(x) edm::LogWarning(x)
0057 #define LOGINFO(x) edm::LogInfo(x)
0058 #define LOGVERBATIM(x) edm::LogVerbatim(x)
0059 #define LOGDEBUG(x) LogDebug(x)
0060 
0061 // ROOT includes
0062 #include "TNamed.h"
0063 #include "TObjString.h"
0064 #include "TText.h"
0065 #include "TTree.h"
0066 
0067 //
0068 // Auxiliary enum to enumerate the conditions types
0069 //
0070 namespace SiStripCondTypes {
0071   enum condformat { Noise = 0, Pedestals = 1, G1Gain = 2, G2Gain = 3, Quality = 4, EndOfTypes = 99 };
0072   static const std::array<std::string, 5> titles = {{"noise", "pedestals", "G1 gain", "G2 gain", "Quality"}};
0073   static const std::array<std::string, 5> units = {{"[ADC counts]", "[ADC counts]", "", "", ""}};
0074 
0075   // some magic from https://stackoverflow.com/questions/47801709/best-way-to-set-a-bitset-with-boolean-values
0076   template <typename... Args>
0077   std::bitset<sizeof...(Args)> makeBitSet(Args... as) {
0078     using unused = bool[];
0079     std::bitset<sizeof...(Args)> ret;
0080     std::size_t ui{ret.size()};
0081     (void)unused{true, (ret.set(--ui, as), true)...};
0082     return ret;
0083   }
0084 
0085 }  // namespace SiStripCondTypes
0086 
0087 //
0088 // class declaration
0089 //
0090 
0091 using HistoMap = std::map<uint32_t, TH1F*>;
0092 
0093 class SiStripCondVisualizer : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchRuns> {
0094 public:
0095   explicit SiStripCondVisualizer(const edm::ParameterSet&);
0096   ~SiStripCondVisualizer() override = default;
0097 
0098   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0099 
0100 private:
0101   void beginRun(edm::Run const&, edm::EventSetup const&) override;
0102   void endRun(edm::Run const&, edm::EventSetup const&) override{};
0103   bool isDetIdSelected(const uint32_t detid);
0104   HistoMap bookModuleHistograms(const TrackerTopology* tTopo, const SiStripCondTypes::condformat& type);
0105   std::tuple<std::string, int, int, int> setTopoInfo(uint32_t detId, const TrackerTopology* tTopo);
0106   std::string module_location_type(const unsigned int& mod);
0107   void fillTheQualityMap(const SiStripQuality* obj, HistoMap& theMap);
0108   template <class Payload>
0109   void fillTheHistoMap(const Payload* obj, HistoMap& theMap);
0110   void analyze(const edm::Event&, const edm::EventSetup&) override;
0111 
0112   // ----------member data ---------------------------
0113   edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_;
0114   edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> pedToken_;
0115   edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> g1Token_;
0116   edm::ESGetToken<SiStripApvGain, SiStripApvGain2Rcd> g2Token_;
0117   edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualToken_;
0118   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0119 
0120   const bool doNoise_;
0121   const bool doPeds_;
0122   const bool doG1_;
0123   const bool doG2_;
0124   const bool doBadComps_;
0125 
0126   std::vector<DetIdSelector> detidsels_;
0127   edm::Service<TFileService> fs_;
0128   SiStripDetInfo detInfo_;
0129   std::map<std::string, TFileDirectory> outputFolders_;
0130   HistoMap NoiseMap_, PedMap_, G1Map_, G2Map_, QualMap_;
0131   std::bitset<5> plottedConditions_;
0132 };
0133 
0134 //
0135 // constructors and destructor
0136 //
0137 SiStripCondVisualizer::SiStripCondVisualizer(const edm::ParameterSet& iConfig)
0138     : topoToken_(esConsumes<edm::Transition::BeginRun>()),
0139       doNoise_(iConfig.getParameter<bool>("doNoise")),
0140       doPeds_(iConfig.getParameter<bool>("doPeds")),
0141       doG1_(iConfig.getParameter<bool>("doG1")),
0142       doG2_(iConfig.getParameter<bool>("doG2")),
0143       doBadComps_(iConfig.getParameter<bool>("doBadComps")),
0144       detidsels_() {
0145   usesResource(TFileService::kSharedResource);
0146   // now do what ever initialization is needed
0147   detInfo_ = SiStripDetInfoFileReader::read(edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile).fullPath());
0148 
0149   plottedConditions_ = SiStripCondTypes::makeBitSet(doNoise_, doPeds_, doG1_, doG2_, doBadComps_);
0150 
0151   // now do the consumes
0152   if (doNoise_)
0153     noiseToken_ = esConsumes();
0154   if (doPeds_)
0155     pedToken_ = esConsumes();
0156   if (doG1_)
0157     g1Token_ = esConsumes();
0158   if (doG2_)
0159     g2Token_ = esConsumes();
0160   if (doBadComps_)
0161     qualToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("StripQualityLabel")));
0162 
0163   // detid selection
0164   std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet>>("selections");
0165   for (std::vector<edm::ParameterSet>::const_iterator selconfig = selconfigs.begin(); selconfig != selconfigs.end();
0166        ++selconfig) {
0167     DetIdSelector selection(*selconfig);
0168     detidsels_.push_back(selection);
0169   }
0170 }
0171 
0172 //
0173 // member functions
0174 //
0175 
0176 /*
0177  * special case for the SiStripQuality
0178  */
0179 void SiStripCondVisualizer::fillTheQualityMap(const SiStripQuality* obj, HistoMap& theMap) {
0180   const auto& badComponentsList = obj->getBadComponentList();
0181 
0182   for (const auto& bc : badComponentsList) {
0183     LogDebug("SiStripCondVisualizer") << "Det:" << bc.detid << " location: " << this->module_location_type(bc.detid)
0184                                       << " bad APVs:" << bc.BadApvs << " bad Fibers:" << bc.BadFibers
0185                                       << " bad Module:" << bc.BadModule;
0186   }
0187 
0188   // now get the detids
0189   std::vector<uint32_t> activeDetIds;
0190   std::transform(badComponentsList.begin(),
0191                  badComponentsList.end(),
0192                  std::back_inserter(activeDetIds),
0193                  [](const SiStripQuality::BadComponent& bc) { return bc.detid; });
0194 
0195   for (const uint32_t& detid : activeDetIds) {
0196     if (!this->isDetIdSelected(detid))
0197       continue;
0198 
0199     unsigned int nStrip = detInfo_.getNumberOfApvsAndStripLength(detid).first * sistrip::STRIPS_PER_APV;
0200 
0201     for (unsigned int istrip_ = 0; istrip_ < nStrip; ++istrip_) {
0202       bool isStripBad = obj->IsStripBad(detid, istrip_);
0203       float quant_ = isStripBad ? 1.f : 0.f;
0204       if (!theMap.count(detid)) {
0205         LOGWARNING("SiStripCondVisualizer")
0206             << "@SUB=SiStripCondVisualizer::analyze(): " << detid << " was not found in the quality histogram map!!!";
0207       } else {
0208         theMap[detid]->SetBinContent(istrip_, quant_);
0209       }
0210     }  // loop on the strips
0211   }    // loop on the active detids
0212   return;
0213 }
0214 
0215 /*
0216  * Payload functor based method for all the other cases
0217  */
0218 template <class Payload>
0219 void SiStripCondVisualizer::fillTheHistoMap(const Payload* obj, HistoMap& theMap) {
0220   std::function<float(unsigned int, typename Payload::Range)> payloadFunctor = [&obj](unsigned int istrip,
0221                                                                                       typename Payload::Range range) {
0222     if constexpr (std::is_same_v<Payload, SiStripNoises>) {
0223       return obj->getNoise(istrip, range);
0224     } else if constexpr (std::is_same_v<Payload, SiStripPedestals>) {
0225       return obj->getPed(istrip, range);
0226     } else if constexpr (std::is_same_v<Payload, SiStripApvGain>) {
0227       return obj->getStripGain(istrip, range);
0228     }
0229   };
0230 
0231   std::vector<uint32_t> activeDetIds;
0232   obj->getDetIds(activeDetIds);
0233 
0234   for (const uint32_t& detid : activeDetIds) {
0235     if (!this->isDetIdSelected(detid))
0236       continue;
0237 
0238     typename Payload::Range condRange = obj->getRange(detid);
0239     unsigned int nStrip = detInfo_.getNumberOfApvsAndStripLength(detid).first * sistrip::STRIPS_PER_APV;
0240 
0241     for (unsigned int istrip_ = 0; istrip_ < nStrip; ++istrip_) {
0242       float quant_ = payloadFunctor(istrip_, condRange);
0243 
0244       if (!theMap.count(detid)) {
0245         LOGWARNING("SiStripCondVisualizer")
0246             << "@SUB=SiStripCondVisualizer::analyze(): " << detid << " was not found in the histogram map!!!";
0247       } else {
0248         theMap[detid]->SetBinContent(istrip_, quant_);
0249       }
0250     }  // loop on the strips
0251   }    // loop on the active detids
0252 }
0253 
0254 // ------------ method called for each event  ------------
0255 void SiStripCondVisualizer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0256   using namespace edm;
0257 
0258   if (doNoise_) {
0259     const SiStripNoises* noiseObj = &iSetup.getData(noiseToken_);
0260     this->fillTheHistoMap<SiStripNoises>(noiseObj, NoiseMap_);
0261   }
0262   if (doPeds_) {
0263     const SiStripPedestals* pedestalObj = &iSetup.getData(pedToken_);
0264     this->fillTheHistoMap<SiStripPedestals>(pedestalObj, PedMap_);
0265   }
0266   if (doG1_) {
0267     const SiStripApvGain* g1Obj = &iSetup.getData(g1Token_);
0268     this->fillTheHistoMap<SiStripApvGain>(g1Obj, G1Map_);
0269   }
0270   if (doG2_) {
0271     const SiStripApvGain* g2Obj = &iSetup.getData(g2Token_);
0272     this->fillTheHistoMap<SiStripApvGain>(g2Obj, G2Map_);
0273   }
0274   if (doBadComps_) { /* special case for the SiStripQuality */
0275     const SiStripQuality* siStripQualityObj = &iSetup.getData(qualToken_);
0276     this->fillTheQualityMap(siStripQualityObj, QualMap_);
0277   }
0278 }
0279 
0280 // ------------ method called for each run  ------------
0281 void SiStripCondVisualizer::beginRun(const edm::Run& iRun, edm::EventSetup const& iSetup) {
0282   const TrackerTopology* tTopo_ = &iSetup.getData(topoToken_);
0283   const std::map<uint32_t, SiStripDetInfo::DetInfo> DetInfos = detInfo_.getAllData();
0284 
0285   for (const auto& it : DetInfos) {
0286     LogDebug("SiStripCondVisualizer") << "detid " << it.first << "isSelected  " << this->isDetIdSelected(it.first);
0287 
0288     if (!this->isDetIdSelected(it.first))
0289       continue;
0290 
0291     auto topolInfo = setTopoInfo(it.first, tTopo_);
0292     std::string thePart = std::get<0>(topolInfo);
0293 
0294     for (std::size_t i = 0; i < plottedConditions_.size(); ++i) {
0295       if (plottedConditions_.test(i)) {
0296         const std::string fname = Form("%s_%s", SiStripCondTypes::titles[i].c_str(), thePart.c_str());
0297 
0298         // book the TFileDirectory if it's not already done
0299         if (!outputFolders_.count(fname)) {
0300           outputFolders_[fname] = fs_->mkdir(fname);
0301         }
0302       }
0303     }  // loop on the bitset of plotted conditions
0304   }    // loop on modules
0305 
0306   if (doNoise_) {
0307     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n Before booking NoisMap_.size(): "
0308                                      << NoiseMap_.size();
0309     NoiseMap_ = bookModuleHistograms(tTopo_, SiStripCondTypes::Noise);
0310     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n After booking NoisMap_.size(): "
0311                                      << NoiseMap_.size();
0312   }
0313   if (doPeds_) {
0314     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n Before booking PedMap_.size(): "
0315                                      << PedMap_.size();
0316     PedMap_ = bookModuleHistograms(tTopo_, SiStripCondTypes::Pedestals);
0317     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n After booking PedMap_.size(): "
0318                                      << PedMap_.size();
0319   }
0320   if (doG1_) {
0321     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n Before booking G1Map_.size(): "
0322                                      << G1Map_.size();
0323     G1Map_ = bookModuleHistograms(tTopo_, SiStripCondTypes::G1Gain);
0324     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n After booking G1Map_.size(): "
0325                                      << G1Map_.size();
0326   }
0327   if (doG2_) {
0328     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n Before booking G2Map_.size(): "
0329                                      << G2Map_.size();
0330     G2Map_ = bookModuleHistograms(tTopo_, SiStripCondTypes::G2Gain);
0331     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n After booking G2Map_.size(): "
0332                                      << G2Map_.size();
0333   }
0334   if (doBadComps_) {
0335     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n Before booking QualMap_.size(): "
0336                                      << QualMap_.size();
0337     QualMap_ = bookModuleHistograms(tTopo_, SiStripCondTypes::Quality);
0338     LOGINFO("SiStripCondVisualizer") << "@SUB=SiStripCondVisualizer::beginRun() \n After booking QualMap_.size(): "
0339                                      << QualMap_.size();
0340   }
0341 }
0342 
0343 // ------------ method called to determine the topology  ------------
0344 std::tuple<std::string, int, int, int> SiStripCondVisualizer::setTopoInfo(uint32_t detId,
0345                                                                           const TrackerTopology* tTopo) {
0346   int subdetId_(-999), layer_(-999), side_(-999);
0347   std::string ret = "";
0348   std::tuple<std::string, int, int, int> def_tuple{ret, subdetId_, layer_, side_};
0349 
0350   subdetId_ = DetId(detId).subdetId();
0351   switch (subdetId_) {
0352     case SiStripSubdetector::TIB:  // TIB
0353       layer_ = tTopo->tibLayer(detId);
0354       side_ = 0;
0355       ret += Form("TIB_Layer%i", layer_);
0356       break;
0357     case SiStripSubdetector::TID:  // TID
0358       side_ = tTopo->tidSide(detId);
0359       layer_ = tTopo->tidWheel(detId);
0360       ret += ("TID_");
0361       ret += (side_ == 1) ? Form("P_disk%i", layer_) : Form("M_disk%i", layer_);
0362       break;
0363     case SiStripSubdetector::TOB:  // TOB
0364       layer_ = tTopo->tobLayer(detId);
0365       side_ = 0;
0366       ret += Form("TOB_Layer%i", layer_);
0367       break;
0368     case SiStripSubdetector::TEC:  // TEC
0369       side_ = tTopo->tecSide(detId);
0370       layer_ = tTopo->tecWheel(detId);
0371       ret += ("TEC_");
0372       ret += (side_ == 1) ? Form("P_disk%i", layer_) : Form("M_disk%i", layer_);
0373       break;
0374     default:
0375       edm::LogError("SiStripCondVisualizer") << "SUB=SiStripCondVisualizer::setTopoInfo() \n unrecognizer partition.";
0376       return def_tuple;
0377   }
0378 
0379   return std::make_tuple(ret, subdetId_, layer_, side_);
0380 }
0381 
0382 // name of the location of a given module and its type,
0383 // e.g. TIB_L1s: stereo module at TIB layer 1
0384 std::string SiStripCondVisualizer::module_location_type(const unsigned int& mod) {
0385   const SiStripDetId detid(mod);
0386   std::string subdet = "";
0387   if (detid.subDetector() == SiStripDetId::TIB)
0388     subdet = "TIB";
0389   if (detid.subDetector() == SiStripDetId::TOB)
0390     subdet = "TOB";
0391   if (detid.subDetector() == SiStripDetId::TID)
0392     subdet = "TID";
0393   if (detid.subDetector() == SiStripDetId::TEC)
0394     subdet = "TEC";
0395 
0396   // Barrel
0397   int layer = int((mod >> 14) & 0x7);
0398   std::string type = (detid.stereo() ? "s" : "a");
0399   std::string d_l_t = Form("%s_L%d%s", subdet.c_str(), layer, type.c_str());
0400 
0401   // Endcaps
0402   if (subdet == "TID" || subdet == "TEC") {
0403     unsigned int sideStartBit_{0};
0404     unsigned int wheelStartBit_{0};
0405     unsigned int ringStartBit_{0};
0406     unsigned int sideMask_{0};
0407     unsigned int wheelMask_{0};
0408     unsigned int ringMask_{0};
0409 
0410     // TEC
0411     if (subdet == "TEC") {
0412       sideStartBit_ = 18;
0413       wheelStartBit_ = 14;
0414       ringStartBit_ = 5;
0415       sideMask_ = 0x3;
0416       wheelMask_ = 0xF;
0417       ringMask_ = 0x7;
0418     }
0419 
0420     // TID
0421     if (subdet == "TID") {
0422       sideStartBit_ = 13;
0423       wheelStartBit_ = 11;
0424       ringStartBit_ = 9;
0425       sideMask_ = 0x3;
0426       wheelMask_ = 0x3;
0427       ringMask_ = 0x3;
0428     }
0429 
0430     // TEC+-, TID+- (see also at the bottom of this file
0431     int side = int((mod >> sideStartBit_) & sideMask_);
0432     int wheel = int((mod >> wheelStartBit_) & wheelMask_);
0433     int ring = int((mod >> ringStartBit_) & ringMask_);
0434 
0435     std::string s_side = (side == 1 ? "Plus" : "Minus");
0436 
0437     d_l_t = Form("%s%s_W%dR%d", subdet.c_str(), s_side.c_str(), wheel, ring);
0438   }
0439   return d_l_t;
0440 }
0441 
0442 // ------------ method called to determine if the detid is selected
0443 bool SiStripCondVisualizer::isDetIdSelected(const uint32_t detid) {
0444   bool isSelected{false};
0445   for (std::vector<DetIdSelector>::const_iterator detidsel = detidsels_.begin(); detidsel != detidsels_.end();
0446        ++detidsel) {
0447     if (detidsel->isSelected(detid)) {
0448       isSelected = true;
0449       break;
0450     }
0451   }
0452   return isSelected;
0453 }
0454 
0455 // ------------ method called once to book all the module level histograms
0456 HistoMap SiStripCondVisualizer::bookModuleHistograms(const TrackerTopology* tTopo_,
0457                                                      const SiStripCondTypes::condformat& type) {
0458   TH1F::SetDefaultSumw2(kTRUE);
0459   HistoMap h;
0460 
0461   const std::map<uint32_t, SiStripDetInfo::DetInfo> DetInfos = detInfo_.getAllData();
0462 
0463   for (const auto& it : DetInfos) {
0464     // check if det id is correct and if it is actually cabled in the detector
0465     if (it.first == 0 || it.first == 0xFFFFFFFF) {
0466       edm::LogError("DetIdNotGood") << "@SUB=analyze"
0467                                     << "Wrong det id: " << it.first << "  ... neglecting!";
0468       continue;
0469     }
0470 
0471     if (!this->isDetIdSelected(it.first))
0472       continue;
0473 
0474     auto topolInfo = setTopoInfo(it.first, tTopo_);
0475     const std::string thePart = std::get<0>(topolInfo);
0476     const std::string fname = Form("%s_%s", SiStripCondTypes::titles[type].c_str(), thePart.c_str());
0477 
0478     unsigned int nStrip = detInfo_.getNumberOfApvsAndStripLength(it.first).first * sistrip::STRIPS_PER_APV;
0479 
0480     h[it.first] =
0481         outputFolders_[fname].make<TH1F>(Form("%sProfile_%i", SiStripCondTypes::titles[type].c_str(), it.first),
0482                                          Form("%s for module %i (%s);n. strip; %s %s",
0483                                               SiStripCondTypes::titles[type].c_str(),
0484                                               it.first,
0485                                               thePart.c_str(),
0486                                               SiStripCondTypes::titles[type].c_str(),
0487                                               SiStripCondTypes::units[type].c_str()),
0488                                          nStrip,
0489                                          -0.5,
0490                                          nStrip + 0.5);
0491   }
0492   return h;
0493 }
0494 
0495 // ------------ method fills 'descriptions' with the allowed parameters for the module
0496 void SiStripCondVisualizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0497   edm::ParameterSetDescription desc;
0498   desc.setComment("Creates a ROOT file with the per-moudle profiles of different SiStrip Database tag contents.");
0499   desc.add<bool>("doNoise", false);
0500   desc.add<bool>("doPeds", false);
0501   desc.add<bool>("doG1", false);
0502   desc.add<bool>("doG2", false);
0503   desc.add<bool>("doBadComps", false);
0504   desc.add<std::string>("StripQualityLabel", "MergedBadComponent");
0505 
0506   // for the DetId selection
0507   edm::ParameterSetDescription desc_detIdSelection;
0508   desc_detIdSelection.add<unsigned int>("detSelection");
0509   desc_detIdSelection.add<std::string>("detLabel");
0510   desc_detIdSelection.addUntracked<std::vector<std::string>>("selection");
0511   std::vector<edm::ParameterSet> default_detIdSelectionVector;
0512   edm::ParameterSet default_detIdSelector;
0513   default_detIdSelector.addParameter<unsigned int>("detSelection", 1);
0514   default_detIdSelector.addParameter<std::string>("detLabel", "Tracker");
0515   default_detIdSelector.addUntrackedParameter<std::vector<std::string>>("selection",
0516                                                                         {"0x1e000000-0x16000000",
0517                                                                          "0x1e006000-0x18002000",
0518                                                                          "0x1e006000-0x18004000",
0519                                                                          "0x1e000000-0x1a000000",
0520                                                                          "0x1e0c0000-0x1c040000",
0521                                                                          "0x1e0c0000-0x1c080000"});
0522   default_detIdSelectionVector.push_back(default_detIdSelector);
0523   desc.addVPSet("selections", desc_detIdSelection, default_detIdSelectionVector);
0524 
0525   descriptions.addWithDefaultLabel(desc);
0526 }
0527 
0528 // define this as a plug-in
0529 DEFINE_FWK_MODULE(SiStripCondVisualizer);