CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCBadChambersConditions.h
Go to the documentation of this file.
1 #ifndef _CSCBADCHAMBERSCONDITIONS_H
2 #define _CSCBADCHAMBERSCONDITIONS_H
3 
13 #include <cmath>
14 #include <memory>
15 
19 
21 public:
23  ~CSCBadChambersConditions() override;
24 
25  inline static CSCBadChambers *prefillBadChambers();
26 
27  typedef std::unique_ptr<CSCBadChambers> ReturnType;
28 
30 
31 private:
32  // ----------member data ---------------------------
34  const edm::IOVSyncValue &,
35  edm::ValidityInterval &) override;
37 };
38 
39 #include <fstream>
40 #include <iostream>
41 #include <vector>
42 
43 // to workaround plugin library
45  // const int MAX_SIZE = 468;
46  // cndbbadchambers = new CSCBadChambers();
47 
48  int new_chambers;
49  std::vector<int> new_badchambers;
50  int old_chamber = -1;
51  int new_nrlines;
52  new_nrlines = 0;
53 
54  std::ifstream newdata;
55 
56  newdata.open("badchambers.dat", std::ios::in);
57  if (!newdata) {
58  std::cerr << "Error: badchambers.dat -> no such file!" << std::endl;
59  exit(1);
60  }
61 
62  while (!newdata.eof()) {
63  newdata >> new_chambers;
64  if (new_chambers != old_chamber) {
65  new_badchambers.push_back(new_chambers);
66  std::cout << new_chambers << std::endl;
67  ++new_nrlines;
68  }
69  old_chamber = new_chambers;
70  }
71  newdata.close();
72 
73  CSCBadChambers *cndbbadchambers = new CSCBadChambers(new_nrlines, new_badchambers);
74 
75  // std::cout <<"numberOfBadChambers "<<new_nrlines<<std::endl;
76 
77  return cndbbadchambers;
78 }
79 
80 #endif
std::unique_ptr< CSCBadChambers > ReturnType
static CSCBadChambers * prefillBadChambers()
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
ReturnType produceBadChambers(const CSCBadChambersRcd &)
tuple cout
Definition: gather_cfg.py:144
CSCBadChambersConditions(const edm::ParameterSet &)