00001 #ifndef StoreEcalCondition_h 00002 #define StoreEcalCondition_h 00003 00004 #include "FWCore/Framework/interface/EDAnalyzer.h" 00005 00006 #include <string> 00007 #include <map> 00008 #include <iostream> 00009 #include <fstream> 00010 #include <cstdio> 00011 #include <typeinfo> 00012 #include <sstream> 00013 00014 #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" 00015 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" 00016 #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" 00017 #include "CondFormats/EcalObjects/interface/EcalTBWeights.h" 00018 #include "CondFormats/EcalObjects/interface/EcalWeightSet.h" 00019 #include "CondFormats/EcalObjects/interface/EcalWeight.h" 00020 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" 00021 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" 00022 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h" 00023 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" 00024 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" 00025 #include "CondFormats/EcalObjects/interface/EcalPedestals.h" 00026 #include "DataFormats/EcalDetId/interface/EBDetId.h" 00027 00028 namespace edm{ 00029 class ParameterSet; 00030 class Event; 00031 class EventSetup; 00032 } 00033 00034 // 00035 // class decleration 00036 // 00037 00038 class StoreEcalCondition : public edm::EDAnalyzer { 00039 public: 00040 00041 EcalWeightXtalGroups* readEcalWeightXtalGroupsFromFile(const char *); 00042 EcalTBWeights* readEcalTBWeightsFromFile(const char *); 00043 EcalADCToGeVConstant* readEcalADCToGeVConstantFromFile(const char *); 00044 EcalIntercalibConstants* readEcalIntercalibConstantsFromFile(const char *, const char *); 00045 EcalIntercalibConstantsMC* readEcalIntercalibConstantsMCFromFile(const char *, const char *); 00046 EcalGainRatios* readEcalGainRatiosFromFile(const char *); 00047 EcalChannelStatus* readEcalChannelStatusFromFile(const char *); 00048 void writeToLogFile(std::string , std::string, unsigned long long) ; 00049 void writeToLogFileResults(char* ) ; 00050 int convertFromConstructionSMToSlot(int ,int ); 00051 00052 explicit StoreEcalCondition(const edm::ParameterSet& iConfig ); 00053 ~StoreEcalCondition(); 00054 00055 virtual void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup); 00056 virtual void endJob(); 00057 00058 private: 00059 00060 void fillHeader(char*); 00061 00062 std::vector< std::string > objectName_ ; 00063 // it can be of type: EcalWeightXtalGroups, EcalTBWeights, EcalADCToGeVConstant, EcalIntercalibConstants, EcalGainRatios 00064 std::vector< std::string > inpFileName_ ; 00065 std::vector< std::string > inpFileNameEE_ ; 00066 std::string prog_name_ ; 00067 int sm_constr_; // SM number from data file 00068 int sm_slot_; // SM slot to map data to 00069 std::vector< unsigned long long > since_; // beginning IOV for objects 00070 std::string logfile_; 00071 00072 std::string to_string( char value[]) { 00073 std::ostringstream streamOut; 00074 streamOut << value; 00075 return streamOut.str(); 00076 } 00077 00078 }; 00079 #endif