CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripNoisesDQMService Class Reference

#include <SiStripNoisesDQMService.h>

Inheritance diagram for SiStripNoisesDQMService:
SiStripBaseServiceFromDQM< SiStripNoises > SiStripCondObjBuilderBase< SiStripNoises >

Public Member Functions

void getObj (SiStripNoises *&obj)
 
 SiStripNoisesDQMService (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripNoisesDQMService ()
 
- Public Member Functions inherited from SiStripBaseServiceFromDQM< SiStripNoises >
virtual bool checkForCompatibility (std::string ss)
 Check is the transfer is needed. More...
 
virtual void getMetaDataString (std::stringstream &ss)
 Used to fill the logDB. More...
 
 SiStripBaseServiceFromDQM (const edm::ParameterSet &)
 
virtual ~SiStripBaseServiceFromDQM ()
 
- Public Member Functions inherited from SiStripCondObjBuilderBase< SiStripNoises >
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Private Member Functions

void readNoises ()
 

Private Attributes

edm::FileInPath fp_
 
edm::ParameterSet iConfig_
 

Additional Inherited Members

- Protected Member Functions inherited from SiStripBaseServiceFromDQM< SiStripNoises >
void getModuleFolderList (std::vector< std::string > &mfolders)
 Fill the mfolders vector with the full list of directories for all the modules. More...
 
MonitorElementgetModuleHistogram (const uint32_t detId, const std::string &name)
 
uint32_t getRunNumber () const
 Returns the run number from the cfg. More...
 
bool goToDir (const std::string &name)
 Uses DQM utilities to access the requested dir. More...
 
void openRequestedFile ()
 Uses DQMStore to access the DQM file. More...
 
- Protected Attributes inherited from SiStripBaseServiceFromDQM< SiStripNoises >
DQMStoredqmStore_
 
boost::shared_ptr
< SiStripFolderOrganizer
folderOrganizer_
 
edm::ParameterSet iConfig_
 
- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripNoises >
edm::ParameterSet _pset
 
SiStripNoisesobj_
 

Detailed Description

Author
M. De Mattia, S. Dutta, D. Giordano to read modules flagged by the DQM as bad and write in the database.

Definition at line 24 of file SiStripNoisesDQMService.h.

Constructor & Destructor Documentation

SiStripNoisesDQMService::SiStripNoisesDQMService ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 13 of file SiStripNoisesDQMService.cc.

References SiStripCondObjBuilderBase< SiStripNoises >::obj_.

13  :
14  // SiStripCondObjBuilderBase<SiStripNoises>::SiStripCondObjBuilderBase(iConfig),
16  iConfig_(iConfig),
17  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")))
18 {
19  obj_ = 0;
20  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::SiStripNoisesDQMService]";
21 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripBaseServiceFromDQM(const edm::ParameterSet &)
SiStripNoisesDQMService::~SiStripNoisesDQMService ( )

Definition at line 23 of file SiStripNoisesDQMService.cc.

24 {
25  edm::LogInfo("SiStripNoisesDQMService") << "[SiStripNoisesDQMService::~SiStripNoisesDQMService]";
26 }

Member Function Documentation

void SiStripNoisesDQMService::getObj ( SiStripNoises *&  obj)
inlinevirtual
void SiStripNoisesDQMService::readNoises ( )
private

Definition at line 28 of file SiStripNoisesDQMService.cc.

References DQMStore::cd(), gather_cfg::cout, SiStripBaseServiceFromDQM< SiStripNoises >::dqmStore_, fp_, edm::FileInPath::fullPath(), DQMStore::getAllContents(), MonitorElement::getTH1F(), edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, iConfig_, j, SiStripCondObjBuilderBase< SiStripNoises >::obj_, SiStripBaseServiceFromDQM< SiStripNoises >::openRequestedFile(), SiStripNoises::put(), matplotRender::reader, SiStripNoises::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getObj().

29 {
30  std::cout << "SiStripNoisesDQMService::readNoises" << std::endl;
31 
33 
34  std::cout << "[readBadComponents]: opened requested file" << std::endl;
35 
36  obj_= new SiStripNoises;
37 
39 
40  // dqmStore_->cd(iConfig_.getUntrackedParameter<std::string>("ME_DIR"));
41  dqmStore_->cd();
42 
43  uint32_t stripsPerApv = 128;
44 
45  // Get the full list of monitoring elements
46  // const std::vector<MonitorElement*>& MEs = dqmStore_->getAllContents(iConfig_.getUntrackedParameter<std::string>("ME_DIR","DQMData"));
47 
48  // Take a copy of the vector
49  std::vector<MonitorElement*> MEs = dqmStore_->getAllContents(iConfig_.getUntrackedParameter<std::string>("ME_DIR","DQMData"));
50  // Remove all but the MEs we are using
51  std::vector<MonitorElement*>::iterator newEnd = remove_if(MEs.begin(), MEs.end(), StringNotMatch("CMSubNoisePerStrip__det__"));
52  MEs.erase(newEnd, MEs.end());
53 
54  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
55  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo> DetInfos = reader.getAllData();
56  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin(); it != DetInfos.end(); ++it) {
57 
58 
59  SiStripNoises::InputVector theSiStripVector;
60 
61  // Take the path for each DetId and build the complete path + histogram name
62 
63 
64  // MonitorElement * mE = getModuleHistogram(it->first, "PedsPerStrip");
65 
66 
67  MonitorElement * mE = 0;
68  std::string MEname("CMSubNoisePerStrip__det__"+boost::lexical_cast<string>(it->first));
69  for( std::vector<MonitorElement*>::const_iterator MEit = MEs.begin();
70  MEit != MEs.end(); ++MEit ) {
71  if( (*MEit)->getName() == MEname ) {
72  mE = *MEit;
73  break;
74  }
75  }
76 
77  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+boost::lexical_cast<string>(it->first), findMEbyName() );
78  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+boost::lexical_cast<string>(it->first)) ));
79 
80  if( mE != 0 ) {
81  TH1F* histo = mE->getTH1F();
82 
83  if( histo != 0 ) {
84 
85  // Read the noise from the histograms
86  uint32_t nBinsX = histo->GetXaxis()->GetNbins();
87 
88  if( nBinsX != stripsPerApv*(it->second.nApvs) ) {
89  std::cout << "ERROR: number of bin = " << nBinsX << " != number of strips = " << stripsPerApv*(it->second.nApvs) << std::endl;
90  }
91 
92  // std::cout << "Bin 0 = " << histo->GetBinContent(0) << std::endl;
93 
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  obj_->setData( histo->GetBinContent(iBin), theSiStripVector );
98  }
99  }
100  else {
101  std::cout << "ERROR: histo = " << histo << std::endl;
102  }
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*it->second.nApvs; ++j){
110  obj_->setData(50, theSiStripVector);
111  }
112  }
113 
114  if ( ! obj_->put(it->first, theSiStripVector) )
115  edm::LogError("SiStripNoisesFakeESSource::produce ")<<" detid already exists"<<std::endl;
116  }
117  dqmStore_->cd();
118 }
T getUntrackedParameter(std::string const &, T const &) const
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:562
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:44
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1837
int j
Definition: DBlmapReader.cc:9
bool put(const uint32_t &detID, const InputVector &input)
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:171
void setData(float noise_, InputVector &vped)
void openRequestedFile()
Uses DQMStore to access the DQM file.

Member Data Documentation

edm::FileInPath SiStripNoisesDQMService::fp_
private

Definition at line 41 of file SiStripNoisesDQMService.h.

Referenced by readNoises().

edm::ParameterSet SiStripNoisesDQMService::iConfig_
private

Definition at line 40 of file SiStripNoisesDQMService.h.

Referenced by readNoises().