36 double resolEt_overEt =
37 sqrt((par[0] /
sqrt(Et)) * (par[0] /
sqrt(Et)) + (par[1] / Et) * (par[1] / Et) + par[2] * par[2]);
38 return 1. / (Et * resolEt_overEt);
56 shapeEB_(consumesCollector()),
57 shapeEE_(consumesCollector()) {
114 if (m_write_ped != 0 && m_write_ped != 1)
118 edm::LogInfo(
"TopInfo") <<
"data will be saved with tag and version=" << tag_ <<
".version" << version_ <<
"\n";
194 useTransparencyCorr_ = pSet.
getParameter<
bool>(
"useTransparencyCorr");
200 if (SFGVB_SpikeKillingThreshold_ == -1 || (SFGVB_SpikeKillingThreshold_ > Et_sat_EB_))
201 SFGVB_SpikeKillingThreshold_ = 1023;
203 SFGVB_SpikeKillingThreshold_ = int(SFGVB_SpikeKillingThreshold_ * 1024 / Et_sat_EB_);
204 edm::LogInfo(
"TopInfo") <<
"INFO:SPIKE KILLING THRESHOLD (ADC)=" << SFGVB_SpikeKillingThreshold_ <<
"\n";
213 std::ostringstream
ss;
215 ss <<
"INFO: READING timing files\n";
220 std::ifstream delay_ee(TimingDelays_EE_.c_str());
222 edm::LogError(
"TopInfo") <<
"ERROR: File " << TimingDelays_EE_.c_str() <<
" could not be opened"
224 std::ifstream phase_eb(TimingPhases_EB_.c_str());
226 edm::LogError(
"TopInfo") <<
"ERROR: File " << TimingPhases_EB_.c_str() <<
" could not be opened"
228 std::ifstream phase_ee(TimingPhases_EE_.c_str());
230 edm::LogError(
"TopInfo") <<
"ERROR: File " << TimingPhases_EE_.c_str() <<
" could not be opened"
235 delay_eb.getline(buf,
sizeof(buf),
'\n');
237 std::stringstream
sin(buf);
242 vector<int> vec_delays_eb;
243 for (
int ieb = 0; ieb < 68; ++ieb) {
246 vec_delays_eb.push_back(time_delay);
247 if (time_delay == -1)
248 edm::LogError(
"TopInfo") <<
"ERROR:Barrel timing delay -1, check file"
252 if (vec_delays_eb.size() != 68)
253 edm::LogError(
"TopInfo") <<
"ERROR:Barrel timing delay wrong, not enough towers, check file"
257 delays_EB_.insert(make_pair(tcc, vec_delays_eb));
261 for (
unsigned int ieb = 0; ieb < vec_delays_eb.size(); ++ieb)
263 ss <<
" " << vec_delays_eb[ieb];
264 delay_eb.getline(buf,
sizeof(buf),
'\n');
270 phase_eb.getline(buf,
sizeof(buf),
'\n');
272 std::stringstream
sin(buf);
276 vector<int> vec_phases_eb;
277 for (
unsigned int ieb = 0; ieb < 68; ++ieb) {
280 vec_phases_eb.push_back(time_phase);
281 if (time_phase == -1)
282 edm::LogError(
"TopInfo") <<
"ERROR:Barrel timing phase -1, check file"
286 if (vec_phases_eb.size() != 68)
287 edm::LogError(
"TopInfo") <<
"ERROR:Barrel timing phase wrong, not enough towers, check file"
291 phases_EB_.insert(make_pair(tcc, vec_phases_eb));
295 for (
unsigned int ieb = 0; ieb < vec_phases_eb.size(); ++ieb)
297 ss <<
" " << vec_phases_eb[ieb];
298 phase_eb.getline(buf,
sizeof(buf),
'\n');
304 delay_ee.getline(buf,
sizeof(buf),
'\n');
306 std::stringstream
sin(buf);
310 vector<int> vec_delays_ee;
311 for (
unsigned int iee = 0; iee < 48; ++iee) {
314 vec_delays_ee.push_back(time_delay);
315 if (time_delay == -1)
316 edm::LogError(
"TopInfo") <<
"ERROR:EE timing delay -1, check file"
320 if (vec_delays_ee.size() != 48)
321 edm::LogError(
"TopInfo") <<
"ERROR:EE timing delay wrong, not enough towers, check file"
325 delays_EE_.insert(make_pair(tcc, vec_delays_ee));
329 for (
unsigned int iee = 0; iee < vec_delays_ee.size(); ++iee)
331 ss <<
" " << vec_delays_ee[iee];
333 delay_ee.getline(buf,
sizeof(buf),
'\n');
338 phase_ee.getline(buf,
sizeof(buf),
'\n');
340 std::stringstream
sin(buf);
344 vector<int> vec_phases_ee;
345 for (
unsigned int iee = 0; iee < 48; ++iee) {
348 vec_phases_ee.push_back(time_phase);
349 if (time_phase == -1)
350 edm::LogError(
"TopInfo") <<
"ERROR:EE timing phase -1, check file"
354 if (vec_phases_ee.size() != 48)
355 edm::LogError(
"TopInfo") <<
"ERROR:EE timing phase wrong, not enough towers, check file"
359 phases_EE_.insert(make_pair(tcc, vec_phases_ee));
362 for (
unsigned int iee = 0; iee < vec_phases_ee.size(); ++iee)
364 ss <<
" " << vec_phases_ee[iee];
366 phase_ee.getline(buf,
sizeof(buf),
'\n');
371 ss <<
"INFO: DONE reading timing files for EB and EE\n";
377 (*out_file_) <<
"EOF" << std::endl;
385 if (item.mean_x1 < 150. || item.mean_x1 > 250)
387 if (item.mean_x6 < 150. || item.mean_x6 > 250)
389 if (item.mean_x12 < 150. || item.mean_x12 > 250)
391 if (item.rms_x1 < 0 || item.rms_x1 > 2)
393 if (item.rms_x6 < 0 || item.rms_x6 > 3)
395 if (item.rms_x12 < 0 || item.rms_x12 > 5)
401 int etaSlice = (towerInTCC - 1) / 4 + 1;
403 if (tccId > 36 && tccId < 73)
407 if (tccId >= 1 && tccId <= 18)
409 else if (tccId >= 19 && tccId <= 36)
411 else if (tccId >= 91 && tccId <= 108)
413 else if (tccId >= 73 && tccId <= 90)
432 std::ostringstream
ss;
433 ss <<
"EcalLaserDbAnalyzer::analyze\n";
435 ss <<
"EcalLaserDbAnalyzer::analyze-> got EcalLaserDbRecord: \n";
442 for (italpha = laserAlphaMap.barrelItems().begin(); italpha != laserAlphaMap.barrelItems().end(); ++italpha) {
443 if (cnt % 1000 == 0) {
445 ss <<
" Barrel ALPHA = " << (*italpha) <<
" cmsswId " << ebdetid.
rawId() <<
"\n";
449 ss <<
"Number of barrel Alpha parameters : " << cnt <<
"\n";
452 for (italpha = laserAlphaMap.endcapItems().begin(); italpha != laserAlphaMap.endcapItems().end(); ++italpha) {
453 if (cnt % 1000 == 0) {
455 ss <<
"EndCap ALPHA = " << (*italpha) <<
" cmsswId " << eedetid.
rawId() <<
"\n";
459 ss <<
"Number of Endcap Alpha parameters : " << cnt <<
"\n";
468 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction files"
470 ss <<
"INFO: READING transparency correction files\n";
477 transparency.getline(buf,
sizeof(buf),
'\n');
479 while (transparency) {
480 std::stringstream
sin(buf);
485 double xtal_trans_corr;
486 sin >> xtal_trans_corr;
489 ss << raw_xtal_id <<
" " << xtal_trans_corr <<
"\n";
494 transparency.getline(buf,
sizeof(buf),
'\n');
496 transparency.close();
497 ss <<
"INFO: DONE transparency correction files " << xtalcounter <<
"\n";
502 edm::LogInfo(
"TopInfo") <<
"INFO: READING transparency correction tag"
510 for (
int ib = 0;
ib < 61200;
ib++) {
517 for (
int ie = 0; ie < 14648; ie++) {
523 ss <<
"INFO: DONE transparency correction tag\n";
530 TFile saving(
"EcalTPGParam.root",
"recreate");
532 TH2F* ICEB =
new TH2F(
"ICEB",
"IC: Barrel", 360, 1, 361, 172, -86, 86);
533 ICEB->GetYaxis()->SetTitle(
"eta index");
534 ICEB->GetXaxis()->SetTitle(
"phi index");
535 TH2F* tpgFactorEB =
new TH2F(
"tpgFactorEB",
"tpgFactor: Barrel", 360, 1, 361, 172, -86, 86);
536 tpgFactorEB->GetYaxis()->SetTitle(
"eta index");
537 tpgFactorEB->GetXaxis()->SetTitle(
"phi index");
539 TH2F* ICEEPlus =
new TH2F(
"ICEEPlus",
"IC: Plus Endcap", 120, -9, 111, 120, -9, 111);
540 ICEEPlus->GetYaxis()->SetTitle(
"y index");
541 ICEEPlus->GetXaxis()->SetTitle(
"x index");
542 TH2F* tpgFactorEEPlus =
new TH2F(
"tpgFactorEEPlus",
"tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111);
543 tpgFactorEEPlus->GetYaxis()->SetTitle(
"y index");
544 tpgFactorEEPlus->GetXaxis()->SetTitle(
"x index");
545 TH2F* ICEEMinus =
new TH2F(
"ICEEMinus",
"IC: Minus Endcap", 120, -9, 111, 120, -9, 111);
546 ICEEMinus->GetYaxis()->SetTitle(
"y index");
547 ICEEMinus->GetXaxis()->SetTitle(
"x index");
548 TH2F* tpgFactorEEMinus =
new TH2F(
"tpgFactorEEMinus",
"tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111);
549 tpgFactorEEMinus->GetYaxis()->SetTitle(
"y index");
550 tpgFactorEEMinus->GetXaxis()->SetTitle(
"x index");
552 TH2F* IC =
new TH2F(
"IC",
"IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
553 IC->GetYaxis()->SetTitle(
"eta");
554 IC->GetXaxis()->SetTitle(
"phi");
555 TH2F* tpgFactor =
new TH2F(
"tpgFactor",
"tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.);
556 tpgFactor->GetYaxis()->SetTitle(
"eta");
557 tpgFactor->GetXaxis()->SetTitle(
"phi");
559 TH1F* hshapeEB =
new TH1F(
"shapeEB",
"shapeEB", 250, 0., 10.);
560 TH1F* hshapeEE =
new TH1F(
"shapeEE",
"shapeEE", 250, 0., 10.);
562 TTree* ntuple =
new TTree(
"tpgmap",
"TPG geometry map");
564 "fed",
"tcc",
"tower",
"stripInTower",
"xtalInStrip",
"CCU",
"VFE",
"xtalInVFE",
"xtalInCCU",
565 "ieta",
"iphi",
"ix",
"iy",
"iz",
"hashedId",
"ic",
"cmsswId",
"dbId",
566 "ietaTT",
"iphiTT",
"TCCch",
"TCCslot",
"SLBch",
"SLBslot",
"ietaGCT",
"iphiGCT"};
568 for (
int i = 0;
i < 26;
i++)
569 ntuple->Branch(branchFloat[
i].c_str(), &
ntupleInts_[
i], (branchFloat[
i] +
string(
"/I")).c_str());
573 TNtuple* ntupleSpike =
new TNtuple(
"spikeParam",
"Spike parameters",
"gainId:theta:G:g:ped:pedLin");
578 list<uint32_t> towerListEB;
579 list<uint32_t> stripListEB;
580 list<uint32_t> towerListEE;
581 list<uint32_t> stripListEE;
582 list<uint32_t>::iterator itList;
584 map<int, uint32_t> stripMapEB;
585 map<int, uint32_t> stripMapEE;
586 map<uint32_t, uint32_t> stripMapEBsintheta;
593 ss <<
"Getting the pedestals from offline DB...\n";
597 const auto& pedMapEB = pedMap.barrelItems();
598 const auto& pedMapEE = pedMap.endcapItems();
601 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
602 const auto aped = (*pedIter);
603 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
605 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
606 const auto aped = (*pedIter);
607 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
610 ss <<
"Getting the pedestals from previous configuration\n";
616 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
624 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
627 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
631 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
638 if (ecid_name ==
"EB_crystal_number") {
639 int sm_num = ecid_xt.
getID1();
640 int xt_num = ecid_xt.
getID2();
652 ss <<
" copy the EB data "
653 <<
" ped = " << item.mean_x12 <<
"\n";
658 }
else if (ecid_name ==
"EE_crystal_number") {
680 const auto& pedMapEE = pedMap.endcapItems();
683 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
684 const auto aped = (*pedIter);
685 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
687 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
688 const auto aped = (*pedIter);
689 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
693 ss <<
"Getting the pedestals from configuration number" <<
m_write_ped <<
"\n";
698 fe_ped_info.
setId(m_write_ped);
700 std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
703 typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
707 for (CIfeped
p = dataset_TpgPed.begin();
p != dataset_TpgPed.end();
p++) {
714 if (ecid_name ==
"EB_crystal_number") {
717 <<
" icells = " << icells <<
"\n";
718 int sm_num = ecid_xt.
getID1();
719 int xt_num = ecid_xt.
getID2();
732 }
else if (ecid_name ==
"EE_crystal_number") {
754 const auto& pedMapEE = pedMap.endcapItems();
757 for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) {
758 const auto aped = (*pedIter);
759 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
761 for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) {
762 const auto aped = (*pedIter);
763 ss << aped.mean_x12 <<
", " << aped.mean_x6 <<
", " << aped.mean_x1 <<
"\n";
771 ss <<
"Getting intercalib from offline DB...\n";
775 const auto& calibMapEE = calibMap.endcapItems();
778 for (calIter = calibMapEB.begin(); calIter != calibMapEB.end() && nCal < 10; ++calIter, ++nCal) {
779 ss << (*calIter) <<
"\n";
781 for (calIter = calibMapEE.begin(); calIter != calibMapEE.end() && nCal < 10; ++calIter, ++nCal) {
782 ss << (*calIter) <<
"\n";
786 float calibvec[1700];
788 edm::LogInfo(
"TopInfo") <<
"H2: overwriting IC coef with file"
794 if (calibfile.is_open()) {
795 calibfile >> strdata >> strdata >> strdata >> strdata >> strdata;
796 while (!calibfile.eof()) {
797 calibfile >> idata >> icry >> fcali >> fdata >> fdata;
798 calibvec[icry - 1] = fcali;
799 if (calibfile.eof()) {
807 ss <<
"Getting the gain ratios from offline DB...\n";
809 const auto& gainMapEB = gainMap.barrelItems();
810 const auto& gainMapEE = gainMap.endcapItems();
813 for (gainIter = gainMapEB.begin(); gainIter != gainMapEB.end() && nGain < 10; ++gainIter, ++nGain) {
814 const auto aGain = (*gainIter);
815 ss << aGain.gain12Over6() <<
", " << aGain.gain6Over1() * aGain.gain12Over6() <<
"\n";
817 for (gainIter = gainMapEE.begin(); gainIter != gainMapEE.end() && nGain < 10; ++gainIter, ++nGain) {
818 const auto aGain = (*gainIter);
819 ss << aGain.gain12Over6() <<
", " << aGain.gain6Over1() * aGain.gain12Over6() <<
"\n";
825 ss <<
"Getting the ADC to GeV from offline DB...\n";
832 vector<EcalLogicID> my_EcalLogicId;
833 vector<EcalLogicID> my_TTEcalLogicId;
834 vector<EcalLogicID> my_StripEcalLogicId;
838 vector<EcalLogicID> my_TTEcalLogicId_EE;
839 vector<EcalLogicID> my_RTEcalLogicId_EE;
840 vector<EcalLogicID> my_StripEcalLogicId1_EE;
841 vector<EcalLogicID> my_StripEcalLogicId2_EE;
842 vector<EcalLogicID> my_CrystalEcalLogicId_EE;
843 vector<EcalLogicID> my_TTEcalLogicId_EB_by_TCC;
844 vector<EcalLogicID> my_StripEcalLogicId_EE_strips_by_TCC;
853 "EB_VFE", 1, 36, 1, 68, 1, 5,
"EB_VFE", 123);
854 ss <<
"got the 3 ecal barrel logic id set\n";
857 my_CrystalEcalLogicId_EE =
862 my_StripEcalLogicId1_EE =
866 my_StripEcalLogicId2_EE =
871 my_StripEcalLogicId_EE_strips_by_TCC =
893 ss <<
"Getting the latest ids for this tag (latest version) "
899 ss <<
"trying to read previous tag if it exists tag=" <<
tag_ <<
".version" <<
version_ <<
"\n";
927 map<EcalLogicID, FEConfigPedDat> pedset;
928 map<EcalLogicID, FEConfigLinDat> linset;
929 map<EcalLogicID, FEConfigLinParamDat> linparamset;
930 map<EcalLogicID, FEConfigLUTParamDat> lutparamset;
931 map<EcalLogicID, FEConfigFgrParamDat> fgrparamset;
933 map<int, linStruc> linEtaSlice;
937 int NbOfStripPerTCC[108][68];
938 for (
int i = 0;
i < 108;
i++)
939 for (
int j = 0;
j < 68;
j++)
940 NbOfStripPerTCC[
i][
j] = 0;
943 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
950 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
951 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
953 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
960 if (stripInTower > NbOfStripPerTCC[tccNb - 1][towerInTCC - 1])
961 NbOfStripPerTCC[tccNb - 1][towerInTCC - 1] = stripInTower;
966 (*out_file_) <<
"COMMENT ====== barrel crystals ====== " << std::endl;
969 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
984 int xtalInVFE = Id.
xtalId();
985 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
987 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
988 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
989 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
990 <<
" ieta = " <<
id.ieta() <<
" iphi = " <<
id.iphi() <<
" xtalhashedId = " <<
id.hashedIndex()
991 <<
" xtalNb = " <<
id.ic() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi()
994 int TCCch = towerInTCC;
995 int SLBslot = int((towerInTCC - 1) / 8.) + 1;
996 int SLBch = (towerInTCC - 1) % 8 + 1;
997 int cmsswId =
id.rawId();
998 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
1001 int val[] = {dccNb + 600,
1027 for (
int i = 0;
i < 26;
i++)
1034 if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
1035 int etaSlice = towid.
ietaAbs();
1040 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(), str);
1042 getCoeff(coeff, gainMap,
id.rawId());
1043 getCoeff(coeff, pedMap,
id.rawId());
1045 for (
int i = 0;
i < 3;
i++) {
1055 edm::LogError(
"TopInfo") <<
"ByEtaSlice: unable to compute the parameters for SM=" <<
id.ism()
1056 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
" gainId=" <<
i
1057 <<
", mult too large! forced to mult=255, shift=0\n";
1060 }
else if (mult < 128) {
1061 edm::LogError(
"TopInfo") <<
"ByEtaSlice: unable to compute the parameters for SM=" <<
id.ism()
1062 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
" gainId=" <<
i
1063 <<
", mult too small! forced to mult=128, shift=15\n";
1078 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1079 linEtaSlice[etaSlice] = lin;
1084 for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
1090 towerListEB.push_back(towid.
rawId());
1092 stripListEB.push_back(elId.
rawId() & 0xfffffff8);
1101 int xtalInVFE = Id.
xtalId();
1102 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1103 int etaSlice = towid.
ietaAbs();
1106 int hashedStripLogicID = 68 * 5 * (
id.ism() - 1) + 5 * (towerInTCC - 1) + (VFEid - 1);
1107 stripMapEB[hashedStripLogicID] = elId.
rawId() & 0xfffffff8;
1125 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1132 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(), str);
1137 getCoeff(coeff, gainMap,
id.rawId());
1138 getCoeff(coeff, pedMap,
id.rawId());
1139 ICEB->Fill(
id.iphi(),
id.ieta(), coeff.
calibCoeff_);
1144 vector<int> xtalCCU;
1145 xtalCCU.push_back(dccNb + 600);
1146 xtalCCU.push_back(CCUid);
1147 xtalCCU.push_back(xtalWithinCCUid);
1148 xtalCCU.push_back(
id.rawId());
1153 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1154 if (itLin != linEtaSlice.end()) {
1155 linMap[xtalCCU] = itLin->second;
1157 for (
int i = 0;
i < 3;
i++)
1158 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1159 << itLin->second.shift_[
i] << std::endl;
1162 for (
int i = 0;
i < 3;
i++) {
1167 }
else if (
i == 1) {
1171 }
else if (
i == 2) {
1178 float factor = float(itLin->second.mult_[0]) *
pow(2., -itLin->second.shift_[0]) /
xtal_LSB_EB_;
1179 tpgFactorEB->Fill(
id.iphi(),
id.ieta(), factor);
1184 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1189 int forceBase12 = 0;
1190 double invSinTheta = 1. /
sin(theta);
1191 for (
int i = 0;
i < 3;
i++) {
1201 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId()
1202 <<
", EB, gainId=" <<
i <<
", mult too large! forced to mult=255, shift=0\n";
1205 }
else if (mult < 128) {
1206 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId()
1207 <<
", EB, gainId=" <<
i <<
", mult too small! forced to mult=128, shift=15\n";
1217 double G = mult *
pow(2.0, -(shift + 2));
1218 double g = G * invSinTheta;
1222 forceBase12 = int(base);
1232 ss <<
"SM=" <<
id.ism() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1234 for (
int i = 0;
i < 3;
i++) {
1243 }
else if (
i == 1) {
1247 }
else if (
i == 2) {
1255 tpgFactorEB->Fill(
id.iphi(),
id.ieta(), factor);
1261 double g = G * invSinTheta;
1262 float val[] = {float(
i),
1268 ntupleSpike->Fill(val);
1270 linMap[xtalCCU] = lin;
1274 int ixtal = (
id.ism() - 1) * 1700 + (
id.ic() - 1);
1276 pedset[logicId] = pedDB;
1277 linset[logicId] = linDB;
1285 linparamset[my_EcalLogicId_EB] = linparam;
1292 fgrparamset[my_EcalLogicId_EB] = fgrparam;
1298 lutparamset[my_EcalLogicId_EB] = lutparam;
1303 (*out_file_) <<
"COMMENT ====== endcap crystals ====== " << std::endl;
1306 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1314 int dccNb = Id.
dccId();
1321 int xtalInVFE = Id.
xtalId();
1322 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1325 bool foundStripLogic =
false;
1326 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId1_EE) {
1327 if (stripLogicId.getID1() == 600 + dccNb && stripLogicId.getID2() == CCUid && stripLogicId.getID3() == VFEid) {
1328 stripMapEE[stripLogicId.getLogicID()] = elId.
rawId() & 0xfffffff8;
1329 foundStripLogic =
true;
1333 if (!foundStripLogic) {
1334 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId2_EE) {
1335 if (stripLogicId.getID1() == 600 + dccNb && stripLogicId.getID2() == CCUid && stripLogicId.getID3() == VFEid) {
1336 stripMapEE[stripLogicId.getLogicID()] = elId.
rawId() & 0xfffffff8;
1337 foundStripLogic =
true;
1342 if (!foundStripLogic) {
1343 edm::LogWarning(
"TopInfo") <<
"Strip ID not found for DCC: " << 600 + dccNb <<
" CCU: " << CCUid
1344 <<
" VFEid: " << VFEid;
1347 (*geomFile_) <<
"dccNb = " << dccNb <<
" tccNb = " << tccNb <<
" towerInTCC = " << towerInTCC
1348 <<
" stripInTower = " << stripInTower <<
" xtalInStrip = " << xtalInStrip <<
" CCUid = " << CCUid
1349 <<
" VFEid = " << VFEid <<
" xtalInVFE = " << xtalInVFE <<
" xtalWithinCCUid = " << xtalWithinCCUid
1350 <<
" ix = " <<
id.ix() <<
" iy = " <<
id.iy() <<
" xtalhashedId = " <<
id.hashedIndex()
1351 <<
" xtalNb = " <<
id.isc() <<
" ietaTT = " << towid.
ieta() <<
" iphiTT = " << towid.
iphi()
1354 int TCCch = stripInTower;
1356 if (towerInTCC < 5) {
1358 SLBch = 4 + towerInTCC;
1360 SLBslot = int((towerInTCC - 5) / 8.) + 2;
1361 SLBch = (towerInTCC - 5) % 8 + 1;
1363 for (
int j = 0;
j < towerInTCC - 1;
j++)
1364 TCCch += NbOfStripPerTCC[tccNb - 1][
j];
1366 int cmsswId =
id.rawId();
1368 int iz =
id.positiveZ();
1371 for (
int k = 0;
k < (int)my_CrystalEcalLogicId_EE.size();
k++) {
1372 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1373 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1374 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1375 if (
id.ix() == x &&
id.iy() == y && iz == z)
1376 logicId = my_CrystalEcalLogicId_EE[
k];
1380 int val[] = {dccNb + 600,
1406 for (
int i = 0;
i < 26;
i++)
1412 if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC - 1) % 4 == 0) {
1413 int etaSlice = towid.
ietaAbs();
1418 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(), str);
1420 getCoeff(coeff, gainMap,
id.rawId());
1421 getCoeff(coeff, pedMap,
id.rawId());
1423 for (
int i = 0;
i < 3;
i++) {
1433 edm::LogError(
"TopInfo") <<
"ByEtaSlice: unable to compute the parameters for Quadrant=" <<
id.iquadrant()
1434 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
" gainId=" <<
i
1435 <<
", mult too large! forced to mult=255, shift=0\n";
1438 }
else if (mult < 128) {
1439 edm::LogError(
"TopInfo") <<
"ByEtaSlice: unable to compute the parameters for Quadrant=" <<
id.iquadrant()
1440 <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
" gainId=" <<
i
1441 <<
", mult too small! forced to mult=128, shift=15\n";
1456 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1458 linEtaSlice[etaSlice] = lin;
1463 for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1471 towerListEE.push_back(towid.
rawId());
1475 towerListEE.push_back(additionalTower.rawId());
1477 stripListEE.push_back(elId.
rawId() & 0xfffffff8);
1479 int dccNb = Id.
dccId();
1486 int xtalInVFE = Id.
xtalId();
1487 int xtalWithinCCUid = 5 * (VFEid - 1) + xtalInVFE - 1;
1488 int etaSlice = towid.
ietaAbs();
1494 (*out_file_) <<
"CRYSTAL " <<
dec <<
id.rawId() << std::endl;
1496 int iz =
id.positiveZ();
1499 for (
int k = 0;
k < (int)my_CrystalEcalLogicId_EE.size();
k++) {
1500 int z = my_CrystalEcalLogicId_EE[
k].getID1();
1501 int x = my_CrystalEcalLogicId_EE[
k].getID2();
1502 int y = my_CrystalEcalLogicId_EE[
k].getID3();
1503 if (
id.ix() == x &&
id.iy() == y && iz == z) {
1504 logicId = my_CrystalEcalLogicId_EE[
k];
1513 getCoeff(coeff, calibMap, laserAlphaMap,
id.rawId(), str);
1515 getCoeff(coeff, gainMap,
id.rawId());
1516 getCoeff(coeff, pedMap,
id.rawId());
1518 ICEEPlus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1520 ICEEMinus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_);
1525 vector<int> xtalCCU;
1526 xtalCCU.push_back(dccNb + 600);
1527 xtalCCU.push_back(CCUid);
1528 xtalCCU.push_back(xtalWithinCCUid);
1529 xtalCCU.push_back(
id.rawId());
1534 map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1535 if (itLin != linEtaSlice.end()) {
1536 linMap[xtalCCU] = itLin->second;
1538 for (
int i = 0;
i < 3;
i++)
1539 (*
out_file_) << hex <<
" 0x" << itLin->second.pedestal_[
i] <<
" 0x" << itLin->second.mult_[
i] <<
" 0x"
1540 << itLin->second.shift_[
i] << std::endl;
1543 for (
int i = 0;
i < 3;
i++) {
1548 }
else if (
i == 1) {
1552 }
else if (
i == 2) {
1559 float factor = float(itLin->second.mult_[0]) *
pow(2., -itLin->second.shift_[0]) /
xtal_LSB_EE_;
1561 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(), factor);
1563 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(), factor);
1568 ss <<
"current EtaSlice = " << etaSlice <<
" not found in the EtaSlice map"
1573 for (
int i = 0;
i < 3;
i++) {
1583 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId()
1584 <<
", EE, gainId=" <<
i <<
", mult too large! forced to mult=255, shift=0\n";
1587 }
else if (mult < 128) {
1588 edm::LogError(
"TopInfo") <<
"unable to compute the parameters for " <<
dec <<
id.rawId()
1589 <<
", EE, gainId=" <<
i <<
", mult too small! forced to mult=128, shift=15\n";
1603 ss <<
"Quadrant=" <<
id.iquadrant() <<
" xt=" <<
id.ic() <<
" " <<
dec <<
id.rawId() <<
"\n";
1605 for (
int i = 0;
i < 3;
i++) {
1614 }
else if (
i == 1) {
1618 }
else if (
i == 2) {
1627 tpgFactorEEPlus->Fill(
id.ix(),
id.iy(), factor);
1629 tpgFactorEEMinus->Fill(
id.ix(),
id.iy(), factor);
1635 linMap[xtalCCU] = lin;
1638 pedset[logicId] = pedDB;
1639 linset[logicId] = linDB;
1649 linparamset[my_EcalLogicId_EE] = linparam;
1655 lutparamset[my_EcalLogicId_EE] = lutparam;
1660 fgrparamset[my_EcalLogicId_EE] = fgrparam;
1668 ss <<
" LIN tag " << lin_tag <<
"\n";
1673 ss <<
"the ped id =" <<
ped_conf_id_ <<
" will be used for the pedestals "
1685 evgueni <<
"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal," << std::endl;
1686 evgueni <<
" int & mult12, int & shift12, int & base12," << std::endl;
1687 evgueni <<
" int & mult6, int & shift6, int & base6," << std::endl;
1688 evgueni <<
" int & mult1, int & shift1, int & base1)" << std::endl;
1689 evgueni <<
"{" << std::endl;
1690 evgueni <<
" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; "
1693 map<vector<int>,
linStruc>::const_iterator itLinMap;
1694 for (itLinMap = linMap.begin(); itLinMap != linMap.end(); itLinMap++) {
1695 vector<int> xtalInCCU = itLinMap->first;
1696 evgueni <<
" if (fed==" << xtalInCCU[0] <<
" && ccu==" << xtalInCCU[1] <<
" && xtal==" << xtalInCCU[2] <<
") {";
1697 evgueni <<
" mult12 = " << itLinMap->second.
mult_[0] <<
" ; shift12 = " << itLinMap->second.shift_[0]
1698 <<
" ; base12 = " << itLinMap->second.pedestal_[0] <<
" ; ";
1699 evgueni <<
" mult6 = " << itLinMap->second.mult_[1] <<
" ; shift6 = " << itLinMap->second.shift_[1]
1700 <<
" ; base6 = " << itLinMap->second.pedestal_[1] <<
" ; ";
1701 evgueni <<
" mult1 = " << itLinMap->second.mult_[2] <<
" ; shift1 = " << itLinMap->second.shift_[2]
1702 <<
" ; base1 = " << itLinMap->second.pedestal_[2] <<
" ; ";
1703 evgueni <<
" return ;}" << std::endl;
1705 evgueni <<
"}" << std::endl;
1712 std::map<int, int> weights_map_even;
1713 std::map<int, int> weights_map_odd;
1719 const int NWEIGROUPS = 2;
1720 std::vector<unsigned int>
weights[NWEIGROUPS];
1724 map<EcalLogicID, FEConfigWeightGroupDat>
dataset;
1726 for (
int igrp = 0; igrp < NWEIGROUPS; igrp++) {
1729 (*out_file_) << std::endl;
1730 (*out_file_) <<
"WEIGHT " <<
dec << igrp << std::endl;
1733 (*out_file_) << std::endl;
1734 (*out_file_) << std::endl;
1737 ss <<
"going to write the weights for group:" << igrp <<
"\n";
1749 dataset[ecid] = gut;
1754 map<EcalLogicID, FEConfigWeightDat> dataset2;
1756 for (
int ich = 0; ich < (int)my_StripEcalLogicId.size(); ich++) {
1759 weights_map_even[stripMapEB[ich]] = 0;
1761 dataset2[my_StripEcalLogicId[ich]] = wut;
1765 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId1_EE) {
1768 weights_map_even[stripMapEE[stripLogicId.getLogicID()]] = 1;
1771 dataset2[stripLogicId] = wut;
1774 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId2_EE) {
1777 weights_map_even[stripMapEE[stripLogicId.getLogicID()]] = 1;
1780 dataset2[stripLogicId] = wut;
1787 wtag <<
"Shape_NGroups_" << NWEIGROUPS;
1789 ss <<
" weight tag " << weight_tag <<
"\n";
1796 std::vector<std::vector<unsigned int>> weights_even;
1800 while (std::getline(file, line)) {
1801 std::istringstream iss(line);
1802 std::vector<unsigned int> wei_group_even;
1804 wei_group_even.push_back(stoi(s));
1805 weights_even.push_back(wei_group_even);
1807 int nweigroups_even = weights_even.size();
1811 while (std::getline(file2, line2)) {
1812 std::istringstream iss(line2);
1816 int wei_group = wei_gr;
1817 if (wei_group > nweigroups_even - 1) {
1818 edm::LogError(
"TopInfo") <<
"Associating strip: " << ch_id <<
" to non-existing weight group: " << wei_gr
1821 weights_map_even[ch_id] = wei_group;
1824 map<EcalLogicID, FEConfigWeightGroupDat> dataset_even;
1826 for (
int igrp = 0; igrp < nweigroups_even; igrp++) {
1829 (*out_file_) << std::endl;
1830 (*out_file_) <<
"WEIGHT " <<
dec << igrp << std::endl;
1833 (*out_file_) << std::endl;
1834 (*out_file_) << std::endl;
1837 ss <<
"going to write the weights for group:" << igrp <<
"\n";
1849 dataset_even[ecid] = gut;
1855 map<EcalLogicID, FEConfigWeightDat> dataset_even_idmap;
1857 for (
int ich = 0; ich < (int)my_StripEcalLogicId.size(); ich++) {
1859 int igroup = weights_map_even[stripMapEB[ich]];
1861 dataset_even_idmap[my_StripEcalLogicId[ich]] = wut;
1864 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId1_EE) {
1866 int igroup = weights_map_even[stripMapEE[stripLogicId.getLogicID()]];
1869 dataset_even_idmap[stripLogicId] = wut;
1872 for (
EcalLogicID& stripLogicId : my_StripEcalLogicId2_EE) {
1874 int igroup = weights_map_even[stripMapEE[stripLogicId.getLogicID()]];
1877 dataset_even_idmap[stripLogicId] = wut;
1882 wtag <<
"Shape_even_NGroups_" << nweigroups_even;
1884 ss <<
" weight tag " << weight_tag <<
"\n";
1893 std::vector<std::vector<unsigned int>> weights_odd;
1896 while (std::getline(file3, line3)) {
1897 std::istringstream iss(line3);
1898 std::vector<unsigned int> wei_group_odd;
1900 wei_group_odd.push_back(stoi(s));
1901 weights_odd.push_back(wei_group_odd);
1903 int nweigroups_odd = weights_odd.size();
1907 while (std::getline(file4, line4)) {
1908 std::istringstream iss(line4);
1912 int wei_group = wei_gr;
1913 if (wei_group > nweigroups_odd - 1) {
1914 edm::LogError(
"TopInfo") <<
"Associating strip: " << ch_id <<
" to non-existing weight group: " << wei_gr
1917 weights_map_odd[ch_id] = wei_group;
1920 map<EcalLogicID, FEConfigOddWeightGroupDat> dataset_odd;
1922 for (
int igrp = 0; igrp < nweigroups_odd; igrp++) {
1925 (*out_file_) << std::endl;
1926 (*out_file_) <<
"WEIGHT_ODD " <<
dec << igrp << std::endl;
1929 (*out_file_) << std::endl;
1930 (*out_file_) << std::endl;
1933 ss <<
"going to write the weights for group:" << igrp <<
"\n";
1945 dataset_odd[ecid] = gut;
1951 (*out_file_) << std::endl;
1952 (*out_file_) <<
"TP_MODE " << std::endl;
1967 (*out_file_) << 0 << std::endl;
1968 (*out_file_) << 0 << std::endl;
1969 (*out_file_) << 0 << std::endl;
1970 (*out_file_) << 0 << std::endl;
1971 (*out_file_) << std::endl;
1976 map<EcalLogicID, FEConfigOddWeightDat> dataset_odd_idmap;
1979 for (
int ich = 0; ich < (int)my_StripEcalLogicId.size(); ich++) {
1981 int igroup = weights_map_odd[stripMapEB[ich]];
1983 dataset_odd_idmap[my_StripEcalLogicId[ich]] = wut;
1986 for (
auto& stripLogicId : my_StripEcalLogicId1_EE) {
1988 int igroup = weights_map_odd[stripMapEE[stripLogicId.getLogicID()]];
1991 dataset_odd_idmap[stripLogicId] = wut;
1994 for (
auto& stripLogicId : my_StripEcalLogicId2_EE) {
1996 int igroup = weights_map_odd[stripMapEE[stripLogicId.getLogicID()]];
1999 dataset_odd_idmap[stripLogicId] = wut;
2002 map<EcalLogicID, FEConfigOddWeightModeDat> dataset_tpmode;
2018 dataset_tpmode[my_StripEcalLogicId[0]] = tp_mode;
2023 wtag <<
"Shape_odd_NGroups_" << nweigroups_odd;
2025 ss <<
" weight tag " << weight_tag <<
"\n";
2028 dataset_odd, dataset_odd_idmap, dataset_tpmode, nweigroups_odd, weight_tag);
2036 (*out_file_) <<
"WEIGHT_ODD " <<
dec << 0 << std::endl;
2040 (*out_file_) << std::endl << std::endl;
2043 (*out_file_) <<
"TP_MODE " << std::endl;
2044 for (
int m = 0;
m < 18;
m++)
2046 (*out_file_) << std::endl;
2059 unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG;
2062 (*out_file_) << std::endl;
2063 (*out_file_) <<
"FG 0" << std::endl;
2064 (*out_file_) << hex <<
"0x" << lowThreshold <<
" 0x" << highThreshold <<
" 0x" << lowRatio <<
" 0x" << highRatio
2065 <<
" 0x" << lutFG << std::endl;
2070 unsigned int lut_strip;
2076 ss <<
"going to write the fgr "
2078 map<EcalLogicID, FEConfigFgrGroupDat>
dataset;
2081 for (
int ich = 0; ich < NFGRGROUPS; ich++) {
2091 dataset[ecid] = gut;
2095 map<EcalLogicID, FEConfigFgrDat> dataset2;
2096 for (
auto&
id : my_TTEcalLogicId) {
2106 for (
auto&
id : my_RTEcalLogicId_EE) {
2118 map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
2119 for (
auto&
id : my_TTEcalLogicId_EE) {
2122 dataset3[
id] = fgreett;
2127 map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
2128 for (
auto&
id : my_StripEcalLogicId1_EE) {
2134 for (
auto&
id : my_StripEcalLogicId2_EE) {
2141 for (
int ich = 0; ich < (int)my_StripEcalLogicId.size(); ich++) {
2145 uint32_t elStripId = stripMapEB[ich];
2146 map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId);
2147 if (it != stripMapEBsintheta.end())
2150 edm::LogError(
"TopInfo") <<
"ERROR: strip SFGVB threshold parameter not found for that strip:"
2151 << thestrip.
getID1() <<
" " << thestrip.
getID3() <<
" " << thestrip.
getID3() <<
"\n";
2157 dataset4[thestrip] = zut;
2165 ss <<
" weight tag " << weight_tag <<
"\n";
2171 map<EcalLogicID, FEConfigSpikeDat> datasetspike;
2172 for (
auto&
id : my_TTEcalLogicId) {
2175 datasetspike[
id] = spiketh;
2183 ss <<
" spike tag " << spike_tag <<
"\n";
2189 map<EcalLogicID, FEConfigTimingDat>
2191 for (
int ich = 0; ich < (int)my_TTEcalLogicId_EB_by_TCC.size(); ich++) {
2194 EcalLogicID logiciddelay = my_TTEcalLogicId_EB_by_TCC[ich];
2195 int id1_tcc = logiciddelay.
getID1();
2196 int id2_tt = logiciddelay.
getID2();
2197 std::map<int, vector<int>>::const_iterator ittEB =
delays_EB_.find(id1_tcc);
2198 std::vector<int> TimingDelaysEB = ittEB->second;
2201 if (TimingDelaysEB[id2_tt - 1] == -1) {
2202 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing delay not specified, check file, putting default value 1"
2208 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find delay parameter for that trigger tower "
2215 std::map<int, vector<int>>::const_iterator ittpEB =
phases_EB_.find(id1_tcc);
2216 std::vector<int> TimingPhasesEB = ittpEB->second;
2219 if (TimingPhasesEB[id2_tt - 1] == -1) {
2220 edm::LogError(
"TopInfo") <<
"ERROR: Barrel timing phase not specified, check file, putting default value 0"
2226 edm::LogError(
"TopInfo") <<
"ERROR:Barrel Could not find phase parameter for that trigger tower "
2233 ss << ich <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" logicId=" << logiciddelay.
getLogicID()
2234 <<
" delay=" << TimingDelaysEB[id2_tt - 1] <<
" phase=" << TimingPhasesEB[id2_tt - 1] <<
"\n";
2238 datasetdelay[logiciddelay] = delay;
2244 for (
int ich = 0; ich < (int)my_StripEcalLogicId_EE_strips_by_TCC.size(); ich++) {
2247 EcalLogicID logiciddelay = my_StripEcalLogicId_EE_strips_by_TCC[ich];
2248 int id1_tcc = logiciddelay.
getID1();
2249 int id2_tt = logiciddelay.
getID2();
2250 int id3_st = logiciddelay.
getID3();
2253 if (id1_tcc != tccin) {
2258 std::map<int, vector<int>>::const_iterator ittEE =
delays_EE_.find(id1_tcc);
2259 std::vector<int> TimingDelaysEE = ittEE->second;
2262 if (TimingDelaysEE[stripindex] == -1) {
2263 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing delay not specified, check file, putting default value 1"
2269 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find delay parameter for that trigger tower "
2276 std::map<int, vector<int>>::const_iterator ittpEE =
phases_EE_.find(id1_tcc);
2277 std::vector<int> TimingPhasesEE = ittpEE->second;
2280 if (TimingPhasesEE[stripindex] == -1) {
2281 edm::LogError(
"TopInfo") <<
"ERROR: Endcap timing phase not specified, check file, putting default value 0"
2287 edm::LogError(
"TopInfo") <<
"ERROR:Endcap Could not find phase parameter for that trigger tower "
2294 ss << ich <<
" stripindex=" << stripindex <<
" tcc=" << id1_tcc <<
" TT=" << id2_tt <<
" id3_st=" << id3_st
2295 <<
" logicId=" << logiciddelay.
getLogicID() <<
" delay=" << TimingDelaysEE[stripindex]
2296 <<
" phase=" << TimingPhasesEE[stripindex] <<
"\n";
2300 datasetdelay[logiciddelay] = delay;
2304 ostringstream de_tag;
2306 de_tag <<
"DelaysFromFile";
2308 ss <<
" delay tag " << delay_tag <<
"\n";
2315 ss <<
"going to write the sliding "
2317 map<EcalLogicID, FEConfigSlidingDat>
dataset;
2318 for (
auto&
id : my_StripEcalLogicId) {
2327 for (
auto&
id : my_StripEcalLogicId1_EE) {
2332 for (
auto&
id : my_StripEcalLogicId2_EE) {
2343 ss <<
" sliding tag " << justatag <<
"\n";
2353 int lut_EB[1024], lut_EE[1024];
2358 (*out_file_) << std::endl;
2359 (*out_file_) <<
"LUT 0" << std::endl;
2360 for (
int i = 0;
i < 1024;
i++)
2361 (*
out_file_) <<
"0x" << hex << lut_EB[
i] << std::endl;
2362 (*out_file_) << std::endl;
2369 for (
int i = 0;
i < 1024;
i++)
2370 if (lut_EE[
i] != lut_EB[
i])
2373 (*out_file_) << std::endl;
2374 (*out_file_) <<
"LUT 1" << std::endl;
2375 for (
int i = 0; i < 1024; i++)
2376 (*
out_file_) <<
"0x" << hex << lut_EE[
i] << std::endl;
2377 (*out_file_) << std::endl;
2381 map<EcalLogicID, FEConfigLUTGroupDat>
dataset;
2387 for (
int i = 0; i < 1024; i++) {
2392 dataset[ecid] = lut;
2398 for (
int i = 0; i < 1024; i++) {
2403 dataset[ecide] = lute;
2410 map<EcalLogicID, FEConfigLUTDat> dataset2;
2412 for (
auto&
id : my_TTEcalLogicId) {
2422 for (
auto&
id : my_TTEcalLogicId_EE) {
2436 ss <<
" LUT tag " << lut_tag <<
"\n";
2461 ss <<
"\n Conf ID = " << conf_id_ <<
"\n";
2470 stripListEB.unique();
2471 ss <<
"Number of EB strips=" <<
dec << stripListEB.size() <<
"\n";
2473 (*out_file_) << std::endl;
2474 for (itList = stripListEB.begin(); itList != stripListEB.end(); itList++) {
2475 (*out_file_) <<
"STRIP_EB " <<
dec << (*itList) << std::endl;
2476 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2477 (*out_file_) << hex <<
"0x" << weights_map_even[(*itList)] <<
" ";
2479 (*out_file_) << hex <<
"0x" << weights_map_odd[(*itList)] << std::endl;
2482 (*out_file_) <<
"0x" << stripMapEBsintheta[(*itList)] <<
" 0x" <<
SFGVB_lut_ << std::endl;
2488 stripListEE.unique();
2489 ss <<
"Number of EE strips=" <<
dec << stripListEE.size() <<
"\n";
2491 (*out_file_) << std::endl;
2492 for (itList = stripListEE.begin(); itList != stripListEE.end(); itList++) {
2493 (*out_file_) <<
"STRIP_EE " <<
dec << (*itList) << std::endl;
2494 (*out_file_) << hex <<
"0x" <<
sliding_ << std::endl;
2495 (*out_file_) << hex <<
"0x" << weights_map_even[(*itList)] <<
" ";
2497 (*out_file_) << hex <<
"0x" << weights_map_odd[(*itList)] << std::endl;
2500 (*out_file_) << hex <<
"0x" << threshold <<
" 0x" << lut_strip << std::endl;
2512 towerListEB.unique();
2513 ss <<
"Number of EB towers=" <<
dec << towerListEB.size() <<
"\n";
2515 (*out_file_) << std::endl;
2516 for (itList = towerListEB.begin(); itList != towerListEB.end(); itList++) {
2517 (*out_file_) <<
"TOWER_EB " <<
dec << (*itList) << std::endl;
2518 (*out_file_) <<
" 0\n 0\n";
2525 towerListEE.unique();
2526 ss <<
"Number of EE towers=" <<
dec << towerListEE.size() <<
"\n";
2528 (*out_file_) << std::endl;
2529 for (itList = towerListEE.begin(); itList != towerListEE.end(); itList++) {
2530 (*out_file_) <<
"TOWER_EE " <<
dec << (*itList) << std::endl;
2532 (*out_file_) <<
" 1\n";
2535 (*out_file_) << hex <<
"0x" << lut_tower << std::endl;
2545 tpgFactorEB->Write();
2547 tpgFactorEEPlus->Write();
2549 tpgFactorEEMinus->Write();
2555 ntupleSpike->Write();
2560 using namespace edm;
2561 using namespace std;
2571 (*out_file_) <<
"PHYSICS_EB " <<
dec << eb.
rawId() << std::endl;
2576 (*out_file_) << std::endl;
2578 (*out_file_) <<
"PHYSICS_EE " <<
dec << ee.
rawId() << std::endl;
2580 (*out_file_) <<
FG_Threshold_EE_ <<
" " << -1 <<
" " << -1 <<
" " << -1 << std::endl;
2581 (*out_file_) << std::endl;
2586 double theta,
double gainRatio,
double calibCoeff,
std::string subdet,
int&
mult,
int&
shift) {
2609 if (subdet ==
"EE") {
2618 double factor = 1024 * ratio * gainRatio * calibCoeff *
sin(theta) * (1 << (
sliding_ + shiftDet + 2));
2620 mult = (int)(factor + 0.5);
2621 for (shift = 0; shift < 15; shift++) {
2622 if (mult >= 128 && mult < 256)
2625 mult = (int)(factor + 0.5);
2627 edm::LogError(
"TopInfo") <<
"too bad we did not manage to calculate the factor for calib=" << calibCoeff <<
"\n";
2634 (*out_file_) <<
"COMMENT put your comments here" << std::endl;
2636 (*out_file_) <<
"COMMENT =================================" << std::endl;
2637 (*out_file_) <<
"COMMENT physics EB structure" << std::endl;
2638 (*out_file_) <<
"COMMENT" << std::endl;
2639 (*out_file_) <<
"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)" << std::endl;
2640 (*out_file_) <<
"COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio" << std::endl;
2642 (*out_file_) <<
"COMMENT =================================" << std::endl;
2643 (*out_file_) <<
"COMMENT" << std::endl;
2645 (*out_file_) <<
"COMMENT =================================" << std::endl;
2646 (*out_file_) <<
"COMMENT physics EE structure" << std::endl;
2647 (*out_file_) <<
"COMMENT" << std::endl;
2648 (*out_file_) <<
"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)" << std::endl;
2649 (*out_file_) <<
"COMMENT FG_Threshold (GeV), dummy, dummy, dummy" << std::endl;
2650 (*out_file_) <<
"COMMENT =================================" << std::endl;
2651 (*out_file_) <<
"COMMENT" << std::endl;
2653 (*out_file_) <<
"COMMENT =================================" << std::endl;
2654 (*out_file_) <<
"COMMENT crystal structure (same for EB and EE)" << std::endl;
2655 (*out_file_) <<
"COMMENT" << std::endl;
2656 (*out_file_) <<
"COMMENT ped, mult, shift [gain12]" << std::endl;
2657 (*out_file_) <<
"COMMENT ped, mult, shift [gain6]" << std::endl;
2658 (*out_file_) <<
"COMMENT ped, mult, shift [gain1]" << std::endl;
2659 (*out_file_) <<
"COMMENT =================================" << std::endl;
2660 (*out_file_) <<
"COMMENT" << std::endl;
2662 (*out_file_) <<
"COMMENT =================================" << std::endl;
2663 (*out_file_) <<
"COMMENT strip EB structure" << std::endl;
2664 (*out_file_) <<
"COMMENT" << std::endl;
2665 (*out_file_) <<
"COMMENT sliding_window" << std::endl;
2666 (*out_file_) <<
"COMMENT even_weightGroupId odd_weightGroupId" << std::endl;
2667 (*out_file_) <<
"COMMENT threshold_sfg lut_sfg" << std::endl;
2668 (*out_file_) <<
"COMMENT =================================" << std::endl;
2669 (*out_file_) <<
"COMMENT" << std::endl;
2671 (*out_file_) <<
"COMMENT =================================" << std::endl;
2672 (*out_file_) <<
"COMMENT strip EE structure" << std::endl;
2673 (*out_file_) <<
"COMMENT" << std::endl;
2674 (*out_file_) <<
"COMMENT sliding_window" << std::endl;
2675 (*out_file_) <<
"COMMENT even_weightGroupId odd_weightGroupId" << std::endl;
2676 (*out_file_) <<
"COMMENT threshold_fg lut_fg" << std::endl;
2677 (*out_file_) <<
"COMMENT =================================" << std::endl;
2678 (*out_file_) <<
"COMMENT" << std::endl;
2680 (*out_file_) <<
"COMMENT =================================" << std::endl;
2681 (*out_file_) <<
"COMMENT tower EB structure" << std::endl;
2682 (*out_file_) <<
"COMMENT" << std::endl;
2683 (*out_file_) <<
"COMMENT LUTGroupId" << std::endl;
2684 (*out_file_) <<
"COMMENT FgGroupId" << std::endl;
2685 (*out_file_) <<
"COMMENT spike_killing_threshold" << std::endl;
2686 (*out_file_) <<
"COMMENT =================================" << std::endl;
2687 (*out_file_) <<
"COMMENT" << std::endl;
2689 (*out_file_) <<
"COMMENT =================================" << std::endl;
2690 (*out_file_) <<
"COMMENT tower EE structure" << std::endl;
2691 (*out_file_) <<
"COMMENT" << std::endl;
2692 (*out_file_) <<
"COMMENT LUTGroupId" << std::endl;
2693 (*out_file_) <<
"COMMENT tower_lut_fg" << std::endl;
2694 (*out_file_) <<
"COMMENT =================================" << std::endl;
2695 (*out_file_) <<
"COMMENT" << std::endl;
2697 (*out_file_) <<
"COMMENT =================================" << std::endl;
2698 (*out_file_) <<
"COMMENT Even Weight structure" << std::endl;
2699 (*out_file_) <<
"COMMENT" << std::endl;
2700 (*out_file_) <<
"COMMENT Weight even" << std::endl;
2701 (*out_file_) <<
"COMMENT weightGroupId" << std::endl;
2702 (*out_file_) <<
"COMMENT w0, w1, w2, w3, w4" << std::endl;
2703 (*out_file_) <<
"COMMENT =================================" << std::endl;
2704 (*out_file_) <<
"COMMENT" << std::endl;
2706 (*out_file_) <<
"COMMENT =================================" << std::endl;
2707 (*out_file_) <<
"COMMENT Odd Weight structure" << std::endl;
2708 (*out_file_) <<
"COMMENT" << std::endl;
2709 (*out_file_) <<
"COMMENT Weight odd" << std::endl;
2710 (*out_file_) <<
"COMMENT weightGroupId" << std::endl;
2711 (*out_file_) <<
"COMMENT w0, w1, w2, w3, w4" << std::endl;
2712 (*out_file_) <<
"COMMENT =================================" << std::endl;
2713 (*out_file_) <<
"COMMENT" << std::endl;
2715 (*out_file_) <<
"COMMENT =================================" << std::endl;
2716 (*out_file_) <<
"COMMENT TP mode" << std::endl;
2717 (*out_file_) <<
"COMMENT EnableEBOddFilter" << std::endl;
2718 (*out_file_) <<
"COMMENT EnableEEOddFilter" << std::endl;
2719 (*out_file_) <<
"COMMENT EnableEBOddPeakFinder" << std::endl;
2720 (*out_file_) <<
"COMMENT EnableEEOddPeakFinder" << std::endl;
2721 (*out_file_) <<
"COMMENT DisableEBEvenPeakFinder" << std::endl;
2722 (*out_file_) <<
"COMMENT DisableEEEvenPeakFinder" << std::endl;
2723 (*out_file_) <<
"COMMENT FenixEBStripOutput" << std::endl;
2724 (*out_file_) <<
"COMMENT FenixEEStripOutput" << std::endl;
2725 (*out_file_) <<
"COMMENT FenixEBStripInfobit2" << std::endl;
2726 (*out_file_) <<
"COMMENT FenixEEStripInfobit2" << std::endl;
2727 (*out_file_) <<
"COMMENT EBFenixTcpOutput" << std::endl;
2728 (*out_file_) <<
"COMMENT EBFenixTcpInfobit1" << std::endl;
2729 (*out_file_) <<
"COMMENT EEFenixTcpOutput" << std::endl;
2730 (*out_file_) <<
"COMMENT EEFenixTcpInfobit1" << std::endl;
2731 (*out_file_) <<
"COMMENT FenixPar15" << std::endl;
2732 (*out_file_) <<
"COMMENT FenixPar16" << std::endl;
2733 (*out_file_) <<
"COMMENT FenixPar17" << std::endl;
2734 (*out_file_) <<
"COMMENT FenixPar18" << std::endl;
2735 (*out_file_) <<
"COMMENT =================================" << std::endl;
2736 (*out_file_) <<
"COMMENT" << std::endl;
2738 (*out_file_) <<
"COMMENT =================================" << std::endl;
2739 (*out_file_) <<
"COMMENT lut structure" << std::endl;
2740 (*out_file_) <<
"COMMENT" << std::endl;
2741 (*out_file_) <<
"COMMENT LUTGroupId" << std::endl;
2742 (*out_file_) <<
"COMMENT LUT[1-1024]" << std::endl;
2743 (*out_file_) <<
"COMMENT =================================" << std::endl;
2744 (*out_file_) <<
"COMMENT" << std::endl;
2746 (*out_file_) <<
"COMMENT =================================" << std::endl;
2747 (*out_file_) <<
"COMMENT fg EB structure" << std::endl;
2748 (*out_file_) <<
"COMMENT" << std::endl;
2749 (*out_file_) <<
"COMMENT FgGroupId" << std::endl;
2750 (*out_file_) <<
"COMMENT el, eh, tl, th, lut_fg" << std::endl;
2751 (*out_file_) <<
"COMMENT =================================" << std::endl;
2752 (*out_file_) <<
"COMMENT" << std::endl;
2757 unsigned int max = (
unsigned int)(
pow(2., complement2) - 1);
2759 iweight = int((1 << 6) * weight + 0.5);
2761 iweight = max - int(-weight * (1 << 6) + 0.5) + 1;
2762 iweight = iweight &
max;
2767 double weight = double(iweight) /
pow(2., 6.);
2769 if ((iweight & (1 << (complement2 - 1))) != 0)
2770 weight = (double(iweight) -
pow(2., complement2)) /
pow(2., 6.);
2775 std::ostringstream
ss;
2776 ss <<
"Computing Weights...\n";
2778 double max = shape(timeMax);
2785 sumf += shape(time) /
max;
2786 sumf2 += shape(time) / max * shape(time) /
max;
2787 for (
int subtime = 0; subtime < 25; subtime++)
2788 histo->Fill(
float(
sample * 25. + subtime) / 25., shape(time + subtime));
2790 double lambda = 1. / (sumf2 - sumf * sumf /
nSample_);
2791 double gamma = -lambda * sumf /
nSample_;
2796 weight[
sample] = lambda * shape(time) / max + gamma;
2805 for (
unsigned int sample = 0; sample <
nSample_; sample++)
2806 isumw += iweight[sample];
2808 isumw = (isumw & imax);
2812 for (
unsigned int sample = 0; sample <
nSample_; sample++) {
2815 ampl += weight[
sample] * shape(time);
2817 ss <<
"weight=" << weight[
sample] <<
" shape=" << shape(time) <<
"\n";
2821 ss <<
"Weights: sum (weight*shape) = " << ampl <<
"\n";
2826 while (isumw != 0 && count < 10) {
2828 unsigned int index = 0;
2831 ss <<
"Correcting for bias: adding 1\n";
2832 for (
unsigned int sample = 0; sample <
nSample_; sample++) {
2833 int new_iweight = iweight[
sample] + 1;
2835 if (fabs(new_weight - weight[sample]) < min) {
2836 min = fabs(new_weight - weight[sample]);
2843 ss <<
"Correcting for bias: subtracting 1\n";
2844 for (
unsigned int sample = 0; sample <
nSample_; sample++) {
2845 int new_iweight = iweight[
sample] - 1;
2847 if (fabs(new_weight - weight[sample]) < min) {
2848 min = fabs(new_weight - weight[sample]);
2855 for (
unsigned int sample = 0; sample <
nSample_; sample++)
2856 isumw += iweight[sample];
2858 isumw = (isumw & imax);
2859 ss <<
"Correcting weight number: " << index <<
" sum weights = " << isumw <<
"\n";
2866 for (
unsigned int sample = 0; sample <
nSample_; sample++)
2867 isumw += iweight[sample];
2869 isumw = (isumw & imax);
2871 for (
unsigned int sample = 0; sample <
nSample_; sample++) {
2876 ampl += new_weight * shape(time);
2877 ss <<
"weight unbiased after integer conversion=" << new_weight <<
" shape=" << shape(time) <<
"\n";
2881 ss <<
"Weights: sum (weight*shape) = " << ampl <<
"\n";
2884 std::vector<unsigned int> theWeights;
2885 for (
unsigned int sample = 0; sample <
nSample_; sample++)
2886 theWeights.push_back(iweight[sample]);
2912 for (
int i = 0;
i < 1024;
i++) {
2921 for (
int i = 0;
i < 1024;
i++) {
2923 if ((
i + 1) % 4 == 0)
2932 func->SetParameters(LUT_stochastic, LUT_noise, LUT_constant);
2933 double norm = func->Integral(0., Et_sat);
2934 for (
int i = 0;
i < 1024;
i++) {
2935 double Et =
i * Et_sat / 1024.;
2936 lut[
i] = int(0xff * func->Integral(0., Et) / norm + 0.5);
2941 for (
int j = 0;
j < 1024;
j++) {
2942 double Et_GeV = Et_sat / 1024 * (
j + 0.5);
2943 if (Et_GeV <= LUT_threshold)
2946 if (Et_GeV >= TTF_highThreshold)
2948 if (Et_GeV >= TTF_lowThreshold && Et_GeV < TTF_highThreshold)
2969 double alpha_factor = 1.0;
2972 icorr = itCorr->second;
2980 st =
"Transparency correction found for xtal " + ss.str() +
" corr=" + ss1.str() +
" intercalib=" + ss2.str() +
2983 edm::LogError(
"TopInfo") <<
"ERROR = Transparency correction not found for xtal " << rawId <<
"\n";
2986 DetId ECALdetid(rawId);
2990 st +=
"DETID=" + ss.str() +
"\n";
2994 if (italpha != laserAlphaMap.
end())
2995 alpha_factor = (*italpha);
2997 edm::LogError(
"TopInfo") <<
"ERROR:LaserAlphe parameter note found!!"
3003 if (italpha != laserAlphaMap.
end())
3004 alpha_factor = (*italpha);
3006 edm::LogError(
"TopInfo") <<
"ERROR:LaserAlphe parameter note found!!"
3020 ss2 << alpha_factor;
3021 st +=
"rawId " + ss.str() +
" " + ss1.str() +
" " + ss2.str() +
"\n";
3022 if (icalit != calibMap.
end())
3028 edm::LogError(
"TopInfo") <<
"getCoeff: " << rawId <<
" not found in EcalIntercalibConstantMap"
3038 if (gainIter != gainMap.
end()) {
3043 edm::LogError(
"TopInfo") <<
"getCoeff: " << rawId <<
" not found in EcalGainRatioMap"
3061 if (pedIter != pedMap.
end()) {
3063 coeff.
pedestals_[0] = int(aped.mean_x12 + 0.5);
3064 coeff.
pedestals_[1] = int(aped.mean_x6 + 0.5);
3065 coeff.
pedestals_[2] = int(aped.mean_x1 + 0.5);
3067 edm::LogError(
"TopInfo") <<
"getCoeff: " << rawId <<
" not found in EcalPedestalsMap\n";
3071 const map<EcalLogicID, MonPedestalsDat>& pedMap,
3078 map<EcalLogicID, MonPedestalsDat>::const_iterator it = pedMap.find(logicId);
3079 if (it != pedMap.end()) {
3086 <<
" not found in map<EcalLogicID, MonPedestalsDat\n";
3090 unsigned int& highRatio,
3091 unsigned int& lowThreshold,
3092 unsigned int& highThreshold,
3093 unsigned int& lut) {
3095 if (lowRatio > 0x7f)
3098 if (highRatio > 0x7f)
3104 if (lowThreshold > 0xff)
3105 lowThreshold = 0xff;
3107 if (highThreshold > 0xff)
3108 highThreshold = 0xff;
3124 unsigned int& lut_strip,
3125 unsigned int& lut_tower) {
3136 for (
int i = 1;
i < 3;
i++) {
3143 for (
int i = 0;
i < 3;
i++) {
3145 edm::LogError(
"TopInfo") <<
"PROBLEM in realignBaseline: xtal=" << cmsswid <<
" base= " << base[
i] <<
", "
3146 << lin.
pedestal_[
i] <<
" for gainId[0-2]=" <<
i <<
" ==> smaller than 0 ==> set to 0"
3147 <<
" mult12:" << lin.
mult_[0] <<
" mult:" << lin.
mult_[
i]
3149 <<
" shift12:" << lin.
shift_[0] <<
" shift: " << lin.
shift_[
i] <<
"\n";
3152 }
else if (base[
i] > 1024) {
3153 edm::LogError(
"TopInfo") <<
"PROBLEM in realignBaseline: xtal=" << cmsswid <<
" base= " << base[
i] <<
", "
3155 <<
" ==> larger than 1024 ==> set to 1024"
3156 <<
" mult12:" << lin.
mult_[0] <<
" mult:" << lin.
mult_[
i]
3158 <<
" shift12:" << lin.
shift_[0] <<
" shift: " << lin.
shift_[
i] <<
"\n";
3170 gctphi = (ttphi + 1) / 4;
3181 gcteta = (tteta - 1) / 4 + 11;
3183 gcteta = (tteta + 1) / 4 + 10;
3188 std::stringstream sdet;
3190 if (tcc > 36 && tcc < 55)
3191 sdet <<
"EB-" << tcc - 36;
3192 else if (tcc >= 55 && tcc < 73)
3193 sdet <<
"EB+" << tcc - 54;
3199 if (tcc <= 36 || tcc >= 73) {
3202 if (tcc == 1 || tcc == 18 || tcc == 19 || tcc == 36)
3204 else if (tcc == 2 || tcc == 3 || tcc == 20 || tcc == 21)
3206 else if (tcc == 4 || tcc == 5 || tcc == 22 || tcc == 23)
3208 else if (tcc == 6 || tcc == 7 || tcc == 24 || tcc == 25)
3210 else if (tcc == 8 || tcc == 9 || tcc == 26 || tcc == 27)
3212 else if (tcc == 10 || tcc == 11 || tcc == 28 || tcc == 29)
3214 else if (tcc == 12 || tcc == 13 || tcc == 30 || tcc == 31)
3216 else if (tcc == 14 || tcc == 15 || tcc == 32 || tcc == 33)
3218 else if (tcc == 16 || tcc == 17 || tcc == 34 || tcc == 35)
3226 std::stringstream crate;
3231 if (tcc >= 40 && tcc <= 42) {
3233 slot = 5 + (tcc - 40) * 6;
3235 if (tcc >= 43 && tcc <= 45) {
3237 slot = 5 + (tcc - 43) * 6;
3239 if (tcc >= 37 && tcc <= 39) {
3241 slot = 5 + (tcc - 37) * 6;
3243 if (tcc >= 52 && tcc <= 54) {
3245 slot = 5 + (tcc - 52) * 6;
3247 if (tcc >= 46 && tcc <= 48) {
3249 slot = 5 + (tcc - 46) * 6;
3251 if (tcc >= 49 && tcc <= 51) {
3253 slot = 5 + (tcc - 49) * 6;
3255 if (tcc >= 58 && tcc <= 60) {
3257 slot = 5 + (tcc - 58) * 6;
3259 if (tcc >= 61 && tcc <= 63) {
3261 slot = 5 + (tcc - 61) * 6;
3263 if (tcc >= 55 && tcc <= 57) {
3265 slot = 5 + (tcc - 55) * 6;
3267 if (tcc >= 70 && tcc <= 72) {
3269 slot = 5 + (tcc - 70) * 6;
3271 if (tcc >= 64 && tcc <= 66) {
3273 slot = 5 + (tcc - 64) * 6;
3275 if (tcc >= 67 && tcc <= 69) {
3277 slot = 5 + (tcc - 67) * 6;
3280 if (tcc >= 76 && tcc <= 81) {
3283 slot = 2 + (tcc - 76) * 3;
3285 slot = 4 + (tcc - 77) * 3;
3287 if (tcc >= 94 && tcc <= 99) {
3290 slot = 3 + (tcc - 94) * 3;
3292 slot = 5 + (tcc - 95) * 3;
3295 if (tcc >= 22 && tcc <= 27) {
3298 slot = 2 + (tcc - 22) * 3;
3300 slot = 4 + (tcc - 23) * 3;
3302 if (tcc >= 4 && tcc <= 9) {
3305 slot = 3 + (tcc - 4) * 3;
3307 slot = 5 + (tcc - 5) * 3;
3310 if (tcc >= 82 && tcc <= 87) {
3313 slot = 2 + (tcc - 82) * 3;
3315 slot = 4 + (tcc - 83) * 3;
3317 if (tcc >= 100 && tcc <= 105) {
3320 slot = 3 + (tcc - 100) * 3;
3322 slot = 5 + (tcc - 101) * 3;
3325 if (tcc >= 28 && tcc <= 33) {
3328 slot = 2 + (tcc - 28) * 3;
3330 slot = 4 + (tcc - 29) * 3;
3332 if (tcc >= 10 && tcc <= 15) {
3335 slot = 3 + (tcc - 10) * 3;
3337 slot = 5 + (tcc - 11) * 3;
3438 return std::pair<std::string, int>(crate.str(), slot);
unsigned int TPmode_FenixEBStripOutput_
std::string weight_even_idMapFile_
int writeToConfDB_TPGLinearCoef(const std::map< EcalLogicID, FEConfigLinDat > &linset, const std::map< EcalLogicID, FEConfigLinParamDat > &linparamset, int iovId, std::string tag)
bool TPmode_DisableEBEvenPeakFinder_
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, std::vector< int > > phases_EB_
void setDisableEEEvenPeakFinder(int x)
bool useTransparencyCorr_
unsigned int TPmode_FenixEBStripInfobit2_
void setThreshLow(float x)
bool TPmode_EnableEEOddFilter_
int xtalId() const
get the channel id
unsigned int TPmode_FenixEBTcpInfobit1_
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
uint16_t *__restrict__ id
unsigned int TPmode_FenixEBTcpOutput_
void setLUTGroupId(int x)
static constexpr uint NWEIGHTS
bool TPmode_EnableEBOddFilter_
int stripId() const
get the tower id
void setFGhighratio(float x)
void setFenixEBTcpInfoBit1(int x)
bool TPmode_EnableEBOddPeakFinder_
const self & getMap() const
void setFenixEBTcpOutput(int x)
EcalLogicID getEcalLogicID(std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="") noexcept(false)
float getPedMeanG1() const
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalmappingToken_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
double TTF_highThreshold_EB_
void setTimingPar2(int x)
unsigned int SFGVB_Threshold_
std::pair< std::string, int > getCrate(int tcc)
const Items & barrelItems() const
int getGCTRegionPhi(int ttphi)
Sin< T >::type sin(const T &t)
constexpr uint32_t rawId() const
get the raw id
std::string TimingPhases_EE_
std::string getDet(int tcc)
double oneOverEtResolEt(double *x, double *par)
Geom::Theta< T > theta() const
void setFenixEBStripInfobit2(int x)
std::string Transparency_Corr_
bool weight_unbias_recovery_
void setFGlowthresh(float x)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
int towerId() const
get the tower id
void setRatioHigh(float x)
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd > ecalLaserAPDPNRatiosToken_
int writeToConfDB_TPGSliding(const std::map< EcalLogicID, FEConfigSlidingDat > &sliset, int iovId, std::string tag)
std::string weight_even_weightGroupFile_
void fetchConfigSet(ICONF *iconf) noexcept(false)
unsigned int TPmode_FenixEEStripOutput_
unsigned int FG_lut_tower_EE_
Log< level::Error, false > LogError
static EEDetId unhashIndex(int hi)
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > theBarrelGeometryToken_
std::string TimingDelays_EE_
int writeToConfDB_Delay(const std::map< EcalLogicID, FEConfigTimingDat > &delaygroupset, std::string tag)
const CaloSubdetectorGeometry * theEndcapGeometry_
double FG_lowThreshold_EB_
void setFenixEETcpInfoBit1(int x)
std::ofstream * out_file_
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void setEnableEEOddPeakFinder(int x)
std::map< int, std::vector< int > > delays_EB_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
int channelId() const
get the channel id
int ieta() const
get the tower ieta
void setPedMeanG6(float mean)
int zside() const
get the z-side of the tower (1/-1)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
edm::ESGetToken< EcalLaserAlphas, EcalLaserAlphasRcd > ecalLaserAlphasToken_
bool getData(T &iHolder) const
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
int SFGVB_SpikeKillingThreshold_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > ecalGainRatiosToken_
std::vector< unsigned int > computeWeights(EcalShapeBase &shape, TH1F *histo)
int hashedIndex(int ieta, int iphi)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
void setWeightGroupId(int x)
double TTF_lowThreshold_EE_
std::string getName() const
const EcalLaserAPDPNRatiosMap & getLaserMap() const
void setThreshold(unsigned int mean)
void setPedMeanG1(float mean)
void setThreshHigh(float x)
float getPedMeanG12() const
~EcalTPGParamBuilder() override
std::map< int, std::vector< int > > delays_EE_
std::string TimingDelays_EB_
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
void setLutFgr(unsigned int mean)
int ietaAbs() const
get the absolute value of the tower ieta
const EcalElectronicsMapping * theMapping_
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID) noexcept(false)
void computeLUT(int *lut, std::string det="EB")
void setDisableEBEvenPeakFinder(int x)
bool useTransverseEnergy_
EcalTPGParamBuilder(edm::ParameterSet const &pSet)
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
void setLUTValue(int i, int x)
bool weight_even_computeFromShape_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
void setEnableEBOddPeakFinder(int x)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
double LUT_stochastic_EE_
unsigned int TPmode_FenixEEStripInfobit2_
tuple DBuser
real DB on lxplus DBsid = cms.string('int2r'), ## test DB P5 online DB DBuser = cms.string('cms_ecal_conf'), DBpass = cms.string('0r4cms_3c4lc0nf'),
std::ofstream * geomFile_
void setLUTGroupId(int x)
void setFgrGroupId(int x)
int pseudoStripId() const
get the tower id
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void setSpikeThreshold(int x)
void setEnableEEOddFilter(int x)
float getPedMeanG12() const
void setTimingPar1(int x)
void insert(std::pair< uint32_t, Item > const &a)
bool TPmode_DisableEEEvenPeakFinder_
void setRatioLow(float x)
void setFgrGroupId(int x)
int writeToConfDB_Spike(const std::map< EcalLogicID, FEConfigSpikeDat > &spikegroupset, std::string tag)
void computeFineGrainEEParameters(uint &threshold, uint &lut_strip, uint &lut_tower)
const EcalTrigTowerConstituentsMap * eTTmap_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > eTTmapToken_
Log< level::Info, false > LogInfo
bool computeLinearizerParam(double theta, double gainRatio, double calibCoeff, std::string subdet, int &mult, int &shift)
unsigned int pedestal_offset_
int iphi() const
get the tower iphi
const CaloSubdetectorGeometry * theBarrelGeometry_
bool TPmode_EnableEEOddPeakFinder_
bool useInterCalibration_
int writeToConfDB_TPGPedestals(const std::map< EcalLogicID, FEConfigPedDat > &pedset, int iovId, std::string tag)
void setPedMeanG12(float mean)
void setFenixEETcpOutput(int x)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
unsigned int TPmode_FenixEETcpInfobit1_
bool weight_useDoubleWeights_
bool realignBaseline(linStruc &lin, float forceBase12, int cmsswid)
std::vector< Item >::const_iterator const_iterator
T getParameter(std::string const &) const
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
unsigned int TPmode_FenixEETcpOutput_
void setFenixEEStripInfobit2(int x)
float gain12Over6() const
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPedestalsToken_
void setWeightGroupId(int x)
float getPedMeanG1() const
float getPedMeanG6() const
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
void setConfigTag(std::string x)
void setFGlowratio(float x)
double TTF_highThreshold_EE_
void setSliding(float mean)
std::string weight_odd_idMapFile_
std::string TimingPhases_EB_
double LUT_stochastic_EB_
void setTTThreshhigh(float x)
int writeToConfDB_TPGLUT(const std::map< EcalLogicID, FEConfigLUTGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigLUTDat > &lutdat, const std::map< EcalLogicID, FEConfigLUTParamDat > &lutparamset, int iovId, std::string tag)
void setEventSetup(const edm::EventSetup &evtSetup)
float getPedMeanG6() const
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > theEndcapGeometryToken_
const_iterator find(uint32_t rawId) const
static unsigned int const shift
void setEnableEBOddFilter(int x)
void setWeightGroupId(int x)
std::string weight_odd_weightGroupFile_
int writeToConfDB_TPGFgr(const std::map< EcalLogicID, FEConfigFgrGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigFgrDat > &lutdat, const std::map< EcalLogicID, FEConfigFgrParamDat > &fgrparamset, const std::map< EcalLogicID, FEConfigFgrEETowerDat > &dataset3, const std::map< EcalLogicID, FEConfigFgrEEStripDat > &dataset4, int iovId, std::string tag)
unsigned int complement2_
const_iterator end() const
int writeToConfDB_TPGWeight(const std::map< EcalLogicID, FEConfigWeightGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigWeightDat > &lutdat, int iovId, std::string tag)
int getGCTRegionEta(int tteta)
int writeToConfDB_TPGWeight_doubleWeights(const std::map< EcalLogicID, FEConfigOddWeightGroupDat > &lutgroupset, const std::map< EcalLogicID, FEConfigOddWeightDat > &lutset, const std::map< EcalLogicID, FEConfigOddWeightModeDat > &tpmode, int ngr, std::string tag)
Log< level::Warning, false > LogWarning
std::map< int, double > Transparency_Correction_
void setTTThreshlow(float x)
static const int SMCRYSTALMODE
void setWeightGroupId(int x)
unsigned int FG_lut_strip_EE_
int getEtaSlice(int tccId, int towerInTCC)
double FG_highThreshold_EB_
void setFenixEBStripOutput(int x)
void setLutValue(int mean)
int writeToConfDB_TPGMain(int ped, int lin, int lut, int fgr, int sli, int wei, int wei2, int spi, int tim, int bxt, int btt, int bst, int cok, std::string tag, int ver)
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
void setFGhighthresh(float x)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
std::map< int, std::vector< int > > phases_EE_
double TTF_lowThreshold_EB_
bool checkIfOK(EcalPedestals::Item item)
void computeFineGrainEBParameters(uint &lowRatio, uint &highRatio, uint &lowThreshold, uint &highThreshold, uint &lut)
void setFenixEEStripOutput(int x)
void getCoeff(coeffStruc &coeff, const EcalGainRatioMap &gainMap, uint rawId)
int uncodeWeight(double weight, int complement2=7)