588 valid &= diamondVFATStatus.
isValid();
589 valid &= pixelTracks.
isValid();
590 valid &= diamondDigis.
isValid();
592 valid &= diamondRecHits.
isValid();
593 valid &= diamondLocalTracks.
isValid();
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.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0) {
634 if (digi.getLeadingEdge() != 0) {
637 if (digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0) {
638 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
641 if (digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0) {
642 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
645 if (digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 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.
getErrorId(hptdcErrorIndex - 1))
659 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex);
661 if (digi.getMultipleHit())
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.getLV1() & 0xFF) - ((
unsigned int)
status.getEC() & 0xFF)) &
686 (
static_cast<uint8_t
>((optorx.getLV1() & 0xFF) -
status.getEC()) < 128))
688 static_cast<int>(optorx.getLV1() & 0xFF) - (static_cast<unsigned int>(
status.getEC()) & 0xFF);
690 if (detId.channel() == 6 || detId.channel() == 7)
691 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
694 <<
"FED " <<
CTPPS_FED_ID_56 <<
": ECError at EV: 0x" << std::hex << optorx.getLV1()
695 <<
"\t\tVFAT EC: 0x" <<
static_cast<unsigned int>(
status.getEC()) <<
"\twith ID: " <<
std::dec 699 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1() & 0xFF) -
status.getEC()) & 0xFF);
701 (
static_cast<uint8_t
>((optorx.getLV1() & 0xFF) -
status.getEC()) < 128))
703 static_cast<int>(optorx.getLV1() & 0xFF) - (static_cast<unsigned int>(
status.getEC()) & 0xFF);
705 if (detId.channel() == 6 || detId.channel() == 7)
706 potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6));
709 <<
"FED " <<
CTPPS_FED_ID_45 <<
": ECError at EV: 0x" << std::hex << optorx.getLV1()
710 <<
"\t\tVFAT EC: 0x" <<
static_cast<unsigned int>(
status.getEC()) <<
"\twith ID: " <<
std::dec 719 std::unordered_map<unsigned int, std::set<unsigned int>> planes;
720 std::unordered_map<unsigned int, std::set<unsigned int>> planes_inclusive;
723 for (
const auto&
rechits : *diamondRecHits) {
726 detId_pot.setChannel(0);
729 for (
const auto& rechit :
rechits) {
730 planes_inclusive[detId_pot].insert(detId.plane());
734 planes[detId_pot].
insert(detId.plane());
739 float UFSDShift = 0.0;
740 if (rechit.getYWidth() < 3)
744 TH2F* hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
745 TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
748 for (
int i = 0;
i < numOfBins; ++
i) {
749 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
752 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
753 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
756 for (
int i = 0;
i < numOfBins; ++
i) {
757 hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin +
i));
761 if (rechit.getToT() != 0) {
763 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill(rechit.getT() + 25 * rechit.getOOTIndex());
764 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill(rechit.getToT());
766 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
767 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
771 for (
int i = 0;
i < numOfBins; ++
i) {
772 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.getOOTIndex(),
773 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
778 TH2F* hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
779 TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
783 for (
int i = 0;
i < numOfBins; ++
i) {
784 hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.getOOTIndex(),
785 hitHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
790 potPlots_[detId_pot].activity_per_bx.count(rechit.getOOTIndex()) > 0)
796 plt.second.activePlanes->Fill(planes[plt.first].size());
797 plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size());
801 for (
const auto&
tracks : *diamondLocalTracks) {
804 detId_pot.setChannel(0);
808 if (!
track.isValid())
814 if (potPlots_.find(detId_pot) == potPlots_.end())
817 TH2F* trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
818 TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
821 for (
int i = 0;
i < numOfBins; ++
i) {
822 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin +
i));
826 TH1F* trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
829 for (
int i = 0;
i < numOfBins; ++
i) {
830 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
837 for (
const auto& tracks : *diamondLocalTracks) {
840 detId_pot.setChannel(0);
841 for (
const auto&
track : tracks) {
844 std::set<int> planesInTrackSet;
845 for (
const auto& vec : *diamondRecHits) {
847 if (detid.arm() != detId_pot.arm())
850 for (
const auto&
hit : vec) {
854 planesInTrackSet.insert(detid.plane());
859 if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) {
860 for (
int plane = 0; plane < 4; ++plane) {
861 for (
int channel = 0; channel < 12; ++channel) {
862 int map_index = plane * 100 + channel;
863 if (potPlots_[detId_pot].effDoublecountingChMap.find(map_index) ==
864 potPlots_[detId_pot].effDoublecountingChMap.end()) {
865 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
866 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
871 ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]);
872 for (
const auto& rechits : *diamondRecHits) {
874 if (detId_hit == detId) {
875 for (
const auto& rechit : rechits) {
876 if (track.containsHit(rechit, 1)) {
878 ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]);
891 for (
const auto& rechits : *diamondRecHits) {
894 detId_pot.setChannel(0);
896 for (
const auto& rechit : rechits) {
899 if (rechit.getToT() == 0)
903 if (potPlots_.find(detId_pot) == potPlots_.end())
906 for (
const auto& ds : *pixelTracks) {
912 for (
const auto& lt : ds) {
913 if (lt.isValid() && pixId.arm() == detId_pot.arm()) {
915 potPlots_[detId_pot].pixelTomographyAll.count(rechit.getOOTIndex()) > 0 &&
918 .pixelTomographyAll.at(rechit.getOOTIndex())
956 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
957 for (
const auto& digis : *diamondDigis) {
960 for (
const auto& digi : digis) {
967 if (digi.getLeadingEdge() != 0) {
968 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel());
969 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
970 channelsPerPlane[detId_plane]++;
972 channelsPerPlane[detId_plane] = 0;
977 for (
const auto& plt : channelsPerPlane) {
978 planePlots_[plt.first].hit_multiplicity->Fill(plt.second);
982 for (
const auto& rechits : *diamondRecHits) {
985 for (
const auto& rechit : rechits) {
988 if (rechit.getToT() == 0)
992 TH1F* hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
995 for (
int i = 0;
i < numOfBins; ++
i) {
996 hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin +
i));
1004 for (
const auto& ds : *pixelTracks) {
1010 for (
const auto& lt : ds) {
1016 std::set<CTPPSDiamondDetId> planesWitHits_set;
1017 for (
const auto& rechits : *diamondRecHits) {
1020 for (
const auto& rechit : rechits) {
1028 planePlots_[detId_plane].pixelTomography_far->Fill(
1031 planesWitHits_set.insert(detId_plane);
1036 for (
auto& planeId : planesWitHits_set)
1048 for (
const auto& digis : *diamondDigis) {
1050 for (
const auto& digi : digis) {
1056 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex)
1057 if (hptdcErrors.
getErrorId(hptdcErrorIndex - 1))
1059 if (digi.getMultipleHit())
1063 if (digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0) {
1065 if (digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0) {
1069 if (digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0) {
1073 if (digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0) {
1075 channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill(
1085 for (
const auto& rechits : *diamondRecHits) {
1087 for (
const auto& rechit : rechits) {
1092 channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.getT() + 25 * rechit.getOOTIndex());
1093 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.getToT());
1095 ++(lumiCache->hitsCounterMap[detId]);
1099 channelPlots_[detId].activity_per_bx.count(rechit.getOOTIndex()) > 0)
1105 for (
const auto& rechits : *diamondRecHits) {
1107 for (
const auto& rechit : rechits) {
1112 if (!pixelTracks.isValid())
1117 for (
const auto& ds : *pixelTracks) {
1123 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)
bool getErrorId(unsigned short id) const
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
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