File indexing completed on 2024-04-06 11:57:58
0001 #ifndef CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H
0002 #define CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <map>
0013 #include <string>
0014
0015 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019
0020 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
0021 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
0022 #include <Geometry/EcalMapping/interface/EcalElectronicsMapping.h>
0023 #include <Geometry/EcalMapping/interface/EcalMappingRcd.h>
0024
0025 #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedResult.h"
0026 #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedValues.h"
0027
0028 class EcalPedOffset : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0029 public:
0030
0031 EcalPedOffset(const edm::ParameterSet &ps);
0032
0033
0034 ~EcalPedOffset() override;
0035
0036
0037 void analyze(edm::Event const &event, edm::EventSetup const &eventSetup) override;
0038
0039
0040 void beginRun(edm::Run const &, edm::EventSetup const &eventSetup) override;
0041
0042
0043 void endRun(edm::Run const &, edm::EventSetup const &) override;
0044
0045
0046 void endJob(void) override;
0047
0048
0049 void writeXMLFiles(std::string fileName);
0050
0051
0052 void writeDb();
0053
0054
0055 void makePlots();
0056
0057 private:
0058 const EcalElectronicsMapping *ecalElectronicsMap_;
0059
0060 std::string intToString(int num);
0061 void readDACs(const edm::Handle<EBDigiCollection> &pDigis, const std::map<int, int> &DACvalues);
0062 void readDACs(const edm::Handle<EEDigiCollection> &pDigis, const std::map<int, int> &DACvalues);
0063
0064 const edm::InputTag m_barrelDigiCollection;
0065 const edm::InputTag m_endcapDigiCollection;
0066 const edm::InputTag m_headerCollection;
0067
0068 const edm::EDGetTokenT<EcalRawDataCollection> m_rawDataToken;
0069 const edm::EDGetTokenT<EBDigiCollection> m_ebDigiToken;
0070 const edm::EDGetTokenT<EEDigiCollection> m_eeDigiToken;
0071 const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> m_mappingToken;
0072
0073 std::string m_xmlFile;
0074
0075 std::map<int, TPedValues *> m_pedValues;
0076 std::map<int, TPedResult *> m_pedResult;
0077
0078 int m_DACmin;
0079 int m_DACmax;
0080 double m_RMSmax;
0081 int m_bestPed;
0082
0083
0084 std::string m_dbHostName;
0085
0086 std::string m_dbName;
0087
0088 std::string m_dbUserName;
0089
0090 std::string m_dbPassword;
0091
0092 int m_dbHostPort;
0093
0094
0095 bool m_create_moniov;
0096
0097 std::string m_location;
0098
0099 int m_run;
0100
0101
0102 std::string m_plotting;
0103
0104 double m_maxSlopeAllowed_;
0105
0106 double m_minSlopeAllowed_;
0107
0108 double m_maxChi2OverNDFAllowed_;
0109 };
0110
0111 #endif