52 : theTemplateCalibrationLocation(iConfig.getParameter<std::
string>(
"siPixelTemplateCalibrationLocation")),
53 theDetailedTemplateDBErrorOutput(iConfig.getParameter<bool>(
"wantDetailedTemplateDBErrorOutput")),
54 theFullTemplateDBOutput(iConfig.getParameter<bool>(
"wantFullTemplateDBOutput")),
55 testGlobalTag(iConfig.getParameter<bool>(
"TestGlobalTag")),
56 hasTriggeredWatcher(
false),
72 float theMagField = magfield.
product()->inTesla(center).mag();
74 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"\nTesting global tag at magfield = " << theMagField;
76 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"With record SiPixelTemplateDBObjectESProducerRcd";
81 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"\nLoading from file " << std::endl;
83 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"With record SiPixelTemplateDBObjectRcd";
90 std::vector<short> tempMapId;
93 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"Map info" << std::endl;
94 std::map<unsigned int, short> templMap = dbobject.
getTemplateIDs();
95 for (std::map<unsigned int, short>::const_iterator it = templMap.begin(); it != templMap.end(); ++it) {
96 if (tempMapId.empty())
97 tempMapId.push_back(it->second);
98 for (
unsigned int i = 0;
i < tempMapId.size(); ++
i) {
99 if (tempMapId[
i] == it->second)
101 else if (
i == tempMapId.size() - 1) {
102 tempMapId.push_back(it->second);
108 <<
"DetId: " << it->first <<
" TemplateID: " << it->second <<
"\n";
111 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"\nMap stores template Id(s): ";
112 for (
unsigned int vindex = 0; vindex < tempMapId.size(); ++vindex)
113 edm::LogPrint(
"SiPixelTemplateDBObjectReader") << tempMapId[vindex] <<
" ";
117 const char* tempfile;
120 float tempnum = 0,
diff = 0;
122 bool error =
false, givenErrorMsg =
false;
125 <<
"\nChecking Template DB object version " << dbobject.
version() <<
" containing " << numOfTempl
126 <<
" calibration(s) at " << dbobject.
sVector()[index + 22] <<
"T\n";
127 for (
int i = 0;
i < numOfTempl; ++
i) {
133 <<
"Calibration " <<
i + 1 <<
" of " << numOfTempl <<
", with Template ID " << dbobject.
sVector()[
index]
134 <<
"\tand Version " << dbobject.
sVector()[index + 1] <<
"\t-------- ";
137 std::ostringstream tout;
139 << std::right << dbobject.
sVector()[
index] <<
".out" << std::ends;
142 tempfile = (
file.fullPath()).c_str();
145 if (in_file.is_open()) {
151 while (!in_file.eof()) {
159 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"does NOT match\n";
162 givenErrorMsg =
true;
166 <<
"from file = " << tempnum <<
"\t from dbobject = " << dbobject.
sVector()[
index]
167 <<
"\tdiff = " <<
diff <<
"\t db index = " << index << std::endl;
176 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"MATCHES\n";
179 givenErrorMsg =
false;
184 <<
"\nThe were differences found between the files and the database.\n"
185 <<
"If you would like more detailed information please set\n"
186 <<
"wantDetailedOutput = True in the cfg file. If you would like a\n"
187 <<
"full output of the contents of the database file please set\n"
188 <<
"wantFullOutput = True. Make sure that you pipe the output to a\n"
189 <<
"log file. This could take a few minutes.\n\n";
192 edm::LogPrint(
"SiPixelTemplateDBObjectReader") << dbobject << std::endl;
202 int txsize[4] = {7, 13, 0, 0};
203 int tysize[4] = {21, 21, 0, 0};
205 int entries[4] = {0};
207 int i,
j,
k,
l,
m,
n, entry_it;
209 int sizeSetter = 0, templateVersion = 0;
211 edm::LogPrint(
"SiPixelTemplateDBObjectReader") <<
"\n\nDBobject version: " << dbobject.
version() << std::endl;
215 templateVersion = (int)dbobject.
sVector_[index + 21];
216 if (templateVersion <= 10) {
218 <<
"*****WARNING***** This code will not format this template version properly *****WARNING*****\n";
220 }
else if (templateVersion <= 16)
224 <<
"*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n";
227 <<
"\n\n*********************************************************************************************"
230 <<
"*************** Reading Template ID " << dbobject.
sVector_[index + 20] <<
"\t(" << m + 1
231 <<
"/" << dbobject.
numOfTempl_ <<
") ***************" << std::endl;
233 <<
"*********************************************************************************************\n\n"
238 for (n = 0; n < 20; ++
n) {
240 s << temp.
c[0] << temp.
c[1] << temp.
c[2] << temp.
c[3];
244 entries[0] = (int)dbobject.
sVector_[index + 3];
245 entries[1] = (
int)(dbobject.
sVector_[index + 4] * dbobject.
sVector_[index + 5]);
249 <<
"\t" << dbobject.
sVector_[index + 3] <<
"\t" << dbobject.
sVector_[index + 4] <<
"\t"
251 <<
"\t" << dbobject.
sVector_[index + 8] <<
"\t" << dbobject.
sVector_[index + 9] <<
"\t"
253 <<
"\t" << dbobject.
sVector_[index + 13] <<
"\t" << dbobject.
sVector_[index + 14] <<
"\t"
254 << dbobject.
sVector_[index + 15] <<
"\t" << dbobject.
sVector_[index + 16] << std::endl;
258 for (entry_it = 0; entry_it < 4; ++entry_it) {
260 for (i = 0; i < entries[entry_it]; ++
i) {
262 <<
"\t" << dbobject.
sVector_[index + 3] <<
"\n"
263 << dbobject.
sVector_[index + 4] <<
"\t" << dbobject.
sVector_[index + 5] <<
"\t"
264 << dbobject.
sVector_[index + 6] <<
"\t" << dbobject.
sVector_[index + 7] <<
"\t"
265 << dbobject.
sVector_[index + 8] <<
"\t" << dbobject.
sVector_[index + 9] <<
"\t"
266 << dbobject.
sVector_[index + 10] <<
"\t" << dbobject.
sVector_[index + 11] <<
"\n"
267 << dbobject.
sVector_[index + 12] <<
"\t" << dbobject.
sVector_[index + 13] <<
"\t"
268 << dbobject.
sVector_[index + 14] <<
"\t" << dbobject.
sVector_[index + 15] <<
"\t"
269 << dbobject.
sVector_[index + 16] <<
"\t" << dbobject.
sVector_[index + 17] <<
"\t"
270 << dbobject.
sVector_[index + 18] << std::endl;
273 for (j = 0; j < 2; ++
j) {
274 for (k = 0; k < 5; ++
k) {
281 for (j = 0; j < 9; ++
j) {
282 for (k = 0; k < tysize[sizeSetter]; ++
k) {
289 for (j = 0; j < 2; ++
j) {
290 for (k = 0; k < 5; ++
k) {
297 for (j = 0; j < 9; ++
j) {
298 for (k = 0; k < txsize[sizeSetter]; ++
k) {
305 for (j = 0; j < 4; ++
j) {
306 for (k = 0; k < 4; ++
k) {
313 for (j = 0; j < 4; ++
j) {
314 for (k = 0; k < 6; ++
k) {
321 for (j = 0; j < 4; ++
j) {
322 for (k = 0; k < 4; ++
k) {
329 for (j = 0; j < 4; ++
j) {
330 for (k = 0; k < 6; ++
k) {
337 for (j = 0; j < 4; ++
j) {
338 for (k = 0; k < 2; ++
k) {
339 for (l = 0; l < 2; ++
l) {
347 for (j = 0; j < 4; ++
j) {
348 for (k = 0; k < 4; ++
k) {
355 for (j = 0; j < 4; ++
j) {
356 for (k = 0; k < 4; ++
k) {
363 for (j = 0; j < 4; ++
j) {
364 for (k = 0; k < 4; ++
k) {
371 for (j = 0; j < 4; ++
j) {
372 for (k = 0; k < 4; ++
k) {
379 for (j = 0; j < 20; ++
j) {
382 if (j == 9 || j == 19)
bool theFullTemplateDBOutput
#define DEFINE_FWK_MODULE(type)
SiPixelTemplateDBObjectReader(const edm::ParameterSet &)
edm::ESGetToken< SiPixelTemplateDBObject, SiPixelTemplateDBObjectRcd > the1DTemplateToken_
std::ostream & operator<<(std::ostream &out, const ALILine &li)
edm::ESWatcher< SiPixelTemplateDBObjectESProducerRcd > SiPixTemplDBObjectWatcher_
bool getData(T &iHolder) const
edm::ESGetToken< SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd > the1DTemplateESProdToken_
const std::map< unsigned int, short > & getTemplateIDs() const
bool theDetailedTemplateDBErrorOutput
if(conf_.getParameter< bool >("UseStripCablingDB"))
Abs< T >::type abs(const T &t)
edm::ESWatcher< SiPixelTemplateDBObjectRcd > SiPixTemplDBObjWatcher_
Log< level::Warning, true > LogPrint
~SiPixelTemplateDBObjectReader() override
T const * product() const
std::vector< float > sVector_
bool check(const edm::EventSetup &iSetup)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
std::string theTemplateCalibrationLocation
std::vector< float > const & sVector() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const