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 // $Id: SiStripOfflineDQM.cc,v 1.35 2010/03/27 11:21:55 dutta Exp $
17 //
18 //
19 
21 
22 
27 
29 
31 
34 
36 
37 //Run Info
41 // Cabling
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  edm::LogInfo( "SiStripOfflineDQM") << "SiStripOfflineDQM::Deleting SiStripOfflineDQM ";
63 
64  // Action Executor
66 
67  // get back-end interface
69 
70  usedWithEDMtoMEConverter_= configPar_.getUntrackedParameter<bool>("UsedWithEDMtoMEConverter",false);
71  createSummary_ = configPar_.getUntrackedParameter<bool>("CreateSummary",false);
72  inputFileName_ = configPar_.getUntrackedParameter<std::string>("InputFileName","");
73  outputFileName_ = configPar_.getUntrackedParameter<std::string>("OutputFileName","");
74  globalStatusFilling_ = configPar_.getUntrackedParameter<int>("GlobalStatusFilling", 1);
75  printFaultyModuleList_ = configPar_.getUntrackedParameter<bool>("PrintFaultyModuleList", false);
76 
77  nEvents_ = 0;
78 }
85  edm::LogInfo("SiStripOfflineDQM") << "SiStripOfflineDQM::Deleting SiStripOfflineDQM ";
86 
87 }
96 
97  // Essential: reads xml file to get the histogram names to create summary
98  // Read the summary configuration file
99  if (createSummary_) {
101  edm::LogInfo ("SiStripOfflineDQM") <<"SiStripOfflineDQM:: Error to read configuration file!! Summary will not be produced!!!";
102  createSummary_ = false;
103  }
104  }
105  edm::LogInfo("SiStripOfflineDQM") << "SiStripOfflineDQM::beginJob done";
106 }
117  edm::LogInfo ("SiStripOfflineDQM") <<"SiStripOfflineDQM:: Begining of Run";
118 
119  int nFEDs = 0;
121  if( eSetup.find( recordKey ) != 0) {
122 
123  edm::ESHandle<RunInfo> sumFED;
124  eSetup.get<RunInfoRcd>().get(sumFED);
125  if ( sumFED.isValid() ) {
126 
127  const FEDNumbering numbering;
128  const int siStripFedIdMin = numbering.MINSiStripFEDID;
129  const int siStripFedIdMax = numbering.MAXSiStripFEDID;
130 
131  std::vector<int> FedsInIds= sumFED->m_fed_in;
132  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
133  int fedID = FedsInIds[it];
134 
135  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDs;
136  }
137  }
138  }
139  if (nFEDs > 0) trackerFEDsFound_ = true;
140  else trackerFEDsFound_ = false;
142  if (!openInputFile()) createSummary_ = false;
143  }
145 }
158  nEvents_++;
159 }
167  edm::LogInfo( "SiStripOfflineDQM") << "SiStripOfflineDQM::endLuminosityBlock";
168  if (trackerFEDsFound_) {
170  }
171 }
179 
180  edm::LogInfo( "SiStripOfflineDQM") << "SiStripOfflineDQM::endRun";
181 
182  // Access Cabling
184  eSetup.get<SiStripDetCablingRcd>().get(det_cabling);
186 
187  if (!trackerFEDsFound_) {
189  return;
190  }
191 
192  // Fill Global Status
194 
196 
197  // create Summary Plots
199 
200  // Create TrackerMap
201  bool create_tkmap = configPar_.getUntrackedParameter<bool>("CreateTkMap",false);
202  if (create_tkmap) {
204  std::vector<std::string> tkMapOptions = configPar_.getUntrackedParameter< std::vector<std::string> >("TkMapOptions" );
206 
207  for(std::vector<std::string>::iterator it = tkMapOptions.begin(); it != tkMapOptions.end(); ++it) {
208  std::string map_type = (*it);
209  actionExecutor_->createOfflineTkMap(tkMapPSet, dqmStore_, map_type);
210  }
211  }
212  }
213  }
214 }
222 
223  edm::LogInfo( "SiStripOfflineDQM") << "SiStripOfflineDQM::endJob";
226  std::ostringstream str_val;
228  std::cout << str_val.str() << std::endl;
229  }
230  // Save Output file
231  dqmStore_->cd();
232  dqmStore_->save(outputFileName_, "","","");
233  }
234 }
242  if (inputFileName_.size() == 0) return false;
243  edm::LogInfo("SiStripOfflineDQM") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
244  dqmStore_->open(inputFileName_, false);
245  return true;
246 }
247 
virtual ~SiStripOfflineDQM()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
static HCTypeTag findType(const char *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:126
SiStripActionExecutor * actionExecutor_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
Analyze.
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:214
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1883
void createOfflineTkMap(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type)
void endJob()
Endjob.
std::string outputFileName_
void createStatus(DQMStore *dqm_store)
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:82
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup)
End Of Luminosity.
std::string inputFileName_
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &fedcabling)
void fillStatusAtLumi(DQMStore *dqm_store)
const T & get() const
Definition: EventSetup.h:55
bool openInputFile()
Open Input File.
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
EndRun.
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:2198
tuple cout
Definition: gather_cfg.py:41
bool isValid() const
Definition: ESHandle.h:37
void printFaultyModuleList(DQMStore *dqm_store, std::ostringstream &str_val)
Definition: Run.h:31
edm::ParameterSet configPar_