CMS 3D CMS Logo

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

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

- 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
 
- 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.

Constructor & Destructor Documentation

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

Definition at line 26 of file SiStripPopConNoisesDQM.cc.

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

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

Definition at line 34 of file SiStripPopConNoisesDQM.cc.

35 {
36  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::~SiStripNoisesDQMService]";
37 }

Member Function Documentation

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

Reimplemented from SiStripDQMPopConSourceHandler< SiStripNoises >.

Definition at line 39 of file SiStripPopConNoisesDQM.cc.

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

40 {
41  std::cout << "SiStripNoisesDQMService::readNoises" << std::endl;
42 
43  m_obj = SiStripNoises();
44 
46 
47  // getter.cd(iConfig_.getUntrackedParameter<std::string>("ME_DIR"));
48  getter.cd();
49 
50  uint32_t stripsPerApv = 128;
51 
52  // Get the full list of monitoring elements
53  // const std::vector<MonitorElement*>& MEs = getter.getAllContents(iConfig_.getUntrackedParameter<std::string>("ME_DIR","DQMData"));
54 
55  // Take a copy of the vector
56  std::vector<MonitorElement*> MEs = getter.getAllContents(MEDir_);
57  // Remove all but the MEs we are using
58  MEs.erase(std::remove_if(MEs.begin(), MEs.end(),
59  [] ( const MonitorElement* ME ) -> bool {
60  return std::string::npos == ME->getName().find("CMSubNoisePerStrip__det__");
61  }), MEs.end());
62 
63  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
64  for ( const auto& detInfo : reader.getAllData() ) {
65 
66  SiStripNoises::InputVector theSiStripVector;
67 
68  // Take the path for each DetId and build the complete path + histogram name
69 
70 
71  // MonitorElement * mE = getModuleHistogram(detInfo.first, "PedsPerStrip");
72  const MonitorElement * mE{nullptr};
73  std::string MEname("CMSubNoisePerStrip__det__"+std::to_string(detInfo.first));
74  for ( const MonitorElement* ime : MEs ) {
75  if( ime->getName() == MEname ) {
76  mE = ime;
77  break;
78  }
79  }
80 
81  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+std::to_string(detInfo.first), findMEbyName() );
82  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+std::to_string(detInfo.first)) ));
83  if ( mE ) {
84  TH1F* histo = mE->getTH1F();
85  if( histo != nullptr ) {
86  // Read the noise 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 50 (we want a high noise to avoid these modules being considered good by mistake)
106  if( theSiStripVector.empty() ) {
107  for(unsigned short j=0; j<128*detInfo.second.nApvs; ++j){
108  m_obj.setData(50, theSiStripVector);
109  }
110  }
111 
112  if ( ! m_obj.put(detInfo.first, theSiStripVector) )
113  edm::LogError("SiStripNoisesFakeESSource::produce ")<<" detid already exists"<<std::endl;
114  }
115  getter.cd();
116 }
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:53
Definition: ME.h:11
bool put(const uint32_t &detID, const InputVector &input)
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0)
Definition: DQMStore.cc:296
MonitorElement ME
std::string fullPath() const
Definition: FileInPath.cc:197
void setData(float noise_, InputVector &vped)
SiStripNoises * SiStripPopConNoisesHandlerFromDQM::getObj ( ) const
overridevirtual

Implements SiStripDQMPopConSourceHandler< SiStripNoises >.

Definition at line 118 of file SiStripPopConNoisesDQM.cc.

References m_obj.

119 {
120  return new SiStripNoises(m_obj);
121 }

Member Data Documentation

edm::FileInPath SiStripPopConNoisesHandlerFromDQM::fp_
private

Definition at line 18 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob().

SiStripNoises SiStripPopConNoisesHandlerFromDQM::m_obj
private

Definition at line 20 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob(), and getObj().

std::string SiStripPopConNoisesHandlerFromDQM::MEDir_
private

Definition at line 19 of file SiStripPopConNoisesDQM.cc.

Referenced by dqmEndJob(), and SiStripPopConNoisesHandlerFromDQM().