CMS 3D CMS Logo

HcalEmap.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibCalorimetry/HcalTPGAlgos
4 // Class : HcalEmap
5 //
6 // Implementation:
7 // structure and functionality for HCAL electronic map
8 // NOTE!
9 // Keep xdaq and Oracle dependencies out of here!
10 //
11 // Original Author: Gena Kukartsev, kukarzev@fnal.gov
12 // Created: Tue Oct 14 14:30:20 CDT 2009
13 //
14 
15 #include <cstdio>
16 #include <iostream>
17 #include <fstream>
18 #include <sstream>
19 #include <vector>
22 
23 using namespace std;
24 
26  int lines = 0;
27 
28  std::string _row;
29  ifstream inFile(filename.c_str(), std::ios::in);
30  if (!inFile) {
31  std::cout << "Unable to open file with the electronic map: " << filename << std::endl;
32  } else {
33  std::cout << "File with the electronic map opened successfully: " << filename << std::endl;
34  }
35  while (getline(inFile, _row)) {
36  HcalEmapRow aRow;
37  char fpga[32];
38  char subdet[32];
39 
40  int _read;
41  const char* _format = "%d %d %d %s %d %d %d %d %s %d %d %d";
42  _read = sscanf(_row.c_str(),
43  _format,
44  &(aRow.rawId),
45  &(aRow.crate),
46  &(aRow.slot),
47  fpga,
48  &(aRow.dcc),
49  &(aRow.spigot),
50  &(aRow.fiber),
51  &(aRow.fiberchan),
52  subdet,
53  &(aRow.ieta),
54  &(aRow.iphi),
55  &(aRow.idepth));
56  if (_read >= 12) {
57  lines++;
58 
59  aRow.subdet.append(subdet);
60  aRow.topbottom.append(fpga);
61 
62  map.push_back(aRow);
63  }
64  }
65  inFile.close();
66  std::cout << "HcalEmap: " << lines << " lines read" << std::endl;
67 
68  return 0;
69 }
70 
71 std::vector<HcalEmap::HcalEmapRow>& HcalEmap::get_map(void) { return map; }
72 
73 bool HcalEmap::HcalEmapRow::operator<(const HcalEmap::HcalEmapRow& other) const { return rawId < other.rawId; }
74 
75 //
76 // _____ test procedures for the HcalEmap class _____________________________
77 //
80  return 0;
81 }
HcalEmap::HcalEmapRow::idepth
int idepth
Definition: HcalEmap.h:40
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalEmap_test::test_read_map
int test_read_map(std::string filename)
Definition: HcalEmap.cc:78
HcalEmap::HcalEmapRow::spigot
int spigot
Definition: HcalEmap.h:40
HcalEmap::HcalEmapRow::fiber
int fiber
Definition: HcalEmap.h:40
HcalEmap::HcalEmapRow::slot
int slot
Definition: HcalEmap.h:40
HcalEmap.h
HcalEmap::HcalEmapRow::topbottom
std::string topbottom
Definition: HcalEmap.h:41
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
trackingPlots.other
other
Definition: trackingPlots.py:1467
HcalEmap::get_map
std::vector< HcalEmap::HcalEmapRow > & get_map(void)
Definition: HcalEmap.cc:71
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalEmap::HcalEmapRow::ieta
int ieta
Definition: HcalEmap.h:40
groupFilesInBlocks.lines
lines
Definition: groupFilesInBlocks.py:95
HcalEmap::HcalEmapRow::subdet
std::string subdet
Definition: HcalEmap.h:41
HcalDetId.h
recoMuon::in
Definition: RecoMuonEnumerators.h:6
HcalEmap::HcalEmapRow
Definition: HcalEmap.h:38
HcalEmap::read_map
int read_map(std::string filename)
Definition: HcalEmap.cc:25
HcalEmap::HcalEmapRow::crate
int crate
Definition: HcalEmap.h:40
HcalEmap::HcalEmapRow::operator<
bool operator<(const HcalEmapRow &other) const
Definition: HcalEmap.cc:73
std
Definition: JetResolutionObject.h:76
HcalEmap
Definition: HcalEmap.h:32
HcalEmap::HcalEmapRow::fiberchan
int fiberchan
Definition: HcalEmap.h:40
HcalEmap::HcalEmapRow::dcc
int dcc
Definition: HcalEmap.h:40
genParticles_cff.map
map
Definition: genParticles_cff.py:11
HcalEmap::HcalEmapRow::rawId
int rawId
Definition: HcalEmap.h:40
HcalEmap::HcalEmapRow::iphi
int iphi
Definition: HcalEmap.h:40