25 monitorName_(parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
26 numberOfValuesToSave_(0) {
52 histosMap_[*itV][itM->first][itM->second] =
nullptr;
89 LogInfo(
"AlcaBeamMonitorClient") <<
"The histogram "
91 "Service/hHistoLumiValues which contains all the values has not "
92 "been found in any lumi!";
101 LogInfo(
"AlcaBeamMonitorClient") <<
"End of run " << iRun.
id().
run() <<
"(" << firstLumi <<
"-" << lastLumi <<
")";
107 for (map<
string, map<string, MonitorElement*> >::iterator itMM = itM->second.begin(); itMM != itM->second.end();
109 if (itMM->first !=
"run") {
110 for (map<string, MonitorElement*>::iterator itMMM = itMM->second.begin(); itMMM != itMM->second.end();
112 name =
string(
"h") + itM->first + itMMM->first;
113 title = itM->first +
"_{0} " + itMMM->first;
114 if (itMM->first ==
"lumi") {
116 itMMM->second =
dbe_->
book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
118 }
else if (itMM->first ==
"validation" && itMMM->first ==
"Lumibased Scalers-DataBase fit") {
120 itMMM->second =
dbe_->
book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
122 }
else if (itMM->first ==
"validation" && itMMM->first !=
"Lumibased Scalers-DataBase fit" &&
123 (itM->first ==
"x" || itM->first ==
"y" || itM->first ==
"z")) {
125 itMMM->second =
dbe_->
book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
127 }
else if (itMM->first ==
"validation" &&
128 (itM->first ==
"sigmaX" || itM->first ==
"sigmaY" || itM->first ==
"sigmaZ")) {
130 itMMM->second =
nullptr;
132 LogInfo(
"AlcaBeamMonitorClient") <<
"Unrecognized category " << itMM->first;
135 if (itMMM->second !=
nullptr) {
136 if (itMMM->first.find(
'-') != string::npos) {
137 itMMM->second->setAxisTitle(
string(
"#Delta ") + itM->first +
"_{0} (cm)", 2);
139 itMMM->second->setAxisTitle(itM->first +
"_{0} (cm)", 2);
141 itMMM->second->setAxisTitle(
"Lumisection", 1);
148 unsigned int bin = 0;
150 for (map<
string, map<string, MonitorElement*> >::iterator itHH = itH->second.begin(); itHH != itH->second.end();
152 for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin(); itHHH != itHH->second.end(); itHHH++) {
156 if (itHHH->second !=
nullptr) {
159 if (itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first] + 2] == 1) {
160 bin = itHHH->second->getTH1()->FindBin(itVal->first);
161 itHHH->second->setBinContent(bin, itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]]);
162 itHHH->second->setBinError(bin, itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first] + 1]);
171 const double bigNumber = 1000000.;
173 for (map<
string, map<string, MonitorElement*> >::iterator itHH = itH->second.begin(); itHH != itH->second.end();
175 double min = bigNumber;
176 double max = -bigNumber;
177 double minDelta = bigNumber;
178 double maxDelta = -bigNumber;
181 if (itHH->first !=
"run") {
182 for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin(); itHHH != itHH->second.end();
184 if (itHHH->second !=
nullptr) {
185 for (
int bin = 1; bin <= itHHH->second->getTH1()->GetNbinsX(); bin++) {
186 if (itHHH->second->getTH1()->GetBinError(bin) != 0 || itHHH->second->getTH1()->GetBinContent(bin) != 0) {
187 if (itHHH->first ==
"Lumibased BeamSpotFit" || itHHH->first ==
"Lumibased PrimaryVertex" ||
188 itHHH->first ==
"Lumibased DataBase" || itHHH->first ==
"Lumibased Scalers") {
189 if (min > itHHH->second->getTH1()->GetBinContent(bin)) {
190 min = itHHH->second->getTH1()->GetBinContent(bin);
192 if (max < itHHH->
second->getTH1()->GetBinContent(bin)) {
193 max = itHHH->second->getTH1()->GetBinContent(bin);
195 }
else if (itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit" ||
196 itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit" ||
197 itHHH->first ==
"Lumibased Scalers-DataBase fit" ||
198 itHHH->first ==
"Lumibased PrimaryVertex-DataBase" ||
199 itHHH->first ==
"Lumibased PrimaryVertex-Scalers") {
200 if (minDelta > itHHH->second->getTH1()->GetBinContent(bin)) {
201 minDelta = itHHH->second->getTH1()->GetBinContent(bin);
203 if (maxDelta < itHHH->
second->getTH1()->GetBinContent(bin)) {
204 maxDelta = itHHH->second->getTH1()->GetBinContent(bin);
207 LogInfo(
"AlcaBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH->first
208 <<
" that I can't recognize in this loop!";
215 for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin(); itHHH != itHH->second.end();
217 if (itHHH->second !=
nullptr) {
218 if (itHHH->first ==
"Lumibased BeamSpotFit" || itHHH->first ==
"Lumibased PrimaryVertex" ||
219 itHHH->first ==
"Lumibased DataBase" || itHHH->first ==
"Lumibased Scalers") {
220 if ((max == -bigNumber && min == bigNumber) || max - min == 0) {
221 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01);
222 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01);
224 itHHH->second->getTH1()->SetMinimum(min - 0.1 * (max - min));
225 itHHH->second->getTH1()->SetMaximum(max + 0.1 * (max - min));
227 }
else if (itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit" ||
228 itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit" ||
229 itHHH->first ==
"Lumibased Scalers-DataBase fit" ||
230 itHHH->first ==
"Lumibased PrimaryVertex-DataBase" ||
231 itHHH->first ==
"Lumibased PrimaryVertex-Scalers") {
232 if ((maxDelta == -bigNumber && minDelta == bigNumber) || maxDelta - minDelta == 0) {
233 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01);
234 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01);
236 itHHH->second->getTH1()->SetMinimum(minDelta - 2 * (maxDelta - minDelta));
237 itHHH->second->getTH1()->SetMaximum(maxDelta + 2 * (maxDelta - minDelta));
240 LogInfo(
"AlcaBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH->first
241 <<
" that I can't recognize in this loop!";
LuminosityBlockID id() const
#define DEFINE_FWK_MODULE(type)
void beginJob(void) override
void setCurrentFolder(std::string const &fullpath) override
PositionContainer positionsMap_
HistosContainer histosMap_
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
std::multimap< std::string, std::string > histoByCategoryNames_
unsigned int LuminosityBlockNumber_t
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
U second(std::pair< T, U > const &p)
virtual MonitorElement * get(std::string const &fullpath) const
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
int numberOfValuesToSave_
Log< level::Info, false > LogInfo
~AlcaBeamMonitorClient() override
std::map< edm::LuminosityBlockNumber_t, std::vector< double > > valuesMap_
virtual TProfile * getTProfile() const
LuminosityBlockNumber_t luminosityBlock() const
AlcaBeamMonitorClient(const edm::ParameterSet &)
std::vector< std::string > varNamesV_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void endLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override