CMS 3D CMS Logo

EcalTPGFineGrainStripfromFile.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","EcalTPGFineGrainStripfromFile")) {
16  fname = ps.getParameter<std::string>("FileName");
17 
18  std::cout << "EcalTPGFineGrainStripfromFile constructor\n" << std::endl;
19 }
20 
22  // do nothing
23 }
24 
26  std::cout << "------- Ecal -> getNewObjects\n";
27  edm::LogInfo("EcalTPGFineGrainStripfromFile") << "Started GetNewObjects!!!";
28 
30  int fileIOV;
31  std::cout << "LinPed which input IOV do you want " << std::endl;
32  std::cin >> fileIOV;
33  std::ifstream fLin;
34  std::ostringstream oss;
35  oss << fileIOV;
36  // std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
37  fLin.open(fname.c_str());
38  if(!fLin.is_open()) {
39  std::cout << "ERROR : can't open file '" << fname << std::endl;
40  return;
41  }
42  std::cout << " file " << fname << " opened" << std::endl;
44  for(int i = 0; i < 304517; i++) getline (fLin, line);
45  char strip[8];
46  unsigned int stripId, Threshold, LUTFgr;
47  for (int istrip = 0; istrip < 15176; istrip++) {
48  getline (fLin, line);
49  sscanf(line.c_str(), "%s %u", strip, &stripId);
50  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " string " << strip << " Id " << stripId;
51  getline (fLin, line); // sliding_window
52  getline (fLin, line); // weightGroupId
53  getline (fLin, line); // threshold_sfg lut_sfg
54  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " line " << line;
55  sscanf(line.c_str(), "%x %x", &Threshold, &LUTFgr);
56  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " Threshold " << Threshold << std::endl;
58  item.threshold = Threshold;
59  item.lut = LUTFgr;
60 
61  fgrStripEE->setValue(stripId, item);
62  if(istrip == 12239) getline (fLin, line); // 1 empty line between EB and EE
63  } // end loop over EB + EE strips
64  fLin.close();
65 
66  m_to_transfer.push_back(std::make_pair((EcalTPGFineGrainStripEE*)fgrStripEE, fileIOV));
67 
68  std::cout << "Ecal -> end of getNewObjects -----------\n";
69 }
T getParameter(std::string const &) const
void setValue(const uint32_t &id, const Item &value)