File indexing completed on 2024-04-06 11:59:57
0001 #ifndef CalibTracker_SiStripLorentzAngle_MeasureLA_h
0002 #define CalibTracker_SiStripLorentzAngle_MeasureLA_h
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/ESProducer.h"
0006
0007 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0008 #include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
0009 #include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h"
0010 #include "CalibTracker/SiStripLorentzAngle/interface/LA_Filler_Fitter.h"
0011 #include "CalibTracker/SiStripCommon/interface/Book.h"
0012
0013 #include <memory>
0014
0015 namespace sistrip {
0016
0017 class MeasureLA : public edm::ESProducer {
0018 public:
0019 explicit MeasureLA(const edm::ParameterSet&);
0020 std::unique_ptr<SiStripLorentzAngle> produce(const SiStripLorentzAngleRcd&);
0021
0022 private:
0023 enum GRANULARITY { LAYER = 0, MODULE = 1, MODULESUMMARY = 2 };
0024 static std::string granularity(int32_t g) {
0025 switch (g) {
0026 case LAYER:
0027 return "_layer";
0028 case MODULE:
0029 return "_module";
0030 case MODULESUMMARY:
0031 return "_moduleSummary";
0032 }
0033 return "";
0034 };
0035
0036 void store_calibrations();
0037 void store_methods_and_granularity(const edm::VParameterSet&);
0038
0039 void summarize_module_muH_byLayer(const LA_Filler_Fitter&);
0040 void process_reports() const;
0041 template <class T>
0042 void write_report_text(const std::string,
0043 const LA_Filler_Fitter::Method&,
0044 const std::map<T, LA_Filler_Fitter::Result>&) const;
0045 void write_report_text_ms(const std::string, const LA_Filler_Fitter::Method) const;
0046 void write_report_plots(const std::string, const LA_Filler_Fitter::Method, const GRANULARITY) const;
0047
0048 void calibrate(const std::pair<unsigned, LA_Filler_Fitter::Method>, LA_Filler_Fitter::Result&) const;
0049 std::pair<unsigned, LA_Filler_Fitter::Method> calibration_key(const std::string layer,
0050 const LA_Filler_Fitter::Method) const;
0051 std::pair<unsigned, LA_Filler_Fitter::Method> calibration_key(const uint32_t detid,
0052 const LA_Filler_Fitter::Method) const;
0053
0054 const std::vector<std::string> inputFiles;
0055 const std::string inFileLocation;
0056 const edm::FileInPath fp_;
0057 const edm::VParameterSet reports, measurementPreferences, calibrations;
0058 std::map<std::pair<uint32_t, LA_Filler_Fitter::Method>, float> slope, offset, error_scaling;
0059 int32_t methods;
0060 bool byModule, byLayer;
0061 const float localybin;
0062 const unsigned stripsperbin, maxEvents;
0063 Book book;
0064
0065 TrackerTopology tTopo_;
0066 };
0067
0068 }
0069 #endif