CMS 3D CMS Logo

SiStripPopConNoisesDQM.cc
Go to the documentation of this file.
10 public:
13 
16  // interface methods: implemented in template
17  void dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGetter& getter) override;
18  SiStripNoises* getObj() const override;
19 
20 private:
24 };
25 
28 
32  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))},
33  MEDir_{iConfig.getUntrackedParameter<std::string>("ME_DIR", "DQMData")} {
34  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::SiStripNoisesDQMService]";
35 }
36 
38  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::~SiStripNoisesDQMService]";
39 }
40 
42  std::cout << "SiStripNoisesDQMService::readNoises" << std::endl;
43 
44  m_obj = SiStripNoises();
45 
47 
48  // getter.cd(iConfig_.getUntrackedParameter<std::string>("ME_DIR"));
49  getter.cd();
50 
51  uint32_t stripsPerApv = 128;
52 
53  // Get the full list of monitoring elements
54  // const std::vector<MonitorElement*>& MEs = getter.getAllContents(iConfig_.getUntrackedParameter<std::string>("ME_DIR","DQMData"));
55 
56  // Take a copy of the vector
57  std::vector<MonitorElement*> MEs = getter.getAllContents(MEDir_);
58  // Remove all but the MEs we are using
59  MEs.erase(std::remove_if(MEs.begin(),
60  MEs.end(),
61  [](const MonitorElement* ME) -> bool {
62  return std::string::npos == ME->getName().find("CMSubNoisePerStrip__det__");
63  }),
64  MEs.end());
65 
66  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
67  for (const auto& detInfo : reader.getAllData()) {
68  SiStripNoises::InputVector theSiStripVector;
69 
70  // Take the path for each DetId and build the complete path + histogram name
71 
72  // MonitorElement * mE = getModuleHistogram(detInfo.first, "PedsPerStrip");
73  const MonitorElement* mE{nullptr};
74  std::string MEname("CMSubNoisePerStrip__det__" + std::to_string(detInfo.first));
75  for (const MonitorElement* ime : MEs) {
76  if (ime->getName() == MEname) {
77  mE = ime;
78  break;
79  }
80  }
81 
82  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+std::to_string(detInfo.first), findMEbyName() );
83  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+std::to_string(detInfo.first)) ));
84  if (mE) {
85  TH1F* histo = mE->getTH1F();
86  if (histo != nullptr) {
87  // Read the noise from the histograms
88  uint32_t nBinsX = histo->GetXaxis()->GetNbins();
89 
90  if (nBinsX != stripsPerApv * (detInfo.second.nApvs)) {
91  std::cout << "ERROR: number of bin = " << nBinsX
92  << " != number of strips = " << stripsPerApv * (detInfo.second.nApvs) << std::endl;
93  }
94 
95  // std::cout << "Bin 0 = " << histo->GetBinContent(0) << std::endl;
96  // TH1 bins start from 1, 0 is the underflow, nBinsX+1 the overflow.
97  for (uint32_t iBin = 1; iBin <= nBinsX; ++iBin) {
98  // encode the pedestal value and put it in the vector (push_back)
99  m_obj.setData(histo->GetBinContent(iBin), theSiStripVector);
100  }
101  } else {
102  std::cout << "ERROR: histo = " << histo << std::endl;
103  }
104  } else {
105  std::cout << "ERROR: ME = " << mE << std::endl;
106  }
107  // If the ME was absent fill the vector with 50 (we want a high noise to avoid these modules being considered good by mistake)
108  if (theSiStripVector.empty()) {
109  for (unsigned short j = 0; j < 128 * detInfo.second.nApvs; ++j) {
110  m_obj.setData(50, theSiStripVector);
111  }
112  }
113 
114  if (!m_obj.put(detInfo.first, theSiStripVector))
115  edm::LogError("SiStripNoisesFakeESSource::produce ") << " detid already exists" << std::endl;
116  }
117  getter.cd();
118 }
119 
121 
SiStripNoises
Definition: SiStripNoises.h:25
SiStripNoises::put
bool put(const uint32_t &detID, const InputVector &input)
Definition: SiStripNoises.cc:16
SiStripDQMPopConSourceHandler
Definition: SiStripDQMPopConSourceHandler.h:18
SiStripPopConDQMEDHarvester.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
SiStripPopConNoisesHandlerFromDQM::m_obj
SiStripNoises m_obj
Definition: SiStripPopConNoisesDQM.cc:23
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripNoises.h
SiStripPopConNoisesHandlerFromDQM::getObj
SiStripNoises * getObj() const override
Definition: SiStripPopConNoisesDQM.cc:120
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
dqm::implementation::IGetter::getAllContents
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:609
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
edm::FileInPath
Definition: FileInPath.h:64
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
DQM.reader
reader
Definition: DQM.py:105
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SiStripPopConNoisesHandlerFromDQM::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripPopConNoisesDQM.cc:12
SiStripDetInfoFileReader.h
SiStripNoises::setData
void setData(float noise_, InputVector &vped)
Definition: SiStripNoises.cc:74
SiStripPopConNoisesHandlerFromDQM
Definition: SiStripPopConNoisesDQM.cc:9
SiStripPopConNoisesHandlerFromDQM::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripPopConNoisesDQM.cc:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
ME
dqm::harvesting::MonitorElement ME
Definition: TrackingDQMClientHeavyIons.cc:20
SiStripPopConNoisesHandlerFromDQM::MEDir_
std::string MEDir_
Definition: SiStripPopConNoisesDQM.cc:22
EcalMEFormatter_cfi.MEs
MEs
Definition: EcalMEFormatter_cfi.py:25
dqm::implementation::IGetter
Definition: DQMStore.h:484
ME
Definition: ME.h:11
SiStripPopConDQMEDHarvester
Definition: SiStripPopConDQMEDHarvester.h:15
SiStripPopConNoisesHandlerFromDQM::SiStripPopConNoisesHandlerFromDQM
SiStripPopConNoisesHandlerFromDQM(const edm::ParameterSet &iConfig)
Definition: SiStripPopConNoisesDQM.cc:29
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiStripPopConNoisesHandlerFromDQM::dqmEndJob
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
Definition: SiStripPopConNoisesDQM.cc:41
SiStripNoises::InputVector
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SiStripPopConNoisesHandlerFromDQM::~SiStripPopConNoisesHandlerFromDQM
~SiStripPopConNoisesHandlerFromDQM() override
Definition: SiStripPopConNoisesDQM.cc:37
edm::Log
Definition: MessageLogger.h:70
SiStripDQMPopConSourceHandler.h
SiStripPopConNoisesHandlerFromDQM::fp_
edm::FileInPath fp_
Definition: SiStripPopConNoisesDQM.cc:21
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163