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.41 2012/11/20 10:24:11 venturia Exp $
17 //
18 //
19 
21 
22 
27 
29 
31 
34 
36 
37 //Run Info
41 // Cabling
44 //#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
45 
46 #include <iostream>
47 #include <iomanip>
48 #include <stdio.h>
49 #include <string>
50 #include <sstream>
51 #include <math.h>
52 
53 
62  // Create MessageSender
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 
86 }
95 
96  // Essential: reads xml file to get the histogram names to create summary
97  // Read the summary configuration file
98  if (createSummary_) {
100  edm::LogInfo ("ReadConfigurationProblem") <<"SiStripOfflineDQM:: Error to read configuration file!! Summary will not be produced!!!";
101  createSummary_ = false;
102  }
103  }
104  edm::LogInfo("BeginJobDone") << "SiStripOfflineDQM::beginJob done";
105 }
116  edm::LogInfo ("BeginRun") <<"SiStripOfflineDQM:: Begining of Run";
117 
118  int nFEDs = 0;
120  if( eSetup.find( recordKey ) != 0) {
121 
122  edm::ESHandle<RunInfo> sumFED;
123  eSetup.get<RunInfoRcd>().get(sumFED);
124  if ( sumFED.isValid() ) {
125 
126  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
127  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
128 
129  std::vector<int> FedsInIds= sumFED->m_fed_in;
130  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
131  int fedID = FedsInIds[it];
132 
133  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDs;
134  }
135  }
136  }
137  if (nFEDs > 0) trackerFEDsFound_ = true;
138  else trackerFEDsFound_ = false;
140  if (!openInputFile()) createSummary_ = false;
141  }
143 }
156  nEvents_++;
157 }
165  edm::LogInfo( "EndLumiBlock") << "SiStripOfflineDQM::endLuminosityBlock";
166  if (trackerFEDsFound_) {
168  }
169 }
177 
178  edm::LogInfo( "EndOfRun") << "SiStripOfflineDQM::endRun";
179 
180  // Access Cabling
182  eSetup.get<SiStripDetCablingRcd>().get(det_cabling);
183  // edm::ESHandle< SiStripFedCabling > fed_cabling;
184  // eSetup.get<SiStripFedCablingRcd>().get(fed_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) {
203  std::vector<edm::ParameterSet> tkMapOptions = configPar_.getUntrackedParameter< std::vector<edm::ParameterSet> >("TkMapOptions" );
205 
206  for(std::vector<edm::ParameterSet>::iterator it = tkMapOptions.begin(); it != tkMapOptions.end(); ++it) {
207  edm::ParameterSet tkMapPSet = *it;
208  std::string map_type = it->getUntrackedParameter<std::string>("mapName","");
209  tkMapPSet.augment(configPar_.getUntrackedParameter<edm::ParameterSet>("TkmapParameters"));
210  edm::LogInfo("TkMapParameters") << tkMapPSet;
211  actionExecutor_->createOfflineTkMap(tkMapPSet, dqmStore_, map_type);
212  }
213  }
214  }
215  }
216 }
224 
225  edm::LogInfo( "EndOfJob") << "SiStripOfflineDQM::endJob";
228  std::ostringstream str_val;
230  std::cout << str_val.str() << std::endl;
231  }
232  // Save Output file
233  dqmStore_->cd();
234  dqmStore_->save(outputFileName_, "","","");
235  }
236 }
244  if (inputFileName_.size() == 0) return false;
245  edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
246  dqmStore_->open(inputFileName_, false);
247  return true;
248 }
249 
virtual ~SiStripOfflineDQM()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
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:406
#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:2113
void createOfflineTkMap(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type)
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:90
void augment(ParameterSet const &from)
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:2432
tuple cout
Definition: gather_cfg.py:121
bool isValid() const
Definition: ESHandle.h:37
void printFaultyModuleList(DQMStore *dqm_store, std::ostringstream &str_val)
Definition: Run.h:33
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:129