CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalLaserCondTools.h
Go to the documentation of this file.
1 #ifndef CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h
2 #define CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h
3 
4 /*
5  * $Id: EcalLaserCondTools.h,v 1.2 2010/06/14 10:45:16 pgras Exp $
6  */
7 
15 
17 
18 #include <cstdio>
19 #include <ctime>
20 #include <string>
21 #include <vector>
25  //static fields
26 
29  static constexpr int nLmes = 92;
30 
31  //methods
32 public:
37 
40  ~EcalLaserCondTools() override;
41 
46  void analyze(const edm::Event& evt, const edm::EventSetup& es) override;
47  void from_hdf_to_db();
48 
49 private:
50  static std::string toNth(int n);
51  static std::string timeToString(time_t t);
52  class CorrReader {
53  public:
54  CorrReader() : verb_(0) {}
55  virtual bool readTime(int& t1, int t2[nLmes], int& t3) { return false; }
56  virtual bool readPs(DetId& rawdetid, EcalLaserAPDPNRatios::EcalLaserAPDPNpair& corr) { return false; }
57  virtual ~CorrReader() {}
58  void setVerbosity(int verb) { verb_ = verb; }
59 
60  protected:
61  int verb_;
62  };
63 
65  public:
66  FileReader(const std::vector<std::string>& fnames) : f_(nullptr), fnames_(fnames), ifile_(-1), iline_(0) {}
67  bool readTime(int& t1, int t2[EcalLaserCondTools::nLmes], int& t3) override;
68  bool readPs(DetId& rawdetid, EcalLaserAPDPNRatios::EcalLaserAPDPNpair& corr) override;
69  ~FileReader() override {}
70 
71  private:
72  bool nextFile();
73  void trim();
74  FILE* f_;
75  std::vector<std::string> fnames_;
76  unsigned ifile_;
77  int iline_;
78  };
79 
80 private:
81  void fillDb(CorrReader& r);
82  void dbToAscii(const edm::EventSetup& es);
83  void processIov(CorrReader& r, int t1, int t2[nLmes], int t3);
84 
85  //fields
86 private:
88  FILE* fout_;
89  FILE* eventList_;
91  int verb_;
93  std::vector<std::string> fnames_;
95  int skipIov_;
96  int nIovs_;
97  int fromTime_;
98  int toTime_;
99  double minP_, maxP_;
100  FILE* ferr_;
101 };
102 
103 #endif //EcaLaserCondTools_h not defined
std::vector< std::string > fnames_
EcalLaserCondTools(const edm::ParameterSet &)
void fillDb(CorrReader &r)
~EcalLaserCondTools() override
static std::string timeToString(time_t t)
edm::Service< cond::service::PoolDBOutputService > db_
void processIov(CorrReader &r, int t1, int t2[nLmes], int t3)
virtual bool readPs(DetId &rawdetid, EcalLaserAPDPNRatios::EcalLaserAPDPNpair &corr)
virtual bool readTime(int &t1, int t2[nLmes], int &t3)
void dbToAscii(const edm::EventSetup &es)
bool readPs(DetId &rawdetid, EcalLaserAPDPNRatios::EcalLaserAPDPNpair &corr) override
bool readTime(int &t1, int t2[EcalLaserCondTools::nLmes], int &t3) override
static constexpr int nLmes
std::string eventListFileName_
void analyze(const edm::Event &evt, const edm::EventSetup &es) override
Definition: DetId.h:17
FileReader(const std::vector< std::string > &fnames)
static std::string toNth(int n)
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd > laserAPDPNRatiosToken_
std::vector< std::string > fnames_