CMS 3D CMS Logo

EcalTPGFineGrainTowerfromFile.cc
Go to the documentation of this file.
2 
4 
6 
9 
10 #include <iostream>
11 #include <fstream>
12 #include <sstream>
13 
15  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalTPGFineGrainTowerfromFile")) {
16  fname = ps.getParameter<std::string>("FileName");
17 
18  std::cout << "EcalTPGFineGrainTowerfromFile constructor\n" << std::endl;
19 }
20 
22 
24  std::cout << "------- Ecal -> getNewObjects\n";
25  edm::LogInfo("EcalTPGFineGrainTowerfromFile") << "Started GetNewObjects!!!";
26 
27  int fileIOV;
28  std::cout << "LinPed which input IOV do you want " << std::endl;
29  std::cin >> fileIOV;
30  std::ifstream fLin;
31  std::ostringstream oss;
32  oss << fileIOV;
33  // std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
34  fLin.open(fname.c_str());
35  if (!fLin.is_open()) {
36  std::cout << "ERROR : can't open file '" << fname << std::endl;
37  return;
38  }
39  std::cout << " file " << fname << " opened" << std::endl;
40  /* structure of the file:
41 TOWER_EB 365224/375015 : 9792 lines 2448 towers 3 lines : 0, 0, 96 (LUTGroupId, FgGroupId, spike_killing_threshold)
42 empty line 375016
43 TOWER_EE 375017/379768 : 4752 lines 1584 towers 2 lines : 0, 0x0 (LUTGroupId, tower_lut_fg)
44  */
46  for (int i = 0; i < 375016; i++)
47  getline(fLin, line);
48  char tower[8];
49  unsigned int towerId, LUTFg;
51  for (int itower = 0; itower < 1584; itower++) {
52  getline(fLin, line);
53  sscanf(line.c_str(), "%s %u", tower, &towerId);
54  if (itower < 10 || (itower > 1574 && itower < 1584))
55  std::cout << " string " << tower << " Id " << towerId;
56  getline(fLin, line); // LUTGroupId
57  getline(fLin, line); // tower_lut_fg
58  if (itower < 10 || (itower > 1574 && itower < 1584))
59  std::cout << " line " << line << std::endl;
60  sscanf(line.c_str(), "%x", &LUTFg);
61  // EcalTPGFineGrainTowerEE::Item item;
62  // item.lut = LUTFg;
63  // fgrMap->setValue(towerId, item);
64 
65  fgrMap->setValue(towerId, LUTFg);
66  } // end loop over EE towers
67  fLin.close();
68 
69  m_to_transfer.push_back(std::make_pair(fgrMap, fileIOV));
70 
71  std::cout << "Ecal -> end of getNewObjects -----------\n";
72 }
popcon::EcalTPGFineGrainTowerfromFile::fname
std::string fname
Definition: EcalTPGFineGrainTowerfromFile.h:30
mps_fire.i
i
Definition: mps_fire.py:355
ESHandle.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
popcon::EcalTPGFineGrainTowerfromFile::EcalTPGFineGrainTowerfromFile
EcalTPGFineGrainTowerfromFile(edm::ParameterSet const &)
Definition: EcalTPGFineGrainTowerfromFile.cc:14
EcalTPGFineGrainTowerEE
Definition: EcalTPGFineGrainTowerEE.h:9
EcalMappingRcd.h
popcon::EcalTPGFineGrainTowerfromFile::getNewObjects
void getNewObjects() override
Definition: EcalTPGFineGrainTowerfromFile.cc:23
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
EcalElectronicsMapping.h
popcon::EcalTPGFineGrainTowerfromFile::~EcalTPGFineGrainTowerfromFile
~EcalTPGFineGrainTowerfromFile() override
Definition: EcalTPGFineGrainTowerfromFile.cc:21
EcalTPGFineGrainTowerfromFile.h
EcalTPGFineGrainTowerEE::setValue
void setValue(const uint32_t &id, const uint32_t &lut)
Definition: EcalTPGFineGrainTowerEE.cc:7
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
std
Definition: JetResolutionObject.h:76
ParameterSetfwd.h
mps_splice.line
line
Definition: mps_splice.py:76