ClusterProperties

LayerMEs

ModMEs

SiStripMonitorCluster

SubDetMEs

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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
#ifndef SiStripMonitorCluster_SiStripMonitorCluster_h
#define SiStripMonitorCluster_SiStripMonitorCluster_h
// -*- C++ -*-
// Package:     SiStripMonitorCluster
// Class  :     SiStripMonitorCluster
/**\class SiStripMonitorCluster SiStripMonitorCluster.h
   DQM/SiStripMonitorCluster/interface/SiStripMonitorCluster.h Data Quality
   Monitoring source of the Silicon Strip Tracker. Produces histograms related
   to clusters.
*/
// Original Author:  dkcira
//         Created:  Wed Feb  1 16:47:14 CET 2006
#include <memory>
#include <vector>

#include "DQM/SiStripCommon/interface/TkHistoMap.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "CalibTracker/SiStripCommon/interface/TkDetMap.h"
#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
#include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
#include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
#include "CalibTracker/Records/interface/SiStripGainRcd.h"
#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
#include "CalibTracker/Records/interface/SiStripQualityRcd.h"

class SiStripCluster;
class SiPixelCluster;
class EventWithHistory;
class APVCyclePhaseCollection;
class SiStripDCSStatus;
class GenericTriggerEventFlag;

class SiStripMonitorCluster : public DQMEDAnalyzer {
public:
  explicit SiStripMonitorCluster(const edm::ParameterSet&);
  ~SiStripMonitorCluster() override;
  void analyze(const edm::Event&, const edm::EventSetup&) override;
  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;

  struct ModMEs {  // MEs for one single detector module

    MonitorElement* NumberOfClusters = nullptr;
    MonitorElement* ClusterPosition = nullptr;
    MonitorElement* ClusterDigiPosition = nullptr;
    MonitorElement* ClusterWidth = nullptr;
    MonitorElement* ClusterCharge = nullptr;
    MonitorElement* ClusterNoise = nullptr;
    MonitorElement* ClusterSignalOverNoise = nullptr;
    MonitorElement* ClusterSignalOverNoiseVsPos = nullptr;
    MonitorElement* ModuleLocalOccupancy = nullptr;
    MonitorElement* NrOfClusterizedStrips = nullptr;  // can be used at client level for occupancy calculations
    MonitorElement* Module_ClusWidthVsAmpTH2 = nullptr;
  };

  struct LayerMEs {  // MEs for Layer Level
    MonitorElement* LayerClusterStoN = nullptr;
    MonitorElement* LayerClusterStoNTrend = nullptr;
    MonitorElement* LayerClusterCharge = nullptr;
    MonitorElement* LayerClusterChargeTrend = nullptr;
    MonitorElement* LayerClusterNoise = nullptr;
    MonitorElement* LayerClusterNoiseTrend = nullptr;
    MonitorElement* LayerClusterWidth = nullptr;
    MonitorElement* LayerClusterWidthTrend = nullptr;
    MonitorElement* LayerLocalOccupancy = nullptr;
    MonitorElement* LayerLocalOccupancyTrend = nullptr;
    MonitorElement* LayerNumberOfClusterProfile = nullptr;
    MonitorElement* LayerNumberOfClusterPerRingTrend = nullptr;
    MonitorElement* LayerNumberOfClusterTrend = nullptr;
    MonitorElement* LayerClusterWidthProfile = nullptr;
    MonitorElement* LayerClusWidthVsAmpTH2 = nullptr;
    MonitorElement* LayerClusterPosition = nullptr;
  };

  struct SubDetMEs {  // MEs for Subdetector Level
    int totNClusters = 0;
    MonitorElement* SubDetTotClusterTH1 = nullptr;
    MonitorElement* SubDetTotClusterProf = nullptr;
    MonitorElement* SubDetClusterApvProf = nullptr;
    MonitorElement* SubDetClusterApvTH2 = nullptr;
    MonitorElement* SubDetClusterDBxCycleProf = nullptr;
    MonitorElement* SubDetApvDBxProf2 = nullptr;
    MonitorElement* SubDetClusterChargeTH1 = nullptr;
    MonitorElement* SubDetClusterWidthTH1 = nullptr;
    MonitorElement* SubDetClusWidthVsAmpTH2 = nullptr;
    MonitorElement* SubDetNumberOfClusterPerLayerTrend = nullptr;
  };

