5 #include "DQM/SiStripMonitorHardware/interface/CMHistograms.hh" 7 CMHistograms::CMHistograms() {
8 for (
unsigned int i(0);
i < 500;
i++) {
13 CMHistograms::~CMHistograms() {}
15 void CMHistograms::initialise(
const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) {
16 getConfigForHistogram(medianAPV1vsAPV0_,
"MedianAPV1vsAPV0", iConfig, pDebugStream);
17 getConfigForHistogram(medianAPV0minusAPV1_,
"MedianAPV0minusAPV1", iConfig, pDebugStream);
19 getConfigForHistogram(meanCMPerFedvsFedId_,
"MeanCMPerFedvsFedId", iConfig, pDebugStream);
20 getConfigForHistogram(meanCMPerFedvsTime_,
"MeanCMPerFedvsTime", iConfig, pDebugStream);
21 getConfigForHistogram(variationsPerFedvsFedId_,
"VariationsPerFedvsFedId", iConfig, pDebugStream);
22 getConfigForHistogram(variationsPerFedvsTime_,
"VariationsPerFedvsTime", iConfig, pDebugStream);
24 getConfigForHistogram(medianAPV1vsAPV0perFED_,
"MedianAPV1vsAPV0perFED", iConfig, pDebugStream);
25 getConfigForHistogram(medianAPV0minusAPV1perFED_,
"MedianAPV0minusAPV1perFED", iConfig, pDebugStream);
27 getConfigForHistogram(medianperChannel_,
"MedianperChannel", iConfig, pDebugStream);
28 getConfigForHistogram(medianAPV0minusAPV1perChannel_,
"MedianAPV0minusAPV1perChannel", iConfig, pDebugStream);
30 getConfigForHistogram(tkMapConfig_,
"TkHistoMap", iConfig, pDebugStream);
32 if (iConfig.
exists(
"FedIdVec")) {
33 std::vector<unsigned int> lIdVec = iConfig.
getUntrackedParameter<std::vector<unsigned int> >(
"FedIdVec");
34 for (
unsigned int i(0);
i < lIdVec.size();
i++) {
35 if (lIdVec.at(
i) < 500)
36 doFed_[lIdVec.at(
i)] =
true;
45 for (
unsigned iEle(0); iEle < aVec.size(); iEle++) {
47 CMvalues lVal = aVec[iEle];
49 if (lVal.Medians.first >= 1024 || lVal.Medians.second >= 1024) {
50 std::cout <<
"----- WARNING ! New max found: " << lVal.Medians.first <<
" " << lVal.Medians.second <<
" " 51 << __FILE__ <<
" " << __LINE__ << std::endl;
54 fillHistogram(medianAPV1vsAPV0_, lVal.Medians.first, lVal.Medians.second);
55 fillHistogram(medianAPV0minusAPV1_, lVal.Medians.first - lVal.Medians.second);
57 lMean += lVal.Medians.first + lVal.Medians.second;
58 lPrevMean += lVal.PreviousMedians.first + lVal.PreviousMedians.second;
61 fillHistogram(medianAPV1vsAPV0perFEDMap_[aFedId], lVal.Medians.first, lVal.Medians.second);
62 fillHistogram(medianAPV0minusAPV1perFEDMap_[aFedId], lVal.Medians.first - lVal.Medians.second);
63 fillHistogram(medianperChannelMap_[aFedId][lVal.ChannelID], lVal.Medians.first);
64 fillHistogram(medianAPV0minusAPV1perChannelMap_[aFedId][lVal.ChannelID],
65 lVal.Medians.first - lVal.Medians.second);
71 lMean = lMean / (2 * aVec.size());
72 lPrevMean = lPrevMean / (2 * aVec.size());
75 fillHistogram(meanCMPerFedvsFedId_, aFedId, lMean);
76 fillHistogram(meanCMPerFedvsTime_, aTime, lMean);
77 fillHistogram(variationsPerFedvsFedId_, aFedId, lMean - lPrevMean);
78 fillHistogram(variationsPerFedvsTime_, aTime, lMean - lPrevMean);
81 void CMHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker,
const TkDetMap* tkDetMap) {
86 histosBooked_.resize(siStripFedIdMax + 1,
false);
92 ibooker.setCurrentFolder(lDir);
94 book2DHistogram(ibooker,
97 "median APV1 vs APV0",
107 bookHistogram(ibooker,
108 medianAPV0minusAPV1_,
109 "MedianAPV0minusAPV1",
110 "median APV0 - median APV1",
114 "median APV0 - median APV1");
117 meanCMPerFedvsFedId_,
118 "MeanCMPerFedvsFedId",
128 bookProfile(ibooker, meanCMPerFedvsTime_,
"MeanCMPerFedvsTime",
"<CM> vs time", 0, 1000,
"Time",
"<CM>^{FED}");
131 variationsPerFedvsFedId_,
132 "VariationsPerFedvsFedId",
140 "<CM>^{FED}_{t}-<CM>^{FED}_{t-1}");
143 variationsPerFedvsTime_,
144 "VariationsPerFedvsTime",
149 "<CM>^{FED}_{t}-<CM>^{FED}_{t-1}");
154 if (tkMapConfig_.enabled) {
155 tkmapCM_[0] = std::make_unique<TkHistoMap>(tkDetMap,
"SiStrip/TkHisto",
"TkHMap_MeanCMAPV", 0.,
true);
156 tkmapCM_[1] = std::make_unique<TkHistoMap>(tkDetMap,
"SiStrip/TkHisto",
"TkHMap_RmsCMAPV", 0.,
true);
157 tkmapCM_[2] = std::make_unique<TkHistoMap>(tkDetMap,
"SiStrip/TkHisto",
"TkHMap_MeanCMAPV0minusAPV1", -500.,
true);
158 tkmapCM_[3] = std::make_unique<TkHistoMap>(tkDetMap,
"SiStrip/TkHisto",
"TkHMap_RmsCMAPV0minusAPV1", -500.,
true);
160 tkmapCM_[0] =
nullptr;
161 tkmapCM_[1] =
nullptr;
162 tkmapCM_[2] =
nullptr;
163 tkmapCM_[3] =
nullptr;
168 bookFEDHistograms(ibooker, i);
171 void CMHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker,
unsigned int fedId) {
172 if (!histosBooked_[fedId]) {
176 std::stringstream fedIdStream;
177 fedIdStream <<
fedId;
179 ibooker.setCurrentFolder(fedKey.path());
181 book2DHistogram(ibooker,
182 medianAPV1vsAPV0perFED_,
183 medianAPV1vsAPV0perFEDMap_[fedId],
184 "MedianAPV1vsAPV0forFED" + fedIdStream.str(),
185 "median APV1 vs APV0 for FED " + fedIdStream.str(),
195 bookHistogram(ibooker,
196 medianAPV0minusAPV1perFED_,
197 medianAPV0minusAPV1perFEDMap_[fedId],
198 "MedianAPV0minusAPV1forFED" + fedIdStream.str(),
199 "median APV0 - median APV1 for FED " + fedIdStream.str(),
205 bookChannelsHistograms(ibooker, fedId);
207 histosBooked_[
fedId] =
true;
211 void CMHistograms::bookChannelsHistograms(DQMStore::IBooker& ibooker,
unsigned int fedId) {
213 std::stringstream fedIdStream;
214 fedIdStream <<
fedId;
216 ibooker.setCurrentFolder(fedKey.path());
221 std::ostringstream lName0, lTitle0, lName1, lTitle1, lName2, lTitle2;
222 lName0 <<
"MedianForFed" << fedId <<
"Channel" << iCh;
223 lTitle0 <<
"Median for FED/Ch " << fedId <<
"/" << iCh;
224 lName2 <<
"MedianAPV0minusAPV1ForFed" << fedId <<
"Channel" << iCh;
225 lTitle2 <<
"Median APV0-APV1 for FED/Ch " << fedId <<
"/" << iCh;
227 bookHistogram(ibooker,
229 medianperChannelMap_[fedId][iCh],
237 bookHistogram(ibooker,
238 medianAPV0minusAPV1perChannel_,
239 medianAPV0minusAPV1perChannelMap_[fedId][iCh],
249 void CMHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker) {
254 for (
unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) {
255 bookFEDHistograms(ibooker, iFed);
259 bool CMHistograms::tkHistoMapEnabled(
unsigned int aIndex) {
return tkMapConfig_.enabled; }
261 TkHistoMap* CMHistograms::tkHistoMapPointer(
unsigned int aIndex) {
263 return tkmapCM_[aIndex].get();
T getUntrackedParameter(std::string const &, T const &) const
static const uint16_t FED_ID_MIN
A container class for generic run and event-related info, information required by the commissioning a...
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Constants and enumerated types for FED/FEC systems.
static const uint16_t FEDCH_PER_FED
static const uint16_t FED_ID_MAX