26 monitorName_ (parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
27 numberOfValuesToSave_ (0)
82 for(
map<
string,map<string,MonitorElement*> >::iterator itMM=itM->second.begin(); itMM!=itM->second.end(); itMM++){
83 if(itMM->first !=
"run"){
84 for(map<string,MonitorElement*>::iterator itMMM=itMM->second.begin(); itMMM!=itMM->second.end(); itMMM++){
85 if( itMMM->second != 0){
86 if(itMM->first ==
"lumi"){
89 else if(itMM->first ==
"validation"){
93 LogInfo(
"AlcaBeamMonitorClient")
94 <<
"Unrecognized category " << itMM->first;
132 LogInfo(
"AlcaBeamMonitorClient")
133 <<
"The histogram " <<
monitorName_+
"Service/hHistoLumiValues which contains all the values has not been found in any lumi!";
142 LogInfo(
"AlcaBeamMonitorClient")
143 <<
"End of run " << iRun.
id().
run() <<
"(" << firstLumi <<
"-" << lastLumi <<
")";
149 for(
map<
string,map<string,MonitorElement*> >::iterator itMM=itM->second.begin(); itMM!=itM->second.end(); itMM++){
150 if(itMM->first !=
"run"){
151 for(map<string,MonitorElement*>::iterator itMMM=itMM->second.begin(); itMMM!=itMM->second.end(); itMMM++){
152 name =
string(
"h") + itM->first + itMMM->first;
153 title = itM->first +
"_{0} " + itMMM->first;
154 if(itMM->first ==
"lumi"){
156 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
158 else if(itMM->first ==
"validation" && itMMM->first ==
"Lumibased Scalers-DataBase fit"){
160 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
162 else if(itMM->first ==
"validation" && itMMM->first !=
"Lumibased Scalers-DataBase fit" && (itM->first ==
"x" || itM->first ==
"y" || itM->first ==
"z")){
165 itMMM->second =
dbe_->
book1D(name,title,lastLumi-firstLumi+1,firstLumi-0.5,lastLumi+0.5);
182 else if(itMM->first ==
"validation" && (itM->first ==
"sigmaX" || itM->first ==
"sigmaY" || itM->first ==
"sigmaZ") ){
187 LogInfo(
"AlcaBeamMonitorClient")
188 <<
"Unrecognized category " << itMM->first;
191 if(itMMM->second != 0){
192 if(itMMM->first.find(
'-') != string::npos){
193 itMMM->second->setAxisTitle(
string(
"#Delta ") + itM->first +
"_{0} (cm)",2);
196 itMMM->second->setAxisTitle(itM->first +
"_{0} (cm)",2);
198 itMMM->second->setAxisTitle(
"Lumisection",1);
207 for(
map<
string, map<string,MonitorElement*> >::iterator itHH=itH->second.begin(); itHH!=itH->second.end(); itHH++){
208 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
210 if(itHHH->second != 0){
212 if(itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]+2] == 1){
213 bin = itHHH->second->getTH1()->FindBin(itVal->first);
214 itHHH->second->setBinContent(bin,itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]]);
215 itHHH->second->setBinError(bin,itVal->second[
positionsMap_[itH->first][itHH->first][itHHH->first]+1]);
224 const double bigNumber = 1000000.;
226 for(
map<
string, map<string,MonitorElement*> >::iterator itHH=itH->second.begin(); itHH!=itH->second.end(); itHH++){
227 double min = bigNumber;
228 double max = -bigNumber;
229 double minDelta = bigNumber;
230 double maxDelta = -bigNumber;
233 if(itHH->first !=
"run"){
234 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
235 if(itHHH->second != 0){
236 for(
int bin=1; bin<=itHHH->second->getTH1()->GetNbinsX(); bin++){
237 if(itHHH->second->getTH1()->GetBinError(bin) != 0 || itHHH->second->getTH1()->GetBinContent(bin) != 0){
238 if(itHHH->first ==
"Lumibased BeamSpotFit"
239 || itHHH->first ==
"Lumibased PrimaryVertex"
240 || itHHH->first ==
"Lumibased DataBase"
241 || itHHH->first ==
"Lumibased Scalers"){
242 if(min > itHHH->second->getTH1()->GetBinContent(bin)){
243 min = itHHH->second->getTH1()->GetBinContent(bin);
245 if(max < itHHH->
second->getTH1()->GetBinContent(bin)){
246 max = itHHH->second->getTH1()->GetBinContent(bin);
249 else if(itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit"
250 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit"
251 || itHHH->first ==
"Lumibased Scalers-DataBase fit"
252 || itHHH->first ==
"Lumibased PrimaryVertex-DataBase"
253 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers"
255 if(minDelta > itHHH->second->getTH1()->GetBinContent(bin)){
256 minDelta = itHHH->second->getTH1()->GetBinContent(bin);
258 if(maxDelta < itHHH->
second->getTH1()->GetBinContent(bin)){
259 maxDelta = itHHH->second->getTH1()->GetBinContent(bin);
274 LogInfo(
"AlcaBeamMonitorClient")
275 <<
"The histosMap_ have a histogram named " << itHHH->first <<
" that I can't recognize in this loop!";
283 for(map<string,MonitorElement*>::iterator itHHH=itHH->second.begin(); itHHH!=itHH->second.end(); itHHH++){
286 if(itHHH->second != 0){
287 if(itHHH->first ==
"Lumibased BeamSpotFit"
288 || itHHH->first ==
"Lumibased PrimaryVertex"
289 || itHHH->first ==
"Lumibased DataBase"
290 || itHHH->first ==
"Lumibased Scalers"){
291 if((max == -bigNumber && min == bigNumber) || max-min == 0){
292 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum()-0.01);
293 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum()+0.01);
296 itHHH->second->getTH1()->SetMinimum(min-0.1*(max-min));
297 itHHH->second->getTH1()->SetMaximum(max+0.1*(max-min));
300 else if(itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit"
301 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit"
302 || itHHH->first ==
"Lumibased Scalers-DataBase fit"
303 || itHHH->first ==
"Lumibased PrimaryVertex-DataBase"
304 || itHHH->first ==
"Lumibased PrimaryVertex-Scalers"
306 if((maxDelta == -bigNumber && minDelta == bigNumber) || maxDelta-minDelta == 0){
307 itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum()-0.01);
308 itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum()+0.01);
311 itHHH->second->getTH1()->SetMinimum(minDelta-2*(maxDelta-minDelta));
312 itHHH->second->getTH1()->SetMaximum(maxDelta+2*(maxDelta-minDelta));
329 LogInfo(
"AlcaBeamMonitorClient")
330 <<
"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)