CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalNoiseRatesClient.cc
Go to the documentation of this file.
3 
8 
11 
13 {
14 
15  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
16 
18  if (!dbe_) {
19  edm::LogError("HcalNoiseRatesClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
20  }
21  if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
22  if(dbe_) dbe_->setVerbose(0);
23  }
24 
25  debug_ = false;
26  verbose_ = false;
27 
28  dirName_=iConfig.getParameter<std::string>("DQMDirName");
29  if(dbe_) dbe_->setCurrentFolder(dirName_);
30 
31 }
32 
33 
35 {
36 
37 }
38 
40 {
41 
42 
43 }
44 
46 {
47  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
48 }
49 
51 {
52 
53 }
54 
55 
57 {
58  runClient_();
59 }
60 
61 //dummy analysis function
63 {
64 
65 }
66 
68 {
69 // runClient_();
70 }
71 
73 {
74  if(!dbe_) return; //we dont have the DQMStore so we cant do anything
76 
77  if (verbose_) std::cout << "\nrunClient" << std::endl;
78 
79  std::vector<MonitorElement*> hcalMEs;
80 
81  // Since out folders are fixed to three, we can just go over these three folders
82  // i.e., CaloTowersD/CaloTowersTask, HcalRecHitsD/HcalRecHitTask, HcalNoiseRatesD/NoiseRatesTask.
83  std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs();
84  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
85 
86  if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
87  dbe_->setCurrentFolder(fullPathHLTFolders[i]);
88 
89  std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
90  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
91 
92  if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
93 
94  if( strcmp(fullSubPathHLTFolders[j].c_str(), "HcalNoiseRatesD/NoiseRatesTask") ==0 ){
95  hcalMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
96  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
97  if( !NoiseRatesEndjob(hcalMEs) ) std::cout<<"\nError in NoiseRatesEndjob!"<<std::endl<<std::endl;
98  }
99 
100  }
101 
102  }
103 
104 }
105 
106 // called after entering the HcalNoiseRatesD/NoiseRatesTask directory
107 // hcalMEs are within that directory
108 int HcalNoiseRatesClient::NoiseRatesEndjob(const std::vector<MonitorElement*> &hcalMEs){
109 
110  int useAllHistos = 0;
111  MonitorElement* hLumiBlockCount =0;
112  for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
113  if( strcmp(hcalMEs[ih]->getName().c_str(), "hLumiBlockCount") ==0 ){
114  hLumiBlockCount = hcalMEs[ih];
115  useAllHistos =1;
116  }
117  }
118  if( useAllHistos !=0 && useAllHistos !=1 ) return 0;
119 
120 // FIXME: dummy lumiCountMap.size since hLumiBlockCount is disabled
121 // in a general case.
122  int lumiCountMapsize = -1; // dummy
123  if (useAllHistos) hLumiBlockCount->Fill(0.0, lumiCountMapsize);
124 
125  return 1;
126 
127 }
128 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1659
virtual void analyze(const edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int NoiseRatesEndjob(const std::vector< MonitorElement * > &hcalMEs)
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:230
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
int j
Definition: DBlmapReader.cc:9
virtual void endRun(const edm::Run &run, const edm::EventSetup &c)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1737
virtual void beginJob(void)
HcalNoiseRatesClient(const edm::ParameterSet &)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
Definition: Run.h:41