File indexing completed on 2024-04-06 11:59:37
0001 #ifndef CALIBTRACKER_SIPIXELSCURVECALIBRATION_SIPIXELSCURVE_CALIBRATION_H
0002 #define CALIBTRACKER_SIPIXELSCURVECALIBRATION_SIPIXELSCURVE_CALIBRATION_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <memory>
0023
0024
0025 #include "CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h"
0026 #include "TMinuit.h"
0027 #include <iomanip>
0028
0029 enum sCurveHistogramType {
0030 kSigmaSummary,
0031 kSigmas,
0032 kThresholdSummary,
0033 kThresholds,
0034 kChi2Summary,
0035 kChi2s,
0036 kFitResults,
0037 kFitResultSummary
0038 };
0039
0040 enum sCurveErrorFlag {
0041 errNoDigi,
0042
0043 errOK,
0044 errFlaggedBadByUser,
0045
0046 errBadChi2Prob,
0047 errFitNonPhysical,
0048
0049 errNoTurnOn,
0050 errAllZeros
0051
0052
0053 };
0054
0055 typedef dqm::legacy::MonitorElement MonitorElement;
0056 typedef std::map<sCurveHistogramType, MonitorElement *> sCurveHistogramHolder;
0057 typedef std::map<uint32_t, sCurveHistogramHolder> detIDHistogramMap;
0058
0059
0060
0061
0062 class SiPixelSCurveCalibrationAnalysis : public SiPixelOfflineCalibAnalysisBase {
0063 public:
0064 explicit SiPixelSCurveCalibrationAnalysis(const edm::ParameterSet &iConfig)
0065 : SiPixelOfflineCalibAnalysisBase(iConfig) {
0066 doSetup(iConfig);
0067 };
0068 ~SiPixelSCurveCalibrationAnalysis() override;
0069 void doSetup(const edm::ParameterSet &);
0070
0071 bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix) override;
0072
0073 static std::vector<float> efficiencies_;
0074 static std::vector<float> effErrors_;
0075 std::vector<float> vCalPointsAsFloats_;
0076
0077 sCurveErrorFlag estimateSCurveParameters(const std::vector<float> &eff, float &threshold, float &sigma);
0078 sCurveErrorFlag fittedSCurveSanityCheck(float threshold, float sigma, float amplitude);
0079
0080 void buildACurveHistogram(const uint32_t &detid,
0081 const uint32_t &row,
0082 const uint32_t &col,
0083 sCurveErrorFlag errorFlag,
0084 const std::vector<float> &efficiencies,
0085 const std::vector<float> &errors);
0086
0087 private:
0088
0089 bool useDetectorHierarchyFolders_;
0090 bool saveCurvesThatFlaggedBad_;
0091 unsigned int maxCurvesToSave_;
0092
0093 unsigned int curvesSavedCounter_;
0094 bool write2dHistograms_;
0095 bool write2dFitResult_;
0096 std::vector<std::string> plaquettesToSave_;
0097 bool printoutthresholds_;
0098 bool writeZeroes_;
0099 std::string thresholdfilename_;
0100 std::map<uint32_t, bool> detIDsToSave_;
0101
0102
0103 double minimumChi2prob_;
0104 double minimumThreshold_;
0105 double maximumThreshold_;
0106 double minimumSigma_;
0107 double maximumSigma_;
0108 double minimumEffAsymptote_;
0109 double maximumEffAsymptote_;
0110
0111
0112 double maximumThresholdBin_;
0113 double maximumSigmaBin_;
0114
0115
0116 detIDHistogramMap histograms_;
0117
0118 void calibrationSetup(const edm::EventSetup &iSetup) override;
0119 bool checkCorrectCalibrationType() override;
0120 void newDetID(uint32_t detid) override;
0121 void makeThresholdSummary(void);
0122 void calibrationEnd() override;
0123
0124
0125 };
0126
0127 #endif