435 valid &= diamondVFATStatus.
isValid();
436 valid &= diamondDigis.
isValid();
442 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 443 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 444 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 445 <<
" fedInfo.isValid = " << fedInfo.
isValid();
459 for (
const auto& ds1 : *stripTracks ) {
460 for (
const auto& tr1 : ds1 ) {
461 if ( ! tr1.isValid() )
continue;
464 unsigned int arm1 = rpId1.
arm();
465 unsigned int stNum1 = rpId1.station();
466 unsigned int rpNum1 = rpId1.rp();
467 if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) )
continue;
468 unsigned int idx1 = arm1*3 + rpNum1-2;
470 for (
const auto& ds2 : *stripTracks ) {
471 for (
const auto& tr2 : ds2 ) {
472 if ( ! tr2.isValid() )
continue;
475 unsigned int arm2 = rpId2.
arm();
476 unsigned int stNum2 = rpId2.station();
477 unsigned int rpNum2 = rpId2.rp();
478 if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) )
continue;
479 unsigned int idx2 = arm2*3 + rpNum2-2;
484 for (
const auto& ds2 : *diamondLocalTracks ) {
485 for (
const auto& tr2 : ds2 ) {
486 if ( ! tr2.isValid() )
continue;
491 unsigned int arm2 = diamId2.
arm();
492 if ( idx1 >= arm2*3+2 )
501 for (
const auto& ds1 : *diamondLocalTracks ) {
502 for (
const auto& tr1 : ds1 ) {
503 if ( ! tr1.isValid() )
continue;
508 unsigned int arm1 = diamId1.
arm();
512 for (
const auto& ds2 : *diamondLocalTracks ) {
513 for (
const auto& tr2 : ds2 ) {
514 if ( ! tr2.isValid() )
continue;
519 unsigned int arm2 = diamId2.
arm();
528 for (
const auto& digis : *diamondDigis ) {
532 for (
const auto& digi : digis ) {
534 detId_pot.setChannel( 0 );
538 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
540 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
541 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
544 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
545 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
548 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
549 ++(
potPlots_[detId_pot].CompleteCounter);
556 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
557 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
558 if ( digi.getMultipleHit() ) ++(
potPlots_[detId_pot].MHCounter);
563 for (
const auto& vfat_status : *diamondVFATStatus ) {
567 detId_pot.setChannel( 0 );
568 for (
const auto&
status : vfat_status ) {
569 if ( !
status.isOK() )
continue;
573 for (
const auto& optorx : *fedInfo ) {
575 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
576 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
577 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
581 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
582 <<
"\twith ID: " <<
std::dec << detId
586 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
587 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
588 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
592 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
593 <<
"\twith ID: " <<
std::dec << detId
601 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
602 std::unordered_map<unsigned int, std::set<unsigned int> > planes_inclusive;
605 for (
const auto&
rechits : *diamondRecHits ) {
608 detId_pot.setChannel( 0 );
611 for (
const auto& rechit :
rechits ) {
612 planes_inclusive[detId_pot].insert( detId.plane() );
615 planes[detId_pot].
insert( detId.plane() );
619 float UFSDShift = 0.0;
620 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
623 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
624 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
625 int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
627 for (
int i=0;
i<numOfBins; ++
i) {
628 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
631 hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F();
632 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
633 startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
635 for (
int i=0;
i<numOfBins; ++
i) {
636 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
641 if ( rechit.getToT() != 0 ) {
643 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
644 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
646 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
647 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
648 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
650 for (
int i=0;
i<numOfBins; ++
i) {
651 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
655 if ( rechit.getT() != 0 ) {
657 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
658 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
659 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
661 for (
int i=0;
i<numOfBins; ++
i) {
662 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
666 if ( (
unsigned int) rechit.getOOTIndex() <
potPlots_[detId_pot].activity_per_bx.size() )
672 plt.second.activePlanes->Fill( planes[plt.first].size() );
673 plt.second.activePlanesInclusive->Fill( planes_inclusive[plt.first].size() );
677 for (
const auto&
tracks : *diamondLocalTracks ) {
680 detId_pot.setChannel( 0 );
684 if ( !
track.isValid() )
continue;
686 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
688 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
689 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
690 int startBin = trackHistoOOTTmpYAxis->FindBin(
track.getX0() -
track.getX0Sigma() );
692 for (
int i=0;
i<numOfBins; ++
i) {
693 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
697 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
698 int startBin = trackHistoInTimeTmp->FindBin(
track.getX0() -
track.getX0Sigma() );
700 for (
int i=0;
i<numOfBins; ++
i) {
701 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
708 for (
const auto& rechits : *diamondRecHits ) {
711 detId_pot.setChannel( 0 );
714 for (
const auto& rechit : rechits ) {
716 if ( rechit.getToT() == 0 )
continue;
717 if ( !stripTracks.isValid() )
continue;
718 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
720 for (
const auto& ds : *stripTracks ) {
722 for (
const auto& striplt : ds ) {
723 if ( !striplt.isValid() )
continue;
724 if ( stripId.arm() != detId_pot.arm() )
continue;
728 if ( (
unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].stripTomographyAllFar.size() )
729 potPlots_[detId_pot].stripTomographyAllFar.at( rechit.getOOTIndex() )->
Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
740 for (
const auto& digis : *diamondDigis ) {
745 detId_pot.setChannel( 0 );
746 for (
const auto& digi : digis ) {
747 if ( digi.getLeadingEdge() != 0 ) {
748 if ( detId.plane() == 1 ) {
749 potPlots_[detId_pot].clock_Digi1_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
750 potPlots_[detId_pot].clock_Digi1_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
752 if ( detId.plane() == 3 ) {
753 potPlots_[detId_pot].clock_Digi3_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
754 potPlots_[detId_pot].clock_Digi3_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
766 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
767 for (
const auto& digis : *diamondDigis ) {
770 for (
const auto& digi : digis ) {
775 if ( digi.getLeadingEdge() != 0 ) {
776 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
777 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
778 else channelsPerPlane[detId_plane] = 0;
783 for (
const auto& plt : channelsPerPlane ) {
784 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
788 for (
const auto& rechits : *diamondRecHits ) {
791 for (
const auto& rechit : rechits ) {
793 if ( rechit.getToT() == 0 )
continue;
796 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
797 int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
799 for (
int i=0;
i<numOfBins; ++
i) {
800 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
808 for (
const auto& rechits : *diamondRecHits ) {
811 for (
const auto& rechit : rechits ) {
813 if ( rechit.getToT() == 0 )
continue;
814 if ( !stripTracks.isValid() )
continue;
817 for (
const auto& ds : *stripTracks ) {
819 for (
const auto& striplt : ds ) {
820 if (! striplt.isValid())
continue;
821 if ( stripId.arm() != detId_plane.arm() )
continue;
825 planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex() , striplt.getY0() );
836 for (
const auto& vfat_status : *diamondVFATStatus ) {
838 for (
const auto&
status : vfat_status ) {
839 if ( !
status.isOK() )
continue;
841 for (
const auto& optorx : *fedInfo ) {
843 channelPlots_[detId].ECCheckPerChannel->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
851 for (
const auto& digis : *diamondDigis ) {
853 for (
const auto& digi : digis ) {
858 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
860 if ( digi.getMultipleHit() ) ++(
channelPlots_[detId].MHCounter);
863 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
865 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
869 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
873 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
883 for (
const auto& rechits : *diamondRecHits ) {
885 for (
const auto& rechit : rechits ) {
888 if ( rechit.getToT() != 0 ) {
889 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
890 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
895 if ( (
unsigned int) rechit.getOOTIndex() <
channelPlots_[detId].activity_per_bx.size() )
902 for (
const auto& rechits : *diamondRecHits ) {
904 for (
const auto& rechit : rechits ) {
906 if ( stripTracks.isValid() ) {
908 for (
const auto& ds : *stripTracks ) {
909 for (
const auto& striplt : ds ) {
911 if ( !striplt.isValid() )
continue;
912 if ( stripId.arm() != detId.arm() )
continue;
916 channelPlots_[detId].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex(), striplt.getY0() );
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_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
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
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_