CMS 3D CMS Logo

SiStripAnalyser.cc
Go to the documentation of this file.
1 /*
2  * \file SiStripAnalyser.cc
3  *
4  * \author S. Dutta INFN-Pisa
5  *
6  */
7 
8 #include "SiStripAnalyser.h"
9 
17 
19 
24 
29 
32 
33 #include <cmath>
34 #include <cstdio>
35 #include <iomanip>
36 #include <iostream>
37 #include <sstream>
38 #include <string>
39 
41  : condDataMon_{ps},
42  actionExecutor_{ps},
43  tkMapPSet_{ps.getParameter<edm::ParameterSet>("TkmapParameters")},
44  summaryFrequency_{ps.getUntrackedParameter<int>("SummaryCreationFrequency", 1)},
45  staticUpdateFrequency_{ps.getUntrackedParameter<int>("StaticUpdateFrequency", 1)},
46  globalStatusFilling_{ps.getUntrackedParameter<int>("GlobalStatusFilling", 1)},
47  shiftReportFrequency_{ps.getUntrackedParameter<int>("ShiftReportFrequency", 1)},
48  rawDataToken_{consumes<FEDRawDataCollection>(ps.getUntrackedParameter<edm::InputTag>("RawDataTag"))},
49  printFaultyModuleList_{ps.getUntrackedParameter<bool>("PrintFaultyModuleList", true)} {
50  std::string const localPath{"DQM/SiStripMonitorClient/test/loader.html"};
51  std::ifstream fin{edm::FileInPath(localPath).fullPath(), std::ios::in};
52  if (!fin) {
53  std::cerr << "Input File: loader.html"
54  << " could not be opened!" << std::endl;
55  return;
56  }
57  edm::LogInfo("SiStripAnalyser") << " SiStripAnalyser::Creating SiStripAnalyser ";
58 }
59 
60 SiStripAnalyser::~SiStripAnalyser() { edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser::Deleting SiStripAnalyser "; }
61 
63  // Read the summary configuration file
65  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: Error to read configuration file!! Summary will "
66  "not be produced!!!";
67  }
68 }
69 
71  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: Begining of Run";
72 
73  // Check latest Fed cabling and create TrackerMapCreator
74  unsigned long long const cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
75  if (m_cacheID_ != cacheID) {
76  m_cacheID_ = cacheID;
77  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser::beginRun: "
78  << " Change in Cabling, recrated TrackerMap";
80  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: Error to read configuration file!! TrackerMap "
81  "will not be produced!!!";
82  }
85  }
86  condDataMon_.beginRun(run.run(), eSetup);
88  auto& dqm_store = *edm::Service<DQMStore>{};
89  actionExecutor_.createStatus(dqm_store);
90  }
91 }
92 
94  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: Begin of LS transition";
95 }
96 
98  ++nEvents_;
99  if (nEvents_ == 1 && globalStatusFilling_ > 0) {
101  if (!trackerFEDsFound_) {
104  } else {
105  auto& dqm_store = *edm::Service<DQMStore>{};
106  actionExecutor_.fillStatus(dqm_store, detCabling_, eSetup);
107  if (shiftReportFrequency_ != -1)
109  }
110  }
111 }
112 
114  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: End of LS transition, "
115  "performing the DQM client operation";
116  ++nLumiSecs_;
117 
118  if (!trackerFEDsFound_) {
120  return;
121  }
122  endLumiAnalysisOn_ = true;
123 
124  std::cout << "====================================================== " << std::endl;
125  std::cout << " ===> Iteration # " << nLumiSecs_ << " " << lumiSeg.luminosityBlock() << std::endl;
126  std::cout << "====================================================== " << std::endl;
127 
128  auto& dqm_store = *edm::Service<DQMStore>{};
129  // Fill Global Status
130  if (globalStatusFilling_ > 0) {
131  actionExecutor_.fillStatus(dqm_store, detCabling_, eSetup);
132  }
133  // -- Create summary monitor elements according to the frequency
134  if (summaryFrequency_ != -1 && nLumiSecs_ > 0 && nLumiSecs_ % summaryFrequency_ == 0) {
135  std::cout << " Creating Summary " << std::endl;
136  actionExecutor_.createSummary(dqm_store);
137  }
138  endLumiAnalysisOn_ = false;
139 }
140 
142  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: End of Run";
143 }
144 
146  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser:: endjob called!";
148  std::ostringstream str_val;
149  auto& dqm_store = *edm::Service<DQMStore>{};
150  actionExecutor_.printFaultyModuleList(dqm_store, str_val);
151  std::cout << str_val.str() << std::endl;
152  }
153 }
154 
156  edm::Handle<FEDRawDataCollection> rawDataHandle;
157  e.getByToken(rawDataToken_, rawDataHandle);
158  if (!rawDataHandle.isValid())
159  return;
160 
161  auto const& rawDataCollection = *rawDataHandle;
162  constexpr int siStripFedIdMin{FEDNumbering::MINSiStripFEDID};
163  constexpr int siStripFedIdMax{FEDNumbering::MAXSiStripFEDID};
164 
165  for (int i = siStripFedIdMin; i <= siStripFedIdMax; ++i) {
166  auto const& fedData = rawDataCollection.FEDData(i);
167  if (fedData.size() && fedData.data()) {
168  trackerFEDsFound_ = true;
169  return;
170  }
171  }
172 }
FEDNumbering.h
SiStripClassToMonitorCondData::beginRun
void beginRun(edm::RunNumber_t iRun, edm::EventSetup const &eSetup)
Definition: SiStripClassToMonitorCondData.cc:83
mps_fire.i
i
Definition: mps_fire.py:428
SiStripAnalyser::nLumiSecs_
int nLumiSecs_
Definition: SiStripAnalyser.h:68
MessageLogger.h
SiStripFolderOrganizer.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
LuminosityBlock.h
SiStripAnalyser::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: SiStripAnalyser.cc:97
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripFedCabling.h
SiStripAnalyser::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup) override
Definition: SiStripAnalyser.cc:93
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripAnalyser::~SiStripAnalyser
~SiStripAnalyser() override
Definition: SiStripAnalyser.cc:60
SiStripAnalyser::checkTrackerFEDs
void checkTrackerFEDs(edm::Event const &e)
Definition: SiStripAnalyser.cc:155
SiStripActionExecutor::printFaultyModuleList
void printFaultyModuleList(DQMStore &dqm_store, std::ostringstream &str_val)
Definition: SiStripActionExecutor.cc:241
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
SiStripActionExecutor::fillStatus
void fillStatus(DQMStore &dqm_store, edm::ESHandle< SiStripDetCabling > const &fedcabling, edm::EventSetup const &eSetup)
Definition: SiStripActionExecutor.cc:116
SiStripUtility.h
SiStripAnalyser::endRun
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Definition: SiStripAnalyser.cc:141
FileInPath.h
SiStripAnalyser::endJob
void endJob() override
Definition: SiStripAnalyser.cc:145
SiStripAnalyser.h
edm::FileInPath
Definition: FileInPath.h:64
MakerMacros.h
SiStripFedCablingRcd
Definition: SiStripCondDataRecords.h:22
SiStripAnalyser::endLumiAnalysisOn_
bool endLumiAnalysisOn_
Definition: SiStripAnalyser.h:72
SiStripDetCabling.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
groupFilesInBlocks.fin
fin
Definition: groupFilesInBlocks.py:94
Service.h
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
SiStripDetCablingRcd
Definition: SiStripDependentRecords.h:19
SiStripActionExecutor::createShiftReport
void createShiftReport(DQMStore &dqm_store)
Definition: SiStripActionExecutor.cc:131
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripAnalyser::condDataMon_
SiStripClassToMonitorCondData condDataMon_
Definition: SiStripAnalyser.h:50
FEDNumbering::MAXSiStripFEDID
Definition: FEDNumbering.h:30
SiStripAnalyser::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Definition: SiStripAnalyser.cc:70
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCondDataRecords.h
Event.h
SiStripActionExecutor::createStatus
void createStatus(DQMStore &dqm_store)
Definition: SiStripActionExecutor.cc:107
recoMuon::in
Definition: RecoMuonEnumerators.h:6
SiStripAnalyser::trackerFEDsFound_
bool trackerFEDsFound_
Definition: SiStripAnalyser.h:70
edm::Service
Definition: Service.h:30
FEDRawDataCollection.h
SiStripAnalyser::detCabling_
edm::ESHandle< SiStripDetCabling > detCabling_
Definition: SiStripAnalyser.h:65
SiStripAnalyser
Definition: SiStripAnalyser.h:31
edm::EventSetup
Definition: EventSetup.h:57
SiStripActionExecutor::readTkMapConfiguration
bool readTkMapConfiguration(const edm::EventSetup &eSetup)
Definition: SiStripActionExecutor.cc:41
SiStripAnalyser::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup) override
Definition: SiStripAnalyser.cc:113
get
#define get
InputTag.h
SiStripAnalyser::beginJob
void beginJob() override
Definition: SiStripAnalyser.cc:62
SiStripAnalyser::nEvents_
int nEvents_
Definition: SiStripAnalyser.h:69
SiStripActionExecutor::createDummyShiftReport
void createDummyShiftReport()
Definition: SiStripActionExecutor.cc:124
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripAnalyser::printFaultyModuleList_
bool printFaultyModuleList_
Definition: SiStripAnalyser.h:71
SiStripActionExecutor::fillDummyStatus
void fillDummyStatus()
Definition: SiStripActionExecutor.cc:114
SiStripAnalyser::summaryFrequency_
int summaryFrequency_
Definition: SiStripAnalyser.h:54
SiStripAnalyser::SiStripAnalyser
SiStripAnalyser(const edm::ParameterSet &ps)
Definition: SiStripAnalyser.cc:40
SiStripAnalyser::globalStatusFilling_
int globalStatusFilling_
Definition: SiStripAnalyser.h:56
SiStripAnalyser::actionExecutor_
SiStripActionExecutor actionExecutor_
Definition: SiStripAnalyser.h:51
SiStripActionExecutor::readConfiguration
bool readConfiguration()
Definition: SiStripActionExecutor.cc:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripActionExecutor::createSummary
void createSummary(DQMStore &dqm_store)
Definition: SiStripActionExecutor.cc:48
SiStripDetCablingRcd.h
ParameterSet.h
SiStripAnalyser::m_cacheID_
unsigned long long m_cacheID_
Definition: SiStripAnalyser.h:67
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
StripSubdetector.h
edm::InputTag
Definition: InputTag.h:15
SiStripAnalyser::rawDataToken_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
Definition: SiStripAnalyser.h:59
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripAnalyser::shiftReportFrequency_
int shiftReportFrequency_
Definition: SiStripAnalyser.h:57
SiStripAnalyser::fedCabling_
edm::ESHandle< SiStripFedCabling > fedCabling_
Definition: SiStripAnalyser.h:64
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FEDNumbering::MINSiStripFEDID
Definition: FEDNumbering.h:29