CMS 3D CMS Logo

CSCBadChambersConditions.h
Go to the documentation of this file.
1 #ifndef _CSCBADCHAMBERSCONDITIONS_H
2 #define _CSCBADCHAMBERSCONDITIONS_H
3 
4 #include <memory>
5 #include <cmath>
15 
19 
21  public:
23  ~CSCBadChambersConditions() override;
24 
25 
26  inline static CSCBadChambers * prefillBadChambers();
27 
28  typedef std::unique_ptr<CSCBadChambers> ReturnType;
29 
30  ReturnType produceBadChambers(const CSCBadChambersRcd&);
31 
32  private:
33  // ----------member data ---------------------------
36 
37 };
38 
39 #include<fstream>
40 #include<vector>
41 #include<iostream>
42 
43 // to workaround plugin library
45 {
46  // const int MAX_SIZE = 468;
47  //cndbbadchambers = new CSCBadChambers();
48 
49  int new_chambers;
50  std::vector<int> new_badchambers;
51  int old_chamber = -1;
52  int new_nrlines;
53  new_nrlines=0;
54 
55  std::ifstream newdata;
56 
57  newdata.open("badchambers.dat",std::ios::in);
58  if(!newdata) {
59  std::cerr <<"Error: badchambers.dat -> no such file!"<< std::endl;
60  exit(1);
61  }
62 
63  while(!newdata.eof() ) {
64 
65  newdata >> new_chambers;
66  if (new_chambers!=old_chamber){
67  new_badchambers.push_back(new_chambers);
68  std::cout<<new_chambers<<std::endl;
69  ++new_nrlines;
70  }
71  old_chamber = new_chambers;
72  }
73  newdata.close();
74 
75  CSCBadChambers * cndbbadchambers = new CSCBadChambers(new_nrlines, new_badchambers);
76 
77  //std::cout <<"numberOfBadChambers "<<new_nrlines<<std::endl;
78 
79  return cndbbadchambers;
80 }
81 
82 #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 &)
CSCBadChambersConditions(const edm::ParameterSet &)