00001 #include "DQM/L1TMonitorClient/interface/L1TGCTClient.h"
00002
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/EventSetup.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "DQMServices/Core/interface/QReport.h"
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "DQMServices/Core/interface/MonitorElement.h"
00011
00012 using namespace edm;
00013 using namespace std;
00014
00015
00016 const unsigned int ETABINS = 22;
00017 const float ETAMIN = -0.5;
00018 const float ETAMAX = 21.5;
00019
00020 const unsigned int PHIBINS = 18;
00021 const float PHIMIN = -0.5;
00022 const float PHIMAX = 17.5;
00023
00024 L1TGCTClient::L1TGCTClient(const edm::ParameterSet& ps):
00025 monitorDir_(ps.getUntrackedParameter<string>("monitorDir","")),
00026 counterLS_(0),
00027 counterEvt_(0),
00028 prescaleLS_(ps.getUntrackedParameter<int>("prescaleLS", -1)),
00029 prescaleEvt_(ps.getUntrackedParameter<int>("prescaleEvt", -1))
00030 {
00031 }
00032
00033 L1TGCTClient::~L1TGCTClient(){}
00034
00035 void L1TGCTClient::beginJob(void)
00036 {
00037
00038 dbe_ = Service<DQMStore>().operator->();
00039
00040
00041 dbe_->setCurrentFolder(monitorDir_);
00042
00043 l1GctIsoEmOccEta_ = dbe_->book1D("IsoEmOccEta","ISO EM #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00044 l1GctIsoEmOccPhi_ = dbe_->book1D("IsoEmOccPhi","ISO EM #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00045 l1GctNonIsoEmOccEta_ = dbe_->book1D("NonIsoEmOccEta","NON-ISO EM #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00046 l1GctNonIsoEmOccPhi_ = dbe_->book1D("NonIsoEmOccPhi","NON-ISO EM #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00047 l1GctAllJetsOccEta_ = dbe_->book1D("AllJetsOccEta","CENTRAL AND FORWARD JET #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00048 l1GctAllJetsOccPhi_ = dbe_->book1D("AllJetsOccPhi","CENTRAL AND FORWARD JET #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00049 l1GctCenJetsOccEta_ = dbe_->book1D("CenJetsOccEta","CENTRAL JET #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00050 l1GctCenJetsOccPhi_ = dbe_->book1D("CenJetsOccPhi","CENTRAL JET #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00051 l1GctForJetsOccEta_ = dbe_->book1D("ForJetsOccEta","FORWARD JET #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00052 l1GctForJetsOccPhi_ = dbe_->book1D("ForJetsOccPhi","FORWARD JET #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00053 l1GctTauJetsOccEta_ = dbe_->book1D("TauJetsOccEta","TAU JET #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
00054 l1GctTauJetsOccPhi_ = dbe_->book1D("TauJetsOccPhi","TAU JET #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
00055 }
00056
00057 void L1TGCTClient::beginRun(const Run& r, const EventSetup& context) {}
00058
00059 void L1TGCTClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {}
00060
00061 void L1TGCTClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c)
00062 {
00063 if (dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")!=NULL){
00064 makeXProjection(dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")->getTH2F(),l1GctIsoEmOccEta_);
00065 makeYProjection(dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")->getTH2F(),l1GctIsoEmOccPhi_);
00066 }
00067
00068 if (dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")!=NULL){
00069 makeXProjection(dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")->getTH2F(),l1GctNonIsoEmOccEta_);
00070 makeYProjection(dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")->getTH2F(),l1GctNonIsoEmOccPhi_);
00071 }
00072
00073 if (dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")!=NULL){
00074 makeXProjection(dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")->getTH2F(),l1GctAllJetsOccEta_);
00075 makeYProjection(dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")->getTH2F(),l1GctAllJetsOccPhi_);
00076 }
00077
00078 if (dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")!=NULL){
00079 makeXProjection(dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")->getTH2F(),l1GctCenJetsOccEta_);
00080 makeYProjection(dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")->getTH2F(),l1GctCenJetsOccPhi_);
00081 }
00082
00083 if (dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")!=NULL){
00084 makeXProjection(dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")->getTH2F(),l1GctForJetsOccEta_);
00085 makeYProjection(dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")->getTH2F(),l1GctForJetsOccPhi_);
00086 }
00087
00088 if (dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")!=NULL){
00089 makeXProjection(dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")->getTH2F(),l1GctTauJetsOccEta_);
00090 makeYProjection(dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")->getTH2F(),l1GctTauJetsOccPhi_);
00091 }
00092 }
00093
00094 void L1TGCTClient::analyze(const Event& e, const EventSetup& context){}
00095
00096 void L1TGCTClient::endRun(const Run& r, const EventSetup& context)
00097 {
00098 if (dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")!=NULL){
00099 makeXProjection(dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")->getTH2F(),l1GctIsoEmOccEta_);
00100 makeYProjection(dbe_->get("L1T/L1TGCT/IsoEmOccEtaPhi")->getTH2F(),l1GctIsoEmOccPhi_);
00101 }
00102
00103 if (dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")!=NULL){
00104 makeXProjection(dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")->getTH2F(),l1GctNonIsoEmOccEta_);
00105 makeYProjection(dbe_->get("L1T/L1TGCT/NonIsoEmOccEtaPhi")->getTH2F(),l1GctNonIsoEmOccPhi_);
00106 }
00107
00108 if (dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")!=NULL){
00109 makeXProjection(dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")->getTH2F(),l1GctAllJetsOccEta_);
00110 makeYProjection(dbe_->get("L1T/L1TGCT/AllJetsOccEtaPhi")->getTH2F(),l1GctAllJetsOccPhi_);
00111 }
00112
00113 if (dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")!=NULL){
00114 makeXProjection(dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")->getTH2F(),l1GctCenJetsOccEta_);
00115 makeYProjection(dbe_->get("L1T/L1TGCT/CenJetsOccEtaPhi")->getTH2F(),l1GctCenJetsOccPhi_);
00116 }
00117
00118 if (dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")!=NULL){
00119 makeXProjection(dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")->getTH2F(),l1GctForJetsOccEta_);
00120 makeYProjection(dbe_->get("L1T/L1TGCT/ForJetsOccEtaPhi")->getTH2F(),l1GctForJetsOccPhi_);
00121 }
00122
00123 if (dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")!=NULL){
00124 makeXProjection(dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")->getTH2F(),l1GctTauJetsOccEta_);
00125 makeYProjection(dbe_->get("L1T/L1TGCT/TauJetsOccEtaPhi")->getTH2F(),l1GctTauJetsOccPhi_);
00126 }
00127 }
00128
00129 void L1TGCTClient::endJob(){}
00130
00131 void L1TGCTClient::makeXProjection(TH2F* input, MonitorElement* output)
00132 {
00133
00134 if (input->GetNbinsX() != output->getNbinsX()) return;
00135
00136
00137 TH1D* projX = input->ProjectionX();
00138
00139 for (Int_t i=0; i<projX->GetNbinsX(); i++) {
00140 output->setBinContent(i+1,projX->GetBinContent(i+1));
00141 }
00142 delete projX;
00143 }
00144
00145 void L1TGCTClient::makeYProjection(TH2F* input, MonitorElement* output)
00146 {
00147
00148 if (input->GetNbinsY() != output->getNbinsX()) return;
00149
00150
00151 TH1D* projY = input->ProjectionY();
00152
00153 for (Int_t i=0; i<projY->GetNbinsX(); i++) {
00154 output->setBinContent(i+1,projY->GetBinContent(i+1));
00155 }
00156 delete projY;
00157 }
00158
00159