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
SiStripPedestalsDQMService Class Reference

#include <SiStripPedestalsDQMService.h>

Inheritance diagram for SiStripPedestalsDQMService:
SiStripBaseServiceFromDQM< SiStripPedestals > SiStripCondObjBuilderBase< SiStripPedestals >

Public Member Functions

void getObj (SiStripPedestals *&obj)
 
 SiStripPedestalsDQMService (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripPedestalsDQMService ()
 
- Public Member Functions inherited from SiStripBaseServiceFromDQM< SiStripPedestals >
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< SiStripPedestals >
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Private Member Functions

void readPedestals ()
 

Private Attributes

edm::FileInPath fp_
 
edm::ParameterSet iConfig_
 

Additional Inherited Members

- Protected Member Functions inherited from SiStripBaseServiceFromDQM< SiStripPedestals >
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< SiStripPedestals >
DQMStoredqmStore_
 
boost::shared_ptr
< SiStripFolderOrganizer
folderOrganizer_
 
edm::ParameterSet iConfig_
 
- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripPedestals >
edm::ParameterSet _pset
 
SiStripPedestalsobj_
 

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

Constructor & Destructor Documentation

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

Definition at line 13 of file SiStripPedestalsDQMService.cc.

References SiStripCondObjBuilderBase< SiStripPedestals >::obj_.

13  :
14  // SiStripCondObjBuilderBase<SiStripPedestals>::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("SiStripPedestalsDQMService") << "[SiStripPedestalsDQMService::SiStripPedestalsDQMService]";
21 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripBaseServiceFromDQM(const edm::ParameterSet &)
SiStripPedestalsDQMService::~SiStripPedestalsDQMService ( )

Definition at line 23 of file SiStripPedestalsDQMService.cc.

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

Member Function Documentation

void SiStripPedestalsDQMService::getObj ( SiStripPedestals *&  obj)
inlinevirtual
void SiStripPedestalsDQMService::readPedestals ( )
private

Definition at line 28 of file SiStripPedestalsDQMService.cc.

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

Referenced by getObj().

29 {
30  std::cout << "SiStripPedestalsDQMService::readPedestals" << std::endl;
31 
33 
34  std::cout << "[readBadComponents]: opened requested file" << std::endl;
35 
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("PedsPerStrip__det__"));
52  MEs.erase(newEnd, MEs.end());
53 
54 
55  // The histograms are one per DetId, loop on all the DetIds and extract the corresponding histogram
56  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo> DetInfos = reader.getAllData();
57  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin(); it != DetInfos.end(); ++it) {
58 
59 
60  SiStripPedestals::InputVector theSiStripVector;
61 
62  // Take the path for each DetId and build the complete path + histogram name
63 
64 
65  // MonitorElement * mE = getModuleHistogram(it->first, "PedsPerStrip");
66 
67 
68  MonitorElement * mE = 0;
69  std::string MEname("PedsPerStrip__det__"+boost::lexical_cast<string>(it->first));
70  for( std::vector<MonitorElement*>::const_iterator MEit = MEs.begin();
71  MEit != MEs.end(); ++MEit ) {
72  if( (*MEit)->getName() == MEname ) {
73  mE = *MEit;
74  break;
75  }
76  }
77 
78  // find( MEs.begin(), MEs.end(), "PedsPerStrip__det__"+boost::lexical_cast<string>(it->first), findMEbyName() );
79  // MonitorElement * mE = *(find( MEs.begin(), MEs.end(), findMEbyName("PedsPerStrip__det__"+boost::lexical_cast<string>(it->first)) ));
80 
81  if( mE != 0 ) {
82  TH1F* histo = mE->getTH1F();
83 
84  if( histo != 0 ) {
85 
86  // Read the pedestals from the histograms
87  uint32_t nBinsX = histo->GetXaxis()->GetNbins();
88 
89  if( nBinsX != stripsPerApv*(it->second.nApvs) ) {
90  std::cout << "ERROR: number of bin = " << nBinsX << " != number of strips = " << stripsPerApv*(it->second.nApvs) << std::endl;
91  }
92 
93  // std::cout << "Bin 0 = " << histo->GetBinContent(0) << std::endl;
94 
95  // TH1 bins start from 1, 0 is the underflow, nBinsX+1 the overflow.
96  for( uint32_t iBin = 1; iBin <= nBinsX; ++iBin ) {
97  // encode the pedestal value and put it in the vector (push_back)
98  obj_->setData( histo->GetBinContent(iBin), theSiStripVector );
99  }
100  }
101  else {
102  std::cout << "ERROR: histo = " << histo << std::endl;
103  }
104  }
105  else {
106  std::cout << "ERROR: ME = " << mE << std::endl;
107  }
108  // If the ME was absent fill the vector with 0
109  if( theSiStripVector.empty() ) {
110  for(unsigned short j=0; j<128*it->second.nApvs; ++j){
111  obj_->setData(0, theSiStripVector);
112  }
113  }
114 
115  if ( ! obj_->put(it->first, theSiStripVector) )
116  edm::LogError("SiStripPedestalsFakeESSource::produce ")<<" detid already exists"<<std::endl;
117  }
118  dqmStore_->cd();
119 }
T getUntrackedParameter(std::string const &, T const &) const
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:209
tuple histo
Definition: trackerHits.py:12
std::vector< MonitorElement * > getAllContents(const std::string &path) const
Definition: DQMStore.cc:1469
std::vector< uint16_t > InputVector
int j
Definition: DBlmapReader.cc:9
bool put(const uint32_t &detID, InputVector &input)
TH1F * getTH1F(void) const
void setData(float ped, InputVector &vped)
tuple cout
Definition: gather_cfg.py:41
std::string fullPath() const
Definition: FileInPath.cc:170
void openRequestedFile()
Uses DQMStore to access the DQM file.

Member Data Documentation

edm::FileInPath SiStripPedestalsDQMService::fp_
private

Definition at line 41 of file SiStripPedestalsDQMService.h.

Referenced by readPedestals().

edm::ParameterSet SiStripPedestalsDQMService::iConfig_
private

Definition at line 40 of file SiStripPedestalsDQMService.h.

Referenced by readPedestals().