File indexing completed on 2024-09-07 04:35:43
0001 #include "CondTools/Ecal/interface/EcalLaser_weekly_Linearization.h"
0002 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
0003 #include "OnlineDB/EcalCondDB/interface/LMFSextuple.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0005 #include "CondCore/CondDB/interface/Time.h"
0006 #include "DataFormats/Provenance/interface/Timestamp.h"
0007 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0008
0009 #include <iostream>
0010 #include <iomanip>
0011 #include <sstream>
0012
0013 popcon::EcalLaser_weekly_Linearization::EcalLaser_weekly_Linearization(const edm::ParameterSet &ps)
0014 : m_name(ps.getUntrackedParameter<std::string>("name", "EcalLaser_weekly_Handler")) {
0015 std::cout << "EcalLaser Source handler constructor\n" << std::endl;
0016 }
0017
0018 popcon::EcalLaser_weekly_Linearization::~EcalLaser_weekly_Linearization() {
0019
0020 }
0021
0022 void popcon::EcalLaser_weekly_Linearization::getNewObjects() {
0023
0024
0025 std::cout << "------- Ecal -> getNewObjects\n";
0026
0027 unsigned long long max_since = 1;
0028 Ref payload = lastPayload();
0029
0030
0031 max_since = tagInfo().lastInterval.since;
0032 Tm max_since_tm(max_since);
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 for (int week = 0; week < 1; week++) {
0048 int fileIOV;
0049 std::cout << " which input IOV do you want " << std::endl;
0050 std::cin >> fileIOV;
0051 std::ifstream fWeek;
0052 std::ostringstream oss;
0053 oss << fileIOV;
0054 std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 fWeek.open(fname.c_str());
0066 if (!fWeek.is_open()) {
0067 std::cout << "ERROR : can't open file '" << fname << std::endl;
0068 break;
0069 }
0070 std::cout << " file " << fname << " opened" << std::endl;
0071
0072
0073 std::string line;
0074 for (int i = 0; i < 85; i++)
0075 getline(fWeek, line);
0076 char cryst[10];
0077 uint32_t ped[kGains], mult[kGains], shift[kGains];
0078 uint32_t id;
0079
0080 EcalTPGLinearizationConst *linC = new EcalTPGLinearizationConst;
0081
0082 for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
0083 getline(fWeek, line);
0084
0085
0086 sscanf(line.c_str(), "%s %u", cryst, &id);
0087
0088
0089 for (int gain = 0; gain < kGains; gain++) {
0090
0091 getline(fWeek, line);
0092
0093 sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
0094
0095 }
0096 EcalTPGLinearizationConst::Item item;
0097 item.mult_x1 = mult[2];
0098 item.mult_x6 = mult[1];
0099 item.mult_x12 = mult[0];
0100 item.shift_x1 = shift[2];
0101 item.shift_x6 = shift[1];
0102 item.shift_x12 = shift[0];
0103
0104 linC->insert(std::make_pair(id, item));
0105
0106
0107
0108 }
0109 getline(fWeek, line);
0110 std::cout << " comment line " << line << std::endl;
0111 for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
0112 getline(fWeek, line);
0113
0114 sscanf(line.c_str(), "%s %u", cryst, &id);
0115
0116
0117 for (int gain = 0; gain < kGains; gain++) {
0118 getline(fWeek, line);
0119
0120 sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
0121
0122
0123 }
0124
0125 EcalTPGLinearizationConst::Item item;
0126 item.mult_x1 = mult[2];
0127 item.mult_x6 = mult[1];
0128 item.mult_x12 = mult[0];
0129 item.shift_x1 = shift[2];
0130 item.shift_x6 = shift[1];
0131 item.shift_x12 = shift[0];
0132
0133 linC->insert(std::make_pair(id, item));
0134 }
0135 fWeek.close();
0136
0137
0138 m_to_transfer.push_back(std::make_pair(linC, fileIOV));
0139
0140 }
0141 std::cout << "Ecal -> end of getNewObjects -----------\n";
0142 }