1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#include "CondTools/Ecal/interface/EcalTPGPhysicsConstfromFile.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <fstream>
#include <sstream>
popcon::EcalTPGPhysicsConstfromFile::EcalTPGPhysicsConstfromFile(const edm::ParameterSet& ps)
: m_name(ps.getUntrackedParameter<std::string>("name", "EcalTPGPhysicsConstfromFile")) {
std::cout << "EcalTPGPhysicsConstfromFile constructor" << std::endl;
}
popcon::EcalTPGPhysicsConstfromFile::~EcalTPGPhysicsConstfromFile() {
// do nothing
}
void popcon::EcalTPGPhysicsConstfromFile::getNewObjects() {
std::cout << "------- EcalTPGPhysicsConstfromFile -> getNewObjects\n";
edm::LogInfo("EcalTPGPhysicsConstfromFile") << "Started GetNewObjects!!!";
Ref payload = lastPayload();
// here popcon tells us which is the last since of the last object in the offline DB
int fileIOV;
std::cout << "LinPed which input IOV do you want " << std::endl;
std::cin >> fileIOV;
std::ifstream fLin;
std::ostringstream oss;
oss << fileIOV;
std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
fLin.open(fname.c_str());
if (!fLin.is_open()) {
std::cout << "ERROR : can't open file '" << fname << std::endl;
return;
}
std::cout << " file " << fname << " opened" << std::endl;
std::string line;
for (int i = 0; i < 76; i++)
getline(fLin, line);
EcalTPGPhysicsConst::Item item;
// Ecal barrel detector
getline(fLin, line); // PHYSICS_EB 838860800
// std::cout << " EB DetId " << line << std::endl;
DetId eb(DetId::Ecal, EcalBarrel);
float ETSat, TTThreshlow, TTThreshhigh, FG_lowThreshold, FG_highThreshold, FG_lowRatio, FG_highRatio;
getline(fLin, line);
sscanf(line.c_str(), "%f %f %f", &ETSat, &TTThreshlow, &TTThreshhigh);
item.EtSat = ETSat;
item.ttf_threshold_Low = TTThreshlow;
item.ttf_threshold_High = TTThreshhigh;
getline(fLin, line);
sscanf(line.c_str(), "%f %f %f %f", &FG_lowThreshold, &FG_highThreshold, &FG_lowRatio, &FG_highRatio);
item.FG_lowThreshold = FG_lowThreshold;
item.FG_highThreshold = FG_highThreshold;
item.FG_lowRatio = FG_lowRatio;
item.FG_highRatio = FG_highRatio;
EcalTPGPhysicsConst* physC = new EcalTPGPhysicsConst;
physC->setValue(eb.rawId(), item);
// Ecal endcap detector
getline(fLin, line); // empty line
getline(fLin, line); // PHYSICS_EE 872415232
std::cout << " EE DetId " << line << std::endl;
DetId ee(DetId::Ecal, EcalEndcap);
getline(fLin, line);
// std::cout << " EE TTT " << line << std::endl;
sscanf(line.c_str(), "%f %f %f", &ETSat, &TTThreshlow, &TTThreshhigh);
item.EtSat = ETSat;
item.ttf_threshold_Low = TTThreshlow;
item.ttf_threshold_High = TTThreshhigh;
getline(fLin, line);
// std::cout << " EE FG " << line << std::endl;
sscanf(line.c_str(), "%f %f %f %f", &FG_lowThreshold, &FG_highThreshold, &FG_lowRatio, &FG_highRatio);
item.FG_lowThreshold = FG_lowThreshold;
item.FG_highThreshold = FG_highThreshold;
item.FG_lowRatio = FG_lowRatio;
item.FG_highRatio = FG_highRatio;
physC->setValue(ee.rawId(), item);
m_to_transfer.push_back(std::make_pair(physC, fileIOV));
std::cout << "EcalTPGPhysicsConstfromFile - > end of getNewObjects -----------\n";
}
|