183 std::unordered_map<unsigned int, PlanePlots>
planePlots_;
204 std::unordered_map<unsigned int, ChannelPlots>
channelPlots_;
235 LeadingOnlyCounter(0),
236 TrailingOnlyCounter(0),
238 pixelTracksMap(
"Pixel track maps for efficiency",
"Pixel track maps for efficiency", 25, 0, 25, 12, -2, 10) {
246 ibooker.
book1D(
"activity per BX 0 25",
title +
" Activity per BX 0 - 25 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
248 ibooker.
book1D(
"activity per BX 25 50",
title +
" Activity per BX 25 - 50 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
250 ibooker.
book1D(
"activity per BX 50 75",
title +
" Activity per BX 50 - 75 ns;Event.BX", 3600, -1.5, 3598. + 0.5);
253 title +
" hits in planes;plane number;x (mm)",
261 title +
" hits in planes in the last lumisection;plane number;x (mm)",
269 title +
" hits with OOT in planes;plane number + 0.25 OOT;x (mm)",
277 title +
" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)",
285 ibooker.
book1D(
"active planes",
title +
" active planes (per event);number of active planes", 6, -0.5, 5.5);
287 ibooker.
book1D(
"active planes inclusive",
288 title +
" active planes, MH and le only included (per event);number of active planes",
296 title +
" tracks with OOT;plane number;x (mm)",
305 ibooker.
book2D(
"tomography pixel 0 25",
306 title +
" tomography with pixel 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)",
314 ibooker.
book2D(
"tomography pixel 25 50",
315 title +
" tomography with pixel 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)",
323 ibooker.
book2D(
"tomography pixel 50 75",
324 title +
" tomography with pixel 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)",
333 "leading edge (le and te)",
title +
" leading edge (le and te) (recHits); leading edge (ns)", 75, 0, 75);
335 "leading edge (all)",
title +
" leading edge (with or without te) (DIGIs); leading edge (ns)", 75, 0, 75);
337 ibooker.
book1D(
"leading edge (le only)",
title +
" leading edge (le only) (DIGIs); leading edge (ns)", 75, 0, 75);
339 "trailing edge (te only)",
title +
" trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75);
341 ibooker.
book1D(
"time over threshold",
title +
" time over threshold;time over threshold (ns)", 250, -25, 100);
343 ibooker.
book2D(
"leading trailing correlation",
344 title +
" leading trailing correlation;leading edge (ns);trailing edge (ns)",
353 ibooker.
book1D(
"event category",
title +
" leading edges without trailing;;%", 3, 0.5, 3.5);
358 ECCheck = ibooker.
book1D(
"optorxEC(8bit) - vfatEC",
title +
" EC Error;optorxEC-vfatEC", 50, -25, 25);
361 for (
unsigned short error_index = 1; error_index < 16; ++error_index)
376 ibooker.
book2D(
"MH in channels",
title +
" MH (%) in channels;plane number;ch number", 10, -0.5, 4.5, 14, -1, 13);
379 ibooker.
book2D(
"Efficiency in channels",
380 title +
" Efficiency (%) in channels (diamonds only);plane number;ch number",
398 : pixelTracksMapWithDiamonds(
"Pixel track maps for efficiency with coincidence",
399 "Pixel track maps for efficiency with coincidence",
418 ibooker.
book2D(
"tomography pixel",
title +
" tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8);
420 ibooker.
book2D(
"Efficiency wrt pixels",
title +
" Efficiency wrt pixels;x (mm);y (mm)", 25, 0, 25, 12, -2, 10);
426 : HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0) {
439 ibooker.
book1D(
"activity per BX 0 25",
title +
" Activity per BX 0 - 25 ns;Event.BX", 500, -1.5, 498. + 0.5);
441 ibooker.
book1D(
"activity per BX 25 50",
title +
" Activity per BX 25 - 50 ns;Event.BX", 500, -1.5, 498. + 0.5);
443 ibooker.
book1D(
"activity per BX 50 75",
title +
" Activity per BX 50 - 75 ns;Event.BX", 500, -1.5, 498. + 0.5);
446 for (
unsigned short error_index = 1; error_index < 16; ++error_index)
451 ibooker.
book1D(
"leading edge (le and te)",
title +
" leading edge (recHits); leading edge (ns)", 75, 0, 75);
453 ibooker.
book1D(
"leading edge (le only)",
title +
" leading edge (DIGIs); leading edge (ns)", 75, 0, 75);
455 "trailing edge (te only)",
title +
" trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75);
457 ibooker.
book1D(
"time over threshold",
title +
" time over threshold;time over threshold (ns)", 75, -25, 50);
459 ibooker.
book2D(
"leading trailing correlation",
460 title +
" leading trailing correlation;leading edge (ns);trailing edge (ns)",
469 ibooker.
book2D(
"tomography pixel",
"tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8);
490 verbosity_(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
493 for (
const auto&
pset : ps.
getParameter<std::vector<edm::ParameterSet>>(
"offsetsOOT")) {
522 if (iRun.
run() > 300000) {
523 det =
geom.sensor(pixid);
555 auto d = std::make_shared<dds::Cache>();
556 d->hitDistribution2dMap.reserve(
potPlots_.size());
558 d->hitDistribution2dMap[
plot.first] =
559 std::unique_ptr<TH2F>(static_cast<TH2F*>(
plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
599 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this "
601 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n"
602 <<
" pixelTracks.isValid = " <<
pixelTracks.isValid() <<
"\n"
603 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n"
604 <<
" fedInfo.isValid = " << fedInfo.
isValid() <<
"\n"
605 <<
" diamondRecHits.isValid = " << diamondRecHits.
isValid() <<
"\n"
606 <<
" diamondLocalTracks.isValid = " << diamondLocalTracks.
isValid();
621 for (
const auto& digis : *diamondDigis) {
625 for (
const auto& digi : digis) {
627 detId_pot.setChannel(0);
633 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
635 if (digi.leadingEdge() != 0) {
638 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
639 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
642 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
643 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
646 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
647 ++(
potPlots_[detId_pot].CompleteCounter);
655 if (detId.channel() == 6 || detId.channel() == 7)
657 int verticalIndex = 2 * detId.plane() + (detId.channel() - 6);
658 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
659 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
660 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex);
662 if (digi.multipleHit())
668 for (
const auto& vfat_status : *diamondVFATStatus) {
672 detId_pot.setChannel(0);
673 for (
const auto&
status : vfat_status) {
682 for (
const auto& optorx : *fedInfo) {
684 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) - ((
unsigned int)
status.ec() & 0xFF)) & 0xFF);
686 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
689 if (detId.channel() == 6 || detId.channel() == 7)
690 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
693 <<
"FED " <<
CTPPS_FED_ID_56 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
694 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
698 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) -
status.ec()) & 0xFF);
700 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
703 if (detId.channel() == 6 || detId.channel() == 7)
704 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
707 <<
"FED " <<
CTPPS_FED_ID_45 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
708 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
717 std::unordered_map<unsigned int, std::set<unsigned int>> planes;
718 std::unordered_map<unsigned int, std::set<unsigned int>> planes_inclusive;
720 auto lumiCache = luminosityBlockCache(
event.getLuminosityBlock().index());
721 for (
const auto&
rechits : *diamondRecHits) {
724 detId_pot.setChannel(0);
727 for (
const auto& rechit :
rechits) {
728 planes_inclusive[detId_pot].insert(detId.plane());
732 planes[detId_pot].
insert(detId.plane());
737 float UFSDShift = 0.0;
738 if (rechit.yWidth() < 3)
742 TH2F* hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
743 TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
746 for (
int i = 0;
i < numOfBins; ++
i) {
747 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
750 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
751 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
754 for (
int i = 0;
i < numOfBins; ++
i) {
755 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
759 if (rechit.toT() != 0) {
761 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
762 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill(rechit.toT());
764 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
765 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
768 for (
int i = 0;
i < numOfBins; ++
i) {
769 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
770 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
775 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
776 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
779 for (
int i = 0;
i < numOfBins; ++
i) {
780 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
781 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
786 potPlots_[detId_pot].activity_per_bx.count(rechit.ootIndex()) > 0)
787 potPlots_[detId_pot].activity_per_bx.at(rechit.ootIndex())->
Fill(
event.bunchCrossing());
792 plt.second.activePlanes->Fill(planes[plt.first].size());
793 plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size());
797 for (
const auto&
tracks : *diamondLocalTracks) {
800 detId_pot.setChannel(0);
804 if (!
track.isValid())
813 TH2F* trackHistoOOTTmp =
potPlots_[detId_pot].trackDistributionOOT->getTH2F();
814 TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
817 for (
int i = 0;
i < numOfBins; ++
i) {
818 trackHistoOOTTmp->Fill(
track.ootIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
822 TH1F* trackHistoInTimeTmp =
potPlots_[detId_pot].trackDistribution->getTH1F();
825 for (
int i = 0;
i < numOfBins; ++
i) {
826 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
833 for (
const auto&
tracks : *diamondLocalTracks) {
836 detId_pot.setChannel(0);
840 std::set<int> planesInTrackSet;
841 for (
const auto& vec : *diamondRecHits) {
843 if (detid.arm() != detId_pot.arm())
846 for (
const auto&
hit : vec) {
850 planesInTrackSet.insert(detid.plane());
855 if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) {
856 for (
int plane = 0; plane < 4; ++plane) {
857 for (
int channel = 0; channel < 12; ++channel) {
858 int map_index = plane * 100 + channel;
859 if (
potPlots_[detId_pot].effDoublecountingChMap.find(map_index) ==
860 potPlots_[detId_pot].effDoublecountingChMap.end()) {
861 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
862 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
867 ++(
potPlots_[detId_pot].effDoublecountingChMap[map_index]);
868 for (
const auto&
rechits : *diamondRecHits) {
870 if (detId_hit == detId) {
871 for (
const auto& rechit :
rechits) {
872 if (
track.containsHit(rechit, 1)) {
874 ++(
potPlots_[detId_pot].effTriplecountingChMap[map_index]);
887 for (
const auto&
rechits : *diamondRecHits) {
890 detId_pot.setChannel(0);
892 for (
const auto& rechit :
rechits) {
895 if (rechit.toT() == 0)
908 for (
const auto& lt : ds) {
909 if (lt.isValid() && pixId.arm() == detId_pot.arm()) {
911 potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 &&
914 .pixelTomographyAll.at(rechit.ootIndex())
952 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
953 for (
const auto& digis : *diamondDigis) {
956 for (
const auto& digi : digis) {
963 if (digi.leadingEdge() != 0) {
964 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel());
965 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
966 channelsPerPlane[detId_plane]++;
968 channelsPerPlane[detId_plane] = 0;
973 for (
const auto& plt : channelsPerPlane) {
974 planePlots_[plt.first].hit_multiplicity->Fill(plt.second);
978 for (
const auto&
rechits : *diamondRecHits) {
981 for (
const auto& rechit :
rechits) {
984 if (rechit.toT() == 0)
988 TH1F* hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
991 for (
int i = 0;
i < numOfBins; ++
i) {
992 hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin +
i));
1006 for (
const auto& lt : ds) {
1012 std::set<CTPPSDiamondDetId> planesWitHits_set;
1013 for (
const auto&
rechits : *diamondRecHits) {
1016 for (
const auto& rechit :
rechits) {
1024 planePlots_[detId_plane].pixelTomography_far->Fill(
1027 planesWitHits_set.insert(detId_plane);
1032 for (
auto& planeId : planesWitHits_set)
1043 for (
const auto& digis : *diamondDigis) {
1045 for (
const auto& digi : digis) {
1051 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
1052 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
1054 if (digi.multipleHit())
1058 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
1060 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
1064 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
1068 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
1080 for (
const auto&
rechits : *diamondRecHits) {
1082 for (
const auto& rechit :
rechits) {
1087 channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
1088 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.toT());
1090 ++(lumiCache->hitsCounterMap[detId]);
1094 channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0)
1100 for (
const auto&
rechits : *diamondRecHits) {
1102 for (
const auto& rechit :
rechits) {
1118 for (
const auto& lt : ds) {
1131 auto lumiCache = luminosityBlockCache(iLumi.
index());
1133 *(
plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[
plot.first]);
1136 auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[
plot.first];
1137 if (hitsCounterPerLumisection != 0) {
1141 double HundredOverHitCounter = .0;
1142 if (
plot.second.HitCounter != 0)
1143 HundredOverHitCounter = 100. /
plot.second.HitCounter;
1144 plot.second.HPTDCErrorFlags->setBinContent(16, HundredOverHitCounter *
plot.second.MHCounter);
1145 plot.second.leadingWithoutTrailing->setBinContent(1, HundredOverHitCounter *
plot.second.LeadingOnlyCounter);
1146 plot.second.leadingWithoutTrailing->setBinContent(2, HundredOverHitCounter *
plot.second.TrailingOnlyCounter);
1147 plot.second.leadingWithoutTrailing->setBinContent(3, HundredOverHitCounter *
plot.second.CompleteCounter);
1151 double HundredOverHitCounterPot = 0.;
1152 if (
plot.second.HitCounter != 0)
1153 HundredOverHitCounterPot = 100. /
plot.second.HitCounter;
1154 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1155 1, HundredOverHitCounterPot *
plot.second.LeadingOnlyCounter);
1156 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1157 2, HundredOverHitCounterPot *
plot.second.TrailingOnlyCounter);
1158 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1159 3, HundredOverHitCounterPot *
plot.second.CompleteCounter);
1161 plot.second.MHComprensive->Reset();
1166 plot.second.MHComprensive->Fill(chId.
plane(), chId.
channel(), chPlot.second.HPTDCErrorFlags->getBinContent(16));
1173 plot.second.EfficiencyOfChannelsInPot->Reset();
1174 for (
auto& element :
plot.second.effTriplecountingChMap) {
1175 if (
plot.second.effDoublecountingChMap[element.first] > 0) {
1176 int plane = element.first / 100;
1177 int channel = element.first % 100;
1178 double counted = element.second;
1179 double total =
plot.second.effDoublecountingChMap[element.first];
1183 plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100 *
efficiency);
1190 TH2F* hitHistoTmp =
plot.second.EfficiencyWRTPixelsInPlane->getTH2F();
1195 hitHistoTmp->Divide(&(
plot.second.pixelTracksMapWithDiamonds), &(
potPlots_[detId_pot].pixelTracksMap));