test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripOfflineDQM.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripMonitorCluster
4 // Class: SiStripOfflineDQM
5 //
13 //
14 // Original Author: Samvel Khalatyan (ksamdev at gmail dot com)
15 // Created: Wed Oct 5 16:42:34 CET 2006
16 //
17 //
18 
20 
21 
26 
28 
30 
33 
35 
36 //Run Info
40 // Cabling
43 //#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
44 
45 #include <iostream>
46 #include <iomanip>
47 #include <stdio.h>
48 #include <string>
49 #include <sstream>
50 #include <math.h>
51 
52 
61  // Create MessageSender
62 
63  // Action Executor
65 
66  // get back-end interface
68 
69  usedWithEDMtoMEConverter_= configPar_.getUntrackedParameter<bool>("UsedWithEDMtoMEConverter",false);
70  createSummary_ = configPar_.getUntrackedParameter<bool>("CreateSummary",false);
73  globalStatusFilling_ = configPar_.getUntrackedParameter<int>("GlobalStatusFilling", 1);
74  printFaultyModuleList_ = configPar_.getUntrackedParameter<bool>("PrintFaultyModuleList", false);
75 
76  nEvents_ = 0;
77 }
84 
85 }
94 
95  // Essential: reads xml file to get the histogram names to create summary
96  // Read the summary configuration file
97  if (createSummary_) {
99  edm::LogInfo ("ReadConfigurationProblem") <<"SiStripOfflineDQM:: Error to read configuration file!! Summary will not be produced!!!";
100  createSummary_ = false;
101  }
102  }
103  edm::LogInfo("BeginJobDone") << "SiStripOfflineDQM::beginJob done";
104 }
115  edm::LogInfo ("BeginRun") <<"SiStripOfflineDQM:: Begining of Run";
116 
117  int nFEDs = 0;
119  if( eSetup.find( recordKey ) != 0) {
120 
121  edm::ESHandle<RunInfo> sumFED;
122  eSetup.get<RunInfoRcd>().get(sumFED);
123  if ( sumFED.isValid() ) {
124 
125  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
126  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
127 
128  std::vector<int> FedsInIds= sumFED->m_fed_in;
129  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
130  int fedID = FedsInIds[it];
131 
132  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDs;
133  }
134  }
135  }
136  if (nFEDs > 0) trackerFEDsFound_ = true;
137  else trackerFEDsFound_ = false;
139  if (!openInputFile()) createSummary_ = false;
140  }
142 }
155  nEvents_++;
156 }
164  edm::LogInfo( "EndLumiBlock") << "SiStripOfflineDQM::endLuminosityBlock";
165  if (trackerFEDsFound_) {
167  }
168 }
176 
177  edm::LogInfo( "EndOfRun") << "SiStripOfflineDQM::endRun";
178 
179  // Access Cabling
181  eSetup.get<SiStripDetCablingRcd>().get(det_cabling);
182  // edm::ESHandle< SiStripFedCabling > fed_cabling;
183  // eSetup.get<SiStripFedCablingRcd>().get(fed_cabling);
185 
186  if (!trackerFEDsFound_) {
188  return;
189  }
190 
191  // Fill Global Status
192  if (globalStatusFilling_ > 0) actionExecutor_->fillStatus(dqmStore_, det_cabling, eSetup);
193 
195 
196  // create Summary Plots
198 
199  // Create TrackerMap
200  bool create_tkmap = configPar_.getUntrackedParameter<bool>("CreateTkMap",false);
201  if (create_tkmap) {
202  std::vector<edm::ParameterSet> tkMapOptions = configPar_.getUntrackedParameter< std::vector<edm::ParameterSet> >("TkMapOptions" );
204 
205  for(std::vector<edm::ParameterSet>::iterator it = tkMapOptions.begin(); it != tkMapOptions.end(); ++it) {
206  edm::ParameterSet tkMapPSet = *it;
207  std::string map_type = it->getUntrackedParameter<std::string>("mapName","");
208  tkMapPSet.augment(configPar_.getUntrackedParameter<edm::ParameterSet>("TkmapParameters"));
209  edm::LogInfo("TkMapParameters") << tkMapPSet;
210  actionExecutor_->createOfflineTkMap(tkMapPSet, dqmStore_, map_type, eSetup);
211  }
212  }
213  }
214  }
215 }
223 
224  edm::LogInfo( "EndOfJob") << "SiStripOfflineDQM::endJob";
227  std::ostringstream str_val;
229  std::cout << str_val.str() << std::endl;
230  }
231  // Save Output file
232  dqmStore_->cd();
233  dqmStore_->save(outputFileName_, "","","");
234  }
235 }
243  if (inputFileName_.size() == 0) return false;
244  edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
245  dqmStore_->open(inputFileName_, false);
246  return true;
247 }
248 
virtual ~SiStripOfflineDQM()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
SiStripActionExecutor * actionExecutor_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
Analyze.
void createOfflineTkMap(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type, const edm::EventSetup &eSetup)
SiStripOfflineDQM(const edm::ParameterSet &ps)
Constructor.
void beginJob()
BeginJob.
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
BeginRun.
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:684
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &fedcabling, const edm::EventSetup &eSetup)
void endJob()
Endjob.
std::string outputFileName_
bool readTkMapConfiguration(const edm::EventSetup &eSetup)
void createStatus(DQMStore *dqm_store)
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:91
void augment(ParameterSet const &from)
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup)
End Of Luminosity.
std::string inputFileName_
void fillStatusAtLumi(DQMStore *dqm_store)
const T & get() const
Definition: EventSetup.h:56
bool openInputFile()
Open Input File.
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
EndRun.
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:2602
void createSummaryOffline(DQMStore *dqm_store)
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2959
tuple cout
Definition: gather_cfg.py:121
bool isValid() const
Definition: ESHandle.h:47
void printFaultyModuleList(DQMStore *dqm_store, std::ostringstream &str_val)
Definition: Run.h:43
edm::ParameterSet configPar_
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125