407 valid &= diamondVFATStatus.
isValid();
408 valid &= diamondDigis.
isValid();
414 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 415 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 416 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 417 <<
" fedInfo.isValid = " << fedInfo.
isValid();
431 for (
const auto& ds1 : *stripTracks ) {
432 for (
const auto& tr1 : ds1 ) {
433 if ( ! tr1.isValid() )
continue;
436 unsigned int arm1 = rpId1.
arm();
437 unsigned int stNum1 = rpId1.station();
438 unsigned int rpNum1 = rpId1.rp();
439 if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) )
continue;
440 unsigned int idx1 = arm1*3 + rpNum1-2;
442 for (
const auto& ds2 : *stripTracks ) {
443 for (
const auto& tr2 : ds2 ) {
444 if ( ! tr2.isValid() )
continue;
447 unsigned int arm2 = rpId2.
arm();
448 unsigned int stNum2 = rpId2.station();
449 unsigned int rpNum2 = rpId2.rp();
450 if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) )
continue;
451 unsigned int idx2 = arm2*3 + rpNum2-2;
456 for (
const auto& ds2 : *diamondLocalTracks ) {
457 for (
const auto& tr2 : ds2 ) {
458 if ( ! tr2.isValid() )
continue;
459 if ( tr2.getOOTIndex() != 1 )
continue;
463 unsigned int arm2 = diamId2.
arm();
464 if ( idx1 >= arm2*3+2 )
473 for (
const auto& ds1 : *diamondLocalTracks ) {
474 for (
const auto& tr1 : ds1 ) {
475 if ( ! tr1.isValid() )
continue;
477 if ( tr1.getOOTIndex() != 1 )
continue;
480 unsigned int arm1 = diamId1.
arm();
484 for (
const auto& ds2 : *diamondLocalTracks ) {
485 for (
const auto& tr2 : ds2 ) {
486 if ( ! tr2.isValid() )
continue;
488 if ( tr2.getOOTIndex() != 1 )
continue;
491 unsigned int arm2 = diamId2.
arm();
500 for (
const auto& digis : *diamondDigis ) {
504 for (
const auto& digi : digis ) {
506 detId_pot.setChannel( 0 );
509 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 1 );
510 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 2 );
511 else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 3 );
512 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 )
potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 4 );
514 if ( digi.getLeadingEdge() != 0 ) {
516 for (
const auto&
fit : *fedInfo ) {
518 potPlots_[detId_pot].activity_per_fedbx->Fill(
fit.getBX() );
519 potPlots_[detId_pot].activity_per_fedbx_short->Fill(
fit.getBX() );
526 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
527 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
528 if ( digi.getMultipleHit() )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( 16 );
533 for (
const auto& vfat_status : *diamondVFATStatus ) {
537 detId_pot.setChannel( 0 );
538 for (
const auto&
status : vfat_status ) {
539 if ( !
status.isOK() )
continue;
543 for (
const auto& optorx : *fedInfo ) {
545 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
546 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
547 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
550 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
551 <<
"\twith ID: " <<
std::dec << detId
555 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
556 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
557 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
560 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
561 <<
"\twith ID: " <<
std::dec << detId
569 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
571 for (
const auto&
rechits : *diamondRecHits ) {
574 detId_pot.setChannel( 0 );
577 for (
const auto& rechit :
rechits ) {
579 planes[detId_pot].insert( detId.plane() );
583 float UFSDShift = 0.0;
584 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
586 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
587 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
588 int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
590 for (
int i=0;
i<numOfBins; ++
i) {
591 hitHistoTmp->Fill( detId.plane(), hitHistoTmpYAxis->GetBinCenter(startBin+
i) + UFSDShift );
594 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
595 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
596 startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
598 for (
int i=0;
i<numOfBins; ++
i) {
599 hitHistoOOTTmp->Fill( detId.plane() + 0.25 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
602 potPlots_[detId_pot].leadingEdgeCumulativePot->Fill( rechit.getT() );
603 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
604 potPlots_[detId_pot].leadingTrailingCorrelationPot->Fill( rechit.getT(), rechit.getT() + rechit.getToT() );
606 switch ( rechit.getOOTIndex() ) {
624 plt.second.activePlanes->Fill( planes[plt.first].size() );
628 for (
const auto&
tracks : *diamondLocalTracks ) {
631 detId_pot.setChannel( 0 );
635 if ( !
track.isValid() )
continue;
637 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
639 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
640 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
641 int startBin = trackHistoOOTTmpYAxis->FindBin(
track.getX0() -
track.getX0Sigma() );
643 for (
int i=0;
i<numOfBins; ++
i) {
644 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
647 if (
track.getOOTIndex() == 1 ) {
648 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
649 int startBin = trackHistoInTimeTmp->FindBin(
track.getX0() -
track.getX0Sigma() );
651 for (
int i=0;
i<numOfBins; ++
i) {
652 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
659 for (
const auto& rechits : *diamondRecHits ) {
662 detId_pot.setChannel( 0 );
665 for (
const auto& rechit : rechits ) {
667 if ( !stripTracks.isValid() )
continue;
668 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
670 for (
const auto& ds : *stripTracks ) {
672 for (
const auto& striplt : ds ) {
673 if ( !striplt.isValid() )
continue;
674 if ( stripId.arm() != detId_pot.arm() )
continue;
677 switch ( rechit.getOOTIndex() ) {
679 potPlots_[detId_pot].stripTomographyAllFar_minus1->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
682 potPlots_[detId_pot].stripTomographyAllFar->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
685 potPlots_[detId_pot].stripTomographyAllFar_plus1->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
690 switch ( rechit.getOOTIndex() ) {
692 potPlots_[detId_pot].stripTomographyAllNear_minus1->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
695 potPlots_[detId_pot].stripTomographyAllNear->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
698 potPlots_[detId_pot].stripTomographyAllNear_plus1->Fill( striplt.getX0() + 50*detId.plane(), striplt.getY0() );
711 for (
const auto& digis : *diamondDigis ) {
716 detId_pot.setChannel( 0 );
717 for (
const auto& digi : digis ) {
718 if ( detId.plane() == 1 ) {
719 potPlots_[detId_pot].clock_Digi1_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
720 potPlots_[detId_pot].clock_Digi1_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
722 if ( detId.plane() == 3 ) {
723 potPlots_[detId_pot].clock_Digi3_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
724 potPlots_[detId_pot].clock_Digi3_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
735 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
736 for (
const auto& digis : *diamondDigis ) {
739 for (
const auto& digi : digis ) {
743 planePlots_[detId_plane].threshold_voltage->Fill( detId.channel(), digi.getThresholdVoltage() );
745 if ( digi.getLeadingEdge() != 0 ) {
746 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
747 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
748 else channelsPerPlane[detId_plane] = 0;
753 for (
const auto& plt : channelsPerPlane ) {
754 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
758 for (
const auto& rechits : *diamondRecHits ) {
761 for (
const auto& rechit : rechits ) {
764 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
765 int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
767 for (
int i=0;
i<numOfBins; ++
i) {
768 if ( rechit.getOOTIndex() == 1 ) hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
775 for (
const auto& rechits : *diamondRecHits ) {
778 for (
const auto& rechit : rechits ) {
780 if ( !stripTracks.isValid() )
continue;
783 for (
const auto& ds : *stripTracks ) {
785 for (
const auto& striplt : ds ) {
786 if (! striplt.isValid())
continue;
787 if ( stripId.arm() != detId_plane.arm() )
continue;
790 planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0(), striplt.getY0() + 50*( rechit.getOOTIndex()-1 ) );
793 planePlots_[detId_plane].stripTomography_near->Fill( striplt.getX0(), striplt.getY0() + 50*( rechit.getOOTIndex()-1 ) );
804 for (
const auto& vfat_status : *diamondVFATStatus ) {
806 for (
const auto&
status : vfat_status ) {
807 if ( !
status.isOK() )
continue;
809 for (
const auto& optorx : *fedInfo ) {
811 channelPlots_[detId].ECCheckPerChannel->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
819 for (
const auto& digis : *diamondDigis ) {
821 for (
const auto& digi : digis ) {
825 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
830 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 1 );
831 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 2 );
832 else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 3 );
833 else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 )
channelPlots_[detId].leadingWithoutTrailing->Fill( 4 );
839 for (
const auto& rechits : *diamondRecHits ) {
841 for (
const auto& rechit : rechits ) {
844 channelPlots_[detId].LeadingEdgeCumulativePerChannel->Fill( rechit.getT() );
845 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
846 channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill( rechit.getT(), rechit.getT() + rechit.getToT() );
853 for (
const auto& rechits : *diamondRecHits ) {
855 for (
const auto& rechit : rechits ) {
857 if ( stripTracks.isValid() ) {
859 for (
const auto& ds : *stripTracks ) {
860 for (
const auto& striplt : ds ) {
862 if ( !striplt.isValid() )
continue;
863 if ( stripId.arm() != detId.arm() )
continue;
866 channelPlots_[detId].stripTomography_far->Fill( striplt.getX0(), striplt.getY0() + 50*( rechit.getOOTIndex()-1 ) );
869 channelPlots_[detId].stripTomography_near->Fill( striplt.getX0(), striplt.getY0() + 50*( rechit.getOOTIndex()-1 ) );
static const int CTPPS_FED_ID_56
MonitorElement * h_trackCorr_hor
static const int CHANNEL_OF_VFAT_CLOCK
static const double DISPLAY_RESOLUTION_FOR_HITS_MM
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
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
static const int CTPPS_NEAR_RP_ID
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > tokenDiamondTrack_
static const double HPTDC_BIN_WIDTH_NS
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_