CMS 3D CMS Logo

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

Public Types

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

Public Member Functions

void dqmEndJob (DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
 
SiStripPedestalsgetObj () const override
 
 SiStripPopConPedestalsHandlerFromDQM (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&)
 
 ~SiStripPopConPedestalsHandlerFromDQM () override
 
- Public Member Functions inherited from SiStripDQMPopConSourceHandler< SiStripPedestals >
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< SiStripPedestals >
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_
 
SiStripPedestals m_obj
 
std::string MEDir_
 

Additional Inherited Members

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

Detailed Description

Author
M. De Mattia, S. Dutta, D. Giordano

::PopConSourceHandler to extract pedestal values the DQM as bad and write in the database.

Definition at line 10 of file SiStripPopConPedestalsDQM.cc.

Member Typedef Documentation

◆ DQMStore

Definition at line 13 of file SiStripPopConPedestalsDQM.cc.

◆ MonitorElement

Definition at line 12 of file SiStripPopConPedestalsDQM.cc.

Constructor & Destructor Documentation

◆ SiStripPopConPedestalsHandlerFromDQM()

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

Definition at line 30 of file SiStripPopConPedestalsDQM.cc.

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

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

◆ ~SiStripPopConPedestalsHandlerFromDQM()

SiStripPopConPedestalsHandlerFromDQM::~SiStripPopConPedestalsHandlerFromDQM ( )
override

Definition at line 39 of file SiStripPopConPedestalsDQM.cc.

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

Member Function Documentation

◆ dqmEndJob()

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

Reimplemented from SiStripDQMPopConSourceHandler< SiStripPedestals >.

Definition at line 43 of file SiStripPopConPedestalsDQM.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, SiStripPedestals::put(), SiStripDetInfoFileReader::read(), SiStripPedestals::setData(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

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

◆ getObj()

SiStripPedestals * SiStripPopConPedestalsHandlerFromDQM::getObj ( ) const
overridevirtual

Member Data Documentation

◆ fp_

edm::FileInPath SiStripPopConPedestalsHandlerFromDQM::fp_
private

Definition at line 22 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob().

◆ m_obj

SiStripPedestals SiStripPopConPedestalsHandlerFromDQM::m_obj
private

Definition at line 24 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob(), and getObj().

◆ MEDir_

std::string SiStripPopConPedestalsHandlerFromDQM::MEDir_
private

Definition at line 23 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob().