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/EcalGainRatios.h" 00022 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" 00023 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" 00024 #include "CondFormats/EcalObjects/interface/EcalPedestals.h" 00025 #include "DataFormats/EcalDetId/interface/EBDetId.h" 00026 00027 namespace edm{ 00028 class ParameterSet; 00029 class Event; 00030 class EventSetup; 00031 } 00032 using namespace std; 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 *); 00045 EcalGainRatios* readEcalGainRatiosFromFile(const char *); 00046 EcalChannelStatus* readEcalChannelStatusFromFile(const char *); 00047 void writeToLogFile(string , string, unsigned long long) ; 00048 void writeToLogFileResults(char* ) ; 00049 int convertFromConstructionSMToSlot(int ,int ); 00050 00051 explicit StoreEcalCondition(const edm::ParameterSet& iConfig ); 00052 ~StoreEcalCondition(); 00053 00054 virtual void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup); 00055 virtual void endJob(); 00056 00057 private: 00058 00059 void fillHeader(char*); 00060 00061 std::vector< std::string > objectName_ ; 00062 // it can be of type: EcalWeightXtalGroups, EcalTBWeights, EcalADCToGeVConstant, EcalIntercalibConstants, EcalGainRatios 00063 std::vector< std::string > inpFileName_ ; 00064 std::string prog_name_ ; 00065 int sm_constr_; // SM number from data file 00066 int sm_slot_; // SM slot to map data to 00067 std::vector< unsigned long long > since_; // beginning IOV for objects 00068 std::string logfile_; 00069 00070 std::string to_string( char value[]) { 00071 std::ostringstream streamOut; 00072 streamOut << value; 00073 return streamOut.str(); 00074 } 00075 00076 }; 00077 #endif