Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQM/RPCMonitorClient/interface/RPCEfficiencyShiftHisto.h"
00011 #include <sstream>
00012
00013
00014 #include "CondFormats/RunInfo/interface/RunInfo.h"
00015 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00016
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 #include "FWCore/Framework/interface/LuminosityBlock.h"
00019 #include "FWCore/Framework/interface/Event.h"
00020 #include "FWCore/Framework/interface/EventSetup.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022
00023 #include "DQMServices/Core/interface/DQMStore.h"
00024
00025 RPCEfficiencyShiftHisto::RPCEfficiencyShiftHisto(const edm::ParameterSet& ps) {
00026
00027 globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
00028 effCut_= ps.getUntrackedParameter<int>("EffCut", 90);
00029 SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
00030 NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
00031 numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
00032 }
00033
00034
00035 RPCEfficiencyShiftHisto::~RPCEfficiencyShiftHisto(){ }
00036
00037 void RPCEfficiencyShiftHisto::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){}
00038
00039 void RPCEfficiencyShiftHisto::beginJob(){
00040
00041 dbe_ = edm::Service<DQMStore>().operator->();
00042 }
00043
00044 void RPCEfficiencyShiftHisto::beginRun(const edm::Run& r, const edm::EventSetup& c){
00045
00046 if(dbe_ == 0) return;
00047
00048 dbe_->setCurrentFolder(globalFolder_);
00049 EffBarrelRoll = dbe_->book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
00050 EffEndcapPlusRoll = dbe_->book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
00051 EffEndcapMinusRoll = dbe_->book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
00052 RollPercentage = dbe_->book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);
00053
00054 RollPercentage->setBinLabel(1,"%",1);
00055 RollPercentage->setBinLabel(1,"E+",2);
00056 RollPercentage->setBinLabel(2,"B",2);
00057 RollPercentage->setBinLabel(3,"E-",2);
00058 }
00059
00060 void RPCEfficiencyShiftHisto::endRun(const edm::Run& r, const edm::EventSetup& c){
00061
00062 std::stringstream meName;
00063 MonitorElement * myMe;
00064
00065 meName.str("");
00066 meName<<globalFolder_;
00067
00068
00069
00070 int entriesBarrel = 0;
00071 int entriesBarrelBeyondEff = 0;
00072 float percBarrel = 0;
00073
00074 for(int w = -2 ; w<3; w++){
00075
00076 meName.str("");
00077 if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
00078 else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;
00079
00080 myMe = dbe_->get(meName.str());
00081
00082 if(myMe){
00083 for(int s = 1; s <= myMe->getNbinsX(); s++){
00084 for(int r = 1;r <= myMe->getNbinsY(); r++){
00085
00086 double effBarrel = myMe->getBinContent(s,r);
00087
00088 if(effBarrel >= 0){
00089
00090 if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
00091 entriesBarrel++;
00092
00093 if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
00094 }
00095 }
00096 }
00097 }
00098 }
00099
00100 if(entriesBarrel != 0){
00101 percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
00102 if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}
00103
00104
00105
00106
00107 int entriesEndcapMinus = 0;
00108 int entriesEndcapMinusBeyondEff = 0;
00109 float percEndcapMinus = 0;
00110 int entriesEndcapPlus = 0;
00111 int entriesEndcapPlusBeyondEff = 0;
00112 float percEndcapPlus = 0;
00113 for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
00114
00115 if(d == 0) continue;
00116
00117 meName.str("");
00118 meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
00119 myMe = dbe_->get(meName.str());
00120
00121
00122 if(myMe){
00123
00124 for (int x = 1 ;x <= myMe->getNbinsX();x++){
00125 for(int y = 1;y<=myMe->getNbinsY(); y++){
00126
00127 double effEndcap = myMe->getBinContent(x,y);
00128
00129 if(d<0 ){
00130 entriesEndcapMinus++;
00131 if(EffEndcapMinusRoll)EffEndcapMinusRoll->Fill(effEndcap);
00132 if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
00133 }else {
00134 entriesEndcapPlus++;
00135 if(EffEndcapPlusRoll)EffEndcapPlusRoll->Fill(effEndcap);
00136 if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
00137 }
00138 }
00139 }
00140 }
00141 }
00142
00143
00144 if(entriesEndcapMinus != 0){
00145 percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
00146 if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}
00147
00148
00149 if(entriesEndcapPlus != 0){
00150 percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
00151 if(RollPercentage) RollPercentage->setBinContent(1,1,percEndcapPlus);
00152 }
00153
00154 if(SaveFile) dbe_->save(NameFile);
00155
00156 }
00157
00158