CMS 3D CMS Logo

EcalTPGSpikeThresholdfromFile.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", "EcalTPGSpikeThresholdfromFile")) {
16  std::cout << "EcalTPGSpikeThresholdfromFile constructor\n" << std::endl;
17 }
18 
20  // do nothing
21 }
22 
24  std::cout << "------- Ecal -> getNewObjects\n";
25  edm::LogInfo("EcalTPGSpikeThresholdfromFile") << "Started GetNewObjects!!!";
26 
28 
29  // here popcon tells us which is the last since of the last object in the offline DB
30 
31  int fileIOV;
32  std::cout << "LinPed which input IOV do you want " << std::endl;
33  std::cin >> fileIOV;
34  std::ifstream fLin;
35  std::ostringstream oss;
36  oss << fileIOV;
37  std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
38  fLin.open(fname.c_str());
39  if (!fLin.is_open()) {
40  std::cout << "ERROR : can't open file '" << fname << std::endl;
41  return;
42  }
43  std::cout << " file " << fname << " opened" << std::endl;
45  for (int i = 0; i < 365223; i++)
46  getline(fLin, line);
47  char tow[8];
48  unsigned int towerId, Threshold;
49  EcalTPGSpike *lut = new EcalTPGSpike();
50  for (int istrip = 0; istrip < 2448; istrip++) {
51  getline(fLin, line);
52  sscanf(line.c_str(), "%s %u", tow, &towerId);
53  if (istrip < 10)
54  std::cout << " string " << tow << " Id " << towerId;
55  getline(fLin, line); // LUTGroupId
56  getline(fLin, line); // FgGroupId
57  getline(fLin, line); // spike_killing_threshold
58  if (istrip < 10)
59  std::cout << " line " << line;
60  sscanf(line.c_str(), "%u", &Threshold);
61  if (istrip < 10)
62  std::cout << " Threshold " << Threshold << std::endl;
63 
64  lut->setValue(towerId, Threshold);
65  } // end loop over EB towers
66  fLin.close();
67 
68  m_to_transfer.push_back(std::make_pair(lut, fileIOV));
69 
70  std::cout << "Ecal -> end of getNewObjects -----------\n";
71 }
void setValue(const uint32_t &id, const uint16_t &val)
Definition: EcalTPGSpike.cc:7
l1t::HGCalTowerID towerId
Definition: classes.h:36
string fname
main script