585 valid &= diamondVFATStatus.
isValid();
586 valid &= pixelTracks.
isValid();
587 valid &= diamondDigis.
isValid();
589 valid &= diamondRecHits.
isValid();
590 valid &= diamondLocalTracks.
isValid();
595 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this " 597 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 598 <<
" pixelTracks.isValid = " << pixelTracks.
isValid() <<
"\n" 599 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 600 <<
" fedInfo.isValid = " << fedInfo.
isValid() <<
"\n" 601 <<
" diamondRecHits.isValid = " << diamondRecHits.
isValid() <<
"\n" 602 <<
" diamondLocalTracks.isValid = " << diamondLocalTracks.
isValid();
617 for (
const auto& digis : *diamondDigis) {
621 for (
const auto& digi : digis) {
623 detId_pot.setChannel(0);
629 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
631 if (digi.leadingEdge() != 0) {
634 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
635 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
638 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
639 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
642 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
643 ++(
potPlots_[detId_pot].CompleteCounter);
651 if (detId.channel() == 6 || detId.channel() == 7)
653 int verticalIndex = 2 * detId.plane() + (detId.channel() - 6);
654 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
655 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
656 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex);
658 if (digi.multipleHit())
664 for (
const auto& vfat_status : *diamondVFATStatus) {
668 detId_pot.setChannel(0);
669 for (
const auto&
status : vfat_status) {
678 for (
const auto& optorx : *fedInfo) {
680 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) - ((
unsigned int)
status.ec() & 0xFF)) & 0xFF);
682 (
static_cast<uint8_t
>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
685 if (detId.channel() == 6 || detId.channel() == 7)
686 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
689 <<
"FED " <<
CTPPS_FED_ID_56 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x" 690 <<
static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
694 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.lv1() & 0xFF) -
status.ec()) & 0xFF);
696 (
static_cast<uint8_t
>((optorx.lv1() & 0xFF) -
status.ec()) < 128))
699 if (detId.channel() == 6 || detId.channel() == 7)
700 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
703 <<
"FED " <<
CTPPS_FED_ID_45 <<
": ECError at EV: 0x" << std::hex << optorx.lv1() <<
"\t\tVFAT EC: 0x" 704 <<
static_cast<unsigned int>(
status.ec()) <<
"\twith ID: " <<
std::dec << detId
713 std::unordered_map<unsigned int, std::set<unsigned int>> planes;
714 std::unordered_map<unsigned int, std::set<unsigned int>> planes_inclusive;
717 for (
const auto&
rechits : *diamondRecHits) {
720 detId_pot.setChannel(0);
723 for (
const auto& rechit :
rechits) {
724 planes_inclusive[detId_pot].insert(detId.plane());
728 planes[detId_pot].
insert(detId.plane());
733 float UFSDShift = 0.0;
734 if (rechit.yWidth() < 3)
738 TH2F* hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
739 TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
742 for (
int i = 0;
i < numOfBins; ++
i) {
743 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
746 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
747 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
750 for (
int i = 0;
i < numOfBins; ++
i) {
751 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
755 if (rechit.toT() != 0) {
757 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
758 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill(rechit.toT());
760 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
761 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
764 for (
int i = 0;
i < numOfBins; ++
i) {
765 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
766 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
771 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
772 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
775 for (
int i = 0;
i < numOfBins; ++
i) {
776 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(),
777 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
782 potPlots_[detId_pot].activity_per_bx.count(rechit.ootIndex()) > 0)
788 plt.second.activePlanes->Fill(planes[plt.first].size());
789 plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size());
793 for (
const auto&
tracks : *diamondLocalTracks) {
796 detId_pot.setChannel(0);
800 if (!
track.isValid())
806 if (potPlots_.find(detId_pot) == potPlots_.end())
809 TH2F* trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
810 TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
813 for (
int i = 0;
i < numOfBins; ++
i) {
814 trackHistoOOTTmp->Fill(
track.ootIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
818 TH1F* trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
821 for (
int i = 0;
i < numOfBins; ++
i) {
822 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
829 for (
const auto& tracks : *diamondLocalTracks) {
832 detId_pot.setChannel(0);
833 for (
const auto&
track : tracks) {
836 std::set<int> planesInTrackSet;
837 for (
const auto& vec : *diamondRecHits) {
839 if (detid.arm() != detId_pot.arm())
842 for (
const auto&
hit : vec) {
846 planesInTrackSet.insert(detid.plane());
851 if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) {
852 for (
int plane = 0; plane < 4; ++plane) {
853 for (
int channel = 0; channel < 12; ++channel) {
854 int map_index = plane * 100 + channel;
855 if (potPlots_[detId_pot].effDoublecountingChMap.find(map_index) ==
856 potPlots_[detId_pot].effDoublecountingChMap.end()) {
857 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
858 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
863 ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]);
864 for (
const auto& rechits : *diamondRecHits) {
866 if (detId_hit == detId) {
867 for (
const auto& rechit : rechits) {
868 if (track.containsHit(rechit, 1)) {
870 ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]);
883 for (
const auto& rechits : *diamondRecHits) {
886 detId_pot.setChannel(0);
888 for (
const auto& rechit : rechits) {
891 if (rechit.toT() == 0)
895 if (potPlots_.find(detId_pot) == potPlots_.end())
898 for (
const auto& ds : *pixelTracks) {
904 for (
const auto& lt : ds) {
905 if (lt.isValid() && pixId.arm() == detId_pot.arm()) {
907 potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 &&
910 .pixelTomographyAll.at(rechit.ootIndex())
948 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
949 for (
const auto& digis : *diamondDigis) {
952 for (
const auto& digi : digis) {
959 if (digi.leadingEdge() != 0) {
960 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel());
961 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
962 channelsPerPlane[detId_plane]++;
964 channelsPerPlane[detId_plane] = 0;
969 for (
const auto& plt : channelsPerPlane) {
970 planePlots_[plt.first].hit_multiplicity->Fill(plt.second);
974 for (
const auto& rechits : *diamondRecHits) {
977 for (
const auto& rechit : rechits) {
980 if (rechit.toT() == 0)
984 TH1F* hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
987 for (
int i = 0;
i < numOfBins; ++
i) {
988 hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin +
i));
996 for (
const auto& ds : *pixelTracks) {
1002 for (
const auto& lt : ds) {
1008 std::set<CTPPSDiamondDetId> planesWitHits_set;
1009 for (
const auto& rechits : *diamondRecHits) {
1012 for (
const auto& rechit : rechits) {
1020 planePlots_[detId_plane].pixelTomography_far->Fill(
1023 planesWitHits_set.insert(detId_plane);
1028 for (
auto& planeId : planesWitHits_set)
1039 for (
const auto& digis : *diamondDigis) {
1041 for (
const auto& digi : digis) {
1047 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
1048 if (hptdcErrors.
errorId(hptdcErrorIndex - 1))
1050 if (digi.multipleHit())
1054 if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) {
1056 if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) {
1060 if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) {
1064 if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) {
1076 for (
const auto& rechits : *diamondRecHits) {
1078 for (
const auto& rechit : rechits) {
1083 channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex());
1084 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.toT());
1086 ++(lumiCache->hitsCounterMap[detId]);
1090 channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0)
1096 for (
const auto& rechits : *diamondRecHits) {
1098 for (
const auto& rechit : rechits) {
1103 if (!pixelTracks.isValid())
1108 for (
const auto& ds : *pixelTracks) {
1114 for (
const auto& lt : ds) {
static const int CTPPS_FED_ID_56
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > tokenDiamondHit_
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const int CHANNEL_OF_VFAT_CLOCK
LuminosityBlockIndex index() const
void setPlane(uint32_t channel)
void setChannel(uint32_t channel)
int bunchCrossing() const
double horizontalShiftOfDiamond_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > tokenDiamondTrack_
Event setup record containing the real (actual) geometry information.
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > tokenPixelTrack_
static const int CTPPS_PIXEL_STATION_ID
static const int CTPPS_DIAMOND_STATION_ID
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondDigi > > tokenDigi_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus_
Abs< T >::type abs(const T &t)
double horizontalShiftBwDiamondPixels_
LuminosityBlock const & getLuminosityBlock() const
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
static const double HPTDC_BIN_WIDTH_NS
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
bool channelAlignedWithTrack(const CTPPSGeometry *geom, const CTPPSDiamondDetId &detid, const CTPPSDiamondLocalTrack &localTrack, const float tolerance=1)
std::unordered_map< unsigned int, PotPlots > potPlots_
static constexpr int TIMESLICE_WITHOUT_LEADING
bool errorId(unsigned short id) const
static const int CTPPS_FAR_RP_ID
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< unsigned int, PlanePlots > planePlots_
bool excludeMultipleHits_
static const int CTPPS_DIAMOND_RP_ID
static const int CTPPS_FED_ID_45
T const * product() const