Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-13 03:30:46

0001 #ifndef CondTools_Ecal_StoreEcalCondition_h
0002 #define CondTools_Ecal_StoreEcalCondition_h
0003 
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005 
0006 #include <string>
0007 #include <map>
0008 #include <memory>
0009 #include <fstream>
0010 #include <cstdio>
0011 #include <typeinfo>
0012 #include <sstream>
0013 
0014 #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h"
0015 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0016 #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h"
0017 #include "CondFormats/EcalObjects/interface/EcalTBWeights.h"
0018 #include "CondFormats/EcalObjects/interface/EcalWeightSet.h"
0019 #include "CondFormats/EcalObjects/interface/EcalWeight.h"
0020 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0021 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
0022 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
0023 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
0024 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h"
0025 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
0026 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
0027 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0028 
0029 namespace edm {
0030   class ParameterSet;
0031   class Event;
0032   class EventSetup;
0033 }  // namespace edm
0034 
0035 //
0036 // class decleration
0037 //
0038 
0039 class StoreEcalCondition : public edm::one::EDAnalyzer<> {
0040 public:
0041   std::shared_ptr<EcalWeightXtalGroups> readEcalWeightXtalGroupsFromFile(const char*);
0042   std::shared_ptr<EcalTBWeights> readEcalTBWeightsFromFile(const char*);
0043   std::shared_ptr<EcalADCToGeVConstant> readEcalADCToGeVConstantFromFile(const char*);
0044   std::shared_ptr<EcalIntercalibConstants> readEcalIntercalibConstantsFromFile(const char*, const char*);
0045   std::shared_ptr<EcalPFRecHitThresholds> readEcalPFRecHitThresholdsFromFile(const char*, const char*);
0046   std::shared_ptr<EcalIntercalibConstantsMC> readEcalIntercalibConstantsMCFromFile(const char*, const char*);
0047   std::shared_ptr<EcalGainRatios> readEcalGainRatiosFromFile(const char*);
0048   std::shared_ptr<EcalChannelStatus> readEcalChannelStatusFromFile(const char*);
0049   void writeToLogFile(std::string, std::string, unsigned long long);
0050   void writeToLogFileResults(char*);
0051   int convertFromConstructionSMToSlot(int, int);
0052 
0053   explicit StoreEcalCondition(const edm::ParameterSet& iConfig);
0054   ~StoreEcalCondition() override;
0055 
0056   void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
0057   void endJob() override;
0058 
0059 private:
0060   void fillHeader(char*);
0061 
0062   std::vector<std::string> objectName_;
0063   // it can be of type: EcalWeightXtalGroups, EcalTBWeights, EcalADCToGeVConstant, EcalIntercalibConstants, EcalGainRatios
0064   std::vector<std::string> inpFileName_;
0065   std::vector<std::string> inpFileNameEE_;
0066   std::string prog_name_;
0067   int sm_constr_;                          // SM number from data file
0068   int sm_slot_;                            // SM slot to map data to
0069   std::vector<unsigned long long> since_;  // beginning IOV for objects
0070   std::string logfile_;
0071 
0072   std::string to_string(char value[]) {
0073     std::ostringstream streamOut;
0074     streamOut << value;
0075     return streamOut.str();
0076   }
0077 };
0078 #endif