184 std::unordered_map<unsigned int, PlanePlots>
planePlots_;
205 std::unordered_map<unsigned int, ChannelPlots>
channelPlots_;
236 LeadingOnlyCounter(0),
237 TrailingOnlyCounter(0),
239 pixelTracksMap(
"Pixel track maps for efficiency",
"Pixel track maps for efficiency", 25, 0, 25, 12, -2, 10) {
247 ibooker.
book1D(
"activity per BX 0 25",
title +
" Activity per BX 0 - 25 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
249 ibooker.
book1D(
"activity per BX 25 50",
title +
" Activity per BX 25 - 50 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
251 ibooker.
book1D(
"activity per BX 50 75",
title +
" Activity per BX 50 - 75 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
254 title +
" hits in planes;plane number;x (mm)",
262 title +
" hits in planes in the last lumisection;plane number;x (mm)",
270 title +
" hits with OOT in planes;plane number + 0.25 OOT;x (mm)",
278 title +
" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)",
286 ibooker.
book1D(
"active planes",
title +
" active planes (per event);number of active planes", 6, -0.5, 5.5);
288 ibooker.
book1D(
"active planes inclusive",
289 title +
" active planes, MH and le only included (per event);number of active planes",
297 title +
" tracks with OOT;plane number;x (mm)",
306 ibooker.
book2D(
"tomography pixel 0 25",
307 title +
" tomography with pixel 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)",
315 ibooker.
book2D(
"tomography pixel 25 50",
316 title +
" tomography with pixel 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)",
324 ibooker.
book2D(
"tomography pixel 50 75",
325 title +
" tomography with pixel 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)",
334 "leading edge (le and te)",
title +
" leading edge (le and te) (recHits); leading edge (ns)", 75, 0, 75);
336 "leading edge (all)",
title +
" leading edge (with or without te) (DIGIs); leading edge (ns)", 75, 0, 75);
338 ibooker.
book1D(
"leading edge (le only)",
title +
" leading edge (le only) (DIGIs); leading edge (ns)", 75, 0, 75);
340 "trailing edge (te only)",
title +
" trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75);
342 ibooker.
book1D(
"time over threshold",
title +
" time over threshold;time over threshold (ns)", 250, -25, 100);
344 ibooker.
book2D(
"leading trailing correlation",
345 title +
" leading trailing correlation;leading edge (ns);trailing edge (ns)",
354 ibooker.
book1D(
"event category",
title +
" leading edges without trailing;;%", 3, 0.5, 3.5);
359 ECCheck = ibooker.
book1D(
"optorxEC(8bit) - vfatEC",
title +
" EC Error;optorxEC-vfatEC", 50, -25, 25);
362 for (
unsigned short error_index = 1; error_index < 16; ++error_index)
377 ibooker.
book2D(
"MH in channels",
title +
" MH (%) in channels;plane number;ch number", 10, -0.5, 4.5, 14, -1, 13);
380 ibooker.
book2D(
"Efficiency in channels",
381 title +
" Efficiency (%) in channels (diamonds only);plane number;ch number",
399 : pixelTracksMapWithDiamonds(
"Pixel track maps for efficiency with coincidence",
400 "Pixel track maps for efficiency with coincidence",
419 ibooker.
book2D(
"tomography pixel",
title +
" tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8);
421 ibooker.
book2D(
"Efficiency wrt pixels",
title +
" Efficiency wrt pixels;x (mm);y (mm)", 25, 0, 25, 12, -2, 10);
427 : HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0) {
440 ibooker.
book1D(
"activity per BX 0 25",
title +
" Activity per BX 0 - 25 ns;Event.BX", 500, -1.5, 498. + 0.5);
442 ibooker.
book1D(
"activity per BX 25 50",
title +
" Activity per BX 25 - 50 ns;Event.BX", 500, -1.5, 498. + 0.5);
444 ibooker.
book1D(
"activity per BX 50 75",
title +
" Activity per BX 50 - 75 ns;Event.BX", 500, -1.5, 498. + 0.5);
447 for (
unsigned short error_index = 1; error_index < 16; ++error_index)
452 ibooker.
book1D(
"leading edge (le and te)",
title +
" leading edge (recHits); leading edge (ns)", 75, 0, 75);
454 ibooker.
book1D(
"leading edge (le only)",
title +
" leading edge (DIGIs); leading edge (ns)", 75, 0, 75);
456 "trailing edge (te only)",
title +
" trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75);
458 ibooker.
book1D(
"time over threshold",
title +
" time over threshold;time over threshold (ns)", 75, -25, 50);
460 ibooker.
book2D(
"leading trailing correlation",
461 title +
" leading trailing correlation;leading edge (ns);trailing edge (ns)",
470 ibooker.
book2D(
"tomography pixel",
"tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8);
492 verbosity_(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
495 for (
const auto&
pset : ps.
getParameter<std::vector<edm::ParameterSet>>(
"offsetsOOT")) {
524 if (iRun.
run() > 300000) {
525 det =
geom.sensor(pixid);
557 auto d = std::make_shared<dds::Cache>();
558 d->hitDistribution2dMap.reserve(
potPlots_.size());
561 d->hitDistribution2dMap[
plot.first] =
562 std::unique_ptr<TH2F>(static_cast<TH2F*>(
plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
603 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this "
605 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n"
606 <<
" pixelTracks.isValid = " <<
pixelTracks.isValid() <<
"\n"
607 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n"
608 <<
" fedInfo.isValid = " << fedInfo.
isValid() <<
"\n"
609 <<
" diamondRecHits.isValid = " << diamondRecHits.
isValid() <<
"\n"
610 <<
" diamondLocalTracks.isValid = " << diamondLocalTracks.
isValid();
625 for (
const auto& digis : *diamondDigis) {
629 for (
const auto& digi : digis) {
631 detId_pot.setChannel(0);
637 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
639 if (digi.leadingEdge() != 0) {
642 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
643 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
646 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
647 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
650 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
651 ++(
potPlots_[detId_pot].CompleteCounter);
659 if (detId.channel() == 6 || detId.channel() == 7)
661 int verticalIndex = 2 * detId.plane() + (detId.channel() - 6);
662 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
663 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
664 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex);
666 if (digi.multipleHit())
672 for (
const auto& vfat_status : *diamondVFATStatus) {
676 detId_pot.setChannel(0);
677 for (
const auto&
status : vfat_status) {
686 for (
const auto& optorx : *fedInfo) {
688 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) - ((
unsigned int)
status.ec() & 0xFF)) & 0xFF);
690 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
693 if (detId.channel() == 6 || detId.channel() == 7)
694 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
697 <<
"FED " <<
CTPPS_FED_ID_56 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
698 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
702 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) -
status.ec()) & 0xFF);
704 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
707 if (detId.channel() == 6 || detId.channel() == 7)
708 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
711 <<
"FED " <<
CTPPS_FED_ID_45 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
712 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
721 std::unordered_map<unsigned int, std::set<unsigned int>> planes;
722 std::unordered_map<unsigned int, std::set<unsigned int>> planes_inclusive;
724 auto lumiCache = luminosityBlockCache(
event.getLuminosityBlock().index());
725 for (
const auto&
rechits : *diamondRecHits) {
728 detId_pot.setChannel(0);
731 for (
const auto& rechit :
rechits) {
732 planes_inclusive[detId_pot].insert(detId.plane());
736 planes[detId_pot].
insert(detId.plane());
741 float UFSDShift = 0.0;
742 if (rechit.yWidth() < 3)
746 TH2F* hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
747 TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
750 for (
int i = 0;
i < numOfBins; ++
i) {
751 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
755 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
756 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
759 for (
int i = 0;
i < numOfBins; ++
i) {
760 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
765 if (rechit.toT() != 0) {
767 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
768 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill(rechit.toT());
770 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
771 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
774 for (
int i = 0;
i < numOfBins; ++
i) {
775 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
776 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
781 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
782 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
785 for (
int i = 0;
i < numOfBins; ++
i) {
786 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
787 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
792 potPlots_[detId_pot].activity_per_bx.count(rechit.ootIndex()) > 0)
793 potPlots_[detId_pot].activity_per_bx.at(rechit.ootIndex())->
Fill(
event.bunchCrossing());
798 plt.second.activePlanes->Fill(planes[plt.first].size());
799 plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size());
803 for (
const auto&
tracks : *diamondLocalTracks) {
806 detId_pot.setChannel(0);
810 if (!
track.isValid())
819 TH2F* trackHistoOOTTmp =
potPlots_[detId_pot].trackDistributionOOT->getTH2F();
820 TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
823 for (
int i = 0;
i < numOfBins; ++
i) {
824 trackHistoOOTTmp->Fill(
track.ootIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
828 TH1F* trackHistoInTimeTmp =
potPlots_[detId_pot].trackDistribution->getTH1F();
831 for (
int i = 0;
i < numOfBins; ++
i) {
832 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
839 for (
const auto&
tracks : *diamondLocalTracks) {
842 detId_pot.setChannel(0);
846 std::set<int> planesInTrackSet;
847 for (
const auto& vec : *diamondRecHits) {
849 if (detid.arm() != detId_pot.arm())
852 for (
const auto&
hit : vec) {
856 planesInTrackSet.insert(detid.plane());
861 if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) {
862 for (
int plane = 0; plane < 4; ++plane) {
863 for (
int channel = 0; channel < 12; ++channel) {
864 int map_index = plane * 100 + channel;
865 if (
potPlots_[detId_pot].effDoublecountingChMap.find(map_index) ==
866 potPlots_[detId_pot].effDoublecountingChMap.end()) {
867 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
868 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
873 ++(
potPlots_[detId_pot].effDoublecountingChMap[map_index]);
874 for (
const auto&
rechits : *diamondRecHits) {
876 if (detId_hit == detId) {
877 for (
const auto& rechit :
rechits) {
878 if (
track.containsHit(rechit, 1)) {
880 ++(
potPlots_[detId_pot].effTriplecountingChMap[map_index]);
893 for (
const auto&
rechits : *diamondRecHits) {
896 detId_pot.setChannel(0);
898 for (
const auto& rechit :
rechits) {
901 if (rechit.toT() == 0)
914 for (
const auto& lt : ds) {
915 if (lt.isValid() && pixId.arm() == detId_pot.arm()) {
917 potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 &&
920 .pixelTomographyAll.at(rechit.ootIndex())
958 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
959 for (
const auto& digis : *diamondDigis) {
962 for (
const auto& digi : digis) {
969 if (digi.leadingEdge() != 0) {
970 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel());
971 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
972 channelsPerPlane[detId_plane]++;
974 channelsPerPlane[detId_plane] = 0;
979 for (
const auto& plt : channelsPerPlane) {
980 planePlots_[plt.first].hit_multiplicity->Fill(plt.second);
984 for (
const auto&
rechits : *diamondRecHits) {
987 for (
const auto& rechit :
rechits) {
990 if (rechit.toT() == 0)
994 TH1F* hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
997 for (
int i = 0;
i < numOfBins; ++
i) {
998 hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin +
i));
1012 for (
const auto& lt : ds) {
1018 std::set<CTPPSDiamondDetId> planesWitHits_set;
1019 for (
const auto&
rechits : *diamondRecHits) {
1022 for (
const auto& rechit :
rechits) {
1030 planePlots_[detId_plane].pixelTomography_far->Fill(
1033 planesWitHits_set.insert(detId_plane);
1038 for (
auto& planeId : planesWitHits_set)
1049 for (
const auto& digis : *diamondDigis) {
1051 for (
const auto& digi : digis) {
1057 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
1058 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
1060 if (digi.multipleHit())
1064 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
1066 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
1070 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
1074 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
1086 for (
const auto&
rechits : *diamondRecHits) {
1088 for (
const auto& rechit :
rechits) {
1093 channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
1094 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.toT());
1096 ++(lumiCache->hitsCounterMap[detId]);
1100 channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0)
1106 for (
const auto&
rechits : *diamondRecHits) {
1108 for (
const auto& rechit :
rechits) {
1124 for (
const auto& lt : ds) {
1137 auto lumiCache = luminosityBlockCache(iLumi.
index());
1140 *(
plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[
plot.first]);
1144 auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[
plot.first];
1145 if (hitsCounterPerLumisection != 0) {
1149 double HundredOverHitCounter = .0;
1150 if (
plot.second.HitCounter != 0)
1151 HundredOverHitCounter = 100. /
plot.second.HitCounter;
1152 plot.second.HPTDCErrorFlags->setBinContent(16, HundredOverHitCounter *
plot.second.MHCounter);
1153 plot.second.leadingWithoutTrailing->setBinContent(1, HundredOverHitCounter *
plot.second.LeadingOnlyCounter);
1154 plot.second.leadingWithoutTrailing->setBinContent(2, HundredOverHitCounter *
plot.second.TrailingOnlyCounter);
1155 plot.second.leadingWithoutTrailing->setBinContent(3, HundredOverHitCounter *
plot.second.CompleteCounter);
1159 double HundredOverHitCounterPot = 0.;
1160 if (
plot.second.HitCounter != 0)
1161 HundredOverHitCounterPot = 100. /
plot.second.HitCounter;
1162 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1163 1, HundredOverHitCounterPot *
plot.second.LeadingOnlyCounter);
1164 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1165 2, HundredOverHitCounterPot *
plot.second.TrailingOnlyCounter);
1166 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1167 3, HundredOverHitCounterPot *
plot.second.CompleteCounter);
1169 plot.second.MHComprensive->Reset();
1174 plot.second.MHComprensive->Fill(
1175 chId.
plane(), chId.
channel(), chPlot.second.HPTDCErrorFlags->getBinContent(16));
1181 plot.second.EfficiencyOfChannelsInPot->Reset();
1182 for (
auto& element :
plot.second.effTriplecountingChMap) {
1183 if (
plot.second.effDoublecountingChMap[element.first] > 0) {
1184 int plane = element.first / 100;
1185 int channel = element.first % 100;
1186 double counted = element.second;
1187 double total =
plot.second.effDoublecountingChMap[element.first];
1191 plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100 *
efficiency);
1198 TH2F* hitHistoTmp =
plot.second.EfficiencyWRTPixelsInPlane->getTH2F();
1203 hitHistoTmp->Divide(&(
plot.second.pixelTracksMapWithDiamonds), &(
potPlots_[detId_pot].pixelTracksMap));