File indexing completed on 2023-03-17 10:56:47
0001 #ifndef SiStripMonitorCluster_SiStripMonitorCluster_h
0002 #define SiStripMonitorCluster_SiStripMonitorCluster_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <memory>
0014 #include <vector>
0015
0016 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 #include "DataFormats/Common/interface/DetSetVector.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/MakerMacros.h"
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 #include "FWCore/Utilities/interface/EDGetToken.h"
0024 #include "FWCore/Utilities/interface/ESGetToken.h"
0025 #include "DataFormats/Common/interface/DetSetVector.h"
0026 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0027 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0028 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0029 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0030 #include "CalibTracker/SiStripCommon/interface/TkDetMap.h"
0031 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0032 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0033 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0034 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0035 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
0036 #include "CalibTracker/Records/interface/SiStripGainRcd.h"
0037 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0038 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0039
0040 class SiStripCluster;
0041 class SiPixelCluster;
0042 class EventWithHistory;
0043 class APVCyclePhaseCollection;
0044 class SiStripDCSStatus;
0045 class GenericTriggerEventFlag;
0046
0047 class SiStripMonitorCluster : public DQMEDAnalyzer {
0048 public:
0049 explicit SiStripMonitorCluster(const edm::ParameterSet&);
0050 ~SiStripMonitorCluster() override;
0051 void analyze(const edm::Event&, const edm::EventSetup&) override;
0052 void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0053 void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
0054
0055 struct ModMEs {
0056
0057 MonitorElement* NumberOfClusters = nullptr;
0058 MonitorElement* ClusterPosition = nullptr;
0059 MonitorElement* ClusterDigiPosition = nullptr;
0060 MonitorElement* ClusterWidth = nullptr;
0061 MonitorElement* ClusterCharge = nullptr;
0062 MonitorElement* ClusterNoise = nullptr;
0063 MonitorElement* ClusterSignalOverNoise = nullptr;
0064 MonitorElement* ClusterSignalOverNoiseVsPos = nullptr;
0065 MonitorElement* ModuleLocalOccupancy = nullptr;
0066 MonitorElement* NrOfClusterizedStrips = nullptr;
0067 MonitorElement* Module_ClusWidthVsAmpTH2 = nullptr;
0068 };
0069
0070 struct LayerMEs {
0071 MonitorElement* LayerClusterStoN = nullptr;
0072 MonitorElement* LayerClusterStoNTrend = nullptr;
0073 MonitorElement* LayerClusterCharge = nullptr;
0074 MonitorElement* LayerClusterChargeTrend = nullptr;
0075 MonitorElement* LayerClusterNoise = nullptr;
0076 MonitorElement* LayerClusterNoiseTrend = nullptr;
0077 MonitorElement* LayerClusterWidth = nullptr;
0078 MonitorElement* LayerClusterWidthTrend = nullptr;
0079 MonitorElement* LayerLocalOccupancy = nullptr;
0080 MonitorElement* LayerLocalOccupancyTrend = nullptr;
0081 MonitorElement* LayerNumberOfClusterProfile = nullptr;
0082 MonitorElement* LayerNumberOfClusterPerRingTrend = nullptr;
0083 MonitorElement* LayerNumberOfClusterTrend = nullptr;
0084 MonitorElement* LayerClusterWidthProfile = nullptr;
0085 MonitorElement* LayerClusWidthVsAmpTH2 = nullptr;
0086 MonitorElement* LayerClusterPosition = nullptr;
0087 };
0088
0089 struct SubDetMEs {
0090 int totNClusters = 0;
0091 MonitorElement* SubDetTotClusterTH1 = nullptr;
0092 MonitorElement* SubDetTotClusterProf = nullptr;
0093 MonitorElement* SubDetClusterApvProf = nullptr;
0094 MonitorElement* SubDetClusterApvTH2 = nullptr;
0095 MonitorElement* SubDetClusterDBxCycleProf = nullptr;
0096 MonitorElement* SubDetApvDBxProf2 = nullptr;
0097 MonitorElement* SubDetClusterChargeTH1 = nullptr;
0098 MonitorElement* SubDetClusterWidthTH1 = nullptr;
0099 MonitorElement* SubDetClusWidthVsAmpTH2 = nullptr;
0100 MonitorElement* SubDetNumberOfClusterPerLayerTrend = nullptr;
0101 };
0102
0103 struct ClusterProperties {
0104 float charge;
0105 float position;
0106 short start;
0107 short width;
0108 float noise;
0109 };
0110
0111 MonitorElement* GlobalApvCycleDBxTH2 = nullptr;
0112 MonitorElement* GlobalDBxTH1 = nullptr;
0113 MonitorElement* GlobalDBxCycleTH1 = nullptr;
0114 MonitorElement* GlobalCStripVsCpix = nullptr;
0115 MonitorElement* GlobalABXTH1_CSCP = nullptr;
0116 MonitorElement* PixVsStripMultiplicityRegions = nullptr;
0117 MonitorElement* GlobalMainDiagonalPosition = nullptr;
0118 MonitorElement* GlobalMainDiagonalPosition_vs_BX = nullptr;
0119 MonitorElement* GlobalTH2MainDiagonalPosition_vs_BX;
0120 MonitorElement* StripNoise2Cycle = nullptr;
0121 MonitorElement* StripNoise3Cycle = nullptr;
0122 MonitorElement* NumberOfPixelClus = nullptr;
0123 MonitorElement* NumberOfStripClus = nullptr;
0124 MonitorElement* BPTXrateTrend = nullptr;
0125 MonitorElement* NclusVsCycleTimeProf2D = nullptr;
0126 MonitorElement* ClusWidthVsAmpTH2 = nullptr;
0127 MonitorElement* NumberOfStripClus_vs_BX = nullptr;
0128 MonitorElement* NumberOfPixelClus_vs_BX = nullptr;
0129 MonitorElement* NumberOfFEDClus = nullptr;
0130
0131 private:
0132 void createMEs(const edm::EventSetup& es, DQMStore::IBooker& ibooker);
0133 void createLayerMEs(std::string label, int ndets, DQMStore::IBooker& ibooker);
0134 void createModuleMEs(ModMEs& mod_single, uint32_t detid, DQMStore::IBooker& ibooker, const SiStripDetCabling&);
0135 void createSubDetMEs(std::string label, DQMStore::IBooker& ibooker);
0136 int FindRegion(int nstrip, int npixel);
0137 void fillModuleMEs(ModMEs& mod_mes, ClusterProperties& cluster);
0138 void fillLayerMEs(LayerMEs&, ClusterProperties& cluster);
0139
0140 void ResetModuleMEs(uint32_t idet);
0141
0142 inline void fillME(MonitorElement* ME, float value1) {
0143 if (ME != nullptr)
0144 ME->Fill(value1);
0145 }
0146 inline void fillME(MonitorElement* ME, float value1, float value2) {
0147 if (ME != nullptr)
0148 ME->Fill(value1, value2);
0149 }
0150 inline void fillME(MonitorElement* ME, float value1, float value2, float value3) {
0151 if (ME != nullptr)
0152 ME->Fill(value1, value2, value3);
0153 }
0154 inline void fillME(MonitorElement* ME, float value1, float value2, float value3, float value4) {
0155 if (ME != nullptr)
0156 ME->Fill(value1, value2, value3, value4);
0157 }
0158 MonitorElement* bookMETrend(const char*, DQMStore::IBooker& ibooker);
0159 MonitorElement* bookME1D(const char* ParameterSetLabel, const char* HistoName, DQMStore::IBooker& ibooker);
0160 MonitorElement* bookME2D(const char* ParameterSetLabel, const char* HistoName, DQMStore::IBooker& ibooker);
0161
0162 edm::ParameterSet conf_;
0163 std::map<uint32_t, ModMEs> ModuleMEsMap;
0164 std::map<std::string, LayerMEs> LayerMEsMap;
0165 std::map<std::string, std::vector<uint32_t> > LayerDetMap;
0166 std::map<std::string, SubDetMEs> SubDetMEsMap;
0167 std::map<std::string, std::string> SubDetPhasePartMap;
0168
0169
0170 bool show_mechanical_structure_view, show_readout_view, show_control_view, select_all_detectors, reset_each_run;
0171 unsigned long long m_cacheID_;
0172
0173 std::vector<uint32_t> ModulesToBeExcluded_;
0174
0175 edm::ParameterSet Parameters;
0176
0177
0178 std::unique_ptr<TkHistoMap> tkmapcluster;
0179 std::unique_ptr<TkHistoMap> tkmapclusterch;
0180
0181 int runNb, eventNb;
0182 int firstEvent;
0183 float trendVar;
0184
0185 bool layerswitchncluson;
0186 bool layerswitchcluschargeon;
0187 bool layerswitchclusstonon;
0188 bool layerswitchclusstonVsposon;
0189 bool layerswitchclusposon;
0190 bool layerswitchclusdigiposon;
0191 bool layerswitchclusnoiseon;
0192 bool layerswitchcluswidthon;
0193 bool layerswitchlocaloccupancy;
0194 bool layerswitchnrclusterizedstrip;
0195 bool layerswitchnumclusterprofon;
0196 bool layerswitchclusterwidthprofon;
0197 bool layer_clusterWidth_vs_amplitude_on;
0198
0199 bool globalswitchstripnoise2apvcycle;
0200 bool globalswitchstripnoise3apvcycle;
0201 bool globalswitchmaindiagonalposition;
0202 bool globalswitchFEDCluster;
0203
0204 bool moduleswitchncluson;
0205 bool moduleswitchcluschargeon;
0206 bool moduleswitchclusstonon;
0207 bool moduleswitchclusstonVsposon;
0208 bool moduleswitchclusposon;
0209 bool moduleswitchclusdigiposon;
0210 bool moduleswitchclusnoiseon;
0211 bool moduleswitchcluswidthon;
0212 bool moduleswitchlocaloccupancy;
0213 bool moduleswitchnrclusterizedstrip;
0214 bool module_clusterWidth_vs_amplitude_on;
0215 bool subdetswitchtotclusprofon;
0216 bool subdetswitchapvcycleprofon;
0217 bool subdetswitchapvcycleth2on;
0218 bool subdetswitchapvcycledbxprof2on;
0219 bool subdetswitchdbxcycleprofon;
0220 bool subdetswitchtotclusth1on;
0221 bool subdetswitchcluschargeon;
0222 bool subdetswitchcluswidthon;
0223 bool subdet_clusterWidth_vs_amplitude_on;
0224 bool globalswitchapvcycledbxth2on;
0225 bool globalswitchcstripvscpix;
0226 bool globalswitchMultiRegions;
0227 bool clustertkhistomapon;
0228 bool clusterchtkhistomapon;
0229 bool createTrendMEs;
0230 bool trendVs10Ls_;
0231 bool globalswitchnclusvscycletimeprof2don;
0232 bool clusterWidth_vs_amplitude_on;
0233
0234 bool Mod_On_;
0235 bool ClusterHisto_;
0236
0237 std::string topFolderName_;
0238 std::string qualityLabel_;
0239
0240
0241
0242
0243
0244
0245
0246
0247 edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterProducerStripToken_;
0248 edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > clusterProducerPixToken_;
0249 edm::EDGetTokenT<EventWithHistory> historyProducerToken_;
0250 edm::EDGetTokenT<APVCyclePhaseCollection> apvPhaseProducerToken_;
0251
0252 edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyRunToken_;
0253 edm::ESGetToken<TkDetMap, TrackerTopologyRcd> tkDetMapToken_;
0254 edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> siStripDetCablingRunToken_;
0255 edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyEventToken_;
0256 edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> siStripNoisesToken_;
0257 edm::ESGetToken<SiStripGain, SiStripGainRcd> siStripGainToken_;
0258 edm::ESGetToken<SiStripQuality, SiStripQualityRcd> siStripQualityToken_;
0259 edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> siStripDetCablingEventToken_;
0260
0261 bool applyClusterQuality_;
0262 double sToNLowerLimit_;
0263 double sToNUpperLimit_;
0264 double widthLowerLimit_;
0265 double widthUpperLimit_;
0266
0267 double k0;
0268 double q0;
0269 double dk0;
0270 double maxClus;
0271 double minPix;
0272
0273 SiStripDCSStatus* dcsStatus_;
0274
0275
0276 GenericTriggerEventFlag* genTriggerEventFlagBPTXfilter_;
0277 GenericTriggerEventFlag* genTriggerEventFlagPixelDCSfilter_;
0278 GenericTriggerEventFlag* genTriggerEventFlagStripDCSfilter_;
0279
0280 bool passBPTXfilter_;
0281 bool passPixelDCSfilter_;
0282 bool passStripDCSfilter_;
0283 };
0284 #endif