436 valid &= diamondVFATStatus.
isValid();
437 valid &= diamondDigis.
isValid();
443 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 444 <<
" diamondVFATStatus.isValid = " << diamondVFATStatus.
isValid() <<
"\n" 445 <<
" diamondDigis.isValid = " << diamondDigis.
isValid() <<
"\n" 446 <<
" fedInfo.isValid = " << fedInfo.
isValid();
460 for (
const auto& ds1 : *stripTracks ) {
461 for (
const auto& tr1 : ds1 ) {
462 if ( ! tr1.isValid() )
continue;
465 unsigned int arm1 = rpId1.
arm();
466 unsigned int stNum1 = rpId1.station();
467 unsigned int rpNum1 = rpId1.rp();
468 if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) )
continue;
469 unsigned int idx1 = arm1*3 + rpNum1-2;
471 for (
const auto& ds2 : *stripTracks ) {
472 for (
const auto& tr2 : ds2 ) {
473 if ( ! tr2.isValid() )
continue;
476 unsigned int arm2 = rpId2.
arm();
477 unsigned int stNum2 = rpId2.station();
478 unsigned int rpNum2 = rpId2.rp();
479 if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) )
continue;
480 unsigned int idx2 = arm2*3 + rpNum2-2;
485 for (
const auto& ds2 : *diamondLocalTracks ) {
486 for (
const auto& tr2 : ds2 ) {
487 if ( ! tr2.isValid() )
continue;
492 unsigned int arm2 = diamId2.
arm();
493 if ( idx1 >= arm2*3+2 )
502 for (
const auto& ds1 : *diamondLocalTracks ) {
503 for (
const auto& tr1 : ds1 ) {
504 if ( ! tr1.isValid() )
continue;
509 unsigned int arm1 = diamId1.
arm();
513 for (
const auto& ds2 : *diamondLocalTracks ) {
514 for (
const auto& tr2 : ds2 ) {
515 if ( ! tr2.isValid() )
continue;
520 unsigned int arm2 = diamId2.
arm();
529 for (
const auto& digis : *diamondDigis ) {
533 for (
const auto& digi : digis ) {
535 detId_pot.setChannel( 0 );
539 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
541 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
542 ++(
potPlots_[detId_pot].LeadingOnlyCounter);
545 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
546 ++(
potPlots_[detId_pot].TrailingOnlyCounter);
549 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
550 ++(
potPlots_[detId_pot].CompleteCounter);
557 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
558 if ( hptdcErrors.
getErrorId( hptdcErrorIndex-1 ) )
potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
559 if ( digi.getMultipleHit() ) ++(
potPlots_[detId_pot].MHCounter);
564 for (
const auto& vfat_status : *diamondVFATStatus ) {
568 detId_pot.setChannel( 0 );
569 for (
const auto&
status : vfat_status ) {
570 if ( !
status.isOK() )
continue;
574 for (
const auto& optorx : *fedInfo ) {
576 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
577 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_56_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
578 EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
582 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
583 <<
"\twith ID: " <<
std::dec << detId
587 potPlots_[detId_pot].ECCheck->Fill((
int)((optorx.getLV1()& 0xFF)-
status.getEC()) & 0xFF);
588 if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) !=
EC_difference_45_ ) && (
static_cast<uint8_t
>( ( optorx.getLV1() & 0xFF )-
status.getEC() ) < 128 ) )
589 EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>(
status.getEC() ) & 0xFF );
593 <<
"\t\tVFAT EC: 0x"<<
static_cast<unsigned int>(
status.getEC() )
594 <<
"\twith ID: " <<
std::dec << detId
602 std::unordered_map<unsigned int, std::set<unsigned int> > planes;
603 std::unordered_map<unsigned int, std::set<unsigned int> > planes_inclusive;
606 for (
const auto&
rechits : *diamondRecHits ) {
609 detId_pot.setChannel( 0 );
612 for (
const auto& rechit :
rechits ) {
613 planes_inclusive[detId_pot].insert( detId.plane() );
616 planes[detId_pot].
insert( detId.plane() );
620 float UFSDShift = 0.0;
621 if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5;
624 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
625 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
626 int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
628 for (
int i=0;
i<numOfBins; ++
i) {
629 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
632 hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F();
633 hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
634 startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
636 for (
int i=0;
i<numOfBins; ++
i) {
637 hitHistoTmp->Fill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+
i) );
642 if ( rechit.getToT() != 0 ) {
644 potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
645 potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
647 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
648 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
649 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
651 for (
int i=0;
i<numOfBins; ++
i) {
652 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
656 if ( rechit.getT() != 0 ) {
658 TH2F *hitHistoOOTTmp =
potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
659 TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
660 int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
662 for (
int i=0;
i<numOfBins; ++
i) {
663 hitHistoOOTTmp->Fill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
667 if ( (
unsigned int) rechit.getOOTIndex() <
potPlots_[detId_pot].activity_per_bx.size() )
673 plt.second.activePlanes->Fill( planes[plt.first].size() );
674 plt.second.activePlanesInclusive->Fill( planes_inclusive[plt.first].size() );
678 for (
const auto&
tracks : *diamondLocalTracks ) {
681 detId_pot.setChannel( 0 );
685 if ( !
track.isValid() )
continue;
687 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
689 TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
690 TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
691 int startBin = trackHistoOOTTmpYAxis->FindBin(
track.getX0() -
track.getX0Sigma() );
693 for (
int i=0;
i<numOfBins; ++
i) {
694 trackHistoOOTTmp->Fill(
track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+
i) );
698 TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
699 int startBin = trackHistoInTimeTmp->FindBin(
track.getX0() -
track.getX0Sigma() );
701 for (
int i=0;
i<numOfBins; ++
i) {
702 trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+
i) );
709 for (
const auto& rechits : *diamondRecHits ) {
712 detId_pot.setChannel( 0 );
715 for (
const auto& rechit : rechits ) {
717 if ( rechit.getToT() == 0 )
continue;
718 if ( !stripTracks.isValid() )
continue;
719 if ( potPlots_.find( detId_pot ) == potPlots_.end() )
continue;
721 for (
const auto& ds : *stripTracks ) {
723 for (
const auto& striplt : ds ) {
724 if ( !striplt.isValid() )
continue;
725 if ( stripId.arm() != detId_pot.arm() )
continue;
729 if ( (
unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].stripTomographyAllFar.size() )
730 potPlots_[detId_pot].stripTomographyAllFar.at( rechit.getOOTIndex() )->
Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
741 for (
const auto& digis : *diamondDigis ) {
746 detId_pot.setChannel( 0 );
747 for (
const auto& digi : digis ) {
748 if ( digi.getLeadingEdge() != 0 ) {
749 if ( detId.plane() == 1 ) {
750 potPlots_[detId_pot].clock_Digi1_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
751 potPlots_[detId_pot].clock_Digi1_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
753 if ( detId.plane() == 3 ) {
754 potPlots_[detId_pot].clock_Digi3_le->Fill(
HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
755 potPlots_[detId_pot].clock_Digi3_te->Fill(
HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
767 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
768 for (
const auto& digis : *diamondDigis ) {
771 for (
const auto& digi : digis ) {
776 if ( digi.getLeadingEdge() != 0 ) {
777 planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
778 if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
779 else channelsPerPlane[detId_plane] = 0;
784 for (
const auto& plt : channelsPerPlane ) {
785 planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
789 for (
const auto& rechits : *diamondRecHits ) {
792 for (
const auto& rechit : rechits ) {
794 if ( rechit.getToT() == 0 )
continue;
797 TH1F *hitHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
798 int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
800 for (
int i=0;
i<numOfBins; ++
i) {
801 hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+
i) );
809 for (
const auto& rechits : *diamondRecHits ) {
812 for (
const auto& rechit : rechits ) {
814 if ( rechit.getToT() == 0 )
continue;
815 if ( !stripTracks.isValid() )
continue;
818 for (
const auto& ds : *stripTracks ) {
820 for (
const auto& striplt : ds ) {
821 if (! striplt.isValid())
continue;
822 if ( stripId.arm() != detId_plane.arm() )
continue;
826 planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex() , striplt.getY0() );
837 for (
const auto& vfat_status : *diamondVFATStatus ) {
839 for (
const auto&
status : vfat_status ) {
840 if ( !
status.isOK() )
continue;
842 for (
const auto& optorx : *fedInfo ) {
844 channelPlots_[detId].ECCheckPerChannel->Fill((
int)((optorx.getLV1()& 0xFF)-((
unsigned int)
status.getEC() & 0xFF)) & 0xFF);
852 for (
const auto& digis : *diamondDigis ) {
854 for (
const auto& digi : digis ) {
859 for (
unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
861 if ( digi.getMultipleHit() ) ++(
channelPlots_[detId].MHCounter);
864 if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) {
866 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) {
870 if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) {
874 if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) {
884 for (
const auto& rechits : *diamondRecHits ) {
886 for (
const auto& rechit : rechits ) {
889 if ( rechit.getToT() != 0 ) {
890 channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
891 channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
896 if ( (
unsigned int) rechit.getOOTIndex() <
channelPlots_[detId].activity_per_bx.size() )
903 for (
const auto& rechits : *diamondRecHits ) {
905 for (
const auto& rechit : rechits ) {
907 if ( stripTracks.isValid() ) {
909 for (
const auto& ds : *stripTracks ) {
910 for (
const auto& striplt : ds ) {
912 if ( !striplt.isValid() )
continue;
913 if ( stripId.arm() != detId.arm() )
continue;
917 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_