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::vector< Triplet > Container
 
typedef std::vector< std::pair< SiStripNoises *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< SiStripNoisesself
 
typedef cond::Summary Summary
 
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)
 
 ~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 convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
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 ()
 
void sort ()
 
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 >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< SiStripNoises >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 9 of file SiStripPopConNoisesDQM.cc.

Member Typedef Documentation

Definition at line 12 of file SiStripPopConNoisesDQM.cc.

Definition at line 11 of file SiStripPopConNoisesDQM.cc.

Constructor & Destructor Documentation

SiStripPopConNoisesHandlerFromDQM::SiStripPopConNoisesHandlerFromDQM ( const edm::ParameterSet iConfig)
explicit

Definition at line 29 of file SiStripPopConNoisesDQM.cc.

References edm::ParameterSet::getUntrackedParameter(), MEDir_, and AlCaHLTBitMon_QueryRunRegistry::string.

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 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripPopConNoisesHandlerFromDQM::~SiStripPopConNoisesHandlerFromDQM ( )
override

Definition at line 37 of file SiStripPopConNoisesDQM.cc.

37  {
38  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::~SiStripNoisesDQMService]";
39 }

Member Function Documentation

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

Reimplemented from SiStripDQMPopConSourceHandler< SiStripNoises >.

Definition at line 41 of file SiStripPopConNoisesDQM.cc.

References dqm::dqmstoreimpl::DQMStore::IGetter::cd(), gather_cfg::cout, fp_, edm::FileInPath::fullPath(), dqm::dqmstoreimpl::DQMStore::IGetter::getAllContents(), timingPdfMaker::histo, dqmiolumiharvest::j, m_obj, MEDir_, EcalMEFormatter_cfi::MEs, SiStripNoises::put(), DQM::reader, SiStripNoises::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

41  {
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 }
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
reader
Definition: DQM.py:105
Definition: ME.h:11
bool put(const uint32_t &detID, const InputVector &input)
dqm::harvesting::MonitorElement ME
std::string fullPath() const
Definition: FileInPath.cc:163
void setData(float noise_, InputVector &vped)
SiStripNoises * SiStripPopConNoisesHandlerFromDQM::getObj ( ) const
overridevirtual

Member Data Documentation

edm::FileInPath SiStripPopConNoisesHandlerFromDQM::fp_
private

Definition at line 21 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob().

SiStripNoises SiStripPopConNoisesHandlerFromDQM::m_obj
private

Definition at line 23 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob(), and getObj().

std::string SiStripPopConNoisesHandlerFromDQM::MEDir_
private

Definition at line 22 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob(), and SiStripPopConNoisesHandlerFromDQM().