28 monitorName_ (parameters_.getUntrackedParameter<string>(
"MonitorName",
"YourSubsystemName")),
29 numberOfValuesToSave_ (0)
84 for(
map<
string,map<string,MonitorElement*> >::iterator itMM=itM->second.begin(); itMM!=itM->second.end(); itMM++){
85 if(itMM->first !=
"run"){
86 for(map<string,MonitorElement*>::iterator itMMM=itMM->second.begin(); itMMM!=itMM->second.end(); itMMM++){
87 if( itMMM->second != 0){
88 if(itMM->first ==
"lumi"){
91 else if(itMM->first ==
"validation"){
95 LogInfo(
"AlcaBeamMonitorClient")
96 <<
"Unrecognized category " << itMM->first;
134 LogInfo(
"AlcaBeamMonitorClient")
135 <<
"The histogram " <<
monitorName_+
"Service/hHistoLumiValues which contains all the values has not been found in any lumi!";
144 LogInfo(
"AlcaBeamMonitorClient")
145 <<
"End of run " << iRun.
id().
run() <<
"(" << firstLumi <<
"-" << lastLumi <<
")";
151 for(
map<
string,map<string,MonitorElement*> >::iterator itMM=itM->second.begin(); itMM!=itM->second.end(); itMM++){
152 if(itMM->first !=
"run"){
153 for(map<string,MonitorElement*>::iterator itMMM=itMM->second.begin(); itMMM!=itMM->second.end(); itMMM++){
154 name = string(
"h") + itM->first + itMMM->first;
155 title = itM->first +
"_{0} " + itMMM->first;
156 if(itMM->first ==
"lumi"){
158 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
160 else if(itMM->first ==
"validation" && itMMM->first ==
"Lumibased Scalers-DataBase fit"){
162 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
164 else if(itMM->first ==
"validation" && itMMM->first !=
"Lumibased Scalers-DataBase fit" && (itM->first ==
"x" || itM->first ==
"y" || itM->first ==
"z")){
167 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
184 else if(itMM->first ==
"validation" && (itM->first ==
"sigmaX" || itM->first ==
"sigmaY" || itM->first ==
"sigmaZ") ){
189 LogInfo(
"AlcaBeamMonitorClient")
190 <<
"Unrecognized category " << itMM->first;
193 if(itMMM->second != 0){
194 if(itMMM->first.find(
'-') != string::npos){
195 itMMM->second->setAxisTitle(
string(
"#Delta ") + itM->first +
"_{0} (cm)",2);
198 itMMM->second->setAxisTitle(itM->first +
"_{0} (cm)",2);
200 itMMM->second->setAxisTitle(
"Lumisection",1);
209 for(
map<
string, map<string,MonitorElement*> >::iterator itHH=itH->second.begin(); itHH!=itH->second.end(); itHH++){
210 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
212 if(itHHH->second != 0){
214 if(itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]+2] == 1){
215 bin = itHHH->second->getTH1()->FindBin(itVal->first);
216 itHHH->second->setBinContent(bin,itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]]);
217 itHHH->second->setBinError(bin,itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]+1]);
226 const double bigNumber = 1000000.;
228 for(
map<
string, map<string,MonitorElement*> >::iterator itHH=itH->second.begin(); itHH!=itH->second.end(); itHH++){
229 double min = bigNumber;
230 double max = -bigNumber;
231 double minDelta = bigNumber;
232 double maxDelta = -bigNumber;
235 if(itHH->first !=
"run"){
236 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
237 if(itHHH->second != 0){
238 for(
int bin=1; bin<=itHHH->second->getTH1()->GetNbinsX(); bin++){
239 if(itHHH->second->getTH1()->GetBinError(bin) != 0 || itHHH->second->getTH1()->GetBinContent(bin) != 0){
240 if(itHHH->first ==
"Lumibased BeamSpotFit"
241 || itHHH->first ==
"Lumibased PrimaryVertex"
242 || itHHH->first ==
"Lumibased DataBase"
243 || itHHH->first ==
"Lumibased Scalers"){
244 if(min > itHHH->second->getTH1()->GetBinContent(bin)){
245 min = itHHH->second->getTH1()->GetBinContent(bin);
247 if(max < itHHH->
second->getTH1()->GetBinContent(bin)){
248 max = itHHH->second->getTH1()->GetBinContent(bin);
251 else if(itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit"
252 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit"
253 || itHHH->first ==
"Lumibased Scalers-DataBase fit"
254 || itHHH->first ==
"Lumibased PrimaryVertex-DataBase"
255 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers"
257 if(minDelta > itHHH->second->getTH1()->GetBinContent(bin)){
258 minDelta = itHHH->second->getTH1()->GetBinContent(bin);
260 if(maxDelta < itHHH->
second->getTH1()->GetBinContent(bin)){
261 maxDelta = itHHH->second->getTH1()->GetBinContent(bin);
276 LogInfo(
"AlcaBeamMonitorClient")
277 <<
"The histosMap_ have a histogram named " << itHHH->first <<
" that I can't recognize in this loop!";
285 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
288 if(itHHH->second != 0){
289 if(itHHH->first ==
"Lumibased BeamSpotFit"
290 || itHHH->first ==
"Lumibased PrimaryVertex"
291 || itHHH->first ==
"Lumibased DataBase"
292 || itHHH->first ==
"Lumibased Scalers"){
293 if((max == -bigNumber && min == bigNumber) || max-min == 0){
294 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum()-0.01);
295 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum()+0.01);
298 itHHH->second->getTH1()->SetMinimum(min-0.1*(max-min));
299 itHHH->second->getTH1()->SetMaximum(max+0.1*(max-min));
302 else if(itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit"
303 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit"
304 || itHHH->first ==
"Lumibased Scalers-DataBase fit"
305 || itHHH->first ==
"Lumibased PrimaryVertex-DataBase"
306 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers"
308 if((maxDelta == -bigNumber && minDelta == bigNumber) || maxDelta-minDelta == 0){
309 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum()-0.01);
310 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum()+0.01);
313 itHHH->second->getTH1()->SetMinimum(minDelta-2*(maxDelta-minDelta));
314 itHHH->second->getTH1()->SetMaximum(maxDelta+2*(maxDelta-minDelta));
331 LogInfo(
"AlcaBeamMonitorClient")
332 <<
"The histosMap_ have a histogram named " << itHHH->first <<
" that I can't recognize in this loop!";
LuminosityBlockID id() const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
#define DEFINE_FWK_MODULE(type)
PositionContainer positionsMap_
HistosContainer histosMap_
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup)
unsigned int LuminosityBlockNumber_t
std::multimap< std::string, std::string > histoByCategoryNames_
U second(std::pair< T, U > const &p)
const T & max(const T &a, const T &b)
void removeElement(const std::string &name)
int numberOfValuesToSave_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup)
LuminosityBlockNumber_t luminosityBlock() const
AlcaBeamMonitorClient(const edm::ParameterSet &)
std::vector< std::vector< double > > tmp
std::map< edm::LuminosityBlockNumber_t, std::vector< double > > valuesMap_
std::vector< std::string > varNamesV_
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
TProfile * getTProfile(void) const
void beginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
void endLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
void setCurrentFolder(const std::string &fullpath)