Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:55:32

0001 #ifndef DQM_L1TMONITORCLIENT_L1TOCCUPANCYCLIENTHISTOGRAMSERVICE_H
0002 #define DQM_L1TMONITORCLIENT_L1TOCCUPANCYCLIENTHISTOGRAMSERVICE_H
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 #include "FWCore/Framework/interface/LuminosityBlock.h"
0009 
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 
0012 #include <memory>
0013 #include <iostream>
0014 #include <fstream>
0015 #include <string>
0016 #include <map>
0017 #include <TH1F.h>
0018 #include <TH1D.h>
0019 #include <TH2F.h>
0020 
0021 class L1TOccupancyClientHistogramService {
0022 public:
0023   typedef dqm::legacy::DQMStore DQMStore;
0024   typedef dqm::legacy::MonitorElement MonitorElement;
0025 
0026   L1TOccupancyClientHistogramService();
0027   L1TOccupancyClientHistogramService(const edm::ParameterSet& iParameters, DQMStore::IBooker& ibooker, bool iVerbose);
0028 
0029   //loads the histo of test into histos_
0030   TH2F* loadHisto(DQMStore::IGetter& igetter, std::string test, std::string histo);
0031 
0032   //updates histo (i.e. calculates differential to previous LS and adds it to cumulatice histo)
0033   void updateHistogramEndLS(DQMStore::IGetter& igetter, std::string test, std::string histo, int iLS);
0034   void updateHistogramEndRun(std::string iHistName);
0035 
0036   //resets the cumulative histo (after performing the test in L1TOccupancyClient)
0037   void resetHisto(std::string test);
0038 
0039   // Masks channels of histo in specific strip to perform L1TOccupancyClient::getAvrg()
0040   int maskBins(std::string test, TH2F* histo, int strip, int axis);
0041 
0042   bool isMasked(std::string test, int x, int y);                 //checks if cells is masked
0043   bool isStripMasked(std::string test, int binStrip, int axis);  //checks if a whole strip is masked
0044 
0045   void setMaskedBins(std::string test,
0046                      const std::vector<edm::ParameterSet>& mask);     //set masked channels specified in python
0047   std::vector<std::pair<int, int> > getMaskedBins(std::string test);  //returns masked channels of test
0048 
0049   unsigned int getNBinsMasked(std::string test);     // Get number of masked bins in test
0050   unsigned int getNBinsHistogram(std::string test);  // Get actual number of bins in test (i.e. nBins-nMaskedBins)
0051   TH2F* getDifferentialHistogram(std::string test);  // Get cumulative histogram
0052   TH2F* getRebinnedHistogram(DQMStore::IGetter& igetter,
0053                              std::string iHistName,
0054                              std::string iHistLocation);  // Get rebinned version of the hist
0055 
0056   std::vector<int> getLSCertification(std::string iHistName);  // Get list of tested LS for test iHistName
0057 
0058 private:
0059   //DQMStore*         mDBE;        // storage service
0060   bool mVerbose;                  // verbose mode
0061   edm::ParameterSet mParameters;  // Copy of the parameters
0062 
0063   // Maps
0064   std::map<std::string, bool> mHistValid;                                 // Map of valid histograms (i.e. that exist)
0065   std::map<std::string, std::pair<TH2F*, TH2F*> > mHistograms;            // The cumulative histograms
0066   std::map<std::string, std::vector<std::pair<int, int> >*> mMaskedBins;  // Marked Bins
0067   std::map<std::string, TH2F*> mHistDiffMinus1;                           // Last already closed LS Block Histogram Diff
0068   std::map<std::string, std::vector<int> > mLSListDiff;                   // LS list of current block
0069   std::map<std::string, std::vector<int> > mLSListDiffMinus1;             // LS list of block -1
0070 };
0071 
0072 #endif