CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
SiStripPopConNoisesHandlerFromDQM Class Reference
Inheritance diagram for SiStripPopConNoisesHandlerFromDQM:
SiStripDQMPopConSourceHandler< SiStripNoises > popcon::PopConSourceHandler< SiStripNoises >

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from SiStripDQMPopConSourceHandler< SiStripNoises >
typedef dqm::legacy::DQMStore DQMStore
 
- Public Types inherited from popcon::PopConSourceHandler< SiStripNoises >
typedef std::map< Time_t, std::shared_ptr< SiStripNoises > > Container
 
typedef std::unique_ptr< SiStripNoisesRef
 
typedef PopConSourceHandler< SiStripNoisesself
 
typedef cond::Time_t Time_t
 
typedef SiStripNoises value_type
 

Public Member Functions

void dqmEndJob (DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
 
SiStripNoisesgetObj () const override
 
 SiStripPopConNoisesHandlerFromDQM (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&)
 
 ~SiStripPopConNoisesHandlerFromDQM () override
 
- Public Member Functions inherited from SiStripDQMPopConSourceHandler< SiStripNoises >
virtual bool checkForCompatibility (const std::string &otherMetaData) const
 
virtual std::string getMetaDataString () const
 
void getNewObjects () override
 
std::string id () const override
 
virtual void initES (const edm::EventSetup &)
 
 SiStripDQMPopConSourceHandler (const edm::ParameterSet &pset)
 
 ~SiStripDQMPopConSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< SiStripNoises >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Attributes

edm::FileInPath fp_
 
SiStripNoises m_obj
 
std::string MEDir_
 

Additional Inherited Members

- Protected Member Functions inherited from SiStripDQMPopConSourceHandler< SiStripNoises >
uint32_t getRunNumber () const
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< SiStripNoises >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< SiStripNoises >
Container m_iovs
 
std::vector< std::pair< SiStripNoises *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 9 of file SiStripPopConNoisesDQM.cc.

Member Typedef Documentation

◆ DQMStore

Definition at line 12 of file SiStripPopConNoisesDQM.cc.

◆ MonitorElement

Definition at line 11 of file SiStripPopConNoisesDQM.cc.

Constructor & Destructor Documentation

◆ SiStripPopConNoisesHandlerFromDQM()

SiStripPopConNoisesHandlerFromDQM::SiStripPopConNoisesHandlerFromDQM ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&   
)
explicit

Definition at line 29 of file SiStripPopConNoisesDQM.cc.

References edm::ParameterSet::getUntrackedParameter(), and SiStripDetInfoFileReader::kDefaultFile.

34  MEDir_{iConfig.getUntrackedParameter<std::string>("ME_DIR", "DQMData")} {
35  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::SiStripNoisesDQMService]";
36 }
T getUntrackedParameter(std::string const &, T const &) const
Log< level::Info, false > LogInfo
static constexpr char const *const kDefaultFile

◆ ~SiStripPopConNoisesHandlerFromDQM()

SiStripPopConNoisesHandlerFromDQM::~SiStripPopConNoisesHandlerFromDQM ( )
override

Definition at line 38 of file SiStripPopConNoisesDQM.cc.

38  {
39  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::~SiStripNoisesDQMService]";
40 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ dqmEndJob()

void SiStripPopConNoisesHandlerFromDQM::dqmEndJob ( DQMStore::IBooker booker,
DQMStore::IGetter getter 
)
overridevirtual

Reimplemented from SiStripDQMPopConSourceHandler< SiStripNoises >.

Definition at line 42 of file SiStripPopConNoisesDQM.cc.

References dqm::implementation::NavigatorBase::cd(), gather_cfg::cout, fp_, edm::FileInPath::fullPath(), dqm::implementation::IGetter::getAllContents(), timingPdfMaker::histo, dqmiolumiharvest::j, m_obj, MEDir_, EcalMEFormatter_cfi::MEs, SiStripNoises::put(), SiStripDetInfoFileReader::read(), SiStripNoises::setData(), AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

