414 std::ostringstream
ss;
415 ss <<
"EcalLaserDbAnalyzer::analyze\n";
418 ss <<
"EcalLaserDbAnalyzer::analyze-> got EcalLaserDbRecord: \n";
426 for (italpha = laserAlphaMap.
barrelItems().begin(); italpha != laserAlphaMap.
barrelItems().end(); ++italpha) {
427 if (cnt % 1000 == 0) {
429 ss <<
" Barrel ALPHA = " << (*italpha) <<
" cmsswId " << ebdetid.
rawId() <<
"\n";
433 ss <<
"Number of barrel Alpha parameters : " << cnt <<
"\n";
436 for (italpha = laserAlphaMap.
endcapItems().begin(); italpha != laserAlphaMap.
endcapItems().end(); ++italpha) {
437 if (cnt % 1000 == 0) {
439 ss <<
"EndCap ALPHA = " << (*italpha) <<
" cmsswId " << eedetid.
rawId() <<
"\n";
443 ss <<
"Number of Endcap Alpha parameters : " << cnt <<
"\n";
452 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction files"
454 ss <<
"INFO: READING transparency correction files\n";
461 transparency.getline(
buf,
sizeof(
buf),
'\n');
463 while (transparency) {
464 std::stringstream
sin(
buf);
469 double xtal_trans_corr;
470 sin >> xtal_trans_corr;
473 ss << raw_xtal_id <<
" " << xtal_trans_corr <<
"\n";
478 transparency.getline(
buf,
sizeof(
buf),
'\n');
480 transparency.close();
481 ss <<
"INFO: DONE transparency correction files " << xtalcounter <<
"\n";
486 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction tag"
496 for (
int ib = 0;
ib < 61200;
ib++) {
503 for (
int ie = 0; ie < 14648; ie++) {
509 ss <<
"INFO: DONE transparency correction tag\n";
516 TFile saving(
"EcalTPGParam.root",
"recreate");
518 TH2F* ICEB =
new TH2F(
"ICEB",
"IC: Barrel", 360, 1, 361, 172, -86, 86);
519 ICEB->GetYaxis()->SetTitle(
"eta index");
520 ICEB->GetXaxis()->SetTitle(
"phi index");
521 TH2F* tpgFactorEB =
new TH2F(
"tpgFactorEB",
"tpgFactor: Barrel", 360, 1, 361, 172, -86, 86);
522 tpgFactorEB->GetYaxis()->SetTitle(
"eta index");
523 tpgFactorEB->GetXaxis()->SetTitle(
"phi index");
525 TH2F* ICEEPlus =
new TH2F(
"ICEEPlus",
"IC: Plus Endcap", 120, -9, 111, 120, -9, 111);
526 ICEEPlus->GetYaxis()->SetTitle(
"y index");
527 ICEEPlus->GetXaxis()->SetTitle(
"x index");
528 TH2F* tpgFactorEEPlus =
new TH2F(
"tpgFactorEEPlus",
"tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111);
529 tpgFactorEEPlus->GetYaxis()->SetTitle(
"y index");
530 tpgFactorEEPlus->GetXaxis()->SetTitle(
"x index");
531 TH2F* ICEEMinus =
new TH2F(
"ICEEMinus",
"IC: Minus Endcap", 120, -9, 111, 120, -9, 111);
532 ICEEMinus->GetYaxis()->SetTitle(
"y index");
533 ICEEMinus->GetXaxis()->SetTitle(
"x index");
534 TH2F* tpgFactorEEMinus =
new TH2F(
"tpgFactorEEMinus",
"tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111);
535 tpgFactorEEMinus->GetYaxis()->SetTitle(
"y index");
536 tpgFactorEEMinus->GetXaxis()->SetTitle(
"x index");
538 TH2F* IC =
new TH2F(
"IC",
"IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
539 IC->GetYaxis()->SetTitle(
"eta");
540 IC->GetXaxis()->SetTitle(
"phi");
541 TH2F* tpgFactor =
new TH2F(
"tpgFactor",
"tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
542 tpgFactor->GetYaxis()->SetTitle(
"eta");
543 tpgFactor->GetXaxis()->SetTitle(
"phi");
545 TH1F* hshapeEB =
new TH1F(
"shapeEB",
"shapeEB", 250, 0., 10.);
546 TH1F* hshapeEE =
new TH1F(
"shapeEE",
"shapeEE", 250, 0., 10.);
548 TTree*
ntuple =
new TTree(
"tpgmap",
"TPG geometry map");
550 "fed",
"tcc",
"tower",
"stripInTower",
"xtalInStrip",
"CCU",
"VFE",
"xtalInVFE",
"xtalInCCU",
551 "ieta",
"iphi",
"ix",
"iy",
"iz",
"hashedId",
"ic",
"cmsswId",
"dbId",
552 "ietaTT",
"iphiTT",
"TCCch",
"TCCslot",
"SLBch",
"SLBslot",
"ietaGCT",
"iphiGCT"};
554 for (
int i = 0;
i < 26;
i++)
559 TNtuple* ntupleSpike =
new TNtuple(
"spikeParam",
"Spike parameters",
"gainId:theta:G:g:ped:pedLin");
564 list<uint32_t> towerListEB;
565 list<uint32_t> stripListEB;
566 list<uint32_t> towerListEE;
567 list<uint32_t> stripListEE;
568 list<uint32_t>::iterator itList;
570 map<int, uint32_t> stripMapEB;
571 map<uint32_t, uint32_t> stripMapEBsintheta;
578 ss <<
"Getting the pedestals from offline DB...\n";
586 for (pedIter = pedMap.
begin(); pedIter != pedMap.
end() && nPed < 10; ++pedIter, nPed++) {
591 ss <<
"Getting the pedestals from previous configuration\n";
597 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
605 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
608 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
612 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
619 if (ecid_name ==
"EB_crystal_number") {
620 int sm_num = ecid_xt.
getID1();
621 int xt_num = ecid_xt.
getID2();
633 ss <<
" copy the EB data "
634 <<
" ped = " <<
item.mean_x12 <<
"\n";
639 }
else if (ecid_name ==
"EE_crystal_number") {
662 for (pedIter = pedMap.
begin(); pedIter != pedMap.
end() && nPed < 10; ++pedIter, nPed++) {
668 ss <<
"Getting the pedestals from configuration number" <<
m_write_ped <<
"\n";
675 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
678 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
682 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
689 if (ecid_name ==
"EB_crystal_number") {
692 <<
" icells = " << icells <<
"\n";
693 int sm_num = ecid_xt.
getID1();
694 int xt_num = ecid_xt.
getID2();
707 }
else if (ecid_name ==
"EE_crystal_number") {
730 for (pedIter = pedMap.
begin(); pedIter != pedMap.
end() && nPed < 10; ++pedIter, nPed++) {
740 ss <<
"Getting intercalib from offline DB...\n";
747 for (calIter = calibMap.
begin(); calIter != calibMap.
end() && nCal < 10; ++calIter, nCal++) {
748 ss << (*calIter) <<
"\n";
752 float calibvec[1700];
754 edm::LogInfo(
"TopInfo") <<
"H2: overwriting IC coef with file"
760 if (calibfile.is_open()) {
761 calibfile >> strdata >> strdata >> strdata >> strdata >> strdata;
762 while (!calibfile.eof()) {
763 calibfile >> idata >> icry >> fcali >> fdata >> fdata;
764 calibvec[icry - 1] = fcali;
765 if (calibfile.eof()) {
773 ss <<
"Getting the gain ratios from offline DB...\n";
779 for (gainIter = gainMap.
begin(); gainIter != gainMap.
end() && nGain < 10; ++gainIter, nGain++) {
787 ss <<
"Getting the ADC to GeV from offline DB...\n";
796 vector<EcalLogicID> my_EcalLogicId;
797 vector<EcalLogicID> my_TTEcalLogicId;
798 vector<EcalLogicID> my_StripEcalLogicId;
802 vector<EcalLogicID> my_TTEcalLogicId_EE;
803 vector<EcalLogicID> my_RTEcalLogicId_EE;
804 vector<EcalLogicID> my_StripEcalLogicId1_EE;
805 vector<EcalLogicID> my_StripEcalLogicId2_EE;
806 vector<EcalLogicID> my_CrystalEcalLogicId_EE;
807 vector<EcalLogicID> my_TTEcalLogicId_EB_by_TCC;
808 vector<EcalLogicID> my_StripEcalLogicId_EE_strips_by_TCC;
817 "EB_VFE", 1, 36, 1, 68, 1, 5,
"EB_VFE", 123);
818 ss <<
"got the 3 ecal barrel logic id set\n";
821 my_CrystalEcalLogicId_EE =
826 my_StripEcalLogicId1_EE =
830 my_StripEcalLogicId2_EE =
835 my_StripEcalLogicId_EE_strips_by_TCC =
857 ss <<
"Getting the latest ids for this tag (latest version) "
863 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
889 map<EcalLogicID, FEConfigPedDat> pedset;
890 map<EcalLogicID, FEConfigLinDat> linset;
891 map<EcalLogicID, FEConfigLinParamDat> linparamset;
892 map<EcalLogicID, FEConfigLUTParamDat> lutparamset;
893 map<EcalLogicID, FEConfigFgrParamDat> fgrparamset;
895 map<int, linStruc> linEtaSlice;
899 int NbOfStripPerTCC[108][68];
900 for (
int i = 0;
i < 108;
i++)
901 for (
int j = 0;
j < 68;
j++)
902 NbOfStripPerTCC[
i][
j] = 0;
905 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
912 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
913 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
915 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
922 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
923 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
928 (*out_file_) <<
"COMMENT ====== barrel crystals ====== " << std::endl;
931 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
946 int xtalInVFE = Id.
xtalId();
947 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
949 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
950 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
951 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
952 <<
" ieta = " <<
id.ieta() <<
" iphi = " <<
id.iphi() <<
" xtalhashedId = " <<
id.hashedIndex()
953 <<
" xtalNb = " <<
id.ic() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi() << endl;
955 int TCCch = towerInTCC;
956 int SLBslot =
int((towerInTCC - 1) / 8.) + 1;
957 int SLBch = (towerInTCC - 1) % 8 + 1;
958 int cmsswId =
id.rawId();
959 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
962 int val[] = {dccNb + 600,
988 for (
int i = 0;
i < 26;
i++)
995 if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
996 int etaSlice = towid.
ietaAbs();
1001 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1003 getCoeff(coeff, gainMap,
id.rawId());
1004 getCoeff(coeff, pedMap,
id.rawId());
1006 for (
int i = 0;
i < 3;
i++) {
1010 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" "
1011 <<
dec <<
id.rawId() <<
"\n";
1023 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1024 linEtaSlice[etaSlice] = lin;
1029 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
1035 towerListEB.push_back(towid.
rawId());
1037 stripListEB.push_back(elId.
rawId() & 0xfffffff8);
1046 int xtalInVFE = Id.
xtalId();
1047 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1048 int etaSlice = towid.
ietaAbs();
1051 int hashedStripLogicID = 68 * 5 * (
id.ism() - 1) + 5 * (towerInTCC - 1) + (VFEid - 1);
1052 stripMapEB[hashedStripLogicID] = elId.
rawId() & 0xfffffff8;
1070 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1077 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1082 getCoeff(coeff, gainMap,
id.rawId());
1083 getCoeff(coeff, pedMap,
id.rawId());
1089 vector<int> xtalCCU;
1090 xtalCCU.push_back(dccNb + 600);
1091 xtalCCU.push_back(CCUid);
1092 xtalCCU.push_back(xtalWithinCCUid);
1093 xtalCCU.push_back(
id.rawId());
1098 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1099 if (itLin != linEtaSlice.end()) {
1100 linMap[xtalCCU] = itLin->second;
1102 for (
int i = 0;
i < 3;
i++)
1103 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1104 << itLin->second.shift_[
i] << std::endl;
1107 for (
int i = 0;
i < 3;
i++) {
1131 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1136 int forceBase12 = 0;
1137 for (
int i = 0;
i < 3;
i++) {
1141 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" "
1142 <<
dec <<
id.rawId() <<
"\n";
1181 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1183 for (
int i = 0;
i < 3;
i++) {
1219 ntupleSpike->Fill(
val);
1221 linMap[xtalCCU] = lin;
1225 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
1227 pedset[logicId] = pedDB;
1228 linset[logicId] = linDB;
1236 linparamset[my_EcalLogicId_EB] = linparam;
1243 fgrparamset[my_EcalLogicId_EB] = fgrparam;
1249 lutparamset[my_EcalLogicId_EB] = lutparam;
1254 (*out_file_) <<
"COMMENT ====== endcap crystals ====== " << std::endl;
1257 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1265 int dccNb = Id.
dccId();
1272 int xtalInVFE = Id.
xtalId();
1273 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1275 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
1276 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
1277 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
1278 <<
" ix = " <<
id.ix() <<
" iy = " <<
id.iy() <<
" xtalhashedId = " <<
id.hashedIndex()
1279 <<
" xtalNb = " <<
id.isc() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi() << endl;
1281 int TCCch = stripInTower;
1283 if (towerInTCC < 5) {
1285 SLBch = 4 + towerInTCC;
1287 SLBslot =
int((towerInTCC - 5) / 8.) + 2;
1288 SLBch = (towerInTCC - 5) % 8 + 1;
1290 for (
int j = 0;
j < towerInTCC - 1;
j++)
1291 TCCch += NbOfStripPerTCC[tccNb - 1][
j];
1293 int cmsswId =
id.rawId();
1295 int iz =
id.positiveZ();
1298 for (
int k = 0;
k < (
int)my_CrystalEcalLogicId_EE.size();
k++) {
1299 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1300 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1301 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1302 if (
id.ix() ==
x &&
id.iy() ==
y && iz ==
z)
1303 logicId = my_CrystalEcalLogicId_EE[
k];
1307 int val[] = {dccNb + 600,
1333 for (
int i = 0;
i < 26;
i++)
1339 if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
1340 int etaSlice = towid.
ietaAbs();
1345 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1347 getCoeff(coeff, gainMap,
id.rawId());
1348 getCoeff(coeff, pedMap,
id.rawId());
1350 for (
int i = 0;
i < 3;
i++) {
1354 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for Quadrant=" <<
id.iquadrant()
1355 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1367 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1369 linEtaSlice[etaSlice] = lin;
1374 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1382 towerListEE.push_back(towid.
rawId());
1386 towerListEE.push_back(additionalTower.rawId());
1388 stripListEE.push_back(elId.
rawId() & 0xfffffff8);
1389 int dccNb = Id.
dccId();
1396 int xtalInVFE = Id.
xtalId();
1397 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1398 int etaSlice = towid.
ietaAbs();
1404 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1406 int iz =
id.positiveZ();
1409 for (
int k = 0;
k < (
int)my_CrystalEcalLogicId_EE.size();
k++) {
1410 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1411 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1412 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1413 if (
id.ix() ==
x &&
id.iy() ==
y && iz ==
z)
1414 logicId = my_CrystalEcalLogicId_EE[
k];
1422 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1424 getCoeff(coeff, gainMap,
id.rawId());
1425 getCoeff(coeff, pedMap,
id.rawId());
1427 ICEEPlus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1429 ICEEMinus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1434 vector<int> xtalCCU;
1435 xtalCCU.push_back(dccNb + 600);
1436 xtalCCU.push_back(CCUid);
1437 xtalCCU.push_back(xtalWithinCCUid);
1438 xtalCCU.push_back(
id.rawId());
1443 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1444 if (itLin != linEtaSlice.end()) {
1445 linMap[xtalCCU] = itLin->second;
1447 for (
int i = 0;
i < 3;
i++)
1448 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1449 << itLin->second.shift_[
i] << std::endl;
1452 for (
int i = 0;
i < 3;
i++) {
1472 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(),
factor);
1474 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(),
factor);
1479 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1484 for (
int i = 0;
i < 3;
i++) {
1488 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId() <<
"\n";
1500 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1502 for (
int i = 0;
i < 3;
i++) {
1526 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(),
factor);
1528 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(),
factor);
1534 linMap[xtalCCU] = lin;
1537 pedset[logicId] = pedDB;
1538 linset[logicId] = linDB;
1548 linparamset[my_EcalLogicId_EE] = linparam;
1554 lutparamset[my_EcalLogicId_EE] = lutparam;
1559 fgrparamset[my_EcalLogicId_EE] = fgrparam;
1567 ss <<
" LIN tag " << lin_tag <<
"\n";
1572 ss <<
"the ped id =" <<
ped_conf_id_ <<
" will be used for the pedestals "
1584 evgueni <<
"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal," << endl;
1585 evgueni <<
" int & mult12, int & shift12, int & base12," << endl;
1586 evgueni <<
" int & mult6, int & shift6, int & base6," << endl;
1587 evgueni <<
" int & mult1, int & shift1, int & base1)" << endl;
1588 evgueni <<
"{" << endl;
1589 evgueni <<
" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; "
1592 map<vector<int>,
linStruc>::const_iterator itLinMap;
1593 for (itLinMap = linMap.begin(); itLinMap != linMap.end(); itLinMap++) {
1594 vector<int> xtalInCCU = itLinMap->first;
1595 evgueni <<
" if (fed==" << xtalInCCU[0] <<
" && ccu==" << xtalInCCU[1] <<
" && xtal==" << xtalInCCU[2] <<
") {";
1596 evgueni <<
" mult12 = " << itLinMap->second.
mult_[0] <<
" ; shift12 = " << itLinMap->second.shift_[0]
1597 <<
" ; base12 = " << itLinMap->second.pedestal_[0] <<
" ; ";
1598 evgueni <<
" mult6 = " << itLinMap->second.mult_[1] <<
" ; shift6 = " << itLinMap->second.shift_[1]
1599 <<
" ; base6 = " << itLinMap->second.pedestal_[1] <<
" ; ";
1600 evgueni <<
" mult1 = " << itLinMap->second.mult_[2] <<
" ; shift1 = " << itLinMap->second.shift_[2]
1601 <<
" ; base1 = " << itLinMap->second.pedestal_[2] <<
" ; ";
1602 evgueni <<
" return ;}" << endl;
1604 evgueni <<
"}" << endl;
1611 const int NWEIGROUPS = 2;
1612 std::vector<unsigned int>
weights[NWEIGROUPS];
1616 shapeEB.setEventSetup(evtSetup);
1618 shapeEE.setEventSetup(evtSetup);
1622 map<EcalLogicID, FEConfigWeightGroupDat>
dataset;
1624 for (
int igrp = 0; igrp < NWEIGROUPS; igrp++) {
1627 (*out_file_) << std::endl;
1628 (*out_file_) <<
"WEIGHT " << igrp << endl;
1631 (*out_file_) << std::endl;
1632 (*out_file_) << std::endl;
1635 ss <<
"going to write the weights for groupe:" << igrp <<
"\n";
1654 map<EcalLogicID, FEConfigWeightDat> dataset2;
1657 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1661 dataset2[my_StripEcalLogicId[ich]] = wut;
1665 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1670 dataset2[my_StripEcalLogicId1_EE[ich]] = wut;
1673 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1678 dataset2[my_StripEcalLogicId2_EE[ich]] = wut;
1684 wtag <<
"Shape_NGroups_" << NWEIGROUPS;
1686 ss <<
" weight tag " << weight_tag <<
"\n";
1698 unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG;
1701 (*out_file_) << std::endl;
1702 (*out_file_) <<
"FG 0" << std::endl;
1703 (*out_file_) << hex <<
"0x" << lowThreshold <<
" 0x" << highThreshold <<
" 0x" << lowRatio <<
" 0x" << highRatio
1704 <<
" 0x" << lutFG << std::endl;
1709 unsigned int lut_strip;
1715 ss <<
"going to write the fgr "
1717 map<EcalLogicID, FEConfigFgrGroupDat>
dataset;
1720 for (
int ich = 0; ich < NFGRGROUPS; ich++) {
1734 map<EcalLogicID, FEConfigFgrDat> dataset2;
1736 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
1743 dataset2[my_TTEcalLogicId[ich]] = wut;
1747 for (
int ich = 0; ich < (
int)my_RTEcalLogicId_EE.size(); ich++) {
1755 dataset2[my_RTEcalLogicId_EE[ich]] = wut;
1759 map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
1760 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EE.size(); ich++) {
1763 dataset3[my_TTEcalLogicId_EE[ich]] = fgreett;
1768 map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
1769 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1773 dataset4[my_StripEcalLogicId1_EE[ich]] = zut;
1775 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1780 dataset4[my_StripEcalLogicId2_EE[ich]] = zut;
1782 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1786 uint32_t elStripId = stripMapEB[ich];
1787 map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId);
1788 if (it != stripMapEBsintheta.end())
1791 edm::LogError(
"TopInfo") <<
"ERROR: strip SFGVB threshold parameter not found for that strip:"
1792 << thestrip.
getID1() <<
" " << thestrip.
getID3() <<
" " << thestrip.
getID3() <<
"\n";
1798 dataset4[thestrip] = zut;
1806 ss <<
" weight tag " << weight_tag <<
"\n";
1812 map<EcalLogicID, FEConfigSpikeDat> datasetspike;
1813 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
1816 datasetspike[my_TTEcalLogicId[ich]] = spiketh;
1824 ss <<
" spike tag " << spike_tag <<
"\n";
1830 map<EcalLogicID, FEConfigTimingDat>
1832 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EB_by_TCC.size(); ich++) {
1835 EcalLogicID logiciddelay = my_TTEcalLogicId_EB_by_TCC[ich];
1836 int id1_tcc = my_TTEcalLogicId_EB_by_TCC[ich].
getID1();
1837 int id2_tt = my_TTEcalLogicId_EB_by_TCC[ich].getID2();
1838 std::map<int, vector<int> >::const_iterator ittEB =
delays_EB_.find(id1_tcc);
1839 std::vector<int> TimingDelaysEB = ittEB->second;
1842 if (TimingDelaysEB[id2_tt - 1] == -1) {
1843 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing delay not specified, check file, putting default value 1"
1845 delay.setTimingPar1(1);
1847 delay.setTimingPar1(TimingDelaysEB[id2_tt - 1]);
1849 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find delay parameter for that trigger tower "
1853 delay.setTimingPar1(1);
1856 std::map<int, vector<int> >::const_iterator ittpEB =
phases_EB_.find(id1_tcc);
1857 std::vector<int> TimingPhasesEB = ittpEB->second;
1860 if (TimingPhasesEB[id2_tt - 1] == -1) {
1861 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing phase not specified, check file, putting default value 0"
1863 delay.setTimingPar2(0);
1865 delay.setTimingPar2(TimingPhasesEB[id2_tt - 1]);
1867 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find phase parameter for that trigger tower "
1871 delay.setTimingPar2(0);
1874 ss << ich <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" logicId=" << logiciddelay.
getLogicID()
1875 <<
" delay=" << TimingDelaysEB[id2_tt - 1] <<
" phase=" << TimingPhasesEB[id2_tt - 1] <<
"\n";
1879 datasetdelay[my_TTEcalLogicId_EB_by_TCC[ich]] =
delay;
1885 for (
int ich = 0; ich < (
int)my_StripEcalLogicId_EE_strips_by_TCC.size(); ich++) {
1891 EcalLogicID logiciddelay = my_StripEcalLogicId_EE_strips_by_TCC[ich];
1892 int id1_tcc = my_StripEcalLogicId_EE_strips_by_TCC[ich].
getID1();
1893 int id2_tt = my_StripEcalLogicId_EE_strips_by_TCC[ich].getID2();
1894 int id3_st = my_StripEcalLogicId_EE_strips_by_TCC[ich].getID3();
1897 if (id1_tcc != tccin) {
1902 std::map<int, vector<int> >::const_iterator ittEE =
delays_EE_.find(id1_tcc);
1903 std::vector<int> TimingDelaysEE = ittEE->second;
1906 if (TimingDelaysEE[stripindex] == -1) {
1907 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing delay not specified, check file, putting default value 1"
1909 delay.setTimingPar1(1);
1911 delay.setTimingPar1(TimingDelaysEE[stripindex]);
1913 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find delay parameter for that trigger tower "
1917 delay.setTimingPar1(1);
1920 std::map<int, vector<int> >::const_iterator ittpEE =
phases_EE_.find(id1_tcc);
1921 std::vector<int> TimingPhasesEE = ittpEE->second;
1924 if (TimingPhasesEE[stripindex] == -1) {
1925 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing phase not specified, check file, putting default value 0"
1927 delay.setTimingPar2(0);
1929 delay.setTimingPar2(TimingPhasesEE[stripindex]);
1931 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find phase parameter for that trigger tower "
1935 delay.setTimingPar2(0);
1938 ss << ich <<
" stripindex=" << stripindex <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" id3_st=" << id3_st
1939 <<
" logicId=" << logiciddelay.
getLogicID() <<
" delay=" << TimingDelaysEE[stripindex]
1940 <<
" phase=" << TimingPhasesEE[stripindex] <<
"\n";
1944 datasetdelay[my_StripEcalLogicId_EE_strips_by_TCC[ich]] =
delay;
1948 ostringstream de_tag;
1950 de_tag <<
"DelaysFromFile";
1952 ss <<
" delay tag " << delay_tag <<
"\n";
1959 ss <<
"going to write the sliding "
1961 map<EcalLogicID, FEConfigSlidingDat>
dataset;
1963 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1969 dataset[my_StripEcalLogicId[ich]] = wut;
1973 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1979 dataset[my_StripEcalLogicId1_EE[ich]] = wut;
1981 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1987 dataset[my_StripEcalLogicId2_EE[ich]] = wut;
1995 ss <<
" sliding tag " << justatag <<
"\n";
2005 int lut_EB[1024], lut_EE[1024];
2010 (*out_file_) << std::endl;
2011 (*out_file_) <<
"LUT 0" << std::endl;
2012 for (
int i = 0;
i < 1024;
i++)
2013 (*
out_file_) <<
"0x" << hex << lut_EB[
i] << endl;
2014 (*out_file_) << endl;
2021 for (
int i = 0;
i < 1024;
i++)
2022 if (lut_EE[
i] != lut_EB[
i])
2025 (*out_file_) << std::endl;
2026 (*out_file_) <<
"LUT 1" << std::endl;
2027 for (
int i = 0;
i < 1024;
i++)
2028 (*
out_file_) <<
"0x" << hex << lut_EE[
i] << endl;
2029 (*out_file_) << endl;
2033 map<EcalLogicID, FEConfigLUTGroupDat>
dataset;
2039 for (
int i = 0;
i < 1024;
i++) {
2050 for (
int i = 0;
i < 1024;
i++) {
2062 map<EcalLogicID, FEConfigLUTDat> dataset2;
2064 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
2070 dataset2[my_TTEcalLogicId[ich]] = lut;
2074 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EE.size(); ich++) {
2080 dataset2[my_TTEcalLogicId_EE[ich]] = lut;
2088 ss <<
" LUT tag " << lut_tag <<
"\n";
2111 ss <<
"\n Conf ID = " << conf_id_ <<
"\n";
2120 stripListEB.unique();
2121 ss <<
"Number of EB strips=" <<
dec << stripListEB.size() <<
"\n";
2123 (*out_file_) << std::endl;
2124 for (itList = stripListEB.begin(); itList != stripListEB.end(); itList++) {
2125 (*out_file_) <<
"STRIP_EB " <<
dec << (*itList) << endl;
2126 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2127 (*out_file_) <<
"0" << std::endl;
2128 (*out_file_) <<
"0x" << stripMapEBsintheta[(*itList)] <<
" 0x" <<
SFGVB_lut_ << std::endl;
2134 stripListEE.unique();
2135 ss <<
"Number of EE strips=" <<
dec << stripListEE.size() <<
"\n";
2137 (*out_file_) << std::endl;
2138 for (itList = stripListEE.begin(); itList != stripListEE.end(); itList++) {
2139 (*out_file_) <<
"STRIP_EE " <<
dec << (*itList) << endl;
2140 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2142 (*out_file_) <<
" 1" << std::endl;
2143 (*out_file_) << hex <<
"0x" <<
threshold <<
" 0x" << lut_strip << std::endl;
2155 towerListEB.unique();
2156 ss <<
"Number of EB towers=" <<
dec << towerListEB.size() <<
"\n";
2158 (*out_file_) << std::endl;
2159 for (itList = towerListEB.begin(); itList != towerListEB.end(); itList++) {
2160 (*out_file_) <<
"TOWER_EB " <<
dec << (*itList) << endl;
2161 (*out_file_) <<
" 0\n 0\n";
2168 towerListEE.unique();
2169 ss <<
"Number of EE towers=" <<
dec << towerListEE.size() <<
"\n";
2171 (*out_file_) << std::endl;
2172 for (itList = towerListEE.begin(); itList != towerListEE.end(); itList++) {
2173 (*out_file_) <<
"TOWER_EE " <<
dec << (*itList) << endl;
2175 (*out_file_) <<
" 1\n";
2178 (*out_file_) << hex <<
"0x" << lut_tower << std::endl;
2188 tpgFactorEB->Write();
2190 tpgFactorEEPlus->Write();
2192 tpgFactorEEMinus->Write();
2198 ntupleSpike->Write();