SiPixelInformationExtractor

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
#ifndef _SiPixelInformationExtractor_h_
#define _SiPixelInformationExtractor_h_

#include "DQMServices/Core/interface/DQMStore.h"

#include "DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h"
#include "DQM/SiPixelMonitorClient/interface/SiPixelConfigParser.h"
#include "DQM/SiPixelMonitorClient/interface/SiPixelConfigWriter.h"
#include "DQM/SiPixelMonitorClient/interface/SiPixelLayoutParser.h"

#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
#include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"

#include "TCanvas.h"
#include "TF1.h"
#include "TGaxis.h"
#include "TH2F.h"
#include "TPaveText.h"

#include <fstream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <cstdint>

class SiPixelEDAClient;
class SiPixelWebInterface;
class SiPixelInformationExtractor {
public:
  typedef dqm::legacy::MonitorElement MonitorElement;
  typedef dqm::legacy::DQMStore DQMStore;

  SiPixelInformationExtractor(bool offlineXMLfile);
  ~SiPixelInformationExtractor();

  void computeStatus(MonitorElement *mE, double &colorValue, std::pair<double, double> &norm);
  void getNormalization(MonitorElement *mE, std::pair<double, double> &norm, std::string theMEType);
  void getNormalization2D(MonitorElement *mE,
                          std::pair<double, double> &normX,
                          std::pair<double, double> &normY,
                          std::string theMEType);
  int getDetId(MonitorElement *mE);
  std::string getMEType(MonitorElement *mE);

  void readConfiguration();
  bool readConfiguration(std::map<std::string, std::vector<std::string>> &layoutMap,
                         std::map<std::string, std::map<std::string, std::string>> &qtestsMap,
                         std::map<std::string, std::vector<std::string>> &meQTestsMap);

  void bookNoisyPixels(DQMStore::IBooker &iBooker, float noiseRate, bool Tier0Flag);

  void findNoisyPixels(DQMStore::IBooker &iBooker,
                       DQMStore::IGetter &iGetter,
                       bool init,
                       float noiseRate,
                       int noiseRateDenominator,
                       const SiPixelFedCablingMap *theCablingMap);

private:
  void getItemList(const std::multimap<std::string, std::string> &req_map,
                   std::string item_name,
                   std::vector<std::string> &items);
  bool hasItem(std::multimap<std::string, std::string> &req_map, std::string item_name);
  std::string getItemValue(const std::multimap<std::string, std::string> &req_map, std::string item_name);
  std::string getItemValue(std::multimap<std::string, std::string> &req_map, std::string item_name);
  void createDummiesFromLayout();
  void selectImage(std::string &name, int status);
  void selectImage(std::string &name, std::vector<QReport *> &reports);
  void selectColor(std::string &col, int status);
  void selectColor(std::string &col, std::vector<QReport *> &reports);

  int alarmCounter_;

  SiPixelConfigParser *configParser_;
  SiPixelConfigWriter *configWriter_;
  SiPixelActionExecutor *actionExecutor_;
  SiPixelLayoutParser *layoutParser_;

  std::map<std::string, std::vector<std::string>> layoutMap;
  std::map<std::string, std::map<std::string, std::string>> qtestsMap;
  std::map<std::string, std::vector<std::string>> meQTestsMap;

  bool readReference_;
  bool readQTestMap_;
  bool readMeMap_;
  bool flagHotModule_;
  bool offlineXMLfile_;

  int count;
  int errcount;
  bool gotDigis;

  std::ofstream myfile_;
  int nevents_;
  std::map<uint32_t, std::vector<std::pair<std::pair<int, int>, float>>> noisyDetIds_;
  bool endOfModules_;

  MonitorElement *EventRateBarrelPixels;
  MonitorElement *EventRateEndcapPixels;

  MonitorElement *EndcapNdigisFREQProjection;
  MonitorElement *BarrelNdigisFREQProjection;
};
#endif