483 valid &= diamondVFATStatus.
isValid();
484 valid &= diamondDigis.
isValid();
490 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this event.\n" 491 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 492 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 493 <<
" fedInfo.isValid = " << fedInfo.
isValid();
508 for (
const auto& digis : *diamondDigis ) {
512 for (
const auto& digi : digis ) {
514 detId_pot.setChannel( 0 );
518 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
520 if ( digi.getLeadingEdge() != 0 ) {
523 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
524 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
527 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
528 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
531 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
532 ++(
potPlots_[detId_pot].CompleteCounter);
539 if ( detId.channel() == 6 || detId.channel() == 7 )
541 int verticalIndex = 2*detId.plane() + (detId.channel() - 6);
542 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
543 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( hptdcErrorIndex, verticalIndex );
545 if ( digi.getMultipleHit() ) ++(
potPlots_[detId_pot].MHCounter);
550 for (
const auto& vfat_status : *diamondVFATStatus ) {
554 detId_pot.setChannel( 0 );
555 for (
const auto&
status : vfat_status ) {
556 if ( !
status.isOK() )
continue;
561 for (
const auto& optorx : *fedInfo ) {
563 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
564 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
565 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
568 if ( detId.channel() == 6 || detId.channel() == 7 )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( 16, 2*detId.plane() + (detId.channel() - 6) );
571 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
572 <<
"\twith ID: " <<
std::dec << detId
577 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
578 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
579 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
582 if ( detId.channel() == 6 || detId.channel() == 7 )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( 16, 2*detId.plane() + (detId.channel() - 6) );
585 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
586 <<
"\twith ID: " <<
std::dec << detId
595 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
596 std::unordered_map<unsigned int, std::set<unsigned int> > planes_inclusive;
599 for (
const auto&
rechits : *diamondRecHits ) {
602 detId_pot.setChannel( 0 );
605 for (
const auto& rechit :
rechits ) {
606 planes_inclusive[detId_pot].insert( detId.plane() );
609 planes[detId_pot].
insert( detId.plane() );
613 float UFSDShift = 0.0;
614 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
617 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
618 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
621 for (
int i=0;
i<numOfBins; ++
i) {
622 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
625 hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F();
626 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
629 for (
int i=0;
i<numOfBins; ++
i) {
630 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
635 if ( rechit.getToT() != 0 ) {
637 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
638 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
640 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
641 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
644 for (
int i=0;
i<numOfBins; ++
i) {
645 hitHistoOOTTmp->Fill( detId.plane() + 0.25 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
651 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
652 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
655 for (
int i=0;
i<numOfBins; ++
i) {
656 hitHistoOOTTmp->Fill( detId.plane() + 0.25 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
666 plt.second.activePlanes->Fill( planes[plt.first].size() );
667 plt.second.activePlanesInclusive->Fill( planes_inclusive[plt.first].size() );
671 for (
const auto&
tracks : *diamondLocalTracks ) {
674 detId_pot.setChannel( 0 );
678 if ( !
track.isValid() )
continue;
681 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
683 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
684 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
687 for (
int i=0;
i<numOfBins; ++
i) {
688 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
692 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
695 for (
int i=0;
i<numOfBins; ++
i) {
696 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
703 for (
const auto& tracks : *diamondLocalTracks ) {
706 detId_pot.setChannel( 0 );
707 for (
const auto&
track : tracks ) {
710 std::set<int> planesInTrackSet;
711 for (
const auto& vec : *diamondRecHits ) {
713 if ( detid.arm() != detId_pot.arm() )
continue;
715 for (
const auto&
hit : vec ) {
719 planesInTrackSet.insert(detid.plane());
724 if ( numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2 ) {
725 for (
int plane=0; plane<4; ++plane ) {
726 for (
int channel=0; channel<12; ++channel ) {
727 int map_index = plane*100 + channel;
728 if ( potPlots_[detId_pot].effDoublecountingChMap.find( map_index ) == potPlots_[detId_pot].effDoublecountingChMap.end() ) {
729 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
730 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
735 ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]);
736 for (
const auto& rechits : *diamondRecHits ) {
738 if ( detId_hit == detId ) {
739 for (
const auto& rechit : rechits ) {
740 if ( track.containsHit( rechit, 1 ) ) {
742 ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]);
755 for (
const auto& rechits : *diamondRecHits ) {
758 detId_pot.setChannel( 0 );
760 for (
const auto& rechit : rechits ) {
762 if ( rechit.getToT() == 0 )
continue;
763 if ( !pixelTracks.
isValid() )
continue;
764 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
766 for (
const auto& ds : *pixelTracks ) {
767 if ( ds.size() > 1 )
continue;
770 for (
const auto& lt : ds ) {
771 if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) {
810 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
811 for (
const auto& digis : *diamondDigis ) {
814 for (
const auto& digi : digis ) {
819 if ( digi.getLeadingEdge() != 0 ) {
820 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
821 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
822 else channelsPerPlane[detId_plane] = 0;
827 for (
const auto& plt : channelsPerPlane ) {
828 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
832 for (
const auto& rechits : *diamondRecHits ) {
835 for (
const auto& rechit : rechits ) {
837 if ( rechit.getToT() == 0 )
continue;
840 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
843 for (
int i=0;
i<numOfBins; ++
i) {
844 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
853 for (
const auto& ds : *pixelTracks ) {
856 if ( ds.size() > 1 )
continue;
857 for (
const auto& lt : ds ) {
858 if ( lt.isValid() ) {
863 std::set< CTPPSDiamondDetId > planesWitHits_set;
864 for (
const auto& rechits : *diamondRecHits ) {
867 for (
const auto& rechit : rechits ) {
873 if (
centralOOT_ != -999 && rechit.getOOTIndex() ==
centralOOT_ ) planesWitHits_set.insert( detId_plane );
879 for (
auto& planeId : planesWitHits_set)
893 for (
const auto& digis : *diamondDigis ) {
895 for (
const auto& digi : digis ) {
900 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
902 if ( digi.getMultipleHit() ) ++(
channelPlots_[detId].MHCounter);
905 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
907 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
911 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
915 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
925 for (
const auto& rechits : *diamondRecHits ) {
927 for (
const auto& rechit : rechits ) {
931 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
932 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
944 for (
const auto& rechits : *diamondRecHits ) {
946 for (
const auto& rechit : rechits ) {
949 if ( !pixelTracks.isValid() )
continue;
952 for (
const auto& ds : *pixelTracks ) {
955 if ( ds.size() > 1 )
continue;
956 for (
const auto& lt : ds ) {
static const int CTPPS_FED_ID_56
static const int CHANNEL_OF_VFAT_CLOCK
void setPlane(uint32_t channel)
void setChannel(uint32_t channel)
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondDigi > > tokenDigi_
bool getErrorId(unsigned short id) const
int bunchCrossing() const
double horizontalShiftOfDiamond_
Event setup record containing the real (actual) geometry information.
static const int CTPPS_PIXEL_STATION_ID
static const int CTPPS_DIAMOND_STATION_ID
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > tokenPixelTrack_
double horizontalShiftBwDiamondPixels_
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > tokenDiamondTrack_
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
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > tokenDiamondHit_
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
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const int CTPPS_FED_ID_45
T const * product() const
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus_