Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:37

0001 #ifndef CalibTracker_SiStripChannelGain_SiStripGainFromAsciiFile_h
0002 #define CalibTracker_SiStripChannelGain_SiStripGainFromAsciiFile_h
0003 
0004 #include "FWCore/ParameterSet/interface/FileInPath.h"
0005 
0006 #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h"
0007 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0008 
0009 #include <vector>
0010 #include <memory>
0011 #include <unordered_map>
0012 
0013 class SiStripGainFromAsciiFile : public ConditionDBWriter<SiStripApvGain> {
0014 public:
0015   explicit SiStripGainFromAsciiFile(const edm::ParameterSet&);
0016   ~SiStripGainFromAsciiFile() override;
0017 
0018 private:
0019   std::unique_ptr<SiStripApvGain> getNewObject() override;
0020 
0021 private:
0022   struct ModuleGain {
0023     float apv[6];
0024 
0025     void soft_reset() {
0026       for (int i = 0; i < 6; ++i)
0027         if (apv[i] == -1)
0028           apv[i] = 1;
0029     }
0030     void hard_reset(float val) {
0031       for (int i = 0; i < 6; ++i)
0032         apv[i] = val;
0033     }
0034   };
0035 
0036   std::string Asciifilename_;
0037   float referenceValue_;
0038   edm::FileInPath fp_;
0039 
0040   std::unordered_map<unsigned int, ModuleGain> GainsMap;
0041 };
0042 #endif