488 valid &= diamondVFATStatus.
isValid();
489 valid &= diamondDigis.
isValid();
495 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 496 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 497 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 498 <<
" fedInfo.isValid = " << fedInfo.
isValid();
512 for (
const auto& ds1 : *pixelTracks ) {
513 for (
const auto& tr1 : ds1 ) {
514 if ( ! tr1.isValid() )
continue;
517 unsigned int arm1 = rpId1.
arm();
518 unsigned int stNum1 = rpId1.station();
519 unsigned int rpNum1 = rpId1.rp();
520 if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) )
continue;
521 unsigned int idx1 = arm1*3 + rpNum1-2;
523 for (
const auto& ds2 : *pixelTracks ) {
524 for (
const auto& tr2 : ds2 ) {
525 if ( ! tr2.isValid() )
continue;
528 unsigned int arm2 = rpId2.
arm();
529 unsigned int stNum2 = rpId2.station();
530 unsigned int rpNum2 = rpId2.rp();
531 if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) )
continue;
532 unsigned int idx2 = arm2*3 + rpNum2-2;
537 for (
const auto& ds2 : *diamondLocalTracks ) {
538 for (
const auto& tr2 : ds2 ) {
539 if ( ! tr2.isValid() )
continue;
544 unsigned int arm2 = diamId2.
arm();
545 if ( idx1 >= arm2*3+2 )
554 for (
const auto& ds1 : *diamondLocalTracks ) {
555 for (
const auto& tr1 : ds1 ) {
556 if ( ! tr1.isValid() )
continue;
561 unsigned int arm1 = diamId1.
arm();
565 for (
const auto& ds2 : *diamondLocalTracks ) {
566 for (
const auto& tr2 : ds2 ) {
567 if ( ! tr2.isValid() )
continue;
572 unsigned int arm2 = diamId2.
arm();
581 for (
const auto& digis : *diamondDigis ) {
585 for (
const auto& digi : digis ) {
587 detId_pot.setChannel( 0 );
591 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
593 if ( digi.getLeadingEdge() != 0 ) {
596 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
597 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
600 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
601 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
604 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
605 ++(
potPlots_[detId_pot].CompleteCounter);
612 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
613 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
614 if ( digi.getMultipleHit() ) ++(
potPlots_[detId_pot].MHCounter);
619 for (
const auto& vfat_status : *diamondVFATStatus ) {
623 detId_pot.setChannel( 0 );
624 for (
const auto&
status : vfat_status ) {
625 if ( !
status.isOK() )
continue;
629 for (
const auto& optorx : *fedInfo ) {
631 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
632 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
633 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
637 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
638 <<
"\twith ID: " <<
std::dec << detId
642 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
643 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
644 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
648 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
649 <<
"\twith ID: " <<
std::dec << detId
657 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
658 std::unordered_map<unsigned int, std::set<unsigned int> > planes_inclusive;
661 for (
const auto&
rechits : *diamondRecHits ) {
664 detId_pot.setChannel( 0 );
667 for (
const auto& rechit :
rechits ) {
668 planes_inclusive[detId_pot].insert( detId.plane() );
671 planes[detId_pot].
insert( detId.plane() );
675 float UFSDShift = 0.0;
676 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
679 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
680 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
683 for (
int i=0;
i<numOfBins; ++
i) {
684 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
687 hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F();
688 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
691 for (
int i=0;
i<numOfBins; ++
i) {
692 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
697 if ( rechit.getToT() != 0 ) {
699 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
700 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
702 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
703 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
706 for (
int i=0;
i<numOfBins; ++
i) {
707 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
713 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
714 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
717 for (
int i=0;
i<numOfBins; ++
i) {
718 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
728 plt.second.activePlanes->Fill( planes[plt.first].size() );
729 plt.second.activePlanesInclusive->Fill( planes_inclusive[plt.first].size() );
733 for (
const auto&
tracks : *diamondLocalTracks ) {
736 detId_pot.setChannel( 0 );
740 if ( !
track.isValid() )
continue;
743 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
745 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
746 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
749 for (
int i=0;
i<numOfBins; ++
i) {
750 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
754 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
757 for (
int i=0;
i<numOfBins; ++
i) {
758 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
765 for (
const auto& tracks : *diamondLocalTracks ) {
768 detId_pot.setChannel( 0 );
769 for (
const auto&
track : tracks ) {
772 std::set<int> planesInTrackSet;
773 for (
const auto& vec : *diamondRecHits ) {
775 if ( detid.arm() != detId_pot.arm() )
continue;
777 for (
const auto&
hit : vec ) {
781 planesInTrackSet.insert(detid.plane());
786 if ( numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2 ) {
787 for (
int plane=0; plane<4; ++plane ) {
788 for (
int channel=0; channel<12; ++channel ) {
789 int map_index = plane*100 + channel;
790 if ( potPlots_[detId_pot].effDoublecountingChMap.find( map_index ) == potPlots_[detId_pot].effDoublecountingChMap.end() ) {
791 potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0;
792 potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0;
797 ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]);
798 for (
const auto& rechits : *diamondRecHits ) {
800 if ( detId_hit == detId ) {
801 for (
const auto& rechit : rechits ) {
802 if ( track.containsHit( rechit, 1 ) ) {
804 ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]);
817 for (
const auto& rechits : *diamondRecHits ) {
820 detId_pot.setChannel( 0 );
822 for (
const auto& rechit : rechits ) {
824 if ( rechit.getToT() == 0 )
continue;
825 if ( !pixelTracks.isValid() )
continue;
826 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
828 for (
const auto& ds : *pixelTracks ) {
831 for (
const auto& lt : ds ) {
832 if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) {
845 for (
const auto& digis : *diamondDigis ) {
850 detId_pot.setChannel( 0 );
851 for (
const auto& digi : digis ) {
852 if ( digi.getLeadingEdge() != 0 ) {
853 if ( detId.plane() == 1 ) {
854 potPlots_[detId_pot].clock_Digi1_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
855 potPlots_[detId_pot].clock_Digi1_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
857 if ( detId.plane() == 3 ) {
858 potPlots_[detId_pot].clock_Digi3_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
859 potPlots_[detId_pot].clock_Digi3_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
871 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
872 for (
const auto& digis : *diamondDigis ) {
875 for (
const auto& digi : digis ) {
880 if ( digi.getLeadingEdge() != 0 ) {
881 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
882 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
883 else channelsPerPlane[detId_plane] = 0;
888 for (
const auto& plt : channelsPerPlane ) {
889 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
893 for (
const auto& rechits : *diamondRecHits ) {
896 for (
const auto& rechit : rechits ) {
898 if ( rechit.getToT() == 0 )
continue;
901 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
904 for (
int i=0;
i<numOfBins; ++
i) {
905 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
914 for (
const auto& ds : *pixelTracks ) {
917 if ( ds.size() > 1 )
continue;
918 for (
const auto& lt : ds ) {
919 if ( lt.isValid() ) {
924 std::set< CTPPSDiamondDetId > planesWitHits_set;
925 for (
const auto& rechits : *diamondRecHits ) {
928 for (
const auto& rechit : rechits ) {
932 if ( pixId.arm() == detId_plane.arm() ) {
934 if (
centralOOT_ != -999 && rechit.getOOTIndex() ==
centralOOT_ ) planesWitHits_set.insert( detId_plane );
940 for (
auto& planeId : planesWitHits_set)
954 for (
const auto& vfat_status : *diamondVFATStatus ) {
956 for (
const auto&
status : vfat_status ) {
957 if ( !
status.isOK() )
continue;
959 for (
const auto& optorx : *fedInfo ) {
961 channelPlots_[detId].ECCheckPerChannel->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
969 for (
const auto& digis : *diamondDigis ) {
971 for (
const auto& digi : digis ) {
976 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
978 if ( digi.getMultipleHit() ) ++(
channelPlots_[detId].MHCounter);
981 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
983 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
987 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
991 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
1001 for (
const auto& rechits : *diamondRecHits ) {
1003 for (
const auto& rechit : rechits ) {
1007 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
1008 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
1020 for (
const auto& rechits : *diamondRecHits ) {
1022 for (
const auto& rechit : rechits ) {
1025 if ( !pixelTracks.isValid() )
continue;
1028 for (
const auto& ds : *pixelTracks ) {
1031 for (
const auto& lt : ds ) {
1032 if ( lt.isValid() && pixId.arm() == detId.arm() )
static const int CTPPS_FED_ID_56
MonitorElement * h_trackCorr_hor
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_
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)
Base class for CTPPS detector IDs.
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_