Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:17

0001 //
0002 // Original Author:  Fedor Ratnikov Oct 21, 2005
0003 //
0004 //
0005 #include <map>
0006 #include <string>
0007 
0008 #include "FWCore/Framework/interface/ESProducer.h"
0009 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
0012 #include "CondFormats/DataRecord/interface/HcalTPParametersRcd.h"
0013 #include "CondFormats/HcalObjects/interface/AllObjects.h"
0014 class ParameterSet;
0015 
0016 class HcalPedestalsRcd;
0017 class HcalPedestalWidthsRcd;
0018 class HcalGainsRcd;
0019 class HcalGainWidthsRcd;
0020 class HcalQIEDataRcd;
0021 class HcalQIETypesRcd;
0022 class HcalChannelQualityRcd;
0023 class HcalElectronicsMapRcd;
0024 class HcalFrontEndMapRcd;
0025 class HcalRespCorrsRcd;
0026 class HcalTimeCorrsRcd;
0027 class HcalLUTCorrsRcd;
0028 class HcalPFCorrsRcd;
0029 class HcalZSThresholdsRcd;
0030 class HcalL1TriggerObjectsRcd;
0031 class HcalValidationCorrsRcd;
0032 class HcalLutMetadataRcd;
0033 class HcalDcsRcd;
0034 class HcalDcsMapRcd;
0035 class HcalRecoParamsRcd;
0036 class HcalLongRecoParamsRcd;
0037 class HcalZDCLowGainFractionsRcd;
0038 class HcalMCParamsRcd;
0039 class HcalFlagHFDigiTimeParamsRcd;
0040 class HcalTimingParamsRcd;
0041 class HcalSiPMParametersRcd;
0042 class HcalSiPMCharacteristicsRcd;
0043 class HcalTPChannelParametersRcd;
0044 class HcalTPParaamersRcd;
0045 
0046 class HcalTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0047 public:
0048   HcalTextCalibrations(const edm::ParameterSet&);
0049   ~HcalTextCalibrations() override;
0050 
0051   void produce(){};
0052 
0053   template <class T>
0054   class CheckGetObject {
0055   public:
0056     CheckGetObject(const HcalTopology* topo) {}
0057     std::unique_ptr<T> operator()(std::istream& inStream) {
0058       auto result = makeResult();
0059       if (!HcalDbASCIIIO::getObject(inStream, &*result))
0060         result.reset(nullptr);
0061       return result;
0062     }
0063     virtual ~CheckGetObject() = default;
0064 
0065   protected:
0066     virtual std::unique_ptr<T> makeResult() { return std::make_unique<T>(); }
0067   };
0068   template <class T>
0069   class CheckGetObjectTopo : public CheckGetObject<T> {
0070   public:
0071     CheckGetObjectTopo(const HcalTopology* topo) : CheckGetObject<T>(topo), topo_(topo) {}
0072     ~CheckGetObjectTopo() override = default;
0073 
0074   protected:
0075     std::unique_ptr<T> makeResult() override { return std::make_unique<T>(topo_); }
0076 
0077   private:
0078     const HcalTopology* topo_;
0079   };
0080   template <class T>
0081   class CheckCreateObject {
0082   public:
0083     CheckCreateObject(const HcalTopology* topo) {}
0084     std::unique_ptr<T> operator()(std::istream& inStream) { return HcalDbASCIIIO::createObject<T>(inStream); }
0085   };
0086 
0087 protected:
0088   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0089                       const edm::IOVSyncValue&,
0090                       edm::ValidityInterval&) override;
0091 
0092   std::unique_ptr<HcalPedestals> producePedestals(const HcalPedestalsRcd& rcd);
0093   std::unique_ptr<HcalPedestalWidths> producePedestalWidths(const HcalPedestalWidthsRcd& rcd);
0094   std::unique_ptr<HcalPedestals> produceEffectivePedestals(const HcalPedestalsRcd& rcd);
0095   std::unique_ptr<HcalPedestalWidths> produceEffectivePedestalWidths(const HcalPedestalWidthsRcd& rcd);
0096   std::unique_ptr<HcalGains> produceGains(const HcalGainsRcd& rcd);
0097   std::unique_ptr<HcalGainWidths> produceGainWidths(const HcalGainWidthsRcd& rcd);
0098   std::unique_ptr<HcalQIEData> produceQIEData(const HcalQIEDataRcd& rcd);
0099   std::unique_ptr<HcalQIETypes> produceQIETypes(const HcalQIETypesRcd& rcd);
0100   std::unique_ptr<HcalChannelQuality> produceChannelQuality(const HcalChannelQualityRcd& rcd);
0101   std::unique_ptr<HcalElectronicsMap> produceElectronicsMap(const HcalElectronicsMapRcd& rcd);
0102   std::unique_ptr<HcalFrontEndMap> produceFrontEndMap(const HcalFrontEndMapRcd& rcd);
0103 
0104   std::unique_ptr<HcalRespCorrs> produceRespCorrs(const HcalRespCorrsRcd& rcd);
0105   std::unique_ptr<HcalZSThresholds> produceZSThresholds(const HcalZSThresholdsRcd& rcd);
0106   std::unique_ptr<HcalL1TriggerObjects> produceL1TriggerObjects(const HcalL1TriggerObjectsRcd& rcd);
0107   std::unique_ptr<HcalTimeCorrs> produceTimeCorrs(const HcalTimeCorrsRcd& rcd);
0108   std::unique_ptr<HcalLUTCorrs> produceLUTCorrs(const HcalLUTCorrsRcd& rcd);
0109   std::unique_ptr<HcalPFCorrs> producePFCorrs(const HcalPFCorrsRcd& rcd);
0110 
0111   std::unique_ptr<HcalRecoParams> produceRecoParams(const HcalRecoParamsRcd& rcd);
0112   std::unique_ptr<HcalLongRecoParams> produceLongRecoParams(const HcalLongRecoParamsRcd& rcd);
0113   std::unique_ptr<HcalZDCLowGainFractions> produceZDCLowGainFractions(const HcalZDCLowGainFractionsRcd& rcd);
0114   std::unique_ptr<HcalMCParams> produceMCParams(const HcalMCParamsRcd& rcd);
0115   std::unique_ptr<HcalFlagHFDigiTimeParams> produceFlagHFDigiTimeParams(const HcalFlagHFDigiTimeParamsRcd& rcd);
0116 
0117   std::unique_ptr<HcalValidationCorrs> produceValidationCorrs(const HcalValidationCorrsRcd& rcd);
0118   std::unique_ptr<HcalLutMetadata> produceLutMetadata(const HcalLutMetadataRcd& rcd);
0119   std::unique_ptr<HcalDcsValues> produceDcsValues(HcalDcsRcd const& rcd);
0120   std::unique_ptr<HcalDcsMap> produceDcsMap(const HcalDcsMapRcd& rcd);
0121 
0122   std::unique_ptr<HcalTimingParams> produceTimingParams(const HcalTimingParamsRcd& rcd);
0123   std::unique_ptr<HcalSiPMParameters> produceSiPMParameters(const HcalSiPMParametersRcd& rcd);
0124   std::unique_ptr<HcalSiPMCharacteristics> produceSiPMCharacteristics(const HcalSiPMCharacteristicsRcd& rcd);
0125   std::unique_ptr<HcalTPChannelParameters> produceTPChannelParameters(const HcalTPChannelParametersRcd& rcd);
0126   std::unique_ptr<HcalTPParameters> produceTPParameters(const HcalTPParametersRcd& rcd);
0127 
0128 private:
0129   std::map<std::string, std::string> mInputs;
0130   std::unordered_map<std::string, edm::ESGetToken<HcalTopology, HcalRecNumberingRecord>> mTokens;
0131 };