420 valid &= diamondVFATStatus.
isValid();
421 valid &= diamondDigis.
isValid();
427 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 428 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 429 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 430 <<
" fedInfo.isValid = " << fedInfo.
isValid();
446 for (
const auto& ds1 : *stripTracks ) {
447 for (
const auto& tr1 : ds1 ) {
448 if ( ! tr1.isValid() )
continue;
451 unsigned int arm1 = rpId1.
arm();
452 unsigned int stNum1 = rpId1.station();
453 unsigned int rpNum1 = rpId1.rp();
454 if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) )
continue;
455 unsigned int idx1 = arm1*3 + rpNum1-2;
457 for (
const auto& ds2 : *stripTracks ) {
458 for (
const auto& tr2 : ds2 ) {
459 if ( ! tr2.isValid() )
continue;
462 unsigned int arm2 = rpId2.
arm();
463 unsigned int stNum2 = rpId2.station();
464 unsigned int rpNum2 = rpId2.rp();
465 if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) )
continue;
466 unsigned int idx2 = arm2*3 + rpNum2-2;
471 for (
const auto& ds2 : *diamondLocalTracks ) {
472 for (
const auto& tr2 : ds2 ) {
473 if ( ! tr2.isValid() )
continue;
478 unsigned int arm2 = diamId2.
arm();
479 if ( idx1 >= arm2*3+2 )
488 for (
const auto& ds1 : *diamondLocalTracks ) {
489 for (
const auto& tr1 : ds1 ) {
490 if ( ! tr1.isValid() )
continue;
495 unsigned int arm1 = diamId1.
arm();
499 for (
const auto& ds2 : *diamondLocalTracks ) {
500 for (
const auto& tr2 : ds2 ) {
501 if ( ! tr2.isValid() )
continue;
506 unsigned int arm2 = diamId2.
arm();
515 for (
const auto& digis : *diamondDigis ) {
519 for (
const auto& digi : digis ) {
521 detId_pot.setChannel( 0 );
525 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 1 );
526 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 2 );
527 else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 3 );
528 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 4 );
532 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
533 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
534 if ( digi.getMultipleHit() )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( 16 );
539 for (
const auto& vfat_status : *diamondVFATStatus ) {
543 detId_pot.setChannel( 0 );
544 for (
const auto&
status : vfat_status ) {
545 if ( !
status.isOK() )
continue;
549 for (
const auto& optorx : *fedInfo ) {
551 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
552 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
553 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
557 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
558 <<
"\twith ID: " <<
std::dec << detId
562 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
563 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
564 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
568 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
569 <<
"\twith ID: " <<
std::dec << detId
577 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
579 for (
const auto&
rechits : *diamondRecHits ) {
582 detId_pot.setChannel( 0 );
585 for (
const auto& rechit :
rechits ) {
587 planes[detId_pot].insert( detId.plane() );
591 float UFSDShift = 0.0;
592 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
595 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
596 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
597 int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
599 for (
int i=0;
i<numOfBins; ++
i) {
600 hitHistoTmp->Fill( detId.plane(), hitHistoTmpYAxis->GetBinCenter(startBin+
i) + UFSDShift );
604 if ( rechit.getToT() != 0 ) {
606 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
607 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
609 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
610 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
611 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
613 for (
int i=0;
i<numOfBins; ++
i) {
614 hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
618 if ( rechit.getT() == 0 ) {
620 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_te->getTH2F();
621 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
622 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
624 for (
int i=0;
i<numOfBins; ++
i) {
625 hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
630 potPlots_[detId_pot].leadingEdgeCumulative_le->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
632 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
633 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
634 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
636 for (
int i=0;
i<numOfBins; ++
i) {
637 hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
642 if ( rechit.getToT() != 0 ) {
660 plt.second.activePlanes->Fill( planes[plt.first].size() );
664 for (
const auto&
tracks : *diamondLocalTracks ) {
667 detId_pot.setChannel( 0 );
671 if ( !
track.isValid() )
continue;
673 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
675 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
676 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
677 int startBin = trackHistoOOTTmpYAxis->FindBin(
track.getX0() -
track.getX0Sigma() );
679 for (
int i=0;
i<numOfBins; ++
i) {
680 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
684 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
685 int startBin = trackHistoInTimeTmp->FindBin(
track.getX0() -
track.getX0Sigma() );
687 for (
int i=0;
i<numOfBins; ++
i) {
688 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
695 for (
const auto& rechits : *diamondRecHits ) {
698 detId_pot.setChannel( 0 );
701 for (
const auto& rechit : rechits ) {
703 if ( rechit.getToT() == 0 )
continue;
704 if ( !stripTracks.isValid() )
continue;
705 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
707 for (
const auto& ds : *stripTracks ) {
709 for (
const auto& striplt : ds ) {
710 if ( !striplt.isValid() )
continue;
711 if ( stripId.arm() != detId_pot.arm() )
continue;
717 potPlots_[detId_pot].stripTomographyAllFar_minus1->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
720 potPlots_[detId_pot].stripTomographyAllFar->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
723 potPlots_[detId_pot].stripTomographyAllFar_plus1->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
736 for (
const auto& digis : *diamondDigis ) {
741 detId_pot.setChannel( 0 );
742 for (
const auto& digi : digis ) {
743 if ( digi.getLeadingEdge() != 0 ) {
744 if ( detId.plane() == 1 ) {
745 potPlots_[detId_pot].clock_Digi1_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
746 potPlots_[detId_pot].clock_Digi1_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
748 if ( detId.plane() == 3 ) {
749 potPlots_[detId_pot].clock_Digi3_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
750 potPlots_[detId_pot].clock_Digi3_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
762 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
763 for (
const auto& digis : *diamondDigis ) {
766 for (
const auto& digi : digis ) {
771 if ( digi.getLeadingEdge() != 0 ) {
772 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
773 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
774 else channelsPerPlane[detId_plane] = 0;
779 for (
const auto& plt : channelsPerPlane ) {
780 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
784 for (
const auto& rechits : *diamondRecHits ) {
787 for (
const auto& rechit : rechits ) {
789 if ( rechit.getToT() == 0 )
continue;
792 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
793 int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
795 for (
int i=0;
i<numOfBins; ++
i) {
796 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
804 for (
const auto& rechits : *diamondRecHits ) {
807 for (
const auto& rechit : rechits ) {
809 if ( rechit.getToT() == 0 )
continue;
810 if ( !stripTracks.isValid() )
continue;
813 for (
const auto& ds : *stripTracks ) {
815 for (
const auto& striplt : ds ) {
816 if (! striplt.isValid())
continue;
817 if ( stripId.arm() != detId_plane.arm() )
continue;
821 planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*(rechit.getOOTIndex() - ( (
centralOOT_ != -999 ) ?
centralOOT_ : 0 ) +1), striplt.getY0() );
832 for (
const auto& vfat_status : *diamondVFATStatus ) {
834 for (
const auto&
status : vfat_status ) {
835 if ( !
status.isOK() )
continue;
837 for (
const auto& optorx : *fedInfo ) {
839 channelPlots_[detId].ECCheckPerChannel->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
847 for (
const auto& digis : *diamondDigis ) {
849 for (
const auto& digi : digis ) {
854 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
859 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 1 );
860 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 2 );
861 else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 3 );
862 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 4 );
868 for (
const auto& rechits : *diamondRecHits ) {
870 for (
const auto& rechit : rechits ) {
873 if ( rechit.getToT() != 0 ) {
874 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
875 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
877 else if ( rechit.getT() != 0 )
channelPlots_[detId].leadingEdgeCumulative_le->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
878 channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill( rechit.getT() + 25*rechit.getOOTIndex(), rechit.getT() + 25*rechit.getOOTIndex() + rechit.getToT() );
882 if ( rechit.getToT() != 0 ) {
900 for (
const auto& rechits : *diamondRecHits ) {
902 for (
const auto& rechit : rechits ) {
904 if ( stripTracks.isValid() ) {
906 for (
const auto& ds : *stripTracks ) {
907 for (
const auto& striplt : ds ) {
909 if ( !striplt.isValid() )
continue;
910 if ( stripId.arm() != detId.arm() )
continue;
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 maximumStripAngleForTomography_
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > tokenDiamondTrack_
static const double HPTDC_BIN_WIDTH_NS
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
Base class for CTPPS detector IDs.
std::unordered_map< unsigned int, PotPlots > potPlots_
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_
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const int CTPPS_FED_ID_45
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus_
double minimumStripAngleForTomography_