51 x_width = 2.0 * det->
params().at(0);
235 LeadingOnlyCounter(0),
236 TrailingOnlyCounter(0),
238 pixelTracksMap(
"Pixel track maps for efficiency",
"Pixel track maps for efficiency", 25, 0, 25, 12, -2, 10) {
241 ibooker.setCurrentFolder(
path);
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",
408 ibooker.setCurrentFolder(
path);
415 hit_multiplicity = ibooker.book1D(
"channels per plane",
title +
" channels per plane; ch per plane", 13, -0.5, 12.5);
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) {
429 ibooker.setCurrentFolder(
path);
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);
471 hit_rate = ibooker.book1D(
"hit rate",
title +
"hit rate;rate (Hz)", 40, 0, 20);
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);
532 ibooker.setCurrentFolder(
"CTPPS");
554 auto d = std::make_shared<dds::Cache>();
555 d->hitDistribution2dMap.reserve(
potPlots_.size());
557 d->hitDistribution2dMap[
plot.first] =
558 std::unique_ptr<TH2F>(static_cast<TH2F*>(
plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
598 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this "
600 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n"
601 <<
" pixelTracks.isValid = " <<
pixelTracks.isValid() <<
"\n"
602 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n"
603 <<
" fedInfo.isValid = " << fedInfo.
isValid() <<
"\n"
604 <<
" diamondRecHits.isValid = " << diamondRecHits.
isValid() <<
"\n"
605 <<
" diamondLocalTracks.isValid = " << diamondLocalTracks.
isValid();
620 for (
const auto& digis : *diamondDigis) {
624 for (
const auto& digi : digis) {
626 detId_pot.setChannel(0);
632 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
634 if (digi.leadingEdge() != 0) {
637 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
638 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
641 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
642 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
645 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
646 ++(
potPlots_[detId_pot].CompleteCounter);
654 if (detId.channel() == 6 || detId.channel() == 7)
656 int verticalIndex = 2 * detId.plane() + (detId.channel() - 6);
657 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
658 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
659 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex);
661 if (digi.multipleHit())
667 for (
const auto& vfat_status : *diamondVFATStatus) {
671 detId_pot.setChannel(0);
672 for (
const auto&
status : vfat_status) {
681 for (
const auto& optorx : *fedInfo) {
683 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) - ((
unsigned int)
status.ec() & 0xFF)) & 0xFF);
685 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
688 if (detId.channel() == 6 || detId.channel() == 7)
689 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
692 <<
"FED " <<
CTPPS_FED_ID_56 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
693 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
697 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) -
status.ec()) & 0xFF);
699 (static_cast<uint8_t>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
702 if (detId.channel() == 6 || detId.channel() == 7)
703 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
706 <<
"FED " <<
CTPPS_FED_ID_45 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x"
707 << static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
716 std::unordered_map<unsigned int, std::set<unsigned int>> planes;
717 std::unordered_map<unsigned int, std::set<unsigned int>> planes_inclusive;
719 auto lumiCache = luminosityBlockCache(
event.getLuminosityBlock().index());
720 for (
const auto&
rechits : *diamondRecHits) {
723 detId_pot.setChannel(0);
726 for (
const auto& rechit :
rechits) {
727 planes_inclusive[detId_pot].insert(detId.plane());
731 planes[detId_pot].
insert(detId.plane());
736 float UFSDShift = 0.0;
737 if (rechit.yWidth() < 3)
741 TH2F* hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
742 TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
745 for (
int i = 0;
i < numOfBins; ++
i) {
746 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
749 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
750 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
753 for (
int i = 0;
i < numOfBins; ++
i) {
754 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
758 if (rechit.toT() != 0) {
760 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
761 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill(rechit.toT());
763 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
764 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
767 for (
int i = 0;
i < numOfBins; ++
i) {
768 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
769 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
774 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
775 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
778 for (
int i = 0;
i < numOfBins; ++
i) {
779 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
780 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
785 potPlots_[detId_pot].activity_per_bx.count(rechit.ootIndex()) > 0)
786 potPlots_[detId_pot].activity_per_bx.at(rechit.ootIndex())->
Fill(
event.bunchCrossing());
791 plt.second.activePlanes->Fill(planes[plt.first].size());
792 plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size());
796 for (
const auto&
tracks : *diamondLocalTracks) {
799 detId_pot.setChannel(0);
803 if (!
track.isValid())
812 TH2F* trackHistoOOTTmp =
potPlots_[detId_pot].trackDistributionOOT->getTH2F();
813 TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
816 for (
int i = 0;
i < numOfBins; ++
i) {
817 trackHistoOOTTmp->Fill(
track.ootIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
821 TH1F* trackHistoInTimeTmp =
potPlots_[detId_pot].trackDistribution->getTH1F();
824 for (
int i = 0;
i < numOfBins; ++
i) {
825 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
832 for (
const auto&
tracks : *diamondLocalTracks) {
835 detId_pot.setChannel(0);
839 std::set<int> planesInTrackSet;
840 for (
const auto& vec : *diamondRecHits) {
842 if (detid.arm() != detId_pot.arm())
845 for (
const auto&
hit : vec) {
849 planesInTrackSet.insert(detid.plane());
854 if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) {
855 for (
int plane = 0; plane < 4; ++plane) {
856 for (
int channel = 0; channel < 12; ++channel) {
857 int map_index = plane * 100 + channel;
858 if (
potPlots_[detId_pot].effDoublecountingChMap.find(map_index) ==
859 potPlots_[detId_pot].effDoublecountingChMap.end()) {
860 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
861 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
866 ++(
potPlots_[detId_pot].effDoublecountingChMap[map_index]);
867 for (
const auto&
rechits : *diamondRecHits) {
869 if (detId_hit == detId) {
870 for (
const auto& rechit :
rechits) {
871 if (
track.containsHit(rechit, 1)) {
873 ++(
potPlots_[detId_pot].effTriplecountingChMap[map_index]);
886 for (
const auto&
rechits : *diamondRecHits) {
889 detId_pot.setChannel(0);
891 for (
const auto& rechit :
rechits) {
894 if (rechit.toT() == 0)
907 for (
const auto& lt : ds) {
908 if (lt.isValid() && pixId.arm() == detId_pot.arm()) {
910 potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 &&
913 .pixelTomographyAll.at(rechit.ootIndex())
951 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
952 for (
const auto& digis : *diamondDigis) {
955 for (
const auto& digi : digis) {
962 if (digi.leadingEdge() != 0) {
963 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel());
964 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
965 channelsPerPlane[detId_plane]++;
967 channelsPerPlane[detId_plane] = 0;
972 for (
const auto& plt : channelsPerPlane) {
973 planePlots_[plt.first].hit_multiplicity->Fill(plt.second);
977 for (
const auto&
rechits : *diamondRecHits) {
980 for (
const auto& rechit :
rechits) {
983 if (rechit.toT() == 0)
987 TH1F* hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
990 for (
int i = 0;
i < numOfBins; ++
i) {
991 hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin +
i));
1005 for (
const auto& lt : ds) {
1011 std::set<CTPPSDiamondDetId> planesWitHits_set;
1012 for (
const auto&
rechits : *diamondRecHits) {
1015 for (
const auto& rechit :
rechits) {
1023 planePlots_[detId_plane].pixelTomography_far->Fill(
1026 planesWitHits_set.insert(detId_plane);
1031 for (
auto& planeId : planesWitHits_set)
1042 for (
const auto& digis : *diamondDigis) {
1044 for (
const auto& digi : digis) {
1050 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
1051 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
1053 if (digi.multipleHit())
1057 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
1059 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
1063 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
1067 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
1079 for (
const auto&
rechits : *diamondRecHits) {
1081 for (
const auto& rechit :
rechits) {
1086 channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
1087 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.toT());
1089 ++(lumiCache->hitsCounterMap[detId]);
1093 channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0)
1099 for (
const auto&
rechits : *diamondRecHits) {
1101 for (
const auto& rechit :
rechits) {
1117 for (
const auto& lt : ds) {
1130 auto lumiCache = luminosityBlockCache(iLumi.
index());
1132 *(
plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[
plot.first]);
1135 auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[
plot.first];
1136 if (hitsCounterPerLumisection != 0) {
1140 double HundredOverHitCounter = .0;
1141 if (
plot.second.HitCounter != 0)
1142 HundredOverHitCounter = 100. /
plot.second.HitCounter;
1143 plot.second.HPTDCErrorFlags->setBinContent(16, HundredOverHitCounter *
plot.second.MHCounter);
1144 plot.second.leadingWithoutTrailing->setBinContent(1, HundredOverHitCounter *
plot.second.LeadingOnlyCounter);
1145 plot.second.leadingWithoutTrailing->setBinContent(2, HundredOverHitCounter *
plot.second.TrailingOnlyCounter);
1146 plot.second.leadingWithoutTrailing->setBinContent(3, HundredOverHitCounter *
plot.second.CompleteCounter);
1150 double HundredOverHitCounterPot = 0.;
1151 if (
plot.second.HitCounter != 0)
1152 HundredOverHitCounterPot = 100. /
plot.second.HitCounter;
1153 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1154 1, HundredOverHitCounterPot *
plot.second.LeadingOnlyCounter);
1155 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1156 2, HundredOverHitCounterPot *
plot.second.TrailingOnlyCounter);
1157 plot.second.leadingWithoutTrailingCumulativePot->setBinContent(
1158 3, HundredOverHitCounterPot *
plot.second.CompleteCounter);
1160 plot.second.MHComprensive->Reset();
1165 plot.second.MHComprensive->Fill(chId.
plane(), chId.
channel(), chPlot.second.HPTDCErrorFlags->getBinContent(16));
1172 plot.second.EfficiencyOfChannelsInPot->Reset();
1173 for (
auto& element :
plot.second.effTriplecountingChMap) {
1174 if (
plot.second.effDoublecountingChMap[element.first] > 0) {
1175 int plane = element.first / 100;
1176 int channel = element.first % 100;
1177 double counted = element.second;
1178 double total =
plot.second.effDoublecountingChMap[element.first];
1182 plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100 *
efficiency);
1189 TH2F* hitHistoTmp =
plot.second.EfficiencyWRTPixelsInPlane->getTH2F();
1194 hitHistoTmp->Divide(&(
plot.second.pixelTracksMapWithDiamonds), &(
potPlots_[detId_pot].pixelTracksMap));