493 valid &= diamondVFATStatus.
isValid();
494 valid &= pixelTracks.
isValid();
495 valid &= diamondDigis.
isValid();
497 valid &= diamondRecHits.
isValid();
498 valid &= diamondLocalTracks.
isValid();
503 <<
"ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this event.\n" 504 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 505 <<
" pixelTracks.isValid = " << pixelTracks.
isValid() <<
"\n" 506 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 507 <<
" fedInfo.isValid = " << fedInfo.
isValid() <<
"\n" 508 <<
" diamondRecHits.isValid = " << diamondRecHits.
isValid() <<
"\n" 509 <<
" diamondLocalTracks.isValid = " << diamondLocalTracks.
isValid();
524 for (
const auto& digis : *diamondDigis ) {
528 for (
const auto& digi : digis ) {
530 detId_pot.setChannel( 0 );
534 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
536 if ( digi.getLeadingEdge() != 0 ) {
539 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
540 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
543 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
544 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
547 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
548 ++(
potPlots_[detId_pot].CompleteCounter);
555 if ( detId.channel() == 6 || detId.channel() == 7 )
557 int verticalIndex = 2*detId.plane() + (detId.channel() - 6);
558 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
559 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( hptdcErrorIndex, verticalIndex );
561 if ( digi.getMultipleHit() ) ++(
potPlots_[detId_pot].MHCounter);
566 for (
const auto& vfat_status : *diamondVFATStatus ) {
570 detId_pot.setChannel( 0 );
571 for (
const auto&
status : vfat_status ) {
572 if ( !
status.isOK() )
continue;
577 for (
const auto& optorx : *fedInfo ) {
579 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
580 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
581 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
584 if ( detId.channel() == 6 || detId.channel() == 7 )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( 16, 2*detId.plane() + (detId.channel() - 6) );
587 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
588 <<
"\twith ID: " <<
std::dec << detId
593 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
594 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
595 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
598 if ( detId.channel() == 6 || detId.channel() == 7 )
potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill( 16, 2*detId.plane() + (detId.channel() - 6) );
601 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
602 <<
"\twith ID: " <<
std::dec << detId
611 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
612 std::unordered_map<unsigned int, std::set<unsigned int> > planes_inclusive;
616 for (
const auto&
rechits : *diamondRecHits ) {
619 detId_pot.setChannel( 0 );
622 for (
const auto& rechit :
rechits ) {
623 planes_inclusive[detId_pot].insert( detId.plane() );
626 planes[detId_pot].
insert( detId.plane() );
630 float UFSDShift = 0.0;
631 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
634 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
635 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
638 for (
int i=0;
i<numOfBins; ++
i) {
639 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
642 hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get();
643 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
646 for (
int i=0;
i<numOfBins; ++
i) {
647 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
652 if ( rechit.getToT() != 0 ) {
654 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
655 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
657 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
658 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
661 for (
int i=0;
i<numOfBins; ++
i) {
662 hitHistoOOTTmp->Fill( detId.plane() + 0.25 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
668 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
669 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
672 for (
int i=0;
i<numOfBins; ++
i) {
673 hitHistoOOTTmp->Fill( detId.plane() + 0.25 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
683 plt.second.activePlanes->Fill( planes[plt.first].size() );
684 plt.second.activePlanesInclusive->Fill( planes_inclusive[plt.first].size() );
688 for (
const auto&
tracks : *diamondLocalTracks ) {
691 detId_pot.setChannel( 0 );
695 if ( !
track.isValid() )
continue;
698 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
700 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
701 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
704 for (
int i=0;
i<numOfBins; ++
i) {
705 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
709 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
712 for (
int i=0;
i<numOfBins; ++
i) {
713 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
720 for (
const auto& tracks : *diamondLocalTracks ) {
723 detId_pot.setChannel( 0 );
724 for (
const auto&
track : tracks ) {
727 std::set<int> planesInTrackSet;
728 for (
const auto& vec : *diamondRecHits ) {
730 if ( detid.arm() != detId_pot.arm() )
continue;
732 for (
const auto&
hit : vec ) {
736 planesInTrackSet.insert(detid.plane());
741 if ( numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2 ) {
742 for (
int plane=0; plane<4; ++plane ) {
743 for (
int channel=0; channel<12; ++channel ) {
744 int map_index = plane*100 + channel;
745 if ( potPlots_[detId_pot].effDoublecountingChMap.find( map_index ) == potPlots_[detId_pot].effDoublecountingChMap.end() ) {
746 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
747 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
752 ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]);
753 for (
const auto& rechits : *diamondRecHits ) {
755 if ( detId_hit == detId ) {
756 for (
const auto& rechit : rechits ) {
757 if ( track.containsHit( rechit, 1 ) ) {
759 ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]);
772 for (
const auto& rechits : *diamondRecHits ) {
775 detId_pot.setChannel( 0 );
777 for (
const auto& rechit : rechits ) {
779 if ( rechit.getToT() == 0 )
continue;
780 if ( !pixelTracks.
isValid() )
continue;
781 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
783 for (
const auto& ds : *pixelTracks ) {
784 if ( ds.size() > 1 )
continue;
787 for (
const auto& lt : ds ) {
788 if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) {
827 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
828 for (
const auto& digis : *diamondDigis ) {
831 for (
const auto& digi : digis ) {
836 if ( digi.getLeadingEdge() != 0 ) {
837 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
838 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
839 else channelsPerPlane[detId_plane] = 0;
844 for (
const auto& plt : channelsPerPlane ) {
845 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
849 for (
const auto& rechits : *diamondRecHits ) {
852 for (
const auto& rechit : rechits ) {
854 if ( rechit.getToT() == 0 )
continue;
857 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
860 for (
int i=0;
i<numOfBins; ++
i) {
861 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
870 for (
const auto& ds : *pixelTracks ) {
873 if ( ds.size() > 1 )
continue;
874 for (
const auto& lt : ds ) {
875 if ( lt.isValid() ) {
880 std::set< CTPPSDiamondDetId > planesWitHits_set;
881 for (
const auto& rechits : *diamondRecHits ) {
884 for (
const auto& rechit : rechits ) {
890 if (
centralOOT_ != -999 && rechit.getOOTIndex() ==
centralOOT_ ) planesWitHits_set.insert( detId_plane );
896 for (
auto& planeId : planesWitHits_set)
910 for (
const auto& digis : *diamondDigis ) {
912 for (
const auto& digi : digis ) {
917 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
919 if ( digi.getMultipleHit() ) ++(
channelPlots_[detId].MHCounter);
922 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
924 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
928 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
932 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
943 for (
const auto& rechits : *diamondRecHits ) {
945 for (
const auto& rechit : rechits ) {
949 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
950 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
952 ++(lumiCache->hitsCounterMap[detId]);
962 for (
const auto& rechits : *diamondRecHits ) {
964 for (
const auto& rechit : rechits ) {
967 if ( !pixelTracks.isValid() )
continue;
970 for (
const auto& ds : *pixelTracks ) {
973 if ( ds.size() > 1 )
continue;
974 for (
const auto& lt : ds ) {
static const int CTPPS_FED_ID_56
static const int CHANNEL_OF_VFAT_CLOCK
LuminosityBlockIndex index() const
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_
LuminosityBlock const & getLuminosityBlock() const
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_