Go to the documentation of this file.00001 #ifndef CALIBTRACKER_SIPIXELSCURVECALIBRATION_SIPIXELSCURVE_CALIBRATION_H
00002 #define CALIBTRACKER_SIPIXELSCURVECALIBRATION_SIPIXELSCURVE_CALIBRATION_H
00003
00004
00005
00006
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <memory>
00024
00025
00026 #include "CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h"
00027 #include "TMinuit.h"
00028 #include <iomanip>
00029
00030 enum sCurveHistogramType {
00031 kSigmaSummary,
00032 kSigmas,
00033 kThresholdSummary,
00034 kThresholds,
00035 kChi2Summary,
00036 kChi2s,
00037 kFitResults,
00038 kFitResultSummary
00039 };
00040
00041 enum sCurveErrorFlag {
00042 errNoDigi,
00043 errOK,
00044 errFlaggedBadByUser,
00045 errBadChi2Prob,
00046 errFitNonPhysical,
00047 errNoTurnOn,
00048 errAllZeros
00049 };
00050
00051
00052 typedef std::map<sCurveHistogramType, MonitorElement*> sCurveHistogramHolder;
00053 typedef std::map<uint32_t, sCurveHistogramHolder> detIDHistogramMap;
00054
00055
00056
00057
00058 class SiPixelSCurveCalibrationAnalysis : public SiPixelOfflineCalibAnalysisBase {
00059 public:
00060 explicit SiPixelSCurveCalibrationAnalysis(const edm::ParameterSet& iConfig):SiPixelOfflineCalibAnalysisBase(iConfig){doSetup(iConfig);};
00061 ~SiPixelSCurveCalibrationAnalysis();
00062 void doSetup(const edm::ParameterSet&);
00063
00064 virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix);
00065
00066 static std::vector<float> efficiencies_;
00067 static std::vector<float> effErrors_;
00068 std::vector<float> vCalPointsAsFloats_;
00069
00070 sCurveErrorFlag estimateSCurveParameters(const std::vector<float>& eff, float& threshold, float& sigma);
00071 sCurveErrorFlag fittedSCurveSanityCheck(float threshold, float sigma, float amplitude);
00072
00073 void buildACurveHistogram(const uint32_t& detid, const uint32_t& row,
00074 const uint32_t& col, sCurveErrorFlag errorFlag,
00075 const std::vector<float>& efficiencies, const std::vector<float>& errors);
00076
00077 private:
00078
00079 bool useDetectorHierarchyFolders_;
00080 bool saveCurvesThatFlaggedBad_;
00081 unsigned int maxCurvesToSave_;
00082 unsigned int curvesSavedCounter_;
00083 bool write2dHistograms_;
00084 bool write2dFitResult_;
00085 std::vector<std::string> plaquettesToSave_;
00086 bool printoutthresholds_;
00087 bool writeZeroes_;
00088 std::string thresholdfilename_;
00089 std::map<uint32_t, bool> detIDsToSave_;
00090
00091
00092
00093 double minimumChi2prob_;
00094 double minimumThreshold_;
00095 double maximumThreshold_;
00096 double minimumSigma_;
00097 double maximumSigma_;
00098 double minimumEffAsymptote_;
00099 double maximumEffAsymptote_;
00100
00101
00102 double maximumThresholdBin_;
00103 double maximumSigmaBin_;
00104
00105
00106
00107 detIDHistogramMap histograms_;
00108
00109 virtual void calibrationSetup(const edm::EventSetup& iSetup);
00110 virtual bool checkCorrectCalibrationType();
00111 virtual void newDetID(uint32_t detid);
00112 void makeThresholdSummary(void);
00113 virtual void calibrationEnd() ;
00114
00115
00116 };
00117
00118 #endif