CMS 3D CMS Logo

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

Public Member Functions

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

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< SiStripPedestals >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< SiStripPedestals *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< SiStripPedestalsself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef SiStripPedestals value_type
 
- Protected Member Functions inherited from SiStripDQMPopConSourceHandler< SiStripPedestals >
uint32_t getRunNumber () const
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< SiStripPedestals >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< SiStripPedestals >
OldContainer 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.

Constructor & Destructor Documentation

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

Definition at line 27 of file SiStripPopConPedestalsDQM.cc.

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

29  , fp_{iConfig.getUntrackedParameter<edm::FileInPath>("file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))}
30  , MEDir_{iConfig.getUntrackedParameter<std::string>("ME_DIR", "DQMData")}
31 {
32  edm::LogInfo("SiStripPedestalsDQMService") << "[SiStripPedestalsDQMService::SiStripPedestalsDQMService]";
33 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripPopConPedestalsHandlerFromDQM::~SiStripPopConPedestalsHandlerFromDQM ( )
override

Definition at line 35 of file SiStripPopConPedestalsDQM.cc.

36 {
37  edm::LogInfo("SiStripPedestalsDQMService") << "[SiStripPedestalsDQMService::~SiStripPedestalsDQMService]";
38 }

Member Function Documentation

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

Reimplemented from SiStripDQMPopConSourceHandler< SiStripPedestals >.

Definition at line 40 of file SiStripPopConPedestalsDQM.cc.

References DQMStore::IGetter::cd(), gather_cfg::cout, fp_, edm::FileInPath::fullPath(), DQMStore::IGetter::getAllContents(), trackerHits::histo, m_obj, MEDir_, SiStripPedestals::put(), matplotRender::reader, SiStripPedestals::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

41 {
42  std::cout << "SiStripPedestalsDQMService::readPedestals" << std::endl;
43 
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(), MEs.end(),
60  [] ( const MonitorElement* ME ) -> bool {
61  return std::string::npos == ME->getName().find("PedsPerStrip__det__");
62  }), MEs.end());
63 
64  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
65  for ( const auto& detInfo : reader.getAllData() ) {
66  SiStripPedestals::InputVector theSiStripVector;
67 
68  // Take the path for each DetId and build the complete path + histogram name
69 
70  // MonitorElement * mE = getModuleHistogram(detInfo.first, "PedsPerStrip");
71  const MonitorElement* mE{nullptr};
72  std::string MEname("PedsPerStrip__det__"+std::to_string(detInfo.first));
73  for ( const MonitorElement* ime : MEs ) {
74  if( ime->getName() == MEname ) {
75  mE = ime;
76  break;
77  }
78  }
79 
80  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+std::to_string(detInfo.first), findMEbyName() );
81  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+std::to_string(detInfo.first)) ));
82 
83  if ( mE ) {
84  TH1F* histo = mE->getTH1F();
85  if ( histo ) {
86  // Read the pedestals from the histograms
87  uint32_t nBinsX = histo->GetXaxis()->GetNbins();
88 
89  if ( nBinsX != stripsPerApv*(detInfo.second.nApvs) ) {
90  std::cout << "ERROR: number of bin = " << nBinsX << " != number of strips = " << stripsPerApv*(detInfo.second.nApvs) << std::endl;
91  }
92 
93  // std::cout << "Bin 0 = " << histo->GetBinContent(0) << std::endl;
94  // TH1 bins start from 1, 0 is the underflow, nBinsX+1 the overflow.
95  for ( uint32_t iBin = 1; iBin <= nBinsX; ++iBin ) {
96  // encode the pedestal value and put it in the vector (push_back)
97  m_obj.setData( histo->GetBinContent(iBin), theSiStripVector );
98  }
99  } else {
100  std::cout << "ERROR: histo = " << histo << std::endl;
101  }
102  } else {
103  std::cout << "ERROR: ME = " << mE << std::endl;
104  }
105  // If the ME was absent fill the vector with 0
106  if ( theSiStripVector.empty() ) {
107  for(unsigned short j=0; j<128*detInfo.second.nApvs; ++j){
108  m_obj.setData(0, theSiStripVector);
109  }
110  }
111 
112  if ( ! m_obj.put(detInfo.first, theSiStripVector) )
113  edm::LogError("SiStripPedestalsFakeESSource::produce ")<<" detid already exists"<<std::endl;
114  }
115  getter.cd();
116 }
std::vector< MonitorElement * > getAllContents(std::string const &path, uint32_t runNumber=0, uint32_t lumi=0)
Definition: DQMStore.cc:295
Definition: ME.h:11
std::vector< uint16_t > InputVector
bool put(const uint32_t &detID, InputVector &input)
MonitorElement ME
void setData(float ped, InputVector &vped)
std::string fullPath() const
Definition: FileInPath.cc:197
SiStripPedestals * SiStripPopConPedestalsHandlerFromDQM::getObj ( ) const
overridevirtual

Member Data Documentation

edm::FileInPath SiStripPopConPedestalsHandlerFromDQM::fp_
private

Definition at line 19 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob().

SiStripPedestals SiStripPopConPedestalsHandlerFromDQM::m_obj
private

Definition at line 21 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob(), and getObj().

std::string SiStripPopConPedestalsHandlerFromDQM::MEDir_
private

Definition at line 20 of file SiStripPopConPedestalsDQM.cc.

Referenced by dqmEndJob(), and SiStripPopConPedestalsHandlerFromDQM().