42  {
43  std::cout << "SiStripNoisesDQMService::readNoises" << std::endl;
44 
45  m_obj = SiStripNoises();
46 
47  const auto detInfo = SiStripDetInfoFileReader::read(fp_.fullPath());
48 
49  // getter.cd(iConfig_.getUntrackedParameter<std::string>("ME_DIR"));
50  getter.cd();
51 
52  uint32_t stripsPerApv = 128;
53 
54  // Get the full list of monitoring elements
55  // const std::vector<MonitorElement*>& MEs = getter.getAllContents(iConfig_.getUntrackedParameter<std::string>("ME_DIR","DQMData"));
56 
57  // Take a copy of the vector
58  std::vector<MonitorElement*> MEs = getter.getAllContents(MEDir_);
59  // Remove all but the MEs we are using
60  MEs.erase(std::remove_if(MEs.begin(),
61  MEs.end(),
62  [](const MonitorElement* ME) -> bool {
63  return std::string::npos == ME->getName().find("CMSubNoisePerStrip__det__");
64  }),
65  MEs.end());
66 
67  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
68  for (const auto& detInfo : detInfo.getAllData()) {
69  SiStripNoises::InputVector theSiStripVector;
70 
71  // Take the path for each DetId and build the complete path + histogram name
72 
73  // MonitorElement * mE = getModuleHistogram(detInfo.first, "PedsPerStrip");
74  const MonitorElement* mE{nullptr};
75  std::string MEname("CMSubNoisePerStrip__det__" + std::to_string(detInfo.first));
76  for (const MonitorElement* ime : MEs) {
77  if (ime->getName() == MEname) {
78  mE = ime;
79  break;
80  }
81  }
82 
83  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+std::to_string(detInfo.first), findMEbyName() );
84  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+std::to_string(detInfo.first)) ));
85  if (mE) {
86  TH1F* histo = mE->getTH1F();
87  if (histo != nullptr) {
88  // Read the noise from the histograms
89  uint32_t nBinsX = histo->GetXaxis()->GetNbins();
90 
91  if (nBinsX != stripsPerApv * (detInfo.second.nApvs)) {
92  std::cout << "ERROR: number of bin = " << nBinsX
93  << " != number of strips = " << stripsPerApv * (detInfo.second.nApvs) << std::endl;
94  }
95 
96  // std::cout << "Bin 0 = " << histo->GetBinContent(0) << std::endl;
97  // TH1 bins start from 1, 0 is the underflow, nBinsX+1 the overflow.
98  for (uint32_t iBin = 1; iBin <= nBinsX; ++iBin) {
99  // encode the pedestal value and put it in the vector (push_back)
100  m_obj.setData(histo->GetBinContent(iBin), theSiStripVector);
101  }
102  } else {
103  std::cout << "ERROR: histo = " << histo << std::endl;
104  }
105  } else {
106  std::cout << "ERROR: ME = " << mE << std::endl;
107  }
108  // If the ME was absent fill the vector with 50 (we want a high noise to avoid these modules being considered good by mistake)
109  if (theSiStripVector.empty()) {
110  for (unsigned short j = 0; j < 128 * detInfo.second.nApvs; ++j) {
111  m_obj.setData(50, theSiStripVector);
112  }
113  }
114 
115  if (!m_obj.put(detInfo.first, theSiStripVector))
116  edm::LogError("SiStripNoisesFakeESSource::produce ") << " detid already exists" << std::endl;
117  }
118  getter.cd();
119 }
std::string fullPath() const
Definition: FileInPath.cc:161
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
static std::string to_string(const XMLCh *ch)
Definition: ME.h:11
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:641
SiStripDetInfo read(std::string filePath)
bool put(const uint32_t &detID, const InputVector &input)
Definition: SiStripNoises.cc:9
dqm::harvesting::MonitorElement ME
void setData(float noise_, InputVector &vped)

◆ getObj()

SiStripNoises * SiStripPopConNoisesHandlerFromDQM::getObj ( ) const
overridevirtual

Member Data Documentation

◆ fp_

edm::FileInPath SiStripPopConNoisesHandlerFromDQM::fp_
private

Definition at line 21 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob().

◆ m_obj

SiStripNoises SiStripPopConNoisesHandlerFromDQM::m_obj
private

Definition at line 23 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob(), and getObj().

◆ MEDir_

std::string SiStripPopConNoisesHandlerFromDQM::MEDir_
private

Definition at line 22 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob().