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 
27  Ref payload = lastPayload();
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 }
HLT_FULL_cff.Threshold
Threshold
Definition: HLT_FULL_cff.py:11663
mps_fire.i
i
Definition: mps_fire.py:428
popcon::EcalTPGSpikeThresholdfromFile::~EcalTPGSpikeThresholdfromFile
~EcalTPGSpikeThresholdfromFile() override
Definition: EcalTPGSpikeThresholdfromFile.cc:19
ESHandle.h
EcalTPGSpike
Definition: EcalTPGSpike.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalTPGSpikeThresholdfromFile.h
ecaldqm::towerId
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:77
EcalTPGSpike::setValue
void setValue(const uint32_t &id, const uint16_t &val)
Definition: EcalTPGSpike.cc:7
popcon::EcalTPGSpikeThresholdfromFile::EcalTPGSpikeThresholdfromFile
EcalTPGSpikeThresholdfromFile(edm::ParameterSet const &)
Definition: EcalTPGSpikeThresholdfromFile.cc:14
EcalMappingRcd.h
jets_cff.payload
payload
Definition: jets_cff.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
EcalElectronicsMapping.h
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
popcon::EcalTPGSpikeThresholdfromFile::getNewObjects
void getNewObjects() override
Definition: EcalTPGSpikeThresholdfromFile.cc:23
ParameterSetfwd.h
mps_splice.line
line
Definition: mps_splice.py:76