CMS 3D CMS Logo

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 
32 
35 
36 #include "SiStripOfflineDQM.h"
37 
38 //Run Info
42 // Cabling
45 //#include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
46 
47 #include <iostream>
48 #include <iomanip>
49 #include <cstdio>
50 #include <string>
51 #include <sstream>
52 #include <cmath>
53 
54 
63  // Create MessageSender
64 
65  // Action Executor
67 
68  // get back-end interface
70 
71  usedWithEDMtoMEConverter_= configPar_.getUntrackedParameter<bool>("UsedWithEDMtoMEConverter",false);
72  createSummary_ = configPar_.getUntrackedParameter<bool>("CreateSummary",false);
73  createTkInfoFile_ = configPar_.getUntrackedParameter<bool>("CreateTkInfoFile",false);
76  globalStatusFilling_ = configPar_.getUntrackedParameter<int>("GlobalStatusFilling", 1);
77  printFaultyModuleList_ = configPar_.getUntrackedParameter<bool>("PrintFaultyModuleList", false);
78 
79  nEvents_ = 0;
80 
81  tkinfoTree_ = nullptr;
82 
83  if(createTkInfoFile_) {
85  tkinfoTree_ = fs->make<TTree>("TkDetIdInfo", "");
86  }
87 
88 }
95 
96 }
105 
106  // Essential: reads xml file to get the histogram names to create summary
107  // Read the summary configuration file
108  if (createSummary_) {
110  edm::LogInfo ("ReadConfigurationProblem") <<"SiStripOfflineDQM:: Error to read configuration file!! Summary will not be produced!!!";
111  createSummary_ = false;
112  }
113  }
114  edm::LogInfo("BeginJobDone") << "SiStripOfflineDQM::beginJob done";
115 }
126  edm::LogInfo ("BeginRun") <<"SiStripOfflineDQM:: Begining of Run";
127 
128  int nFEDs = 0;
130  if( eSetup.find( recordKey ) != nullptr) {
131 
132  edm::ESHandle<RunInfo> sumFED;
133  eSetup.get<RunInfoRcd>().get(sumFED);
134  if ( sumFED.isValid() ) {
135 
136  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
137  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
138 
139  std::vector<int> FedsInIds= sumFED->m_fed_in;
140  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
141  int fedID = FedsInIds[it];
142 
143  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDs;
144  }
145  }
146  }
147  if (nFEDs > 0) trackerFEDsFound_ = true;
148  else trackerFEDsFound_ = false;
150  if (!openInputFile()) createSummary_ = false;
151  }
153 }
166  nEvents_++;
167 }
175  edm::LogInfo( "EndLumiBlock") << "SiStripOfflineDQM::endLuminosityBlock";
176  if (trackerFEDsFound_) {
178  }
179 }
187 
188  edm::LogInfo( "EndOfRun") << "SiStripOfflineDQM::endRun";
189 
190  // Access Cabling
192  eSetup.get<SiStripDetCablingRcd>().get(det_cabling);
193  // edm::ESHandle< SiStripFedCabling > fed_cabling;
194  // eSetup.get<SiStripFedCablingRcd>().get(fed_cabling);
196 
197  if (!trackerFEDsFound_) {
199  return;
200  }
201 
202  // Fill Global Status
203  if (globalStatusFilling_ > 0) actionExecutor_->fillStatus(dqmStore_, det_cabling, eSetup);
204 
206 
207  // create Summary Plots
209 
210  // Create TrackerMap
211  bool create_tkmap = configPar_.getUntrackedParameter<bool>("CreateTkMap",false);
212  if (create_tkmap) {
213  std::vector<edm::ParameterSet> tkMapOptions = configPar_.getUntrackedParameter< std::vector<edm::ParameterSet> >("TkMapOptions" );
215  std::vector<std::string> map_names;
216 
217  for(std::vector<edm::ParameterSet>::iterator it = tkMapOptions.begin(); it != tkMapOptions.end(); ++it) {
218  edm::ParameterSet tkMapPSet = *it;
219  std::string map_type = it->getUntrackedParameter<std::string>("mapName","");
220  map_names.push_back(map_type);
221  tkMapPSet.augment(configPar_.getUntrackedParameter<edm::ParameterSet>("TkmapParameters"));
222  edm::LogInfo("TkMapParameters") << tkMapPSet;
223  actionExecutor_->createOfflineTkMap(tkMapPSet, dqmStore_, map_type, eSetup);
224  }
225  if(createTkInfoFile_) {
227  }
228  }
229  }
230  }
231 }
239 
240  edm::LogInfo( "EndOfJob") << "SiStripOfflineDQM::endJob";
243  std::ostringstream str_val;
245  std::cout << str_val.str() << std::endl;
246  }
247  }
248 }
256  if (inputFileName_.empty()) return false;
257  edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
258  dqmStore_->open(inputFileName_, false);
259  return true;
260 }
261 
T getUntrackedParameter(std::string const &, T const &) const
SiStripActionExecutor * actionExecutor_
void createOfflineTkMap(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type, const edm::EventSetup &eSetup)
SiStripOfflineDQM(const edm::ParameterSet &ps)
Constructor.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
EndRun.
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Analyze.
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &fedcabling, const edm::EventSetup &eSetup)
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::string outputFileName_
bool readTkMapConfiguration(const edm::EventSetup &eSetup)
void createStatus(DQMStore *dqm_store)
void augment(ParameterSet const &from)
std::vector< int > m_fed_in
Definition: RunInfo.h:26
std::string inputFileName_
void endJob() override
Endjob.
void fillStatusAtLumi(DQMStore *dqm_store)
~SiStripOfflineDQM() override
Destructor.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup) override
End Of Luminosity.
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
BeginRun.
void beginJob() override
BeginJob.
bool openInputFile()
Open Input File.
void createTkInfoFile(std::vector< std::string > tkhmap_names, TTree *tkinfo_tree, DQMStore *dqm_store)
T get() const
Definition: EventSetup.h:63
boost::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:88
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:2936
bool isValid() const
Definition: ESHandle.h:47
void printFaultyModuleList(DQMStore *dqm_store, std::ostringstream &str_val)
Definition: Run.h:44
edm::ParameterSet configPar_