405 std::ostringstream
ss;
406 ss <<
"EcalLaserDbAnalyzer::analyze\n";
408 ss <<
"EcalLaserDbAnalyzer::analyze-> got EcalLaserDbRecord: \n";
415 for (italpha = laserAlphaMap.
barrelItems().begin(); italpha != laserAlphaMap.
barrelItems().end(); ++italpha) {
416 if (cnt % 1000 == 0) {
418 ss <<
" Barrel ALPHA = " << (*italpha) <<
" cmsswId " << ebdetid.
rawId() <<
"\n";
422 ss <<
"Number of barrel Alpha parameters : " << cnt <<
"\n";
425 for (italpha = laserAlphaMap.
endcapItems().begin(); italpha != laserAlphaMap.
endcapItems().end(); ++italpha) {
426 if (cnt % 1000 == 0) {
428 ss <<
"EndCap ALPHA = " << (*italpha) <<
" cmsswId " << eedetid.
rawId() <<
"\n";
432 ss <<
"Number of Endcap Alpha parameters : " << cnt <<
"\n";
441 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction files"
443 ss <<
"INFO: READING transparency correction files\n";
450 transparency.getline(
buf,
sizeof(
buf),
'\n');
452 while (transparency) {
453 std::stringstream
sin(
buf);
458 double xtal_trans_corr;
459 sin >> xtal_trans_corr;
462 ss << raw_xtal_id <<
" " << xtal_trans_corr <<
"\n";
467 transparency.getline(
buf,
sizeof(
buf),
'\n');
469 transparency.close();
470 ss <<
"INFO: DONE transparency correction files " << xtalcounter <<
"\n";
475 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction tag"
483 for (
int ib = 0;
ib < 61200;
ib++) {
490 for (
int ie = 0; ie < 14648; ie++) {
496 ss <<
"INFO: DONE transparency correction tag\n";
503 TFile saving(
"EcalTPGParam.root",
"recreate");
505 TH2F* ICEB =
new TH2F(
"ICEB",
"IC: Barrel", 360, 1, 361, 172, -86, 86);
506 ICEB->GetYaxis()->SetTitle(
"eta index");
507 ICEB->GetXaxis()->SetTitle(
"phi index");
508 TH2F* tpgFactorEB =
new TH2F(
"tpgFactorEB",
"tpgFactor: Barrel", 360, 1, 361, 172, -86, 86);
509 tpgFactorEB->GetYaxis()->SetTitle(
"eta index");
510 tpgFactorEB->GetXaxis()->SetTitle(
"phi index");
512 TH2F* ICEEPlus =
new TH2F(
"ICEEPlus",
"IC: Plus Endcap", 120, -9, 111, 120, -9, 111);
513 ICEEPlus->GetYaxis()->SetTitle(
"y index");
514 ICEEPlus->GetXaxis()->SetTitle(
"x index");
515 TH2F* tpgFactorEEPlus =
new TH2F(
"tpgFactorEEPlus",
"tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111);
516 tpgFactorEEPlus->GetYaxis()->SetTitle(
"y index");
517 tpgFactorEEPlus->GetXaxis()->SetTitle(
"x index");
518 TH2F* ICEEMinus =
new TH2F(
"ICEEMinus",
"IC: Minus Endcap", 120, -9, 111, 120, -9, 111);
519 ICEEMinus->GetYaxis()->SetTitle(
"y index");
520 ICEEMinus->GetXaxis()->SetTitle(
"x index");
521 TH2F* tpgFactorEEMinus =
new TH2F(
"tpgFactorEEMinus",
"tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111);
522 tpgFactorEEMinus->GetYaxis()->SetTitle(
"y index");
523 tpgFactorEEMinus->GetXaxis()->SetTitle(
"x index");
525 TH2F* IC =
new TH2F(
"IC",
"IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
526 IC->GetYaxis()->SetTitle(
"eta");
527 IC->GetXaxis()->SetTitle(
"phi");
528 TH2F* tpgFactor =
new TH2F(
"tpgFactor",
"tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
529 tpgFactor->GetYaxis()->SetTitle(
"eta");
530 tpgFactor->GetXaxis()->SetTitle(
"phi");
532 TH1F* hshapeEB =
new TH1F(
"shapeEB",
"shapeEB", 250, 0., 10.);
533 TH1F* hshapeEE =
new TH1F(
"shapeEE",
"shapeEE", 250, 0., 10.);
535 TTree*
ntuple =
new TTree(
"tpgmap",
"TPG geometry map");
537 "fed",
"tcc",
"tower",
"stripInTower",
"xtalInStrip",
"CCU",
"VFE",
"xtalInVFE",
"xtalInCCU",
538 "ieta",
"iphi",
"ix",
"iy",
"iz",
"hashedId",
"ic",
"cmsswId",
"dbId",
539 "ietaTT",
"iphiTT",
"TCCch",
"TCCslot",
"SLBch",
"SLBslot",
"ietaGCT",
"iphiGCT"};
541 for (
int i = 0;
i < 26;
i++)
546 TNtuple* ntupleSpike =
new TNtuple(
"spikeParam",
"Spike parameters",
"gainId:theta:G:g:ped:pedLin");
551 list<uint32_t> towerListEB;
552 list<uint32_t> stripListEB;
553 list<uint32_t> towerListEE;
554 list<uint32_t> stripListEE;
555 list<uint32_t>::iterator itList;
557 map<int, uint32_t> stripMapEB;
558 map<uint32_t, uint32_t> stripMapEBsintheta;
565 ss <<
"Getting the pedestals from offline DB...\n";
573 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
574 const auto aped = (*pedIter);
575 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
577 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
578 const auto aped = (*pedIter);
579 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
582 ss <<
"Getting the pedestals from previous configuration\n";
588 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
596 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
599 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
603 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
610 if (ecid_name ==
"EB_crystal_number") {
611 int sm_num = ecid_xt.
getID1();
612 int xt_num = ecid_xt.
getID2();
624 ss <<
" copy the EB data "
625 <<
" ped = " <<
item.mean_x12 <<
"\n";
630 }
else if (ecid_name ==
"EE_crystal_number") {
655 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
656 const auto aped = (*pedIter);
657 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
659 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
660 const auto aped = (*pedIter);
661 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
665 ss <<
"Getting the pedestals from configuration number" <<
m_write_ped <<
"\n";
672 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
675 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
679 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
686 if (ecid_name ==
"EB_crystal_number") {
689 <<
" icells = " << icells <<
"\n";
690 int sm_num = ecid_xt.
getID1();
691 int xt_num = ecid_xt.
getID2();
704 }
else if (ecid_name ==
"EE_crystal_number") {
729 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
730 const auto aped = (*pedIter);
731 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
733 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
734 const auto aped = (*pedIter);
735 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
743 ss <<
"Getting intercalib from offline DB...\n";
750 for (calIter = calibMapEB.begin(); calIter != calibMapEB.end() && nCal < 10; ++calIter, ++nCal) {
751 ss << (*calIter) <<
"\n";
753 for (calIter = calibMapEE.begin(); calIter != calibMapEE.end() && nCal < 10; ++calIter, ++nCal) {
754 ss << (*calIter) <<
"\n";
758 float calibvec[1700];
760 edm::LogInfo(
"TopInfo") <<
"H2: overwriting IC coef with file"
766 if (calibfile.is_open()) {
767 calibfile >> strdata >> strdata >> strdata >> strdata >> strdata;
768 while (!calibfile.eof()) {
769 calibfile >> idata >> icry >> fcali >> fdata >> fdata;
770 calibvec[icry - 1] = fcali;
771 if (calibfile.eof()) {
779 ss <<
"Getting the gain ratios from offline DB...\n";
785 for (gainIter = gainMapEB.begin(); gainIter != gainMapEB.end() && nGain < 10; ++gainIter, ++nGain) {
786 const auto aGain = (*gainIter);
787 ss << aGain.gain12Over6() <<
", " << aGain.gain6Over1() * aGain.gain12Over6() <<
"\n";
789 for (gainIter = gainMapEE.begin(); gainIter != gainMapEE.end() && nGain < 10; ++gainIter, ++nGain) {
790 const auto aGain = (*gainIter);
791 ss << aGain.gain12Over6() <<
", " << aGain.gain6Over1() * aGain.gain12Over6() <<
"\n";
797 ss <<
"Getting the ADC to GeV from offline DB...\n";
804 vector<EcalLogicID> my_EcalLogicId;
805 vector<EcalLogicID> my_TTEcalLogicId;
806 vector<EcalLogicID> my_StripEcalLogicId;
810 vector<EcalLogicID> my_TTEcalLogicId_EE;
811 vector<EcalLogicID> my_RTEcalLogicId_EE;
812 vector<EcalLogicID> my_StripEcalLogicId1_EE;
813 vector<EcalLogicID> my_StripEcalLogicId2_EE;
814 vector<EcalLogicID> my_CrystalEcalLogicId_EE;
815 vector<EcalLogicID> my_TTEcalLogicId_EB_by_TCC;
816 vector<EcalLogicID> my_StripEcalLogicId_EE_strips_by_TCC;
825 "EB_VFE", 1, 36, 1, 68, 1, 5,
"EB_VFE", 123);
826 ss <<
"got the 3 ecal barrel logic id set\n";
829 my_CrystalEcalLogicId_EE =
834 my_StripEcalLogicId1_EE =
838 my_StripEcalLogicId2_EE =
843 my_StripEcalLogicId_EE_strips_by_TCC =
865 ss <<
"Getting the latest ids for this tag (latest version) "
871 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
897 map<EcalLogicID, FEConfigPedDat> pedset;
898 map<EcalLogicID, FEConfigLinDat> linset;
899 map<EcalLogicID, FEConfigLinParamDat> linparamset;
900 map<EcalLogicID, FEConfigLUTParamDat> lutparamset;
901 map<EcalLogicID, FEConfigFgrParamDat> fgrparamset;
903 map<int, linStruc> linEtaSlice;
907 int NbOfStripPerTCC[108][68];
908 for (
int i = 0;
i < 108;
i++)
909 for (
int j = 0;
j < 68;
j++)
910 NbOfStripPerTCC[
i][
j] = 0;
913 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
920 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
921 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
923 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
930 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
931 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
936 (*out_file_) <<
"COMMENT ====== barrel crystals ====== " << std::endl;
939 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
954 int xtalInVFE = Id.
xtalId();
955 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
957 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
958 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
959 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
960 <<
" ieta = " <<
id.ieta() <<
" iphi = " <<
id.iphi() <<
" xtalhashedId = " <<
id.hashedIndex()
961 <<
" xtalNb = " <<
id.ic() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi() << endl;
963 int TCCch = towerInTCC;
964 int SLBslot =
int((towerInTCC - 1) / 8.) + 1;
965 int SLBch = (towerInTCC - 1) % 8 + 1;
966 int cmsswId =
id.rawId();
967 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
970 int val[] = {dccNb + 600,
996 for (
int i = 0;
i < 26;
i++)
1003 if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
1004 int etaSlice = towid.
ietaAbs();
1009 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1011 getCoeff(coeff, gainMap,
id.rawId());
1012 getCoeff(coeff, pedMap,
id.rawId());
1014 for (
int i = 0;
i < 3;
i++) {
1018 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" "
1019 <<
dec <<
id.rawId() <<
"\n";
1031 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1032 linEtaSlice[etaSlice] = lin;
1037 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
1043 towerListEB.push_back(towid.
rawId());
1045 stripListEB.push_back(elId.
rawId() & 0xfffffff8);
1054 int xtalInVFE = Id.
xtalId();
1055 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1056 int etaSlice = towid.
ietaAbs();
1059 int hashedStripLogicID = 68 * 5 * (
id.ism() - 1) + 5 * (towerInTCC - 1) + (VFEid - 1);
1060 stripMapEB[hashedStripLogicID] = elId.
rawId() & 0xfffffff8;
1078 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1085 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1090 getCoeff(coeff, gainMap,
id.rawId());
1091 getCoeff(coeff, pedMap,
id.rawId());
1097 vector<int> xtalCCU;
1098 xtalCCU.push_back(dccNb + 600);
1099 xtalCCU.push_back(CCUid);
1100 xtalCCU.push_back(xtalWithinCCUid);
1101 xtalCCU.push_back(
id.rawId());
1106 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1107 if (itLin != linEtaSlice.end()) {
1108 linMap[xtalCCU] = itLin->second;
1110 for (
int i = 0;
i < 3;
i++)
1111 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1112 << itLin->second.shift_[
i] << std::endl;
1115 for (
int i = 0;
i < 3;
i++) {
1120 }
else if (
i == 1) {
1124 }
else if (
i == 2) {
1137 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1142 int forceBase12 = 0;
1143 double invSinTheta = 1. /
sin(
theta);
1144 for (
int i = 0;
i < 3;
i++) {
1148 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" "
1149 <<
dec <<
id.rawId() <<
"\n";
1161 double g =
G * invSinTheta;
1186 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1188 for (
int i = 0;
i < 3;
i++) {
1197 }
else if (
i == 1) {
1201 }
else if (
i == 2) {
1215 double g =
G * invSinTheta;
1222 ntupleSpike->Fill(
val);
1224 linMap[xtalCCU] = lin;
1228 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
1230 pedset[logicId] = pedDB;
1231 linset[logicId] = linDB;
1239 linparamset[my_EcalLogicId_EB] = linparam;
1246 fgrparamset[my_EcalLogicId_EB] = fgrparam;
1252 lutparamset[my_EcalLogicId_EB] = lutparam;
1257 (*out_file_) <<
"COMMENT ====== endcap crystals ====== " << std::endl;
1260 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1268 int dccNb = Id.
dccId();
1275 int xtalInVFE = Id.
xtalId();
1276 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1278 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
1279 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
1280 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
1281 <<
" ix = " <<
id.ix() <<
" iy = " <<
id.iy() <<
" xtalhashedId = " <<
id.hashedIndex()
1282 <<
" xtalNb = " <<
id.isc() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi() << endl;
1284 int TCCch = stripInTower;
1286 if (towerInTCC < 5) {
1288 SLBch = 4 + towerInTCC;
1290 SLBslot =
int((towerInTCC - 5) / 8.) + 2;
1291 SLBch = (towerInTCC - 5) % 8 + 1;
1293 for (
int j = 0;
j < towerInTCC - 1;
j++)
1294 TCCch += NbOfStripPerTCC[tccNb - 1][
j];
1296 int cmsswId =
id.rawId();
1298 int iz =
id.positiveZ();
1301 for (
int k = 0;
k < (
int)my_CrystalEcalLogicId_EE.size();
k++) {
1302 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1303 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1304 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1305 if (
id.ix() ==
x &&
id.iy() ==
y && iz ==
z)
1306 logicId = my_CrystalEcalLogicId_EE[
k];
1310 int val[] = {dccNb + 600,
1336 for (
int i = 0;
i < 26;
i++)
1342 if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
1343 int etaSlice = towid.
ietaAbs();
1348 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1350 getCoeff(coeff, gainMap,
id.rawId());
1351 getCoeff(coeff, pedMap,
id.rawId());
1353 for (
int i = 0;
i < 3;
i++) {
1357 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for Quadrant=" <<
id.iquadrant()
1358 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1370 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1372 linEtaSlice[etaSlice] = lin;
1377 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1385 towerListEE.push_back(towid.
rawId());
1389 towerListEE.push_back(additionalTower.rawId());
1391 stripListEE.push_back(elId.
rawId() & 0xfffffff8);
1392 int dccNb = Id.
dccId();
1399 int xtalInVFE = Id.
xtalId();
1400 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1401 int etaSlice = towid.
ietaAbs();
1407 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1409 int iz =
id.positiveZ();
1412 for (
int k = 0;
k < (
int)my_CrystalEcalLogicId_EE.size();
k++) {
1413 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1414 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1415 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1416 if (
id.ix() ==
x &&
id.iy() ==
y && iz ==
z)
1417 logicId = my_CrystalEcalLogicId_EE[
k];
1425 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(),
str);
1427 getCoeff(coeff, gainMap,
id.rawId());
1428 getCoeff(coeff, pedMap,
id.rawId());
1430 ICEEPlus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1432 ICEEMinus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1437 vector<int> xtalCCU;
1438 xtalCCU.push_back(dccNb + 600);
1439 xtalCCU.push_back(CCUid);
1440 xtalCCU.push_back(xtalWithinCCUid);
1441 xtalCCU.push_back(
id.rawId());
1446 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1447 if (itLin != linEtaSlice.end()) {
1448 linMap[xtalCCU] = itLin->second;
1450 for (
int i = 0;
i < 3;
i++)
1451 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1452 << itLin->second.shift_[
i] << std::endl;
1455 for (
int i = 0;
i < 3;
i++) {
1460 }
else if (
i == 1) {
1464 }
else if (
i == 2) {
1473 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(),
factor);
1475 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(),
factor);
1480 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1485 for (
int i = 0;
i < 3;
i++) {
1489 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId() <<
"\n";
1501 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1503 for (
int i = 0;
i < 3;
i++) {
1512 }
else if (
i == 1) {
1516 }
else if (
i == 2) {
1525 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(),
factor);
1527 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(),
factor);
1533 linMap[xtalCCU] = lin;
1536 pedset[logicId] = pedDB;
1537 linset[logicId] = linDB;
1547 linparamset[my_EcalLogicId_EE] = linparam;
1553 lutparamset[my_EcalLogicId_EE] = lutparam;
1558 fgrparamset[my_EcalLogicId_EE] = fgrparam;
1566 ss <<
" LIN tag " << lin_tag <<
"\n";
1571 ss <<
"the ped id =" <<
ped_conf_id_ <<
" will be used for the pedestals "
1583 evgueni <<
"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal," << endl;
1584 evgueni <<
" int & mult12, int & shift12, int & base12," << endl;
1585 evgueni <<
" int & mult6, int & shift6, int & base6," << endl;
1586 evgueni <<
" int & mult1, int & shift1, int & base1)" << endl;
1587 evgueni <<
"{" << endl;
1588 evgueni <<
" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; "
1591 map<vector<int>,
linStruc>::const_iterator itLinMap;
1592 for (itLinMap = linMap.begin(); itLinMap != linMap.end(); itLinMap++) {
1593 vector<int> xtalInCCU = itLinMap->first;
1594 evgueni <<
" if (fed==" << xtalInCCU[0] <<
" && ccu==" << xtalInCCU[1] <<
" && xtal==" << xtalInCCU[2] <<
") {";
1595 evgueni <<
" mult12 = " << itLinMap->second.
mult_[0] <<
" ; shift12 = " << itLinMap->second.shift_[0]
1596 <<
" ; base12 = " << itLinMap->second.pedestal_[0] <<
" ; ";
1597 evgueni <<
" mult6 = " << itLinMap->second.mult_[1] <<
" ; shift6 = " << itLinMap->second.shift_[1]
1598 <<
" ; base6 = " << itLinMap->second.pedestal_[1] <<
" ; ";
1599 evgueni <<
" mult1 = " << itLinMap->second.mult_[2] <<
" ; shift1 = " << itLinMap->second.shift_[2]
1600 <<
" ; base1 = " << itLinMap->second.pedestal_[2] <<
" ; ";
1601 evgueni <<
" return ;}" << endl;
1603 evgueni <<
"}" << endl;
1610 const int NWEIGROUPS = 2;
1611 std::vector<unsigned int>
weights[NWEIGROUPS];
1615 shapeEB.setEventSetup(evtSetup);
1617 shapeEE.setEventSetup(evtSetup);
1621 map<EcalLogicID, FEConfigWeightGroupDat>
dataset;
1623 for (
int igrp = 0; igrp < NWEIGROUPS; igrp++) {
1626 (*out_file_) << std::endl;
1627 (*out_file_) <<
"WEIGHT " << igrp << endl;
1630 (*out_file_) << std::endl;
1631 (*out_file_) << std::endl;
1634 ss <<
"going to write the weights for groupe:" << igrp <<
"\n";
1653 map<EcalLogicID, FEConfigWeightDat> dataset2;
1656 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1660 dataset2[my_StripEcalLogicId[ich]] = wut;
1664 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1669 dataset2[my_StripEcalLogicId1_EE[ich]] = wut;
1672 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1677 dataset2[my_StripEcalLogicId2_EE[ich]] = wut;
1683 wtag <<
"Shape_NGroups_" << NWEIGROUPS;
1685 ss <<
" weight tag " << weight_tag <<
"\n";
1697 unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG;
1700 (*out_file_) << std::endl;
1701 (*out_file_) <<
"FG 0" << std::endl;
1702 (*out_file_) << hex <<
"0x" << lowThreshold <<
" 0x" << highThreshold <<
" 0x" << lowRatio <<
" 0x" << highRatio
1703 <<
" 0x" << lutFG << std::endl;
1708 unsigned int lut_strip;
1714 ss <<
"going to write the fgr "
1716 map<EcalLogicID, FEConfigFgrGroupDat>
dataset;
1719 for (
int ich = 0; ich < NFGRGROUPS; ich++) {
1733 map<EcalLogicID, FEConfigFgrDat> dataset2;
1735 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
1742 dataset2[my_TTEcalLogicId[ich]] = wut;
1746 for (
int ich = 0; ich < (
int)my_RTEcalLogicId_EE.size(); ich++) {
1754 dataset2[my_RTEcalLogicId_EE[ich]] = wut;
1758 map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
1759 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EE.size(); ich++) {
1762 dataset3[my_TTEcalLogicId_EE[ich]] = fgreett;
1767 map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
1768 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1772 dataset4[my_StripEcalLogicId1_EE[ich]] = zut;
1774 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1779 dataset4[my_StripEcalLogicId2_EE[ich]] = zut;
1781 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1785 uint32_t elStripId = stripMapEB[ich];
1786 map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId);
1787 if (it != stripMapEBsintheta.end())
1790 edm::LogError(
"TopInfo") <<
"ERROR: strip SFGVB threshold parameter not found for that strip:"
1791 << thestrip.
getID1() <<
" " << thestrip.
getID3() <<
" " << thestrip.
getID3() <<
"\n";
1797 dataset4[thestrip] = zut;
1805 ss <<
" weight tag " << weight_tag <<
"\n";
1811 map<EcalLogicID, FEConfigSpikeDat> datasetspike;
1812 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
1815 datasetspike[my_TTEcalLogicId[ich]] = spiketh;
1823 ss <<
" spike tag " << spike_tag <<
"\n";
1829 map<EcalLogicID, FEConfigTimingDat>
1831 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EB_by_TCC.size(); ich++) {
1834 EcalLogicID logiciddelay = my_TTEcalLogicId_EB_by_TCC[ich];
1835 int id1_tcc = my_TTEcalLogicId_EB_by_TCC[ich].
getID1();
1836 int id2_tt = my_TTEcalLogicId_EB_by_TCC[ich].getID2();
1837 std::map<int, vector<int> >::const_iterator ittEB =
delays_EB_.find(id1_tcc);
1838 std::vector<int> TimingDelaysEB = ittEB->second;
1841 if (TimingDelaysEB[id2_tt - 1] == -1) {
1842 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing delay not specified, check file, putting default value 1"
1844 delay.setTimingPar1(1);
1846 delay.setTimingPar1(TimingDelaysEB[id2_tt - 1]);
1848 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find delay parameter for that trigger tower "
1852 delay.setTimingPar1(1);
1855 std::map<int, vector<int> >::const_iterator ittpEB =
phases_EB_.find(id1_tcc);
1856 std::vector<int> TimingPhasesEB = ittpEB->second;
1859 if (TimingPhasesEB[id2_tt - 1] == -1) {
1860 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing phase not specified, check file, putting default value 0"
1862 delay.setTimingPar2(0);
1864 delay.setTimingPar2(TimingPhasesEB[id2_tt - 1]);
1866 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find phase parameter for that trigger tower "
1870 delay.setTimingPar2(0);
1873 ss << ich <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" logicId=" << logiciddelay.
getLogicID()
1874 <<
" delay=" << TimingDelaysEB[id2_tt - 1] <<
" phase=" << TimingPhasesEB[id2_tt - 1] <<
"\n";
1878 datasetdelay[my_TTEcalLogicId_EB_by_TCC[ich]] =
delay;
1884 for (
int ich = 0; ich < (
int)my_StripEcalLogicId_EE_strips_by_TCC.size(); ich++) {
1890 EcalLogicID logiciddelay = my_StripEcalLogicId_EE_strips_by_TCC[ich];
1891 int id1_tcc = my_StripEcalLogicId_EE_strips_by_TCC[ich].
getID1();
1892 int id2_tt = my_StripEcalLogicId_EE_strips_by_TCC[ich].getID2();
1893 int id3_st = my_StripEcalLogicId_EE_strips_by_TCC[ich].getID3();
1896 if (id1_tcc != tccin) {
1901 std::map<int, vector<int> >::const_iterator ittEE =
delays_EE_.find(id1_tcc);
1902 std::vector<int> TimingDelaysEE = ittEE->second;
1905 if (TimingDelaysEE[stripindex] == -1) {
1906 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing delay not specified, check file, putting default value 1"
1908 delay.setTimingPar1(1);
1910 delay.setTimingPar1(TimingDelaysEE[stripindex]);
1912 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find delay parameter for that trigger tower "
1916 delay.setTimingPar1(1);
1919 std::map<int, vector<int> >::const_iterator ittpEE =
phases_EE_.find(id1_tcc);
1920 std::vector<int> TimingPhasesEE = ittpEE->second;
1923 if (TimingPhasesEE[stripindex] == -1) {
1924 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing phase not specified, check file, putting default value 0"
1926 delay.setTimingPar2(0);
1928 delay.setTimingPar2(TimingPhasesEE[stripindex]);
1930 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find phase parameter for that trigger tower "
1934 delay.setTimingPar2(0);
1937 ss << ich <<
" stripindex=" << stripindex <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" id3_st=" << id3_st
1938 <<
" logicId=" << logiciddelay.
getLogicID() <<
" delay=" << TimingDelaysEE[stripindex]
1939 <<
" phase=" << TimingPhasesEE[stripindex] <<
"\n";
1943 datasetdelay[my_StripEcalLogicId_EE_strips_by_TCC[ich]] =
delay;
1947 ostringstream de_tag;
1949 de_tag <<
"DelaysFromFile";
1951 ss <<
" delay tag " << delay_tag <<
"\n";
1958 ss <<
"going to write the sliding "
1960 map<EcalLogicID, FEConfigSlidingDat>
dataset;
1962 for (
int ich = 0; ich < (
int)my_StripEcalLogicId.size(); ich++) {
1968 dataset[my_StripEcalLogicId[ich]] = wut;
1972 for (
int ich = 0; ich < (
int)my_StripEcalLogicId1_EE.size(); ich++) {
1978 dataset[my_StripEcalLogicId1_EE[ich]] = wut;
1980 for (
int ich = 0; ich < (
int)my_StripEcalLogicId2_EE.size(); ich++) {
1986 dataset[my_StripEcalLogicId2_EE[ich]] = wut;
1994 ss <<
" sliding tag " << justatag <<
"\n";
2004 int lut_EB[1024], lut_EE[1024];
2009 (*out_file_) << std::endl;
2010 (*out_file_) <<
"LUT 0" << std::endl;
2011 for (
int i = 0;
i < 1024;
i++)
2012 (*
out_file_) <<
"0x" << hex << lut_EB[
i] << endl;
2013 (*out_file_) << endl;
2020 for (
int i = 0;
i < 1024;
i++)
2021 if (lut_EE[
i] != lut_EB[
i])
2024 (*out_file_) << std::endl;
2025 (*out_file_) <<
"LUT 1" << std::endl;
2026 for (
int i = 0;
i < 1024;
i++)
2027 (*
out_file_) <<
"0x" << hex << lut_EE[
i] << endl;
2028 (*out_file_) << endl;
2032 map<EcalLogicID, FEConfigLUTGroupDat>
dataset;
2038 for (
int i = 0;
i < 1024;
i++) {
2049 for (
int i = 0;
i < 1024;
i++) {
2061 map<EcalLogicID, FEConfigLUTDat> dataset2;
2063 for (
int ich = 0; ich < (
int)my_TTEcalLogicId.size(); ich++) {
2069 dataset2[my_TTEcalLogicId[ich]] = lut;
2073 for (
int ich = 0; ich < (
int)my_TTEcalLogicId_EE.size(); ich++) {
2079 dataset2[my_TTEcalLogicId_EE[ich]] = lut;
2087 ss <<
" LUT tag " << lut_tag <<
"\n";
2110 ss <<
"\n Conf ID = " << conf_id_ <<
"\n";
2119 stripListEB.unique();
2120 ss <<
"Number of EB strips=" <<
dec << stripListEB.size() <<
"\n";
2122 (*out_file_) << std::endl;
2123 for (itList = stripListEB.begin(); itList != stripListEB.end(); itList++) {
2124 (*out_file_) <<
"STRIP_EB " <<
dec << (*itList) << endl;
2125 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2126 (*out_file_) <<
"0" << std::endl;
2127 (*out_file_) <<
"0x" << stripMapEBsintheta[(*itList)] <<
" 0x" <<
SFGVB_lut_ << std::endl;
2133 stripListEE.unique();
2134 ss <<
"Number of EE strips=" <<
dec << stripListEE.size() <<
"\n";
2136 (*out_file_) << std::endl;
2137 for (itList = stripListEE.begin(); itList != stripListEE.end(); itList++) {
2138 (*out_file_) <<
"STRIP_EE " <<
dec << (*itList) << endl;
2139 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2141 (*out_file_) <<
" 1" << std::endl;
2142 (*out_file_) << hex <<
"0x" <<
threshold <<
" 0x" << lut_strip << std::endl;
2154 towerListEB.unique();
2155 ss <<
"Number of EB towers=" <<
dec << towerListEB.size() <<
"\n";
2157 (*out_file_) << std::endl;
2158 for (itList = towerListEB.begin(); itList != towerListEB.end(); itList++) {
2159 (*out_file_) <<
"TOWER_EB " <<
dec << (*itList) << endl;
2160 (*out_file_) <<
" 0\n 0\n";
2167 towerListEE.unique();
2168 ss <<
"Number of EE towers=" <<
dec << towerListEE.size() <<
"\n";
2170 (*out_file_) << std::endl;
2171 for (itList = towerListEE.begin(); itList != towerListEE.end(); itList++) {
2172 (*out_file_) <<
"TOWER_EE " <<
dec << (*itList) << endl;
2174 (*out_file_) <<
" 1\n";
2177 (*out_file_) << hex <<
"0x" << lut_tower << std::endl;
2187 tpgFactorEB->Write();
2189 tpgFactorEEPlus->Write();
2191 tpgFactorEEMinus->Write();
2197 ntupleSpike->Write();