511 edm::LogProblem(
"TotemTimingDQMSource") <<
"ERROR in TotemTimingDQMSource::analyze > some of the required inputs " 512 "are not valid. Skipping this event.\n" 513 <<
" timingDigis.isValid = " << timingDigis.
isValid() <<
"\n" 514 <<
" fedInfo.isValid = " << fedInfo.
isValid();
521 std::set<uint8_t> boardSet;
522 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
523 std::unordered_map<unsigned int, unsigned int> channelsPerPlaneWithTime;
525 auto lumiCache = luminosityBlockCache(
event.getLuminosityBlock().index());
526 for (
const auto &digis : *timingDigis) {
530 detId_pot.setChannel(0);
534 for (
const auto &digi : digis) {
539 potPlots_[detId_pot].digiDistribution->Fill(detId.plane(), detId.channel());
541 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
542 potPlots_[detId_pot].dataSamplesRaw->Fill(*it);
544 float boardId = digi.eventInfo().hardwareBoardId() + 0.5 * digi.eventInfo().hardwareSampicId();
546 if (boardSet.find(digi.eventInfo().hardwareId()) == boardSet.end()) {
548 boardSet.insert(digi.eventInfo().hardwareId());
549 std::bitset<16> chMap(digi.eventInfo().channelMap());
550 for (
int i = 0;
i < 16; ++
i) {
557 potPlots_[detId_pot].planesWithDigisSet.insert(detId.plane());
562 planePlots_[detId_plane].digiDistribution->Fill(detId.channel());
564 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
565 channelsPerPlane[detId_plane]++;
567 channelsPerPlane[detId_plane] = 0;
574 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
579 unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin();
585 ++(lumiCache->hitsCounterMap[detId]);
591 for (
const auto &
rechits : *timingRecHits) {
595 detId_pot.setChannel(0);
599 for (
const auto &rechit :
rechits) {
601 potPlots_[detId_pot].amplitude->Fill(rechit.amplitude());
603 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
604 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
605 float yCorrected = rechit.y();
607 float x_shift = detId.plane();
608 x_shift += (rechit.x() > 2) ? 0.25 : 0;
609 int startBin = hitHistoTmpYAxis->FindBin(yCorrected - 0.5 * rechit.yWidth());
611 for (
int i = 0;
i < numOfBins; ++
i) {
612 potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + 0.25 * (rechit.x() > 2),
613 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
615 potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(x_shift,
616 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
621 for (
int i = 0;
i < numOfBins; ++
i)
622 potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + 0.25 * (rechit.x() > 2),
623 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
625 potPlots_[detId_pot].recHitTime->Fill(rechit.time());
626 potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane());
631 float x_shift = (rechit.x() > 2) ? 15 : 0;
632 TH1F *hitProfileHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
635 float yCorrected = rechit.y() +
verticalShiftTop_ - 0.5 * rechit.yWidth() + x_shift;
636 int startBin = hitProfileHistoTmp->FindBin(yCorrected);
637 for (
int i = 0;
i < numOfBins; ++
i)
638 hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin +
i));
640 float yCorrected = rechit.y() +
verticalShiftBot_ + 0.5 * rechit.yWidth() + (15 - x_shift);
641 int startBin = hitProfileHistoTmp->FindBin(yCorrected);
642 int totBins = hitProfileHistoTmp->GetNbinsX();
643 for (
int i = 0;
i < numOfBins; ++
i)
644 hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(totBins - startBin +
i));
647 if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end())
648 channelsPerPlaneWithTime[detId_plane]++;
650 channelsPerPlaneWithTime[detId_plane] = 0;
654 potPlots_[detId_pot].tirggerCellTime->Fill(rechit.sampicThresholdTime());
655 channelPlots_[detId].tirggerCellTime->Fill(rechit.sampicThresholdTime());
666 for (
const auto &
rechits : *timingRecHits) {
670 detId_pot.setChannel(0);
676 for (
const auto &rechit :
rechits) {
680 for (
const auto &ds : *stripTracks) {
691 rp_x = (
geometry.sensor(plId_V)->translation().x() +
geometry.sensor(plId_U)->translation().x()) / 2;
692 rp_y = (
geometry.sensor(plId_V)->translation().y() +
geometry.sensor(plId_U)->translation().y()) / 2;
697 for (
const auto &striplt : ds) {
698 if (striplt.isValid() && stripId.arm() == detId.arm()) {
704 double x = striplt.x0() - rp_x;
705 double y = striplt.y0() - rp_y;
707 potPlots_[detId_pot].stripTomography210->Fill(
x + detId.plane() * 50,
y + y_shift);
710 potPlots_[detId_pot].stripTomography220->Fill(
x + detId.plane() * 50,
y + y_shift);
723 plt.second.planesWithDigis->Fill(plt.second.planesWithDigisSet.size());
724 plt.second.planesWithDigisSet.clear();
725 plt.second.planesWithTime->Fill(plt.second.planesWithTimeSet.size());
726 plt.second.planesWithTimeSet.clear();
729 for (
const auto &plt : channelsPerPlane) {
730 planePlots_[plt.first].hitMultiplicity->Fill(plt.second);
732 for (
const auto &plt : channelsPerPlaneWithTime) {
733 planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second);
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
static const double LHC_CLOCK_PERIOD_NS
Detector ID class for TOTEM Si strip detectors.
static const int TOTEM_STRIP_MAX_RP_ID
static const int TOTEM_STATION_210
double minimumStripAngleForTomography_
void setChannel(uint32_t channel)
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
std::unordered_map< unsigned int, PlanePlots > planePlots_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
static const int TOTEM_STATION_220
void setPlane(uint32_t channel)
unsigned int samplesForNoise_
double maximumStripAngleForTomography_
static const int TOTEM_TIMING_TOP_RP_ID
std::unordered_map< unsigned int, PotPlots > potPlots_
static const double SAMPIC_ADC_V
Base class for CTPPS detector IDs.
edm::TimeValue_t timeOfPreviousEvent_
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const int TOTEM_TIMING_BOT_RP_ID
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
Log< level::Error, true > LogProblem
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...