CMS 3D CMS Logo

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
CSCBadChambersConditions::ReturnType
std::unique_ptr< CSCBadChambers > ReturnType
Definition: CSCBadChambersConditions.h:27
CSCBadChambersConditions::~CSCBadChambersConditions
~CSCBadChambersConditions() override
Definition: CSCBadChambersConditions.cc:16
ESHandle.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
CSCBadChambersConditions
Definition: CSCBadChambersConditions.h:20
CSCBadChambers
Definition: CSCBadChambers.h:9
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
CSCDetId.h
CSCBadChambersConditions::CSCBadChambersConditions
CSCBadChambersConditions(const edm::ParameterSet &)
Definition: CSCBadChambersConditions.cc:8
CSCBadChambersConditions::prefillBadChambers
static CSCBadChambers * prefillBadChambers()
Definition: CSCBadChambersConditions.h:44
MakerMacros.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
EventSetupRecordIntervalFinder.h
SourceFactory.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
CSCBadChambersConditions::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CSCBadChambersConditions.cc:31
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
recoMuon::in
Definition: RecoMuonEnumerators.h:6
CSCBadChambersConditions::produceBadChambers
ReturnType produceBadChambers(const CSCBadChambersRcd &)
Definition: CSCBadChambersConditions.cc:26
CSCBadChambersConditions::cndbBadChambers
CSCBadChambers * cndbBadChambers
Definition: CSCBadChambersConditions.h:36
CSCBadChambersRcd.h
CSCBadChambersRcd
Definition: CSCBadChambersRcd.h:5
Frameworkfwd.h
EventSetup.h
edm::ESProducer
Definition: ESProducer.h:101
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
ParameterSet.h
CSCBadChambers.h