Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:50

0001 #include "DQM/L1TMonitorClient/interface/L1TGCTClient.h"
0002 
0003 #include "FWCore/ServiceRegistry/interface/Service.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 
0010 using namespace edm;
0011 using namespace std;
0012 
0013 // Define statics for bins etc.

0014 const unsigned int ETABINS = 22;
0015 const float ETAMIN = -0.5;
0016 const float ETAMAX = 21.5;
0017 
0018 const unsigned int PHIBINS = 18;
0019 const float PHIMIN = -0.5;
0020 const float PHIMAX = 17.5;
0021 
0022 L1TGCTClient::L1TGCTClient(const edm::ParameterSet& ps)
0023     : monitorDir_(ps.getUntrackedParameter<string>("monitorDir", "")),
0024       counterLS_(0),
0025       counterEvt_(0),
0026       prescaleLS_(ps.getUntrackedParameter<int>("prescaleLS", -1)),
0027       prescaleEvt_(ps.getUntrackedParameter<int>("prescaleEvt", -1)),
0028       m_runInEventLoop(ps.getUntrackedParameter<bool>("runInEventLoop", false)),
0029       m_runInEndLumi(ps.getUntrackedParameter<bool>("runInEndLumi", false)),
0030       m_runInEndRun(ps.getUntrackedParameter<bool>("runInEndRun", false)),
0031       m_runInEndJob(ps.getUntrackedParameter<bool>("runInEndJob", false)),
0032       m_stage1_layer2_(ps.getUntrackedParameter<bool>("stage1_layer2_"))
0033 
0034 {}
0035 
0036 L1TGCTClient::~L1TGCTClient() {}
0037 
0038 void L1TGCTClient::book(DQMStore::IBooker& ibooker) {
0039   // Set to directory with ME in

0040   ibooker.setCurrentFolder(monitorDir_);
0041 
0042   l1GctIsoEmOccEta_ = ibooker.book1D("IsoEmOccEta", "ISO EM  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0043   l1GctIsoEmOccPhi_ = ibooker.book1D("IsoEmOccPhi", "ISO EM  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0044   l1GctNonIsoEmOccEta_ = ibooker.book1D("NonIsoEmOccEta", "NON-ISO EM  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0045   l1GctNonIsoEmOccPhi_ = ibooker.book1D("NonIsoEmOccPhi", "NON-ISO EM  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0046   l1GctAllJetsOccEta_ =
0047       ibooker.book1D("AllJetsOccEta", "CENTRAL AND FORWARD JET  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0048   l1GctAllJetsOccPhi_ =
0049       ibooker.book1D("AllJetsOccPhi", "CENTRAL AND FORWARD JET  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0050   l1GctCenJetsOccEta_ = ibooker.book1D("CenJetsOccEta", "CENTRAL JET  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0051   l1GctCenJetsOccPhi_ = ibooker.book1D("CenJetsOccPhi", "CENTRAL JET  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0052   l1GctForJetsOccEta_ = ibooker.book1D("ForJetsOccEta", "FORWARD JET  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0053   l1GctForJetsOccPhi_ = ibooker.book1D("ForJetsOccPhi", "FORWARD JET  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0054   l1GctTauJetsOccEta_ = ibooker.book1D("TauJetsOccEta", "TAU JET  #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0055   l1GctTauJetsOccPhi_ = ibooker.book1D("TauJetsOccPhi", "TAU JET  #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0056   if (m_stage1_layer2_ == true) {
0057     l1GctIsoTauJetsOccEta_ = ibooker.book1D("IsoTauJetsOccEta", "TAU JET #eta OCCUPANCY", ETABINS, ETAMIN, ETAMAX);
0058     l1GctIsoTauJetsOccPhi_ = ibooker.book1D("IsoTauJetsOccPhi", "TAU JET #phi OCCUPANCY", PHIBINS, PHIMIN, PHIMAX);
0059   }
0060 }
0061 
0062 void L1TGCTClient::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
0063                                          DQMStore::IGetter& igetter,
0064                                          const edm::LuminosityBlock& lumiSeg,
0065                                          const edm::EventSetup& c) {
0066   if (m_runInEndLumi) {
0067     book(ibooker);
0068     processHistograms(igetter);
0069   }
0070 }
0071 
0072 void L1TGCTClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0073   if (m_runInEndRun) {
0074     book(ibooker);
0075     processHistograms(igetter);
0076   }
0077 }
0078 
0079 void L1TGCTClient::processHistograms(DQMStore::IGetter& igetter) {
0080   MonitorElement* Input;
0081 
0082   if (m_stage1_layer2_ == false) {
0083     InputDir = "L1T/L1TGCT/";
0084   } else {
0085     InputDir = "L1T/L1TStage1Layer2/";
0086   }
0087 
0088   Input = igetter.get(InputDir + "IsoEmOccEtaPhi");
0089   if (Input != nullptr) {
0090     makeXProjection(Input->getTH2F(), l1GctIsoEmOccEta_);
0091     makeYProjection(Input->getTH2F(), l1GctIsoEmOccPhi_);
0092   }
0093 
0094   Input = igetter.get(InputDir + "NonIsoEmOccEtaPhi");
0095   if (Input != nullptr) {
0096     makeXProjection(Input->getTH2F(), l1GctNonIsoEmOccEta_);
0097     makeYProjection(Input->getTH2F(), l1GctNonIsoEmOccPhi_);
0098   }
0099 
0100   Input = igetter.get(InputDir + "AllJetsOccEtaPhi");
0101   if (Input != nullptr) {
0102     makeXProjection(Input->getTH2F(), l1GctAllJetsOccEta_);
0103     makeYProjection(Input->getTH2F(), l1GctAllJetsOccPhi_);
0104   }
0105 
0106   Input = igetter.get(InputDir + "CenJetsOccEtaPhi");
0107   if (Input != nullptr) {
0108     makeXProjection(Input->getTH2F(), l1GctCenJetsOccEta_);
0109     makeYProjection(Input->getTH2F(), l1GctCenJetsOccPhi_);
0110   }
0111 
0112   Input = igetter.get(InputDir + "ForJetsOccEtaPhi");
0113   if (Input != nullptr) {
0114     makeXProjection(Input->getTH2F(), l1GctForJetsOccEta_);
0115     makeYProjection(Input->getTH2F(), l1GctForJetsOccPhi_);
0116   }
0117 
0118   Input = igetter.get(InputDir + "TauJetsOccEtaPhi");
0119   if (Input != nullptr) {
0120     makeXProjection(Input->getTH2F(), l1GctTauJetsOccEta_);
0121     makeYProjection(Input->getTH2F(), l1GctTauJetsOccPhi_);
0122   }
0123 
0124   if (m_stage1_layer2_ == true) {
0125     Input = igetter.get(InputDir + "IsoTauJetsOccEtaPhi");
0126     if (Input != nullptr) {
0127       makeXProjection(Input->getTH2F(), l1GctIsoTauJetsOccEta_);
0128       makeYProjection(Input->getTH2F(), l1GctIsoTauJetsOccPhi_);
0129     }
0130   }
0131 }
0132 
0133 void L1TGCTClient::makeXProjection(TH2F* input, MonitorElement* output) {
0134   // Are the provided input and output consistent

0135   if (input->GetNbinsX() != output->getNbinsX())
0136     return;
0137 
0138   // Make the projection

0139   TH1D* projX = input->ProjectionX();
0140 
0141   for (Int_t i = 0; i < projX->GetNbinsX(); i++) {
0142     output->setBinContent(i + 1, projX->GetBinContent(i + 1));
0143   }
0144   delete projX;
0145 }
0146 
0147 void L1TGCTClient::makeYProjection(TH2F* input, MonitorElement* output) {
0148   // Are the provided input and output consistent

0149   if (input->GetNbinsY() != output->getNbinsX())
0150     return;
0151 
0152   // Make the projection

0153   TH1D* projY = input->ProjectionY();
0154 
0155   for (Int_t i = 0; i < projY->GetNbinsX(); i++) {
0156     output->setBinContent(i + 1, projY->GetBinContent(i + 1));
0157   }
0158   delete projY;
0159 }