File indexing completed on 2024-04-06 11:59:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0022 #include "FWCore/Framework/interface/Event.h"
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/ServiceRegistry/interface/Service.h"
0027 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0028 #include "DQMServices/Core/interface/DQMStore.h"
0029 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0030 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0031 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0032 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0033 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
0034 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0035 #include "CalibTracker/Records/interface/SiStripGainRcd.h"
0036 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0037
0038
0039 #include "CalibTracker/SiStripChannelGain/interface/APVGainStruct.h"
0040
0041
0042 #include "TH1F.h"
0043 #include "TH2S.h"
0044 #include "TProfile.h"
0045 #include "TF1.h"
0046
0047
0048 #include <unordered_map>
0049
0050 class SiStripGainsPCLHarvester : public DQMEDHarvester {
0051 public:
0052 explicit SiStripGainsPCLHarvester(const edm::ParameterSet& ps);
0053 void beginRun(edm::Run const& run, edm::EventSetup const& isetup) override;
0054 void endRun(edm::Run const& run, edm::EventSetup const& isetup) override;
0055 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0056
0057 private:
0058 virtual void checkBookAPVColls(const edm::EventSetup& setup);
0059 void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override;
0060 void gainQualityMonitor(DQMStore::IBooker& ibooker_, const MonitorElement* Charge_Vs_Index) const;
0061 void storeGainsTree(const TAxis* chVsIdxXaxis) const;
0062 int statCollectionFromMode(const char* tag) const;
0063
0064 void algoComputeMPVandGain(const MonitorElement* Charge_Vs_Index);
0065 void getPeakOfLandau(TH1* InputHisto,
0066 double* FitResults,
0067 double LowRange = 50,
0068 double HighRange = 5400,
0069 bool gaussianConvolution = false);
0070 bool IsGoodLandauFit(double* FitResults);
0071
0072 bool produceTagFilter(const MonitorElement* Charge_Vs_Index);
0073 std::unique_ptr<SiStripApvGain> getNewObject(const MonitorElement* Charge_Vs_Index);
0074
0075 bool doStoreOnDB;
0076 bool doChargeMonitorPerPlane;
0077 bool storeGainsTree_;
0078 unsigned int GOOD;
0079 unsigned int BAD;
0080 unsigned int MASKED;
0081
0082 double tagCondition_NClusters;
0083 double tagCondition_GoodFrac;
0084
0085 int NStripAPVs;
0086 int NPixelDets;
0087 double MinNrEntries;
0088
0089 std::string m_Record;
0090
0091 std::string m_DQMdir;
0092 std::string m_calibrationMode;
0093 std::vector<std::string> VChargeHisto;
0094
0095 std::vector<std::string> dqm_tag_;
0096
0097 int CalibrationLevel;
0098
0099 const TrackerGeometry* bareTkGeomPtr_ = nullptr;
0100 std::unique_ptr<TrackerTopology> tTopo_;
0101
0102 std::vector<std::shared_ptr<stAPVGain> > APVsCollOrdered;
0103 std::unordered_map<unsigned int, std::shared_ptr<stAPVGain> > APVsColl;
0104
0105 edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoTokenBR_, tTopoTokenER_;
0106 edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomToken_;
0107 edm::ESGetToken<SiStripGain, SiStripGainRcd> gainToken_;
0108 edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualityToken_;
0109
0110
0111 bool fit_gaussianConvolution_ = false;
0112 bool fit_gaussianConvolutionTOBL56_ = false;
0113 bool fit_dataDrivenRange_ = false;
0114 };