Go to the documentation of this file.00001 #include "CondTools/Ecal/interface/EcalLaser_weekly_Linearization.h"
00002 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00003 #include "OnlineDB/EcalCondDB/interface/LMFSextuple.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00005 #include "CondCore/DBCommon/interface/Time.h"
00006 #include "DataFormats/Provenance/interface/Timestamp.h"
00007 #include "OnlineDB/EcalCondDB/interface/Tm.h"
00008
00009 #include<iostream>
00010 #include<iomanip>
00011 #include <sstream>
00012
00013 popcon::EcalLaser_weekly_Linearization::EcalLaser_weekly_Linearization(const edm::ParameterSet & ps)
00014 : m_name(ps.getUntrackedParameter<std::string>("name","EcalLaser_weekly_Handler")) {
00015 std::cout << "EcalLaser Source handler constructor\n" << std::endl;
00016 }
00017
00018 popcon::EcalLaser_weekly_Linearization::~EcalLaser_weekly_Linearization() {
00019
00020 }
00021
00022 void popcon::EcalLaser_weekly_Linearization::getNewObjects() {
00023
00024
00025 int iIov = 0;
00026
00027 std::cout << "------- Ecal -> getNewObjects\n";
00028
00029
00030 unsigned long long max_since= 1;
00031 Ref payload= lastPayload();
00032
00033
00034 max_since=tagInfo().lastInterval.first;
00035 Tm max_since_tm(max_since);
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 for(int week = 0; week < 1; week++) {
00051 EcalTPGLinearizationConst *linC = new EcalTPGLinearizationConst;
00052 int fileIOV;
00053 std::cout << " which input IOV do you want " << std::endl;
00054 std::cin >> fileIOV;
00055 std::ifstream fWeek;
00056 std::ostringstream oss;
00057 oss << fileIOV;
00058 std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 fWeek.open(fname.c_str());
00070 if(!fWeek.is_open()) {
00071 std::cout << "ERROR : can't open file '" << fname << std::endl;
00072 break;
00073 }
00074 std::cout << " file " << fname << " opened" << std::endl;
00075
00076
00077 std::string line;
00078 for(int i = 0; i < 85; i++) getline (fWeek, line);
00079 char cryst[10];
00080 uint32_t ped[kGains], mult[kGains], shift[kGains];
00081 uint32_t id;
00082 for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
00083 getline (fWeek, line);
00084
00085
00086 sscanf(line.c_str(), "%s %u", cryst, &id);
00087
00088
00089 for (int gain = 0; gain < kGains; gain++) {
00090
00091 getline (fWeek, line);
00092
00093 sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
00094
00095 }
00096 EcalTPGLinearizationConst::Item item;
00097 item.mult_x1 = mult[2];
00098 item.mult_x6 = mult[1];
00099 item.mult_x12 = mult[0];
00100 item.shift_x1 = shift[2];
00101 item.shift_x6 = shift[1];
00102 item.shift_x12 = shift[0];
00103
00104 linC->insert(std::make_pair(id, item));
00105
00106
00107
00108 }
00109 getline (fWeek, line);
00110 std::cout << " comment line " << line << std::endl;
00111 for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
00112 getline (fWeek, line);
00113
00114 sscanf(line.c_str(), "%s %u", cryst, &id);
00115
00116
00117 for (int gain =0; gain < kGains; gain++) {
00118 getline (fWeek, line);
00119
00120 sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
00121
00122
00123 }
00124
00125 EcalTPGLinearizationConst::Item item;
00126 item.mult_x1 = mult[2];
00127 item.mult_x6 = mult[1];
00128 item.mult_x12 = mult[0];
00129 item.shift_x1 = shift[2];
00130 item.shift_x6 = shift[1];
00131 item.shift_x12 = shift[0];
00132
00133 linC->insert(std::make_pair(id, item));
00134 }
00135 fWeek.close();
00136
00137
00138 m_to_transfer.push_back(std::make_pair((EcalTPGLinearizationConst*)linC, fileIOV));
00139
00140 iIov++;
00141 }
00142 std::cout << "Ecal -> end of getNewObjects -----------\n";
00143 }