  struct ClusterProperties {  // Cluster Properties
    float charge;
    float position;
    short start;
    short width;
    float noise;
  };

  MonitorElement* GlobalApvCycleDBxTH2 = nullptr;
  MonitorElement* GlobalDBxTH1 = nullptr;
  MonitorElement* GlobalDBxCycleTH1 = nullptr;
  MonitorElement* GlobalCStripVsCpix = nullptr;
  MonitorElement* GlobalABXTH1_CSCP = nullptr;
  MonitorElement* PixVsStripMultiplicityRegions = nullptr;
  MonitorElement* GlobalMainDiagonalPosition = nullptr;
  MonitorElement* GlobalMainDiagonalPosition_vs_BX = nullptr;
  MonitorElement* GlobalTH2MainDiagonalPosition_vs_BX;
  MonitorElement* StripNoise2Cycle = nullptr;
  MonitorElement* StripNoise3Cycle = nullptr;
  MonitorElement* NumberOfPixelClus = nullptr;
  MonitorElement* NumberOfStripClus = nullptr;
  MonitorElement* BPTXrateTrend = nullptr;
  MonitorElement* NclusVsCycleTimeProf2D = nullptr;
  MonitorElement* ClusWidthVsAmpTH2 = nullptr;
  MonitorElement* NumberOfStripClus_vs_BX = nullptr;  // plot n. 3
  MonitorElement* NumberOfPixelClus_vs_BX = nullptr;  // plot n. 4
  MonitorElement* NumberOfFEDClus = nullptr;

private:
  void createMEs(const edm::EventSetup& es, DQMStore::IBooker& ibooker);
  void createLayerMEs(std::string label, int ndets, DQMStore::IBooker& ibooker);
  void createModuleMEs(ModMEs& mod_single, uint32_t detid, DQMStore::IBooker& ibooker, const SiStripDetCabling&);
  void createSubDetMEs(std::string label, DQMStore::IBooker& ibooker);
  int FindRegion(int nstrip, int npixel);
  void fillModuleMEs(ModMEs& mod_mes, ClusterProperties& cluster);
  void fillLayerMEs(LayerMEs&, ClusterProperties& cluster);

  void ResetModuleMEs(uint32_t idet);

