test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
17  std::cout << "EcalTPGFineGrainStripfromFile constructor\n" << std::endl;
18 }
19 
21  // do nothing
22 }
23 
25  std::cout << "------- Ecal -> getNewObjects\n";
26  edm::LogInfo("EcalTPGFineGrainStripfromFile") << "Started GetNewObjects!!!";
27 
28  Ref payload= lastPayload();
29 
30  // here popcon tells us which is the last since of the last object in the offline DB
31 
33  int fileIOV;
34  std::cout << "LinPed which input IOV do you want " << std::endl;
35  std::cin >> fileIOV;
36  std::ifstream fLin;
37  std::ostringstream oss;
38  oss << fileIOV;
39  std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
40  fLin.open(fname.c_str());
41  if(!fLin.is_open()) {
42  std::cout << "ERROR : can't open file '" << fname << std::endl;
43  return;
44  }
45  std::cout << " file " << fname << " opened" << std::endl;
47  for(int i = 0; i < 304517; i++) getline (fLin, line);
48  char strip[8];
49  unsigned int stripId, Threshold, LUTFgr;
50  for (int istrip = 0; istrip < 15176; istrip++) {
51  getline (fLin, line);
52  sscanf(line.c_str(), "%s %u", strip, &stripId);
53  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " string " << strip << " Id " << stripId;
54  getline (fLin, line); // sliding_window
55  getline (fLin, line); // weightGroupId
56  getline (fLin, line); // threshold_sfg lut_sfg
57  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " line " << line;
58  sscanf(line.c_str(), "%x %x", &Threshold, &LUTFgr);
59  if(istrip < 10 || (istrip > 12239 && istrip < 12250)) std::cout << " Threshold " << Threshold << std::endl;
61  item.threshold = Threshold;
62  item.lut = LUTFgr;
63 
64  fgrStripEE->setValue(stripId, item);
65  if(istrip == 12239) getline (fLin, line); // 1 empty line between EB and EE
66  } // end loop over EB + EE strips
67  fLin.close();
68 
69  m_to_transfer.push_back(std::make_pair((EcalTPGFineGrainStripEE*)fgrStripEE, fileIOV));
70 
71  std::cout << "Ecal -> end of getNewObjects -----------\n";
72 }
int i
Definition: DBlmapReader.cc:9
void setValue(const uint32_t &id, const Item &value)
string fname
main script
tuple cout
Definition: gather_cfg.py:145