File indexing completed on 2023-10-25 09:37:53
0001 #include "CondTools/Ecal/interface/EcalTPGPhysicsConstfromFile.h"
0002
0003 #include "DataFormats/DetId/interface/DetId.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007 #include <iostream>
0008 #include <fstream>
0009 #include <sstream>
0010
0011 popcon::EcalTPGPhysicsConstfromFile::EcalTPGPhysicsConstfromFile(const edm::ParameterSet& ps)
0012 : m_name(ps.getUntrackedParameter<std::string>("name", "EcalTPGPhysicsConstfromFile")) {
0013 std::cout << "EcalTPGPhysicsConstfromFile constructor" << std::endl;
0014 }
0015
0016 popcon::EcalTPGPhysicsConstfromFile::~EcalTPGPhysicsConstfromFile() {
0017
0018 }
0019
0020 void popcon::EcalTPGPhysicsConstfromFile::getNewObjects() {
0021 std::cout << "------- EcalTPGPhysicsConstfromFile -> getNewObjects\n";
0022 edm::LogInfo("EcalTPGPhysicsConstfromFile") << "Started GetNewObjects!!!";
0023
0024 Ref payload = lastPayload();
0025
0026
0027 int fileIOV;
0028 std::cout << "LinPed which input IOV do you want " << std::endl;
0029 std::cin >> fileIOV;
0030 std::ifstream fLin;
0031 std::ostringstream oss;
0032 oss << fileIOV;
0033 std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
0034 fLin.open(fname.c_str());
0035 if (!fLin.is_open()) {
0036 std::cout << "ERROR : can't open file '" << fname << std::endl;
0037 return;
0038 }
0039 std::cout << " file " << fname << " opened" << std::endl;
0040 std::string line;
0041 for (int i = 0; i < 76; i++)
0042 getline(fLin, line);
0043
0044 EcalTPGPhysicsConst::Item item;
0045
0046 getline(fLin, line);
0047
0048 DetId eb(DetId::Ecal, EcalBarrel);
0049 float ETSat, TTThreshlow, TTThreshhigh, FG_lowThreshold, FG_highThreshold, FG_lowRatio, FG_highRatio;
0050 getline(fLin, line);
0051 sscanf(line.c_str(), "%f %f %f", &ETSat, &TTThreshlow, &TTThreshhigh);
0052 item.EtSat = ETSat;
0053 item.ttf_threshold_Low = TTThreshlow;
0054 item.ttf_threshold_High = TTThreshhigh;
0055 getline(fLin, line);
0056 sscanf(line.c_str(), "%f %f %f %f", &FG_lowThreshold, &FG_highThreshold, &FG_lowRatio, &FG_highRatio);
0057 item.FG_lowThreshold = FG_lowThreshold;
0058 item.FG_highThreshold = FG_highThreshold;
0059 item.FG_lowRatio = FG_lowRatio;
0060 item.FG_highRatio = FG_highRatio;
0061 EcalTPGPhysicsConst* physC = new EcalTPGPhysicsConst;
0062 physC->setValue(eb.rawId(), item);
0063
0064
0065 getline(fLin, line);
0066 getline(fLin, line);
0067 std::cout << " EE DetId " << line << std::endl;
0068 DetId ee(DetId::Ecal, EcalEndcap);
0069 getline(fLin, line);
0070
0071 sscanf(line.c_str(), "%f %f %f", &ETSat, &TTThreshlow, &TTThreshhigh);
0072 item.EtSat = ETSat;
0073 item.ttf_threshold_Low = TTThreshlow;
0074 item.ttf_threshold_High = TTThreshhigh;
0075 getline(fLin, line);
0076
0077 sscanf(line.c_str(), "%f %f %f %f", &FG_lowThreshold, &FG_highThreshold, &FG_lowRatio, &FG_highRatio);
0078 item.FG_lowThreshold = FG_lowThreshold;
0079 item.FG_highThreshold = FG_highThreshold;
0080 item.FG_lowRatio = FG_lowRatio;
0081 item.FG_highRatio = FG_highRatio;
0082 physC->setValue(ee.rawId(), item);
0083
0084 m_to_transfer.push_back(std::make_pair(physC, fileIOV));
0085
0086 std::cout << "EcalTPGPhysicsConstfromFile - > end of getNewObjects -----------\n";
0087 }