  inline void fillME(MonitorElement* ME, float value1) {
    if (ME != nullptr)
      ME->Fill(value1);
  }
  inline void fillME(MonitorElement* ME, float value1, float value2) {
    if (ME != nullptr)
      ME->Fill(value1, value2);
  }
  inline void fillME(MonitorElement* ME, float value1, float value2, float value3) {
    if (ME != nullptr)
      ME->Fill(value1, value2, value3);
  }
  inline void fillME(MonitorElement* ME, float value1, float value2, float value3, float value4) {
    if (ME != nullptr)
      ME->Fill(value1, value2, value3, value4);
  }
  MonitorElement* bookMETrend(const char*, DQMStore::IBooker& ibooker);
  MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName, DQMStore::IBooker& ibooker);
  MonitorElement* bookME2D(const char* ParameterSetLabel, const char* HistoName, DQMStore::IBooker& ibooker);

  edm::ParameterSet conf_;
  std::map<uint32_t, ModMEs> ModuleMEsMap;
  std::map<std::string, LayerMEs> LayerMEsMap;
  std::map<std::string, std::vector<uint32_t> > LayerDetMap;
  std::map<std::string, SubDetMEs> SubDetMEsMap;
  std::map<std::string, std::string> SubDetPhasePartMap;

  // flags
  bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, reset_each_run;
  unsigned long long m_cacheID_;

  std::vector<uint32_t> ModulesToBeExcluded_;

  edm::ParameterSet Parameters;

  // TkHistoMap added
  std::unique_ptr<TkHistoMap> tkmapcluster;
  std::unique_ptr<TkHistoMap> tkmapclusterch;

  int runNb, eventNb;
  int firstEvent;
  float trendVar;

  bool layerswitchncluson;
  bool layerswitchcluschargeon;
  bool layerswitchclusstonon;
  bool layerswitchclusstonVsposon;
  bool layerswitchclusposon;
  bool layerswitchclusdigiposon;
  bool layerswitchclusnoiseon;
  bool layerswitchcluswidthon;
  bool layerswitchlocaloccupancy;
  bool layerswitchnrclusterizedstrip;
  bool layerswitchnumclusterprofon;
  bool layerswitchclusterwidthprofon;
  bool layer_clusterWidth_vs_amplitude_on;

  bool globalswitchstripnoise2apvcycle;
  bool globalswitchstripnoise3apvcycle;
  bool globalswitchmaindiagonalposition;
  bool globalswitchFEDCluster;

  bool moduleswitchncluson;
  bool moduleswitchcluschargeon;
  bool moduleswitchclusstonon;
  bool moduleswitchclusstonVsposon;
  bool moduleswitchclusposon;
  bool moduleswitchclusdigiposon;
  bool moduleswitchclusnoiseon;
  bool moduleswitchcluswidthon;
  bool moduleswitchlocaloccupancy;
  bool moduleswitchnrclusterizedstrip;
  bool module_clusterWidth_vs_amplitude_on;
  bool subdetswitchtotclusprofon;
  bool subdetswitchapvcycleprofon;
  bool subdetswitchapvcycleth2on;
  bool subdetswitchapvcycledbxprof2on;
  bool subdetswitchdbxcycleprofon;
  bool subdetswitchtotclusth1on;
  bool subdetswitchcluschargeon;
  bool subdetswitchcluswidthon;
  bool subdet_clusterWidth_vs_amplitude_on;
  bool globalswitchapvcycledbxth2on;
  bool globalswitchcstripvscpix;
  bool globalswitchMultiRegions;
  bool clustertkhistomapon;
  bool clusterchtkhistomapon;
  bool createTrendMEs;
  bool trendVs10Ls_;
  bool globalswitchnclusvscycletimeprof2don;
  bool clusterWidth_vs_amplitude_on;

  bool Mod_On_;
  bool ClusterHisto_;

  std::string topFolderName_;
  std::string qualityLabel_;

  /*
  edm::InputTag clusterProducerStrip_;
  edm::InputTag clusterProducerPix_;
  edm::InputTag historyProducer_;
  edm::InputTag apvPhaseProducer_;
  */

  edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterProducerStripToken_;
  edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > clusterProducerPixToken_;
  edm::EDGetTokenT<EventWithHistory> historyProducerToken_;
  edm::EDGetTokenT<APVCyclePhaseCollection> apvPhaseProducerToken_;

  edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyRunToken_;
  edm::ESGetToken<TkDetMap, TrackerTopologyRcd> tkDetMapToken_;
  edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> siStripDetCablingRunToken_;
  edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyEventToken_;
  edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> siStripNoisesToken_;
  edm::ESGetToken<SiStripGain, SiStripGainRcd> siStripGainToken_;
  edm::ESGetToken<SiStripQuality, SiStripQualityRcd> siStripQualityToken_;
  edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> siStripDetCablingEventToken_;

  bool applyClusterQuality_;
  double sToNLowerLimit_;
  double sToNUpperLimit_;
  double widthLowerLimit_;
  double widthUpperLimit_;

  double k0;
  double q0;
  double dk0;
  double maxClus;
  double minPix;

  SiStripDCSStatus* dcsStatus_;

  // add for selecting on ZeroBias events in the MinimumBias PD
  GenericTriggerEventFlag* genTriggerEventFlagBPTXfilter_;
  GenericTriggerEventFlag* genTriggerEventFlagPixelDCSfilter_;
  GenericTriggerEventFlag* genTriggerEventFlagStripDCSfilter_;

  bool passBPTXfilter_;
  bool passPixelDCSfilter_;
  bool passStripDCSfilter_;
};
#endif